mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-08 22:05:20 +00:00
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:
parent
3a93487b82
commit
286a23fbd4
@ -112,6 +112,7 @@ impl hypervisor::Hypervisor for MshvHypervisor {
|
|||||||
fd: vm_fd,
|
fd: vm_fd,
|
||||||
msrs,
|
msrs,
|
||||||
hv_state: hv_state_init(),
|
hv_state: hv_state_init(),
|
||||||
|
vmmops: None,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
@ -138,6 +139,7 @@ pub struct MshvVcpu {
|
|||||||
cpuid: CpuId,
|
cpuid: CpuId,
|
||||||
msrs: MsrEntries,
|
msrs: MsrEntries,
|
||||||
hv_state: Arc<RwLock<HvState>>, // Mshv State
|
hv_state: Arc<RwLock<HvState>>, // Mshv State
|
||||||
|
vmmops: Option<Arc<Box<dyn vm::VmmOps>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Implementation of Vcpu trait for Microsoft Hypervisor
|
/// Implementation of Vcpu trait for Microsoft Hypervisor
|
||||||
@ -339,6 +341,7 @@ pub struct MshvVm {
|
|||||||
msrs: MsrEntries,
|
msrs: MsrEntries,
|
||||||
// Hypervisor State
|
// Hypervisor State
|
||||||
hv_state: Arc<RwLock<HvState>>,
|
hv_state: Arc<RwLock<HvState>>,
|
||||||
|
vmmops: Option<Arc<Box<dyn vm::VmmOps>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hv_state_init() -> Arc<RwLock<HvState>> {
|
fn hv_state_init() -> Arc<RwLock<HvState>> {
|
||||||
@ -400,6 +403,7 @@ impl vm::Vm for MshvVm {
|
|||||||
cpuid: CpuId::new(1 as usize),
|
cpuid: CpuId::new(1 as usize),
|
||||||
msrs: self.msrs.clone(),
|
msrs: self.msrs.clone(),
|
||||||
hv_state: self.hv_state.clone(),
|
hv_state: self.hv_state.clone(),
|
||||||
|
vmmops,
|
||||||
};
|
};
|
||||||
Ok(Arc::new(vcpu))
|
Ok(Arc::new(vcpu))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user