mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
hypervisor, vmm: move away from CpuId type
CpuId is an alias type for the flexible array structure type over CpuIdEntry. The type itself and the type of the element in the array portion are tied to the underlying hypervisor. Switch to using CpuIdEntry slice or vector directly. The construction of CpuId type is left to hypervisors. This allows us to decouple CpuIdEntry from hypervisors more easily. No functional change intended. Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
@@ -43,7 +43,7 @@ use hypervisor::kvm::kvm_bindings;
|
||||
#[cfg(feature = "tdx")]
|
||||
use hypervisor::kvm::{TdxExitDetails, TdxExitStatus};
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
use hypervisor::x86_64::CpuId;
|
||||
use hypervisor::x86_64::CpuIdEntry;
|
||||
#[cfg(feature = "guest_debug")]
|
||||
use hypervisor::x86_64::{MsrEntries, MsrEntry};
|
||||
use hypervisor::{CpuState, HypervisorCpuError, VmExit, VmOps};
|
||||
@@ -311,7 +311,7 @@ impl Vcpu {
|
||||
#[cfg(target_arch = "aarch64")] vm: &Arc<dyn hypervisor::Vm>,
|
||||
kernel_entry_point: Option<EntryPoint>,
|
||||
#[cfg(target_arch = "x86_64")] vm_memory: &GuestMemoryAtomic<GuestMemoryMmap>,
|
||||
#[cfg(target_arch = "x86_64")] cpuid: CpuId,
|
||||
#[cfg(target_arch = "x86_64")] cpuid: Vec<CpuIdEntry>,
|
||||
#[cfg(target_arch = "x86_64")] kvm_hyperv: bool,
|
||||
) -> Result<()> {
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
@@ -418,7 +418,7 @@ pub struct CpuManager {
|
||||
#[cfg_attr(target_arch = "aarch64", allow(dead_code))]
|
||||
vm_memory: GuestMemoryAtomic<GuestMemoryMmap>,
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
cpuid: CpuId,
|
||||
cpuid: Vec<CpuIdEntry>,
|
||||
#[cfg_attr(target_arch = "aarch64", allow(dead_code))]
|
||||
vm: Arc<dyn hypervisor::Vm>,
|
||||
vcpus_kill_signalled: Arc<AtomicBool>,
|
||||
@@ -1217,7 +1217,7 @@ impl CpuManager {
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub fn common_cpuid(&self) -> CpuId {
|
||||
pub fn common_cpuid(&self) -> Vec<CpuIdEntry> {
|
||||
self.cpuid.clone()
|
||||
}
|
||||
|
||||
|
||||
@@ -355,7 +355,7 @@ pub fn start_vmm_thread(
|
||||
struct VmMigrationConfig {
|
||||
vm_config: Arc<Mutex<VmConfig>>,
|
||||
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
||||
common_cpuid: hypervisor::x86_64::CpuId,
|
||||
common_cpuid: Vec<hypervisor::x86_64::CpuIdEntry>,
|
||||
memory_manager_data: MemoryManagerSnapshotData,
|
||||
}
|
||||
|
||||
@@ -1593,7 +1593,7 @@ impl Vmm {
|
||||
fn vm_check_cpuid_compatibility(
|
||||
&self,
|
||||
src_vm_config: &Arc<Mutex<VmConfig>>,
|
||||
src_vm_cpuid: &hypervisor::x86_64::CpuId,
|
||||
src_vm_cpuid: &[hypervisor::x86_64::CpuIdEntry],
|
||||
) -> result::Result<(), MigratableError> {
|
||||
// We check the `CPUID` compatibility of between the source vm and destination, which is
|
||||
// mostly about feature compatibility and "topology/sgx" leaves are not relevant.
|
||||
|
||||
@@ -2618,7 +2618,7 @@ pub struct VmSnapshot {
|
||||
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
||||
pub clock: Option<hypervisor::ClockData>,
|
||||
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
||||
pub common_cpuid: hypervisor::x86_64::CpuId,
|
||||
pub common_cpuid: Vec<hypervisor::x86_64::CpuIdEntry>,
|
||||
}
|
||||
|
||||
pub const VM_SNAPSHOT_ID: &str = "vm";
|
||||
|
||||
Reference in New Issue
Block a user