Skip to content

efi: reset_system is a no-op, Windows guests cannot shut down or reboot #422

@CMGS

Description

@CMGS

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

  1. Boot a Windows 11 25H2 guest using CLOUDHV.fd firmware on Cloud Hypervisor
  2. SSH in and run shutdown /s /t 0
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions