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 <liuwe@microsoft.com>
This commit is contained in:
Wei Liu 2024-07-03 19:20:17 +00:00 committed by Liu Wei
parent 519476e842
commit 14b45e4d2e

View File

@ -638,13 +638,18 @@ impl cpu::Vcpu for MshvVcpu {
Ok(cpu::VmExit::Ignore) Ok(cpu::VmExit::Ignore)
} }
#[cfg(target_arch = "x86_64")] #[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 info = x.to_memory_info().unwrap();
let insn_len = info.instruction_byte_count as usize; 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 { let mut context = MshvEmulatorContext {
vcpu: self, vcpu: self,
map: (info.guest_virtual_address, info.guest_physical_address), map: (gva, gpa),
}; };
// Create a new emulator. // Create a new emulator.