Skip to contentSkip to conversation

hw/riscv: virt: Avoid double FDT platform node

PATCH Applied Dylan Reid 3 participants 5 messages May 12, 2022 – May 19, 2022 RISC-V

lore
Share & tools
lore

Dylan Reid

author
#0 lore raw

PATCH 1/1 hw/riscv: virt: Avoid double FDT platform node

When starting the virt machine with -machine virt,aia=aplic-imsic, both the imsic and aplic init code will add platform fdt nodes by calling platform_bus_add_all_fdt_nodes. This leads to an error at startup:

```
qemu_fdt_add_subnode: Failed to create subnode /platform@4000000: FDT_ERR_EXISTS
```

The call from create_fdt_imsic is not needed as an imsic is currently always combined with an aplic that will create the nodes.

Fixes 3029fab64309 ("hw/riscv: virt: Add support for generating platform FDT entries")
---
 hw/riscv/virt.c | 5 -----
 1 file changed, 5 deletions(-)
hw/riscv/virt.c +0 -5
index 3326f4db96..d625f776a6 100644
@@ -561,11 +561,6 @@ static void create_fdt_imsic(RISCVVirtState *s, const MemMapEntry *memmap,
     }
     qemu_fdt_setprop_cell(mc->fdt, imsic_name, "phandle", *msi_m_phandle);
 
-    platform_bus_add_all_fdt_nodes(mc->fdt, imsic_name,
-                                   memmap[VIRT_PLATFORM_BUS].base,
-                                   memmap[VIRT_PLATFORM_BUS].size,
-                                   VIRT_PLATFORM_BUS_IRQ);
-
     g_free(imsic_name);
 
     /* S-level IMSIC node */
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Dylan Reid

When starting the virt machine with -machine virt,aia=aplic-imsic, both the imsic and aplic init code will add platform fdt nodes by calling platform_bus_add_all_fdt_nodes. This leads to an error at startup:

```
qemu_fdt_add_subnode: Failed to create subnode /platform@4000000: FDT_ERR_EXISTS
```
Quoted 5 lines

The call from create_fdt_imsic is not needed as an imsic is currently always combined with an aplic that will create the nodes.

Fixes 3029fab64309 ("hw/riscv: virt: Add support for generating platform FDT entries")

Alistair

Quoted 24 lines
---
 hw/riscv/virt.c | 5 -----
 1 file changed, 5 deletions(-)
hw/riscv/virt.c +0 -6
index 3326f4db96..d625f776a6 100644
@@ -561,11 +561,6 @@ static void create_fdt_imsic(RISCVVirtState *s, const MemMapEntry *memmap,
     }
     qemu_fdt_setprop_cell(mc->fdt, imsic_name, "phandle", *msi_m_phandle);
 
-    platform_bus_add_all_fdt_nodes(mc->fdt, imsic_name,
-                                   memmap[VIRT_PLATFORM_BUS].base,
-                                   memmap[VIRT_PLATFORM_BUS].size,
-                                   VIRT_PLATFORM_BUS_IRQ);
-
     g_free(imsic_name);
 
     /* S-level IMSIC node */
--

2.30.2

#2 lore raw
In reply to Dylan Reid
Quoted 9 lines · Dylan Reid

When starting the virt machine with -machine virt,aia=aplic-imsic, both the imsic and aplic init code will add platform fdt nodes by calling platform_bus_add_all_fdt_nodes. This leads to an error at startup:

```
qemu_fdt_add_subnode: Failed to create subnode /platform@4000000: FDT_ERR_EXISTS
```
Quoted 5 lines

The call from create_fdt_imsic is not needed as an imsic is currently always combined with an aplic that will create the nodes.

Fixes 3029fab64309 ("hw/riscv: virt: Add support for generating platform FDT entries")

Thanks!

Applied to riscv-to-apply.next

Alistair

Quoted 24 lines
---
 hw/riscv/virt.c | 5 -----
 1 file changed, 5 deletions(-)
hw/riscv/virt.c +0 -6
index 3326f4db96..d625f776a6 100644
@@ -561,11 +561,6 @@ static void create_fdt_imsic(RISCVVirtState *s, const MemMapEntry *memmap,
     }
     qemu_fdt_setprop_cell(mc->fdt, imsic_name, "phandle", *msi_m_phandle);
 
