From ba3e02ce8653d875452306334a43fd6077625662 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 8dc987aac..98df89ab3 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")] ///