Message ID | 20241111071256.459119-1-npiggin@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | platforms/qemu: QEMU now has support for direct controls on Power10 | expand |
On Mon, Nov 11, 2024 at 05:12:56PM +1000, Nicholas Piggin wrote: >--- a/core/direct-controls.c >+++ b/core/direct-controls.c >@@ -1151,7 +1151,7 @@ int64_t opal_signal_system_reset(int cpu_nr) > > void direct_controls_init(void) > { >- if (chip_quirk(QUIRK_MAMBO_CALLOUTS)) >+ if (chip_quirk(QUIRK_NO_DIRECT_CTL)) > return; > > if (proc_gen != proc_gen_p9 && proc_gen != proc_gen_p10) I think this function will now return early for "qemu,powernv9", where it did not before, so no system reset callback will be registered at all. Does that matter?
On Sat Jan 11, 2025 at 3:55 AM AEST, Reza Arbab wrote: > On Mon, Nov 11, 2024 at 05:12:56PM +1000, Nicholas Piggin wrote: > >--- a/core/direct-controls.c > >+++ b/core/direct-controls.c > >@@ -1151,7 +1151,7 @@ int64_t opal_signal_system_reset(int cpu_nr) > > > > void direct_controls_init(void) > > { > >- if (chip_quirk(QUIRK_MAMBO_CALLOUTS)) > >+ if (chip_quirk(QUIRK_NO_DIRECT_CTL)) > > return; > > > > if (proc_gen != proc_gen_p9 && proc_gen != proc_gen_p10) > > I think this function will now return early for "qemu,powernv9", where > it did not before, so no system reset callback will be registered at > all. Does that matter? Ah... no, I think QEMU powernv9 shouldn't have any direct controls either so the callback shouldn't have worked. Seems okay to not register it. Thanks, Nick
On Tue, Jan 14, 2025 at 04:31:28PM +1000, Nicholas Piggin wrote: >On Sat Jan 11, 2025 at 3:55 AM AEST, Reza Arbab wrote: >> On Mon, Nov 11, 2024 at 05:12:56PM +1000, Nicholas Piggin wrote: >> >--- a/core/direct-controls.c >> >+++ b/core/direct-controls.c >> >@@ -1151,7 +1151,7 @@ int64_t opal_signal_system_reset(int cpu_nr) >> > >> > void direct_controls_init(void) >> > { >> >- if (chip_quirk(QUIRK_MAMBO_CALLOUTS)) >> >+ if (chip_quirk(QUIRK_NO_DIRECT_CTL)) >> > return; >> > >> > if (proc_gen != proc_gen_p9 && proc_gen != proc_gen_p10) >> >> I think this function will now return early for "qemu,powernv9", where >> it did not before, so no system reset callback will be registered at >> all. Does that matter? > >Ah... no, I think QEMU powernv9 shouldn't have any direct controls >either so the callback shouldn't have worked. Seems okay to not >register it. No problem then. Applied to master.
diff --git a/core/chip.c b/core/chip.c index 0e96e6253..73c6f3077 100644 --- a/core/chip.c +++ b/core/chip.c @@ -148,7 +148,7 @@ void init_chips(void) if (dt_find_by_path(dt_root, "/mambo")) { proc_chip_quirks |= QUIRK_NO_CHIPTOD | QUIRK_MAMBO_CALLOUTS | QUIRK_NO_F000F | QUIRK_NO_PBA | QUIRK_NO_OCC_IRQ - | QUIRK_NO_RNG; + | QUIRK_NO_RNG | QUIRK_NO_DIRECT_CTL; enable_mambo_console(); @@ -182,10 +182,13 @@ void init_chips(void) model_type); } /* Detect Qemu */ - if (dt_node_is_compatible(dt_root, "qemu,powernv") || + if (dt_node_is_compatible(dt_root, "qemu,powernv10")) { + /* POWER10 has direct controls */ + proc_chip_quirks |= QUIRK_QEMU | QUIRK_NO_RNG; + prlog(PR_NOTICE, "CHIP: Detected QEMU simulator\n"); + } else if (dt_node_is_compatible(dt_root, "qemu,powernv") || dt_node_is_compatible(dt_root, "qemu,powernv8") || dt_node_is_compatible(dt_root, "qemu,powernv9") || - dt_node_is_compatible(dt_root, "qemu,powernv10") || dt_find_by_path(dt_root, "/qemu")) { proc_chip_quirks |= QUIRK_QEMU | QUIRK_NO_DIRECT_CTL | QUIRK_NO_RNG; prlog(PR_NOTICE, "CHIP: Detected QEMU simulator\n"); diff --git a/core/direct-controls.c b/core/direct-controls.c index 37bcf9826..c3c6ae717 100644 --- a/core/direct-controls.c +++ b/core/direct-controls.c @@ -1151,7 +1151,7 @@ int64_t opal_signal_system_reset(int cpu_nr) void direct_controls_init(void) { - if (chip_quirk(QUIRK_MAMBO_CALLOUTS)) + if (chip_quirk(QUIRK_NO_DIRECT_CTL)) return; if (proc_gen != proc_gen_p9 && proc_gen != proc_gen_p10) diff --git a/core/fast-reboot.c b/core/fast-reboot.c index c1cb86670..fa5e87955 100644 --- a/core/fast-reboot.c +++ b/core/fast-reboot.c @@ -420,15 +420,15 @@ void __noreturn fast_reboot_entry(void) if (platform.fast_reboot_init) platform.fast_reboot_init(); - if (!chip_quirk(QUIRK_MAMBO_CALLOUTS)) { + if (!chip_quirk(QUIRK_MAMBO_CALLOUTS) && !chip_quirk(QUIRK_QEMU)) { /* * mem_region_clear_unused avoids these preload regions * so it can run along side image preloading. Clear these * regions now to catch anything not overwritten by * preload. * - * Mambo may have embedded payload here, so don't clear - * it at all. + * Simulators may have embedded payload here, so don't clear + * these ranges for them. */ memset(kerneal_load_base_addr, 0, KERNEL_LOAD_SIZE); memset(initramfs_load_base_addr, 0, INITRAMFS_LOAD_SIZE);
The QUIRK_NO_DIRECT_CTL quirk is no longer required for Power10 on QEMU. Older QEMU versions won't work, but skiboot and Linux should just time out the NMI IPIs and fall back. Add QUIRK_NO_DIRECT_CTL to mambo rather than check mambo explicitly. There are some hacks around the fast reboot code for mambo still, but they have never worked too well. Now that QEMU supports it, the mambo stuff there could be removed eventually. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> --- core/chip.c | 9 ++++++--- core/direct-controls.c | 2 +- core/fast-reboot.c | 6 +++--- 3 files changed, 10 insertions(+), 7 deletions(-)