[PATCH v3 3/4] hw/riscv: virt: fix syscon subnode paths

Conor Dooley mail at conchuod.ie
Wed Aug 10 11:46:11 PDT 2022


From: Conor Dooley <conor.dooley at microchip.com>

The reset and poweroff features of the syscon were originally added to
top level, which is a valid path for a syscon subnode. Subsequently a
reorganisation was carried out while implementing NUMA in which the
subnodes were moved into the /soc node. As /soc is a "simple-bus", this
path is invalid, and so dt-validate produces the following warnings:

/stuff/qemu/qemu.dtb: soc: poweroff: {'value': [[21845]], 'offset': [[0]], 'regmap': [[4]], 'compatible': ['syscon-poweroff']} should not be valid under {'type': 'object'}
        From schema: /home/conor/.local/lib/python3.9/site-packages/dtschema/schemas/simple-bus.yaml
/stuff/qemu/qemu.dtb: soc: reboot: {'value': [[30583]], 'offset': [[0]], 'regmap': [[4]], 'compatible': ['syscon-reboot']} should not be valid under {'type': 'object'}
        From schema: /home/conor/.local/lib/python3.9/site-packages/dtschema/schemas/simple-bus.yaml

Move the syscon subnodes back to the top level and silence the warnings.

Reported-by: Rob Herring <robh at kernel.org>
Link: https://lore.kernel.org/linux-riscv/20220803170552.GA2250266-robh@kernel.org/
Fixes: 18df0b4695 ("hw/riscv: virt: Allow creating multiple NUMA sockets")
Signed-off-by: Conor Dooley <conor.dooley at microchip.com>
---
I dropped your R-b Alistair intentionally.
Tested both Linux and FreeBSD:
[    0.073406] device: 'poweroff': device_add
[    0.073441] bus: 'platform': add device poweroff
[    0.502347] bus: 'platform': add driver syscon-poweroff
[    0.502379] bus: 'platform': __driver_probe_device: matched device poweroff with driver syscon-poweroff
[    0.502397] bus: 'platform': really_probe: probing driver syscon-poweroff with device poweroff
[    0.502423] syscon-poweroff poweroff: no pinctrl handle
[    0.502681] syscon-poweroff poweroff: pm_power_off already claimed for sbi_srst_power_off
[    0.503333] syscon-poweroff: probe of poweroff failed with error -16
[    0.073629] device: 'reboot': device_add
[    0.073664] bus: 'platform': add device reboot
[    0.500640] bus: 'platform': add driver syscon-reboot
[    0.500673] bus: 'platform': __driver_probe_device: matched device reboot with driver syscon-reboot
[    0.500694] bus: 'platform': really_probe: probing driver syscon-reboot with device reboot
[    0.500725] syscon-reboot reboot: no pinctrl handle
[    0.502168] driver: 'syscon-reboot': driver_bound: bound to device 'reboot'
[    0.502242] bus: 'platform': really_probe: bound device reboot to driver syscon-reboot

syscon_power0: <Syscon poweroff> on ofwbus0
syscon_power1: <Syscon reboot> on ofwbus0
---
 hw/riscv/virt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 8b2978076e..6f0fd1541b 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -896,7 +896,7 @@ static void create_fdt_reset(RISCVVirtState *s, const MemMapEntry *memmap,
     test_phandle = qemu_fdt_get_phandle(mc->fdt, name);
     g_free(name);
 
-    name = g_strdup_printf("/soc/reboot");
+    name = g_strdup_printf("/reboot");
     qemu_fdt_add_subnode(mc->fdt, name);
     qemu_fdt_setprop_string(mc->fdt, name, "compatible", "syscon-reboot");
     qemu_fdt_setprop_cell(mc->fdt, name, "regmap", test_phandle);
@@ -904,7 +904,7 @@ static void create_fdt_reset(RISCVVirtState *s, const MemMapEntry *memmap,
     qemu_fdt_setprop_cell(mc->fdt, name, "value", FINISHER_RESET);
     g_free(name);
 
-    name = g_strdup_printf("/soc/poweroff");
+    name = g_strdup_printf("/poweroff");
     qemu_fdt_add_subnode(mc->fdt, name);
     qemu_fdt_setprop_string(mc->fdt, name, "compatible", "syscon-poweroff");
     qemu_fdt_setprop_cell(mc->fdt, name, "regmap", test_phandle);
-- 
2.37.1




More information about the linux-riscv mailing list