mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
hypervisor: x86: drop get/set Xcrs from Vcpu trait
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
@@ -19,7 +19,7 @@ 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::{ExtendedControlRegisters, MsrEntries, VcpuEvents};
|
use crate::x86_64::{MsrEntries, VcpuEvents};
|
||||||
use crate::CpuState;
|
use crate::CpuState;
|
||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
use crate::DeviceAttr;
|
use crate::DeviceAttr;
|
||||||
@@ -351,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 "xcrs".
|
|
||||||
///
|
|
||||||
fn get_xcrs(&self) -> Result<ExtendedControlRegisters>;
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
///
|
|
||||||
/// X86 specific call that sets the vcpu's current "xcrs".
|
|
||||||
///
|
|
||||||
fn set_xcrs(&self, xcrs: &ExtendedControlRegisters) -> Result<()>;
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
///
|
|
||||||
/// Returns currently pending exceptions, interrupts, and NMIs as well as related
|
/// Returns currently pending exceptions, interrupts, and NMIs as well as related
|
||||||
/// states of the vcpu.
|
/// states of the vcpu.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -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 "xcrs".
|
|
||||||
///
|
|
||||||
fn get_xcrs(&self) -> cpu::Result<ExtendedControlRegisters> {
|
|
||||||
self.fd
|
|
||||||
.get_xcrs()
|
|
||||||
.map_err(|e| cpu::HypervisorCpuError::GetXcsr(e.into()))
|
|
||||||
}
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
///
|
|
||||||
/// X86 specific call that sets the vcpu's current "xcrs".
|
|
||||||
///
|
|
||||||
fn set_xcrs(&self, xcrs: &ExtendedControlRegisters) -> cpu::Result<()> {
|
|
||||||
self.fd
|
|
||||||
.set_xcrs(xcrs)
|
|
||||||
.map_err(|e| cpu::HypervisorCpuError::SetXcsr(e.into()))
|
|
||||||
}
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
///
|
|
||||||
/// Translates guest virtual address to guest physical address using the `KVM_TRANSLATE` ioctl.
|
/// Translates guest virtual address to guest physical address using the `KVM_TRANSLATE` ioctl.
|
||||||
///
|
///
|
||||||
fn translate_gva(&self, gva: u64, _flags: u64) -> cpu::Result<(u64, u32)> {
|
fn translate_gva(&self, gva: u64, _flags: u64) -> cpu::Result<(u64, u32)> {
|
||||||
@@ -2106,6 +2088,24 @@ impl KvmVcpu {
|
|||||||
.set_xsave(xsave)
|
.set_xsave(xsave)
|
||||||
.map_err(|e| cpu::HypervisorCpuError::SetXsaveState(e.into()))
|
.map_err(|e| cpu::HypervisorCpuError::SetXsaveState(e.into()))
|
||||||
}
|
}
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
///
|
||||||
|
/// X86 specific call that returns the vcpu's current "xcrs".
|
||||||
|
///
|
||||||
|
fn get_xcrs(&self) -> cpu::Result<ExtendedControlRegisters> {
|
||||||
|
self.fd
|
||||||
|
.get_xcrs()
|
||||||
|
.map_err(|e| cpu::HypervisorCpuError::GetXcsr(e.into()))
|
||||||
|
}
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
///
|
||||||
|
/// X86 specific call that sets the vcpu's current "xcrs".
|
||||||
|
///
|
||||||
|
fn set_xcrs(&self, xcrs: &ExtendedControlRegisters) -> cpu::Result<()> {
|
||||||
|
self.fd
|
||||||
|
.set_xcrs(xcrs)
|
||||||
|
.map_err(|e| cpu::HypervisorCpuError::SetXcsr(e.into()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Device struct for KVM
|
/// Device struct for KVM
|
||||||
|
|||||||
@@ -354,24 +354,6 @@ impl cpu::Vcpu for MshvVcpu {
|
|||||||
.map_err(|e| cpu::HypervisorCpuError::SetMsrEntries(e.into()))
|
.map_err(|e| cpu::HypervisorCpuError::SetMsrEntries(e.into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
///
|
|
||||||
/// X86 specific call that returns the vcpu's current "xcrs".
|
|
||||||
///
|
|
||||||
fn get_xcrs(&self) -> cpu::Result<ExtendedControlRegisters> {
|
|
||||||
self.fd
|
|
||||||
.get_xcrs()
|
|
||||||
.map_err(|e| cpu::HypervisorCpuError::GetXcsr(e.into()))
|
|
||||||
}
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
///
|
|
||||||
/// X86 specific call that sets the vcpu's current "xcrs".
|
|
||||||
///
|
|
||||||
fn set_xcrs(&self, xcrs: &ExtendedControlRegisters) -> cpu::Result<()> {
|
|
||||||
self.fd
|
|
||||||
.set_xcrs(xcrs)
|
|
||||||
.map_err(|e| cpu::HypervisorCpuError::SetXcsr(e.into()))
|
|
||||||
}
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
///
|
///
|
||||||
/// Returns currently pending exceptions, interrupts, and NMIs as well as related
|
/// Returns currently pending exceptions, interrupts, and NMIs as well as related
|
||||||
@@ -725,6 +707,24 @@ impl MshvVcpu {
|
|||||||
.set_xsave(xsave)
|
.set_xsave(xsave)
|
||||||
.map_err(|e| cpu::HypervisorCpuError::SetXsaveState(e.into()))
|
.map_err(|e| cpu::HypervisorCpuError::SetXsaveState(e.into()))
|
||||||
}
|
}
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
///
|
||||||
|
/// X86 specific call that returns the vcpu's current "xcrs".
|
||||||
|
///
|
||||||
|
fn get_xcrs(&self) -> cpu::Result<ExtendedControlRegisters> {
|
||||||
|
self.fd
|
||||||
|
.get_xcrs()
|
||||||
|
.map_err(|e| cpu::HypervisorCpuError::GetXcsr(e.into()))
|
||||||
|
}
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
///
|
||||||
|
/// X86 specific call that sets the vcpu's current "xcrs".
|
||||||
|
///
|
||||||
|
fn set_xcrs(&self, xcrs: &ExtendedControlRegisters) -> cpu::Result<()> {
|
||||||
|
self.fd
|
||||||
|
.set_xcrs(xcrs)
|
||||||
|
.map_err(|e| cpu::HypervisorCpuError::SetXcsr(e.into()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Device struct for MSHV
|
/// Device struct for MSHV
|
||||||
|
|||||||
Reference in New Issue
Block a user