From 14b45e4d2e35be8a0d4e86e0f49425f262be2fbb Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Wed, 3 Jul 2024 19:20:17 +0000 Subject: [PATCH] hypervisor: mshv: handle GPA intercept We will start receiving GPA intercepts. For our use cases they are handled the same way as UNMAPPED GPA intercepts. Put in some logging to distinguish the two cases. Signed-off-by: Wei Liu --- hypervisor/src/mshv/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hypervisor/src/mshv/mod.rs b/hypervisor/src/mshv/mod.rs index 5560a926b..2ea1d2de4 100644 --- a/hypervisor/src/mshv/mod.rs +++ b/hypervisor/src/mshv/mod.rs @@ -638,13 +638,18 @@ impl cpu::Vcpu for MshvVcpu { Ok(cpu::VmExit::Ignore) } #[cfg(target_arch = "x86_64")] - hv_message_type_HVMSG_UNMAPPED_GPA => { + msg_type @ (hv_message_type_HVMSG_UNMAPPED_GPA + | hv_message_type_HVMSG_GPA_INTERCEPT) => { let info = x.to_memory_info().unwrap(); let insn_len = info.instruction_byte_count as usize; + let gva = info.guest_virtual_address; + let gpa = info.guest_physical_address; + + debug!("Exit ({:?}) GVA {:x} GPA {:x}", msg_type, gva, gpa); let mut context = MshvEmulatorContext { vcpu: self, - map: (info.guest_virtual_address, info.guest_physical_address), + map: (gva, gpa), }; // Create a new emulator.