Description
The EFI ResetSystem runtime service in src/efi/runtime_services.rs is intentionally a no-op:
pub extern "efiapi" fn reset_system(_: ResetType, _: Status, _: usize, _: *mut c_void) {
// Don't do anything to force the kernel to use ACPI for shutdown and triple-fault for reset
}
This works for Linux, which falls back to ACPI (SLEEP_CONTROL_REG) for shutdown and triple-fault for reboot. However, Windows calls ResetSystem(EfiResetShutdown) as its final shutdown step and does not fall back to ACPI when the call returns. This causes the Cloud Hypervisor process to hang indefinitely after a Windows guest shuts down.
Impact
shutdown /s /t 0 inside Windows: SSH dies (Windows stops services), but CH process never exits
- ACPI power button (
vm.power-button): Windows receives the event and starts shutdown, but CH never exits
Reproduction
- Boot a Windows 11 25H2 guest using CLOUDHV.fd firmware on Cloud Hypervisor
- SSH in and run
shutdown /s /t 0
- Observe: SSH connection drops (Windows is shutting down), but
cloud-hypervisor process never exits
Fix
Write the appropriate value to Cloud Hypervisor's AcpiShutdownDevice I/O port (0x600) based on the reset type:
EfiResetShutdown → write 0x34 (SLP_TYP=5, SLP_EN=1) → CH exits cleanly
EfiResetCold/EfiResetWarm → write 0x01 → CH resets
With this fix:
- SSH
shutdown /s /t 0 → CH exits in ~22s
- ACPI power button → CH exits in ~19s
Linux guests are unaffected as they do not call ResetSystem for shutdown.
Branch with fix: https://github.com/CMGS/rust-hypervisor-firmware/tree/fix/reset-system
Signed-off-by: CMGS ilskdw@gmail.com
Description
The EFI
ResetSystemruntime service insrc/efi/runtime_services.rsis intentionally a no-op:This works for Linux, which falls back to ACPI (
SLEEP_CONTROL_REG) for shutdown and triple-fault for reboot. However, Windows callsResetSystem(EfiResetShutdown)as its final shutdown step and does not fall back to ACPI when the call returns. This causes the Cloud Hypervisor process to hang indefinitely after a Windows guest shuts down.Impact
shutdown /s /t 0inside Windows: SSH dies (Windows stops services), but CH process never exitsvm.power-button): Windows receives the event and starts shutdown, but CH never exitsReproduction
shutdown /s /t 0cloud-hypervisorprocess never exitsFix
Write the appropriate value to Cloud Hypervisor's
AcpiShutdownDeviceI/O port (0x600) based on the reset type:EfiResetShutdown→ write0x34(SLP_TYP=5, SLP_EN=1) → CH exits cleanlyEfiResetCold/EfiResetWarm→ write0x01→ CH resetsWith this fix:
shutdown /s /t 0→ CH exits in ~22sLinux guests are unaffected as they do not call
ResetSystemfor shutdown.Branch with fix: https://github.com/CMGS/rust-hypervisor-firmware/tree/fix/reset-system
Signed-off-by: CMGS ilskdw@gmail.com