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 <anrayabh@microsoft.com>
This commit is contained in:
Anirudh Rayabharam 2025-07-30 11:04:24 +00:00 committed by Bo Chen
parent 90b0dc911c
commit 10fb713218

View file

@ -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)