From 10fb713218b328b712df5243f75d013934def54b Mon Sep 17 00:00:00 2001 From: Anirudh Rayabharam Date: Wed, 30 Jul 2025 11:04:24 +0000 Subject: [PATCH] hypervisor: mshv: handle reset intercepts for arm64 Handle MSHV reset intercepts on arm64 such that guests can gracefully shutdown/reboot instead of panicking due to unhandled intercept. Signed-off-by: Anirudh Rayabharam --- hypervisor/src/mshv/mod.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hypervisor/src/mshv/mod.rs b/hypervisor/src/mshv/mod.rs index bc03c44da..373e338f1 100644 --- a/hypervisor/src/mshv/mod.rs +++ b/hypervisor/src/mshv/mod.rs @@ -640,6 +640,21 @@ impl cpu::Vcpu for MshvVcpu { debug!("HALT"); Ok(cpu::VmExit::Reset) } + #[cfg(target_arch = "aarch64")] + hv_message_type_HVMSG_ARM64_RESET_INTERCEPT => { + let reset_msg = x.to_reset_intercept_msg().unwrap(); + + match reset_msg.reset_type { + hv_arm64_reset_type_HV_ARM64_RESET_TYPE_REBOOT => Ok(cpu::VmExit::Reset), + hv_arm64_reset_type_HV_ARM64_RESET_TYPE_POWER_OFF => { + Ok(cpu::VmExit::Shutdown) + } + _ => Err(cpu::HypervisorCpuError::RunVcpu(anyhow!( + "Unhandled VCPU exit (RESET_INTERCEPT): reset type: {:?}", + reset_msg.reset_type + ))), + } + } hv_message_type_HVMSG_UNRECOVERABLE_EXCEPTION => { warn!("TRIPLE FAULT"); Ok(cpu::VmExit::Shutdown)