arch, vmm: Add new struct CpuidConfig

This struct contains all configuration fields that controls the way how
we generate CPUID for the guest on x86_64. This allows cleaner extension
when adding new configuration fields.

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen
2023-10-11 11:52:24 -07:00
committed by Bo Chen
parent 30975ea102
commit 7dd260f82f
5 changed files with 50 additions and 34 deletions

View File

@@ -726,7 +726,7 @@ impl CpuManager {
&mut self,
memory_manager: &Arc<Mutex<MemoryManager>>,
hypervisor: &Arc<dyn hypervisor::Hypervisor>,
#[cfg(feature = "tdx")] tdx_enabled: bool,
#[cfg(feature = "tdx")] tdx: bool,
) -> Result<()> {
let sgx_epc_sections = memory_manager
.lock()
@@ -739,11 +739,13 @@ impl CpuManager {
let phys_bits = physical_bits(hypervisor, self.config.max_phys_bits);
arch::generate_common_cpuid(
hypervisor,
sgx_epc_sections,
phys_bits,
self.config.kvm_hyperv,
#[cfg(feature = "tdx")]
tdx_enabled,
&arch::CpuidConfig {
sgx_epc_sections,
phys_bits,
kvm_hyperv: self.config.kvm_hyperv,
#[cfg(feature = "tdx")]
tdx,
},
)
.map_err(Error::CommonCpuId)?
};