hypervisor: mshv: Add vmmops to MshvVm struct

vmmops trait object is needed to get access some
of the upper level vmm functionalities i.e guest
memory access, IO read write etc.

Co-Developed-by: Praveen Paladugu <prapal@microsoft.com>
Signed-off-by: Praveen Paladugu <prapal@microsoft.com>
Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
Muminul Islam 2020-12-03 23:03:51 -08:00 committed by Samuel Ortiz
parent 3a93487b82
commit 286a23fbd4

View File

@ -112,6 +112,7 @@ impl hypervisor::Hypervisor for MshvHypervisor {
fd: vm_fd,
msrs,
hv_state: hv_state_init(),
vmmops: None,
}))
}
///
@ -138,6 +139,7 @@ pub struct MshvVcpu {
cpuid: CpuId,
msrs: MsrEntries,
hv_state: Arc<RwLock<HvState>>, // Mshv State
vmmops: Option<Arc<Box<dyn vm::VmmOps>>>,
}
/// Implementation of Vcpu trait for Microsoft Hypervisor
@ -339,6 +341,7 @@ pub struct MshvVm {
msrs: MsrEntries,
// Hypervisor State
hv_state: Arc<RwLock<HvState>>,
vmmops: Option<Arc<Box<dyn vm::VmmOps>>>,
}
fn hv_state_init() -> Arc<RwLock<HvState>> {
@ -400,6 +403,7 @@ impl vm::Vm for MshvVm {
cpuid: CpuId::new(1 as usize),
msrs: self.msrs.clone(),
hv_state: self.hv_state.clone(),
vmmops,
};
Ok(Arc::new(vcpu))
}