mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: arch: Make phys_bits functionality use CPU vendor API
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Anatol Belski
parent
7df80220ec
commit
7bf2a2c382
@@ -716,7 +716,7 @@ impl CpuManager {
|
||||
);
|
||||
|
||||
self.cpuid = {
|
||||
let phys_bits = physical_bits(self.config.max_phys_bits);
|
||||
let phys_bits = physical_bits(hypervisor, self.config.max_phys_bits);
|
||||
arch::generate_common_cpuid(
|
||||
hypervisor,
|
||||
topology,
|
||||
|
||||
@@ -1219,7 +1219,8 @@ impl Vmm {
|
||||
))
|
||||
})?;
|
||||
|
||||
let phys_bits = vm::physical_bits(config.lock().unwrap().cpus.max_phys_bits);
|
||||
let phys_bits =
|
||||
vm::physical_bits(&self.hypervisor, config.lock().unwrap().cpus.max_phys_bits);
|
||||
|
||||
let memory_manager = MemoryManager::new(
|
||||
vm,
|
||||
@@ -1535,7 +1536,8 @@ impl Vmm {
|
||||
let vm_config = vm.get_config();
|
||||
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
||||
let common_cpuid = {
|
||||
let phys_bits = vm::physical_bits(vm_config.lock().unwrap().cpus.max_phys_bits);
|
||||
let phys_bits =
|
||||
vm::physical_bits(&hypervisor, vm_config.lock().unwrap().cpus.max_phys_bits);
|
||||
arch::generate_common_cpuid(
|
||||
&hypervisor,
|
||||
None,
|
||||
@@ -1725,7 +1727,7 @@ impl Vmm {
|
||||
let dest_cpuid = &{
|
||||
let vm_config = &src_vm_config.lock().unwrap();
|
||||
|
||||
let phys_bits = vm::physical_bits(vm_config.cpus.max_phys_bits);
|
||||
let phys_bits = vm::physical_bits(&self.hypervisor, vm_config.cpus.max_phys_bits);
|
||||
arch::generate_common_cpuid(
|
||||
&self.hypervisor.clone(),
|
||||
None,
|
||||
|
||||
@@ -417,8 +417,8 @@ impl VmOps for VmOpsHandler {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn physical_bits(max_phys_bits: u8) -> u8 {
|
||||
let host_phys_bits = get_host_cpu_phys_bits();
|
||||
pub fn physical_bits(hypervisor: &Arc<dyn hypervisor::Hypervisor>, max_phys_bits: u8) -> u8 {
|
||||
let host_phys_bits = get_host_cpu_phys_bits(hypervisor);
|
||||
|
||||
cmp::min(host_phys_bits, max_phys_bits)
|
||||
}
|
||||
@@ -762,7 +762,7 @@ impl Vm {
|
||||
tdx_enabled,
|
||||
)?;
|
||||
|
||||
let phys_bits = physical_bits(vm_config.lock().unwrap().cpus.max_phys_bits);
|
||||
let phys_bits = physical_bits(&hypervisor, vm_config.lock().unwrap().cpus.max_phys_bits);
|
||||
|
||||
let memory_manager = if let Some(snapshot) =
|
||||
snapshot_from_id(snapshot.as_ref(), MEMORY_MANAGER_SNAPSHOT_ID)
|
||||
@@ -2413,7 +2413,10 @@ impl Snapshottable for Vm {
|
||||
|
||||
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
||||
let common_cpuid = {
|
||||
let phys_bits = physical_bits(self.config.lock().unwrap().cpus.max_phys_bits);
|
||||
let phys_bits = physical_bits(
|
||||
&self.hypervisor,
|
||||
self.config.lock().unwrap().cpus.max_phys_bits,
|
||||
);
|
||||
arch::generate_common_cpuid(
|
||||
&self.hypervisor,
|
||||
None,
|
||||
|
||||
Reference in New Issue
Block a user