From 35ecfb6ec584f7ae46ca8a942daa476e548719d9 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sun, 26 Mar 2023 19:52:24 +0200 Subject: [PATCH] hypervisor: mshv: Implement set_cpuid2 call Passing the CPUID leafs with the topology is integrated into the common mechanism of setting and patching CPUID in Cloud Hypervisor. All the CPUID values will be passed to the hypervisor through the register intercept call. Signed-off-by: Anatol Belski --- hypervisor/src/mshv/mod.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hypervisor/src/mshv/mod.rs b/hypervisor/src/mshv/mod.rs index 82ba89ef3..91cf40119 100644 --- a/hypervisor/src/mshv/mod.rs +++ b/hypervisor/src/mshv/mod.rs @@ -583,8 +583,14 @@ impl cpu::Vcpu for MshvVcpu { /// /// X86 specific call to setup the CPUID registers. /// - fn set_cpuid2(&self, _cpuid: &[CpuIdEntry]) -> cpu::Result<()> { - Ok(()) + fn set_cpuid2(&self, cpuid: &[CpuIdEntry]) -> cpu::Result<()> { + let cpuid: Vec = cpuid.iter().map(|e| (*e).into()).collect(); + let mshv_cpuid = ::from_entries(&cpuid) + .map_err(|_| cpu::HypervisorCpuError::SetCpuid(anyhow!("failed to create CpuId")))?; + + self.fd + .register_intercept_result_cpuid(&mshv_cpuid) + .map_err(|e| cpu::HypervisorCpuError::SetCpuid(e.into())) } #[cfg(target_arch = "x86_64")] ///