Skip to contentSkip to conversation

hw/ppc/e500: fix bus-frequency property hardcoded to zero in CPU FDT node

PATCH In review Vivien LEGER 3 participants 5 messages Apr 11 – Jun 1

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/ppc/e500: fix bus-frequency property hardcoded to zero in CPU FDT node

The bus-frequency property in the CPU FDT node was hardcoded to 0. This is incorrect - it should reflect the actual platform bus clock frequency, as firmware and RTOSes use it to derive peripheral clock rates.

Notably, the RTEMS QorIQ BSP uses bus-frequency to program the MPIC global timer interval. With bus-frequency=0, the timer interval overflows to ~85 seconds, preventing any clock interrupts from firing.

Fix by adding a bus_freq field to PPCE500MachineClass and using it in the FDT generator. Set bus_freq = PLATFORM_CLK_FREQ_HZ (400MHz) for existing machines, matching the existing clock_freq value.

---
 hw/ppc/e500.c      | 2 +-
 hw/ppc/e500.h      | 1 +
 hw/ppc/e500plat.c  | 1 +
 hw/ppc/mpc8544ds.c | 1 +
 4 files changed, 4 insertions(+), 1 deletion(-)
hw/ppc/e500.c +1 -1
index d6ca2e8..5be2f20 100644
@@ -518,7 +518,7 @@ static int ppce500_load_device_tree(PPCE500MachineState *pms,
                               env->icache_line_size);
         qemu_fdt_setprop_cell(fdt, cpu_name, "d-cache-size", 0x8000);
         qemu_fdt_setprop_cell(fdt, cpu_name, "i-cache-size", 0x8000);
