Skip to contentSkip to conversation

hw/riscv: virt: Fix riscv,pmu DT node path

PATCH Applied Conor Dooley 3 participants 4 messages Jul 27, 2023 – Aug 11, 2023 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/riscv: virt: Fix riscv,pmu DT node path

From: Conor Dooley <[email protected]>

On a dtb dumped from the virt machine, dt-validate complains:
soc: pmu: {'riscv,event-to-mhpmcounters': [[1, 1, 524281], [2, 2, 524284], [65561, 65561, 524280], [65563, 65563, 524280], [65569, 65569, 524280]], 'compatible': ['riscv,pmu']} should not be valid under {'type': 'object'}
from schema $id: http://devicetree.org/schemas/simple-bus.yaml#
That's pretty cryptic, but running the dtb back through dtc produces
something a lot more reasonable:
Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property

Moving the riscv,pmu node out of the soc bus solves the problem.

---
CC: Palmer Dabbelt <[email protected]>
CC: Alistair Francis <[email protected]>
CC: Bin Meng <[email protected]>
CC: Weiwei Li <[email protected]>
CC: Daniel Henrique Barboza <[email protected]>
CC: Liu Zhiwei <[email protected]>
CC: [email protected]
CC: [email protected]

---
 hw/riscv/virt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/riscv/virt.c +1 -1
index d90286dc46..25dcc2616e 100644
@@ -732,7 +732,7 @@ static void create_fdt_pmu(RISCVVirtState *s)
     MachineState *ms = MACHINE(s);
     RISCVCPU hart = s->soc[0].harts[0];
 
-    pmu_name = g_strdup_printf("/soc/pmu");
+    pmu_name = g_strdup_printf("/pmu");
     qemu_fdt_add_subnode(ms->fdt, pmu_name);
     qemu_fdt_setprop_string(ms->fdt, pmu_name, "compatible", "riscv,pmu");
     riscv_pmu_generate_fdt_node(ms->fdt, hart.cfg.pmu_num, pmu_name);
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Conor Dooley

From: Conor Dooley <[email protected]>

On a dtb dumped from the virt machine, dt-validate complains:
soc: pmu: {'riscv,event-to-mhpmcounters': [[1, 1, 524281], [2, 2, 524284], [65561, 65561, 524280], [65563, 65563, 524280], [65569, 65569, 524280]], 'compatible': ['riscv,pmu']} should not be valid under {'type': 'object'}
from schema $id: http://devicetree.org/schemas/simple-bus.yaml#
That's pretty cryptic, but running the dtb back through dtc produces
something a lot more reasonable:
Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property

Quoted 4 lines

Moving the riscv,pmu node out of the soc bus solves the problem.

---

Quoted 25 lines
CC Palmer Dabbelt <[email protected]>
CC Alistair Francis <[email protected]>
CC Bin Meng <[email protected]>
CC Weiwei Li <[email protected]>
CC Daniel Henrique Barboza <[email protected]>
CC Liu Zhiwei <[email protected]>
---
  hw/riscv/virt.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/riscv/virt.c +1 -1
index d90286dc46..25dcc2616e 100644
@@ -732,7 +732,7 @@ static void create_fdt_pmu(RISCVVirtState *s)
      MachineState *ms = MACHINE(s);
      RISCVCPU hart = s->soc[0].harts[0];
 
-    pmu_name = g_strdup_printf("/soc/pmu");
+    pmu_name = g_strdup_printf("/pmu");
      qemu_fdt_add_subnode(ms->fdt, pmu_name);
      qemu_fdt_setprop_string(ms->fdt, pmu_name, "compatible", "riscv,pmu");
      riscv_pmu_generate_fdt_node(ms->fdt, hart.cfg.pmu_num, pmu_name);
Acked-by on v1 1/1
#2 lore raw
In reply to Conor Dooley
Quoted 10 lines · Conor Dooley

From: Conor Dooley <[email protected]>

On a dtb dumped from the virt machine, dt-validate complains:
soc: pmu: {'riscv,event-to-mhpmcounters': [[1, 1, 524281], [2, 2, 524284], [65561, 65561, 524280], [65563, 65563, 524280], [65569, 65569, 524280]], 'compatible': ['riscv,pmu']} should not be valid under {'type': 'object'}
from schema $id: http://devicetree.org/schemas/simple-bus.yaml#
That's pretty cryptic, but running the dtb back through dtc produces
something a lot more reasonable:
Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property

Quoted 3 lines

Moving the riscv,pmu node out of the soc bus solves the problem.

Alistair

Quoted 30 lines

---
CC: Palmer Dabbelt <[email protected]>
CC: Alistair Francis <[email protected]>
CC: Bin Meng <[email protected]>
CC: Weiwei Li <[email protected]>
CC: Daniel Henrique Barboza <[email protected]>
CC: Liu Zhiwei <[email protected]>
CC: [email protected]
CC: [email protected]

---
 hw/riscv/virt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/riscv/virt.c +1 -2
index d90286dc46..25dcc2616e 100644
@@ -732,7 +732,7 @@ static void create_fdt_pmu(RISCVVirtState *s)
     MachineState *ms = MACHINE(s);
     RISCVCPU hart = s->soc[0].harts[0];
 
-    pmu_name = g_strdup_printf("/soc/pmu");
+    pmu_name = g_strdup_printf("/pmu");
     qemu_fdt_add_subnode(ms->fdt, pmu_name);
     qemu_fdt_setprop_string(ms->fdt, pmu_name, "compatible", "riscv,pmu");
     riscv_pmu_generate_fdt_node(ms->fdt, hart.cfg.pmu_num, pmu_name);
--

2.39.2

#3 lore raw
In reply to Conor Dooley
Quoted 10 lines · Conor Dooley

From: Conor Dooley <[email protected]>

On a dtb dumped from the virt machine, dt-validate complains:
soc: pmu: {'riscv,event-to-mhpmcounters': [[1, 1, 524281], [2, 2, 524284], [65561, 65561, 524280], [65563, 65563, 524280], [65569, 65569, 524280]], 'compatible': ['riscv,pmu']} should not be valid under {'type': 'object'}
from schema $id: http://devicetree.org/schemas/simple-bus.yaml#
That's pretty cryptic, but running the dtb back through dtc produces
something a lot more reasonable:
Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property

Quoted 3 lines

Moving the riscv,pmu node out of the soc bus solves the problem.

Thanks!

Applied to riscv-to-apply.next

Alistair

Quoted 30 lines

---
CC: Palmer Dabbelt <[email protected]>
CC: Alistair Francis <[email protected]>
CC: Bin Meng <[email protected]>
CC: Weiwei Li <[email protected]>
CC: Daniel Henrique Barboza <[email protected]>
CC: Liu Zhiwei <[email protected]>
CC: [email protected]
CC: [email protected]

---
 hw/riscv/virt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/riscv/virt.c +1 -2
index d90286dc46..25dcc2616e 100644
@@ -732,7 +732,7 @@ static void create_fdt_pmu(RISCVVirtState *s)
     MachineState *ms = MACHINE(s);
     RISCVCPU hart = s->soc[0].harts[0];
 
-    pmu_name = g_strdup_printf("/soc/pmu");
+    pmu_name = g_strdup_printf("/pmu");
     qemu_fdt_add_subnode(ms->fdt, pmu_name);
     qemu_fdt_setprop_string(ms->fdt, pmu_name, "compatible", "riscv,pmu");
     riscv_pmu_generate_fdt_node(ms->fdt, hart.cfg.pmu_num, pmu_name);
--

2.39.2