Hppa boot reboot fixes patches
The following changes since commit b455ce4c2f300c8ba47cba7232dd03261368a4cb:
Merge tag 'q800-for-8.1-pull-request' of https://github.com/vivier/qemu-m68k into staging (2023-06-22 10:18:32 +0200)
are available in the Git repository at:
https://github.com/hdeller/qemu-hppa.git tags/hppa-boot-reboot-fixes-pull-request
for you to fetch changes up to 34ec3aea54368a92b62a55c656335885ba8c65ef:
target/hppa: Update to SeaBIOS-hppa version 8 (2023-06-24 13:39:48 +0200)
----------------------------------------------------------------
target/hppa: Fix boot and reboot for SMP machines
Fix some SMP-related boot and reboot issues with HP-UX and Linux by correctly initializing the CPU PSW bits, disabling data and instruction translations and unhalting the CPU in the qemu hppa_machine_reset() function.
To work correctly some fixes are needed in the SeaBIOS-hppa firmware too, which is why this series updates it to version 8 which includes those fixes and enhancements:
Fixes
- boot of HP-UX with SMP, and
- reboot of Linux and HP-UX with SMP
Enhancements:
- show qemu version in boot menu
- adds exit menu entry in boot menu to quit emulation
- allow to trace PCD_CHASSIS codes more specifically
----------------------------------------------------------------
Helge Deller (3):
target/hppa: Fix OS reboot issues
target/hppa: Provide qemu version via fw_cfg to firmware target/hppa: Update to SeaBIOS-hppa version 8
hw/hppa/machine.c | 15 +++++++++++++-- pc-bios/hppa-firmware.img | Bin 719376 -> 720216 bytes roms/seabios-hppa | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-)
--
2.38.1
[PULL v2 1/3] target/hppa: Fix OS reboot issues
When the OS triggers a reboot, the reset helper function sends a qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET) together with an EXCP_HLT exception to halt the CPUs.
So, at reboot when initializing the CPUs again, make sure to set all instruction pointers to the firmware entry point, disable any interrupts, disable data and instruction translations, enable PSW_Q bit and tell qemu to unhalt (halted=0) the CPUs again.
This fixes the various reboot issues which were seen when rebooting a Linux VM, including the case where even the monarch CPU has been virtually halted from the OS (e.g. via "chcpu -d 0" inside the Linux VM).
--- hw/hppa/machine.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
hw/hppa/machine.c +8 -2
@@ -418,10 +418,16 @@ static void hppa_machine_reset(MachineState *ms, ShutdownCause reason)/* Start all CPUs at the firmware entry point. * Monarch CPU will initialize firmware, secondary CPUs -* will enter a small idle look and wait for rendevouz. */ +* will enter a small idle loop and wait for rendevouz. */ for (i =0 ; i < smp_cpus; i++) { -cpu_set_pc (CPU (cpu[i]), firmware_entry); +CPUState *cs =CPU (cpu[i]); + +cpu_set_pc (cs, firmware_entry); + cpu[i]->env.psw =PSW_Q ; cpu[i]->env.gr[5 ] =CPU_HPA + i *0x1000 ; + + cs->exception_index =-1 ; + cs->halted =0 ; }/* already initialized by machine_hppa_init()? */
--
2.38.1
Re: [PULL v2 1/3] target/hppa: Fix OS reboot issues
24.06.2023 14:50, Helge Deller пишет:
Quoted 4 lines
When the OS triggers a reboot, the reset helper function sends a
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET)together with anEXCP_HLTexception to halt the CPUs.
Quoted 8 lines
So, at reboot when initializing the CPUs again, make sure to set all instruction pointers to the firmware entry point, disable any interrupts, disable data and instruction translations, enable
PSW_Qbit and tell qemu to unhalt (halted=0) the CPUs again.This fixes the various reboot issues which were seen when rebooting a Linux VM, including the case where even the monarch CPU has been virtually halted from the OS (e.g. via "chcpu -d 0" inside the Linux VM).
Is this a -stable material? It applies cleanly to 8.0 and 7.2.
Thanks,
/mjt
Re: [PULL v2 1/3] target/hppa: Fix OS reboot issues
Quoted 10 lines · Michael Tokarev
24.06.2023 14:50, Helge Deller пишет:
Quoted 9 lines
When the OS triggers a reboot, the reset helper function sends a
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET)together with anEXCP_HLTexception to halt the CPUs.So, at reboot when initializing the CPUs again, make sure to set all instruction pointers to the firmware entry point, disable any interrupts, disable data and instruction translations, enable
PSW_Qbit and tell qemu to unhalt (halted=0) the CPUs again.
Quoted 5 lines
Quoted 3 lines
This fixes the various reboot issues which were seen when rebooting a Linux VM, including the case where even the monarch CPU has been virtually halted from the OS (e.g. via "chcpu -d 0" inside the Linux VM).
Is this a -stable material? It applies cleanly to 8.0 and 7.2.
Yes, please.
At least for 8.0 I think it should be added.
I didn't tested 7.2, but can do and would prefer it if could be added there too.
Thanks!
Helge
Re: [PULL v2 1/3] target/hppa: Fix OS reboot issues
Quoted 15 lines · Helge Deller
Quoted 14 lines · Michael Tokarev
24.06.2023 14:50, Helge Deller пишет:
Quoted 12 lines
When the OS triggers a reboot, the reset helper function sends a
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET)together with anEXCP_HLTexception to halt the CPUs.So, at reboot when initializing the CPUs again, make sure to set all instruction pointers to the firmware entry point, disable any interrupts, disable data and instruction translations, enable
PSW_Qbit and tell qemu to unhalt (halted=0) the CPUs again.This fixes the various reboot issues which were seen when rebooting a Linux VM, including the case where even the monarch CPU has been virtually halted from the OS (e.g. via "chcpu -d 0" inside the Linux VM).
Quoted 5 lines
Quoted 1 line
Is this a -stable material? It applies cleanly to 8.0 and 7.2.
Yes, please.
At least for 8.0 I think it should be added.
I didn't tested 7.2, but can do and would prefer it if could be added there too.
Just tested: The patches work nicely when applied to v7.2 as well. Could you add them to -stable (or what is the process)?
Thanks,
Helge
Re: [PULL v2 1/3] target/hppa: Fix OS reboot issues
Quoted 8 lines · Helge Deller
Quoted 5 lines
Quoted 1 line
Is this a -stable material? It applies cleanly to 8.0 and 7.2.
Yes, please.
At least for 8.0 I think it should be added.
I didn't tested 7.2, but can do and would prefer it if could be added there too.Just tested: The patches work nicely when applied to v7.2 as well. Could you add them to -stable (or what is the process)?
Hmm. Now I'm a bit confused.
Initially I thought it's just this patch, 1/3, "target/hppa: Fix OS reboot issues", to which I replied, is the one which should perhaps go to -stable. But now I see it is the whole series, all 3 changes, which are needed.
And for 7.2, things are a bit more interesting in this context: seabios-hppa version in 7.2 is 6, it changed to version 7 in qemu 8.0, and changed further by this patchset. There isn't much differences between seabios-hppa 6 and 7, so it's probably okay to have it of version 7 in qemu-7.2-stable too (esp. since the change in there is another bugfix, with debian 12 as a reproducer).
So, just to confirm: do we update seabios-hppa to this commit 673d2595d4f773cc266cbf (version 8) in both stable-7.2 and stable-8.0? :)
The changes in there seems to be okay anyway, should be good to have in -stable.
Besides, I'm having sort of difficult time cherry-picking the commit which updates seabios-hppa submodule and hppa-firmware.img file, - git tells me there's a conflict (even when applying to stable-8.0 branch) but I see no changes to this areas in- between (yes, a conflict when applying to 7.2 is expected). So I ended up in doing:
staging-8.0$ git cherry-pick -xs 34ec3aea54368a92b62a55c656335885ba8c65ef
error: Could not read 20cf9c785c3aa493a39be532642883a7a1dc360c
warning: Cannot merge binary files: pc-bios/hppa-firmware.img (HEAD vs. 34ec3aea54 (target/hppa: Update to SeaBIOS-hppa version 8)) Auto-merging pc-bios/hppa-firmware.img
CONFLICT (content): Merge conflict in pc-bios/hppa-firmware.img
Failed to merge submodule roms/seabios-hppa (commits don't follow merge-base)
CONFLICT (submodule): Merge conflict in roms/seabios-hppa
Recursive merging with submodules currently only supports trivial cases.
Please manually handle the merging of each conflicted submodule.
This can be accomplished with the following steps:
- go to submodule (roms/seabios-hppa), and either merge commit 673d2595
or update to an existing commit which has merged those changes
- come back to superproject and run:
git add roms/seabios-hppa
to record the above merge or update
- resolve any other conflicts in the superproject
- commit the resulting index in the superproject
error: could not apply 34ec3aea54... target/hppa: Update to SeaBIOS-hppa version 8
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
staging-8.0$ git checkout 34ec3aea54368a92b62a55c656335885ba8c65ef roms/seabios-hppa pc-bios/hppa-firmware.img
Updated 1 path from dc78364a05
staging-8.0$ git status
On branch staging-8.0
You are currently cherry-picking commit 34ec3aea54.
(all conflicts fixed: run "git cherry-pick --continue") (use "git cherry-pick --skip" to skip this patch)
(use "git cherry-pick --abort" to cancel the cherry-pick operation)
Changes to be committed:
modified: pc-bios/hppa-firmware.img
modified: roms/seabios-hppa
staging-8.0$ git cherry-pick --continue
(commit changes)
Yes, this moves us to the right contents of both the submodule and the binary file (the same as on master), but I don't see why it goes the way it goes.
Besides, it looks like this is the first change to submodules within qemu-stable series..
Thanks,
/mjt
Re: [PULL v2 1/3] target/hppa: Fix OS reboot issues
Quoted 17 lines · Michael Tokarev
Quoted 8 lines · Helge Deller
Quoted 5 lines
Quoted 1 line
Is this a -stable material? It applies cleanly to 8.0 and 7.2.
Yes, please.
At least for 8.0 I think it should be added.
I didn't tested 7.2, but can do and would prefer it if could be added there too.Just tested: The patches work nicely when applied to v7.2 as well. Could you add them to -stable (or what is the process)?
Hmm. Now I'm a bit confused.
Initially I thought it's just this patch, 1/3, "target/hppa: Fix OS reboot issues", to which I replied, is the one which should perhaps go to -stable. But now I see it is the whole series, all 3 changes, which are needed.
Quoted 8 lines
And for 7.2, things are a bit more interesting in this context: seabios-hppa version in 7.2 is 6, it changed to version 7 in qemu 8.0, and changed further by this patchset. There isn't much differences between seabios-hppa 6 and 7, so it's probably okay to have it of version 7 in qemu-7.2-stable too (esp. since the change in there is another bugfix, with debian 12 as a reproducer).
So, just to confirm: do we update seabios-hppa to this commit
673d2595d4f773cc266cbf(version 8) in both stable-7.2 and stable-8.0? :)
Yes.
Quoted 1 line
The changes in there seems to be okay anyway, should be good to have in -stable.
Yes.
Quoted 5 lines
Besides, I'm having sort of difficult time cherry-picking the commit which updates seabios-hppa submodule and hppa-firmware.img file, - git tells me there's a conflict (even when applying to stable-8.0 branch) but I see no changes to this areas in- between (yes, a conflict when applying to 7.2 is expected). So I ended up in doing:
starting in both branches (staging-7.2 and staging-8.0) this works for me:
git cherry-pick bb9c998ca9343d445c76b69fa15dea9db692f526 git cherry-pick 50ba97e928b44ff5bc731c9ffe68d86acbe44639 git cherry-pick 069d296669448b9eef72c6332ae84af962d9582c git cherry-pick 34ec3aea54368a92b62a55c656335885ba8c65ef
Helge
Re: [PULL v2 1/3] target/hppa: Fix OS reboot issues
26.06.2023 19:20, Helge Deller wrote:
..
Quoted 6 lines
starting in both branches (staging-7.2 and staging-8.0) this works for me:
git cherry-pick
bb9c998ca9343d445c76b69fa15dea9db692f526git cherry-pick50ba97e928b44ff5bc731c9ffe68d86acbe44639git cherry-pick069d296669448b9eef72c6332ae84af962d9582cgit cherry-pick34ec3aea54368a92b62a55c656335885ba8c65ef
Got it. Somehow I missed bb9c998ca9343d445c76b69fa15dea9db692f526. It all works fine now.
Thank you!
/mjt
[PULL v2 3/3] target/hppa: Update to SeaBIOS-hppa version 8
In reply to Helge DellerUpdate SeaBIOS-hppa to version 8.
Fixes:
- boot of HP-UX with SMP, and
- reboot of Linux and HP-UX with SMP
Enhancements:
- show qemu version in boot menu
- adds exit menu entry in boot menu to quit emulation
- allow to trace PCD_CHASSIS codes & machine run status
--- pc-bios/hppa-firmware.img | Bin 719376 -> 720216 bytes roms/seabios-hppa | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-)
pc-bios/hppa-firmware.img binary +0 -0
roms/seabios-hppa +1 -1
@@ -1 +1 @@ -Subproject commit 1cfbe76ff625fce9ed5991f7e13d80ffec900f40 +Subproject commit 673d2595d4f773cc266cbf8dbaf2f475a6adb949
--
2.38.1
[PULL v2 2/3] target/hppa: Provide qemu version via fw_cfg to firmware
In reply to Helge DellerGive current QEMU version string to SeaBIOS-hppa via fw_cfg interface so that the firmware can show the QEMU version in the boot menu info.
--- hw/hppa/machine.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/hppa/machine.c +5 -0
@@ -122,6 +122,7 @@ static FWCfgState *create_fw_cfg(MachineState *ms) {FWCfgState *fw_cfg;uint64_t val; +const char qemu_version[] =QEMU_VERSION ; fw_cfg =fw_cfg_init_mem (FW_CFG_IO_BASE ,FW_CFG_IO_BASE +4 );fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , ms->smp.cpus);
@@ -147,6 +148,10 @@ static FWCfgState *create_fw_cfg(MachineState *ms)fw_cfg_add_i16 (fw_cfg,FW_CFG_BOOT_DEVICE , ms->boot_config.order[0 ]);qemu_register_boot_set (fw_cfg_boot_set, fw_cfg); +fw_cfg_add_file (fw_cfg,"/etc/qemu-version" , +g_memdup (qemu_version,sizeof (qemu_version)), +sizeof (qemu_version)); +return fw_cfg; }
--
2.38.1
Richard Henderson
AppliedQuoted 28 lines · Helge Deller
The following changes since commit
b455ce4c2f300c8ba47cba7232dd03261368a4cb:Merge tag 'q800-for-8.1-pull-request' ofhttps://github.com/vivier/qemu-m68k into staging (2023-06-22 10:18:32 +0200)are available in the Git repository at:
https://github.com/hdeller/qemu-hppa.git tags/hppa-boot-reboot-fixes-pull-request
for you to fetch changes up to
34ec3aea54368a92b62a55c656335885ba8c65ef:target/hppa: Update to SeaBIOS-hppa version 8 (2023-06-24 13:39:48 +0200)----------------------------------------------------------------
target/hppa: Fix boot and reboot for SMP machinesFix some SMP-related boot and reboot issues with HP-UX and Linux by correctly initializing the CPU PSW bits, disabling data and instruction translations and unhalting the CPU in the qemu
hppa_machine_reset()function.To work correctly some fixes are needed in the SeaBIOS-hppa firmware too, which is why this series updates it to version 8 which includes those fixes and enhancements:
Fixes
- boot of HP-UX with SMP, and
- reboot of Linux and HP-UX with SMP
Quoted 6 lines
Enhancements:
- show qemu version in boot menu
- adds exit menu entry in boot menu to quit emulation
- allow to tracePCD_CHASSIScodes more specificallySigned-off-by Helge Deller<[email protected]>
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/8.1 as appropriate.
r~