-        qemu_fdt_setprop_cell(fdt, cpu_name, "bus-frequency", 0);
+        qemu_fdt_setprop_cell(fdt, cpu_name, "bus-frequency", pmc->bus_freq);
         if (cpu->cpu_index) {
             qemu_fdt_setprop_string(fdt, cpu_name, "status", "disabled");
             qemu_fdt_setprop_string(fdt, cpu_name, "enable-method",
hw/ppc/e500.h +1 -0
index 11f8ae5..6d56c7b 100644
@@ -40,6 +40,7 @@ struct PPCE500MachineClass {
     hwaddr pci_mmio_bus_base;
     hwaddr spin_base;
     uint32_t clock_freq;
+    uint32_t bus_freq;
     uint32_t tb_freq;
 };
 
hw/ppc/e500plat.c +1 -0
index ca56472..85cec81 100644
@@ -94,6 +94,7 @@ static void e500plat_machine_class_init(ObjectClass *oc, const void *data)
     pmc->pci_mmio_bus_base = 0xE0000000ULL;
     pmc->spin_base = 0xFEF000000ULL;
     pmc->clock_freq = PLATFORM_CLK_FREQ_HZ;
+    pmc->bus_freq = PLATFORM_CLK_FREQ_HZ;
     pmc->tb_freq = PLATFORM_CLK_FREQ_HZ;
 
     mc->desc = "generic paravirt e500 platform";
hw/ppc/mpc8544ds.c +1 -0
index 5826985..d022761 100644
@@ -56,6 +56,7 @@ static void mpc8544ds_machine_class_init(ObjectClass *oc, const void *data)
     pmc->pci_pio_base = 0xE1000000ULL;
     pmc->spin_base = 0xEF000000ULL;
     pmc->clock_freq = PLATFORM_CLK_FREQ_HZ;
+    pmc->bus_freq = PLATFORM_CLK_FREQ_HZ;
     pmc->tb_freq = PLATFORM_CLK_FREQ_HZ;
 
     mc->desc = "mpc8544ds";
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw

+ qemu-stable

Am 11. April 2026 15:45:35 UTC schrieb Vivien LEGER <[email protected]>:

Quoted 63 lines

The bus-frequency property in the CPU FDT node was hardcoded to 0. This is incorrect - it should reflect the actual platform bus clock frequency, as firmware and RTOSes use it to derive peripheral clock rates.

Notably, the RTEMS QorIQ BSP uses bus-frequency to program the MPIC global timer interval. With bus-frequency=0, the timer interval overflows to ~85 seconds, preventing any clock interrupts from firing.

Fix by adding a bus_freq field to PPCE500MachineClass and using it in the FDT generator. Set bus_freq = PLATFORM_CLK_FREQ_HZ (400MHz) for existing machines, matching the existing clock_freq value.

---

hw/ppc/e500.c      | 2 +-
hw/ppc/e500.h      | 1 +
hw/ppc/e500plat.c  | 1 +
hw/ppc/mpc8544ds.c | 1 +
4 files changed, 4 insertions(+), 1 deletion(-)
hw/ppc/e500.c +1 -1
index d6ca2e8..5be2f20 100644
@@ -518,7 +518,7 @@ static int ppce500_load_device_tree(PPCE500MachineState *pms,
                              env->icache_line_size);
        qemu_fdt_setprop_cell(fdt, cpu_name, "d-cache-size", 0x8000);
        qemu_fdt_setprop_cell(fdt, cpu_name, "i-cache-size", 0x8000);
-        qemu_fdt_setprop_cell(fdt, cpu_name, "bus-frequency", 0);
+        qemu_fdt_setprop_cell(fdt, cpu_name, "bus-frequency", pmc->bus_freq);
        if (cpu->cpu_index) {
            qemu_fdt_setprop_string(fdt, cpu_name, "status", "disabled");
            qemu_fdt_setprop_string(fdt, cpu_name, "enable-method",
hw/ppc/e500.h +1 -0
index 11f8ae5..6d56c7b 100644
@@ -40,6 +40,7 @@ struct PPCE500MachineClass {
    hwaddr pci_mmio_bus_base;
    hwaddr spin_base;
    uint32_t clock_freq;
+    uint32_t bus_freq;
    uint32_t tb_freq;
 };
 
hw/ppc/e500plat.c +1 -0
index ca56472..85cec81 100644
@@ -94,6 +94,7 @@ static void e500plat_machine_class_init(ObjectClass *oc, const void *data)
    pmc->pci_mmio_bus_base = 0xE0000000ULL;
    pmc->spin_base = 0xFEF000000ULL;
    pmc->clock_freq = PLATFORM_CLK_FREQ_HZ;
+    pmc->bus_freq = PLATFORM_CLK_FREQ_HZ;
    pmc->tb_freq = PLATFORM_CLK_FREQ_HZ;
 
    mc->desc = "generic paravirt e500 platform";
hw/ppc/mpc8544ds.c +0 -0
index 5826985..d022761 100644

hw/ppc/mpc8544ds.c static void mpc8544ds_machine_class_init(ObjectClass *oc, const void *data) · line 62

Quoted 7 lines
hw/ppc/mpc8544ds.c +1 -0
@@ -56,6 +56,7 @@ static void mpc8544ds_machine_class_init(ObjectClass *oc, const void *data)
    pmc->pci_pio_base = 0xE1000000ULL;
    pmc->spin_base = 0xEF000000ULL;
    pmc->clock_freq = PLATFORM_CLK_FREQ_HZ;
+    pmc->bus_freq = PLATFORM_CLK_FREQ_HZ;
    pmc->tb_freq = PLATFORM_CLK_FREQ_HZ;
 
    mc->desc = "mpc8544ds";
#2 lore raw
Quoted 1 line · Bernhard Beschow

+ qemu-stable

Hi!

A bit late reply, but here it goes.

What do you recommend for 10.0.x series and this patch? This change (commit 774e6f5c15) contextually depends on a previous commit in the same area, v10.0.0-1542-gea585b1022 "hw/ppc/e500: Move clock and TB frequency to machine class".

Should I pick both to 10.0.x, or neither, or modify 774e6f5c15 to apply without ea585b1022? Do these patches have effect on migration stream?

What do yo think?

Thanks,

/mjt

Quoted 21 lines

Am 11. April 2026 15:45:35 UTC schrieb Vivien LEGER <[email protected]>:

Quoted 20 lines

The bus-frequency property in the CPU FDT node was hardcoded to 0. This is incorrect - it should reflect the actual platform bus clock frequency, as firmware and RTOSes use it to derive peripheral clock rates.

Notably, the RTEMS QorIQ BSP uses bus-frequency to program the MPIC global timer interval. With bus-frequency=0, the timer interval overflows to ~85 seconds, preventing any clock interrupts from firing.

Fix by adding a bus_freq field to PPCE500MachineClass and using it in the FDT generator. Set bus_freq = PLATFORM_CLK_FREQ_HZ (400MHz) for existing machines, matching the existing clock_freq value.

---

hw/ppc/e500.c      | 2 +-
hw/ppc/e500.h      | 1 +
hw/ppc/e500plat.c  | 1 +
hw/ppc/mpc8544ds.c | 1 +
4 files changed, 4 insertions(+), 1 deletion(-)
#3 lore raw

Am 5. Mai 2026 14:58:40 UTC schrieb Michael Tokarev <[email protected]>:

Quoted 12 lines · Bernhard Beschow
Quoted 1 line

+ qemu-stable

Hi!

A bit late reply, but here it goes.

What do you recommend for 10.0.x series and this patch? This change (commit 774e6f5c15) contextually depends on a previous commit in the same area, v10.0.0-1542-gea585b1022 "hw/ppc/e500: Move clock and TB frequency to machine class".

Quoted 5 lines

Should I pick both to 10.0.x, or neither, or modify 774e6f5c15 to apply without ea585b1022? Do these patches have effect on migration stream?

What do yo think?

IMO you made the correct choice for 10.0. Migration should not be affected since the dtb is created in RAM which gets restored by the migration stream. The new dtb will be effective only after a reset, i.e. a power cycle.

Sorry for the late reply and thanks for backporting!

Best regards,
Bernhard

Quoted 26 lines

Thanks,

/mjt

Quoted 21 lines

Am 11. April 2026 15:45:35 UTC schrieb Vivien LEGER <[email protected]>:

Quoted 20 lines

The bus-frequency property in the CPU FDT node was hardcoded to 0. This is incorrect - it should reflect the actual platform bus clock frequency, as firmware and RTOSes use it to derive peripheral clock rates.

Notably, the RTEMS QorIQ BSP uses bus-frequency to program the MPIC global timer interval. With bus-frequency=0, the timer interval overflows to ~85 seconds, preventing any clock interrupts from firing.

Fix by adding a bus_freq field to PPCE500MachineClass and using it in the FDT generator. Set bus_freq = PLATFORM_CLK_FREQ_HZ (400MHz) for existing machines, matching the existing clock_freq value.

---

hw/ppc/e500.c      | 2 +-
hw/ppc/e500.h      | 1 +
hw/ppc/e500plat.c  | 1 +
hw/ppc/mpc8544ds.c | 1 +
4 files changed, 4 insertions(+), 1 deletion(-)
#4 lore raw
Quoted 9 lines · Bernhard Beschow
Quoted 5 lines

Should I pick both to 10.0.x, or neither, or modify 774e6f5c15 to apply without ea585b1022? Do these patches have effect on migration stream?

What do yo think?

IMO you made the correct choice for 10.0. Migration should not be affected since the dtb is created in RAM which gets restored by the migration stream. The new dtb will be effective only after a reset, i.e. a power cycle.

Sorry for the late reply and thanks for backporting!

Thank you for getting back to this! Much appreciated.

/mjt