-    platform_bus_add_all_fdt_nodes(mc->fdt, imsic_name,
-                                   memmap[VIRT_PLATFORM_BUS].base,
-                                   memmap[VIRT_PLATFORM_BUS].size,
-                                   VIRT_PLATFORM_BUS_IRQ);
-
     g_free(imsic_name);
 
     /* S-level IMSIC node */
--

2.30.2

#3 lore raw
In reply to Dylan Reid
Quoted 23 lines · Dylan Reid

When starting the virt machine with -machine virt,aia=aplic-imsic, both the imsic and aplic init code will add platform fdt nodes by calling platform_bus_add_all_fdt_nodes. This leads to an error at startup:

```
qemu_fdt_add_subnode: Failed to create subnode /platform@4000000: FDT_ERR_EXISTS
```

The call from create_fdt_imsic is not needed as an imsic is currently always combined with an aplic that will create the nodes.

Fixes 3029fab64309 ("hw/riscv: virt: Add support for generating platform FDT entries")
---
 hw/riscv/virt.c | 5 -----
 1 file changed, 5 deletions(-)
hw/riscv/virt.c +0 -0
index 3326f4db96..d625f776a6 100644

hw/riscv/virt.c static void create_fdt_imsic(RISCVVirtState *s, const MemMapEntry *memmap, · line 568

Quoted 8 lines
hw/riscv/virt.c +0 -5
@@ -561,11 +561,6 @@ static void create_fdt_imsic(RISCVVirtState *s, const MemMapEntry *memmap,
     }
     qemu_fdt_setprop_cell(mc->fdt, imsic_name, "phandle", *msi_m_phandle);
 
-    platform_bus_add_all_fdt_nodes(mc->fdt, imsic_name,
-                                   memmap[VIRT_PLATFORM_BUS].base,
-                                   memmap[VIRT_PLATFORM_BUS].size,
-                                   VIRT_PLATFORM_BUS_IRQ);
-

This patch only fixes for the case where there is only one socket.

I had send-out a similar fix which also handles multi-socket case.
https://lore.kernel.org/all/[email protected]/

Regards,
Anup

Quoted 7 lines
hw/riscv/virt.c +0 -1
     g_free(imsic_name);
 
     /* S-level IMSIC node */
--

2.30.2

author
#4 lore raw
Quoted 35 lines · Anup Patel
Quoted 23 lines · Dylan Reid

When starting the virt machine with -machine virt,aia=aplic-imsic, both the imsic and aplic init code will add platform fdt nodes by calling platform_bus_add_all_fdt_nodes. This leads to an error at startup:

```
qemu_fdt_add_subnode: Failed to create subnode /platform@4000000: FDT_ERR_EXISTS
```

The call from create_fdt_imsic is not needed as an imsic is currently always combined with an aplic that will create the nodes.

Fixes 3029fab64309 ("hw/riscv: virt: Add support for generating platform FDT entries")
---
 hw/riscv/virt.c | 5 -----
 1 file changed, 5 deletions(-)
hw/riscv/virt.c +0 -0
index 3326f4db96..d625f776a6 100644

hw/riscv/virt.c static void create_fdt_imsic(RISCVVirtState *s, const MemMapEntry *memmap, · line 568

Quoted 8 lines
hw/riscv/virt.c +0 -5
@@ -561,11 +561,6 @@ static void create_fdt_imsic(RISCVVirtState *s, const MemMapEntry *memmap,
     }
     qemu_fdt_setprop_cell(mc->fdt, imsic_name, "phandle", *msi_m_phandle);
 
-    platform_bus_add_all_fdt_nodes(mc->fdt, imsic_name,
-                                   memmap[VIRT_PLATFORM_BUS].base,
-                                   memmap[VIRT_PLATFORM_BUS].size,
-                                   VIRT_PLATFORM_BUS_IRQ);
-

This patch only fixes for the case where there is only one socket.

Quoted 2 lines

I had send-out a similar fix which also handles multi-socket case.
https://lore.kernel.org/all/[email protected]/

Thanks Anup, that looks good to me.

Quoted 12 lines

Regards,
Anup

Quoted 7 lines
hw/riscv/virt.c +0 -1
     g_free(imsic_name);
 
     /* S-level IMSIC node */
--

2.30.2