mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-03 11:25:20 +00:00
hypervisor: x86: drop get/set Xsave from Vcpu trait
They are only needed internally within the hypervisor crate. Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
6a8c0fc887
commit
c8d9a43072
@ -19,8 +19,6 @@ use crate::kvm::{TdxExitDetails, TdxExitStatus};
|
|||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
use crate::x86_64::LapicState;
|
use crate::x86_64::LapicState;
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
use crate::x86_64::Xsave;
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
use crate::x86_64::{ExtendedControlRegisters, MsrEntries, VcpuEvents};
|
use crate::x86_64::{ExtendedControlRegisters, MsrEntries, VcpuEvents};
|
||||||
use crate::CpuState;
|
use crate::CpuState;
|
||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
@ -353,16 +351,6 @@ pub trait Vcpu: Send + Sync {
|
|||||||
fn set_mp_state(&self, mp_state: MpState) -> Result<()>;
|
fn set_mp_state(&self, mp_state: MpState) -> Result<()>;
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
///
|
///
|
||||||
/// X86 specific call that returns the vcpu's current "xsave struct".
|
|
||||||
///
|
|
||||||
fn get_xsave(&self) -> Result<Xsave>;
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
///
|
|
||||||
/// X86 specific call that sets the vcpu's current "xsave struct".
|
|
||||||
///
|
|
||||||
fn set_xsave(&self, xsave: &Xsave) -> Result<()>;
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
///
|
|
||||||
/// X86 specific call that returns the vcpu's current "xcrs".
|
/// X86 specific call that returns the vcpu's current "xcrs".
|
||||||
///
|
///
|
||||||
fn get_xcrs(&self) -> Result<ExtendedControlRegisters>;
|
fn get_xcrs(&self) -> Result<ExtendedControlRegisters>;
|
||||||
|
@ -1426,24 +1426,6 @@ impl cpu::Vcpu for KvmVcpu {
|
|||||||
}
|
}
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
///
|
///
|
||||||
/// X86 specific call that returns the vcpu's current "xsave struct".
|
|
||||||
///
|
|
||||||
fn get_xsave(&self) -> cpu::Result<Xsave> {
|
|
||||||
self.fd
|
|
||||||
.get_xsave()
|
|
||||||
.map_err(|e| cpu::HypervisorCpuError::GetXsaveState(e.into()))
|
|
||||||
}
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
///
|
|
||||||
/// X86 specific call that sets the vcpu's current "xsave struct".
|
|
||||||
///
|
|
||||||
fn set_xsave(&self, xsave: &Xsave) -> cpu::Result<()> {
|
|
||||||
self.fd
|
|
||||||
.set_xsave(xsave)
|
|
||||||
.map_err(|e| cpu::HypervisorCpuError::SetXsaveState(e.into()))
|
|
||||||
}
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
///
|
|
||||||
/// X86 specific call that returns the vcpu's current "xcrs".
|
/// X86 specific call that returns the vcpu's current "xcrs".
|
||||||
///
|
///
|
||||||
fn get_xcrs(&self) -> cpu::Result<ExtendedControlRegisters> {
|
fn get_xcrs(&self) -> cpu::Result<ExtendedControlRegisters> {
|
||||||
@ -2105,6 +2087,27 @@ impl cpu::Vcpu for KvmVcpu {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl KvmVcpu {
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
///
|
||||||
|
/// X86 specific call that returns the vcpu's current "xsave struct".
|
||||||
|
///
|
||||||
|
fn get_xsave(&self) -> cpu::Result<Xsave> {
|
||||||
|
self.fd
|
||||||
|
.get_xsave()
|
||||||
|
.map_err(|e| cpu::HypervisorCpuError::GetXsaveState(e.into()))
|
||||||
|
}
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
///
|
||||||
|
/// X86 specific call that sets the vcpu's current "xsave struct".
|
||||||
|
///
|
||||||
|
fn set_xsave(&self, xsave: &Xsave) -> cpu::Result<()> {
|
||||||
|
self.fd
|
||||||
|
.set_xsave(xsave)
|
||||||
|
.map_err(|e| cpu::HypervisorCpuError::SetXsaveState(e.into()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Device struct for KVM
|
/// Device struct for KVM
|
||||||
pub type KvmDevice = DeviceFd;
|
pub type KvmDevice = DeviceFd;
|
||||||
|
|
||||||
|
@ -606,24 +606,6 @@ impl cpu::Vcpu for MshvVcpu {
|
|||||||
fn set_mp_state(&self, _mp_state: MpState) -> cpu::Result<()> {
|
fn set_mp_state(&self, _mp_state: MpState) -> cpu::Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
///
|
|
||||||
/// X86 specific call that returns the vcpu's current "xsave struct".
|
|
||||||
///
|
|
||||||
fn get_xsave(&self) -> cpu::Result<Xsave> {
|
|
||||||
self.fd
|
|
||||||
.get_xsave()
|
|
||||||
.map_err(|e| cpu::HypervisorCpuError::GetXsaveState(e.into()))
|
|
||||||
}
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
///
|
|
||||||
/// X86 specific call that sets the vcpu's current "xsave struct".
|
|
||||||
///
|
|
||||||
fn set_xsave(&self, xsave: &Xsave) -> cpu::Result<()> {
|
|
||||||
self.fd
|
|
||||||
.set_xsave(xsave)
|
|
||||||
.map_err(|e| cpu::HypervisorCpuError::SetXsaveState(e.into()))
|
|
||||||
}
|
|
||||||
///
|
///
|
||||||
/// Set CPU state
|
/// Set CPU state
|
||||||
///
|
///
|
||||||
@ -724,6 +706,27 @@ impl cpu::Vcpu for MshvVcpu {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl MshvVcpu {
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
///
|
||||||
|
/// X86 specific call that returns the vcpu's current "xsave struct".
|
||||||
|
///
|
||||||
|
fn get_xsave(&self) -> cpu::Result<Xsave> {
|
||||||
|
self.fd
|
||||||
|
.get_xsave()
|
||||||
|
.map_err(|e| cpu::HypervisorCpuError::GetXsaveState(e.into()))
|
||||||
|
}
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
///
|
||||||
|
/// X86 specific call that sets the vcpu's current "xsave struct".
|
||||||
|
///
|
||||||
|
fn set_xsave(&self, xsave: &Xsave) -> cpu::Result<()> {
|
||||||
|
self.fd
|
||||||
|
.set_xsave(xsave)
|
||||||
|
.map_err(|e| cpu::HypervisorCpuError::SetXsaveState(e.into()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Device struct for MSHV
|
/// Device struct for MSHV
|
||||||
pub type MshvDevice = DeviceFd;
|
pub type MshvDevice = DeviceFd;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user