Skip to content

efi: Implement reset_system for Cloud Hypervisor#423

Closed
CMGS wants to merge 1 commit intocloud-hypervisor:mainfrom
cocoonstack:fix/reset-system
Closed

efi: Implement reset_system for Cloud Hypervisor#423
CMGS wants to merge 1 commit intocloud-hypervisor:mainfrom
cocoonstack:fix/reset-system

Conversation

@CMGS
Copy link
Copy Markdown

@CMGS CMGS commented Apr 1, 2026

Summary

Implement the EFI ResetSystem runtime service to write to Cloud Hypervisor's AcpiShutdownDevice I/O port (0x600).

The function was intentionally left as a no-op to force Linux to use ACPI for shutdown. Linux does fall back correctly, but Windows calls ResetSystem(EfiResetShutdown) as its final shutdown step and does not fall back to ACPI. This causes the Cloud Hypervisor process to hang indefinitely after a Windows guest shuts down.

Changes

  • EfiResetShutdown: write 0x34 (SLP_TYP=5, SLP_EN=1) to port
    0x600, triggering a clean VM exit
  • EfiResetCold/EfiResetWarm: write 0x01 to port 0x600,
    triggering a VM reset

Test results

Scenario Before After
SSH shutdown /s /t 0 CH hangs forever 22s exit
ACPI power button CH hangs forever 19s exit

Linux guests are unaffected as they use ACPI directly for shutdown.

Fixes: #422

Signed-off-by: CMGS ilskdw@gmail.com

@CMGS CMGS force-pushed the fix/reset-system branch from f806f97 to 55c68f9 Compare April 1, 2026 09:56
@retrage
Copy link
Copy Markdown
Contributor

retrage commented Apr 1, 2026

Thank you for the finding and the fix! It would be nice if the build passes on other architectures.

The ResetSystem runtime service was intentionally left as a no-op
to force Linux to use ACPI for shutdown. 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 Windows shuts
down.

Write the appropriate value to Cloud Hypervisor's shutdown I/O
port (0x600) based on the reset type:
- EfiResetShutdown: SLP_TYP=5 + SLP_EN (triggers VM exit)
- EfiResetCold/Warm: reboot value (triggers VM reset)

Linux guests are unaffected as they use ACPI directly.

Fixes: cloud-hypervisor#422

Signed-off-by: CMGS <ilskdw@gmail.com>
@CMGS CMGS force-pushed the fix/reset-system branch from 55c68f9 to 51e84a4 Compare April 1, 2026 10:20
@CMGS CMGS closed this Apr 1, 2026
@CMGS
Copy link
Copy Markdown
Author

CMGS commented Apr 1, 2026

sorry, move proj from my personal repo to org cuz head ref missing, i got to close this PR and open new one for CI testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants