hypervisor: provide a generic MpState structure

It is however only used for KVM right now because MSHV does not need it
yet.

Nonetheless a stub MSHV constructor should be there and get/set
functions should be implemented for MSHV.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu
2022-07-14 15:17:07 +00:00
committed by Liu Wei
parent 02866fccb0
commit 9810ed4496
5 changed files with 56 additions and 21 deletions

View File

@@ -25,7 +25,8 @@ use vm::DataMatch;
pub mod x86_64;
use crate::device;
use crate::{
UserMemoryRegion, USER_MEMORY_REGION_EXECUTE, USER_MEMORY_REGION_READ, USER_MEMORY_REGION_WRITE,
MpState, UserMemoryRegion, USER_MEMORY_REGION_EXECUTE, USER_MEMORY_REGION_READ,
USER_MEMORY_REGION_WRITE,
};
use vmm_sys_util::eventfd::EventFd;
#[cfg(target_arch = "x86_64")]
@@ -541,6 +542,18 @@ impl cpu::Vcpu for MshvVcpu {
.set_lapic(lapic)
.map_err(|e| cpu::HypervisorCpuError::SetLapicState(e.into()))
}
///
/// Returns the vcpu's current "multiprocessing state".
///
fn get_mp_state(&self) -> cpu::Result<MpState> {
Ok(MpState::Mshv)
}
///
/// Sets the vcpu's current "multiprocessing state".
///
fn set_mp_state(&self, _mp_state: MpState) -> cpu::Result<()> {
Ok(())
}
#[cfg(target_arch = "x86_64")]
///
/// X86 specific call that returns the vcpu's current "xsave struct".

View File

@@ -66,8 +66,6 @@ impl fmt::Display for VcpuMshvState {
}
}
pub struct MpState {}
impl SegmentRegisterOps for SegmentRegister {
fn segment_type(&self) -> u8 {
self.type_