WHPX accelerator run with edk2 EFI fails to process the reboot signal from guest OS
Host environment
-
Operating system: Windows 11 23H2
-
OS/kernel version: Home
-
Architecture: x64
-
QEMU flavor: qemu-system-x86_64.exe
-
QEMU version: v9.0.0-12054-g923cf646f4
-
QEMU command line:
qemu-system-x86_64.exe -accel whpx -bios share\edk2-x86_64.fd -cpu Westmere,aes=on,avx=on,sse4.1=on,sse4.2=on,ssse3=on,x2apic=on,xsave=on -machine q35 -m 4096 -cdrom C:\windows11_23H2.iso
Emulated/Virtualized environment
- Operating system: Windows 11 23H2
- OS/kernel version: Home
- Architecture: x64
Description of problem
Qemu freezes any time WHPX-accelerated guest Windows 11 sends a reboot signal to Qemu while running on edk2 EFI. At rare cases, Qemu errors out with qemu: WHPX: Unexpected VP exit code 4
Steps to reproduce
- Grab Windows 11 23H2 ISO from https://www.microsoft.com/en-Us/software-download/windows11 using either Media Creation Tool or directly and save it under C:\windows11_23H2.iso
- Download QEMU 9.0 from https://qemu.weilnetz.de/w64/qemu-w64-setup-20240423.exe and install it into C:\Program Files\qemu
- Make one merged EFI file from two ones bundled in QEMU 9.0 (merged EFI is the only working option for edk2 EFI on windows host):
cd /d C:\Program Files\qemu\share
copy /B edk2-i386-vars.fd + edk2-x86_64-code.fd edk2-x86_64.fd
- Run this command:
qemu-system-x86_64.exe -accel whpx -bios share\edk2-x86_64.fd -cpu Westmere,aes=on,avx=on,sse4.1=on,sse4.2=on,ssse3=on,x2apic=on,xsave=on -machine q35 -m 4096 -cdrom C:\windows11_23H2.iso
- Press any key once you see "Press any key to boot from CD..." and wait until Windows Setup suggests to opt for language and currency.
- Click red "X" close button inside Windows Setup and confirm your choice when Windows Setup asks you to.
Windows Setup sends a reboot signal to the underlying hardware and Qemu freezes.
Additional information
If -bios share\edk2-x86_64.fd switch is omitted, this command works ok:
qemu-system-x86_64 -accel whpx -cpu Westmere,aes=on,avx=on,sse4.1=on,sse4.2=on,ssse3=on,x2apic=on,xsave=on -machine q35 -m 4096 -cdrom D:\originalWindows11_23H2.iso
This bug seems to be closely related to this one: #2042 - Not able to reboot Linux guest on Windows host