From e19079782dc8f3e47d6b8a02d8f2771f9771b2c7 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 16 Jun 2020 14:47:09 +0100 Subject: [PATCH] vmm, arch: x86_64: Set the APIC ID on the 0x1f CPUID leaf The extended topology leaf (0x1f) also needs to have the APIC ID (which is the KVM cpu ID) set. This mirrors the APIC ID set on the 0xb topology leaf Signed-off-by: Rob Bradford --- arch/src/x86_64/mod.rs | 1 + vmm/src/cpu.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/src/x86_64/mod.rs b/arch/src/x86_64/mod.rs index e9438168d..a743b3000 100644 --- a/arch/src/x86_64/mod.rs +++ b/arch/src/x86_64/mod.rs @@ -208,6 +208,7 @@ pub fn configure_vcpu( ) -> super::Result<()> { let mut cpuid = cpuid; CpuidPatch::set_cpuid_reg(&mut cpuid, 0xb, None, CpuidReg::EDX, u32::from(id)); + CpuidPatch::set_cpuid_reg(&mut cpuid, 0x1f, None, CpuidReg::EDX, u32::from(id)); fd.set_cpuid2(&cpuid) .map_err(Error::SetSupportedCpusFailed)?; diff --git a/vmm/src/cpu.rs b/vmm/src/cpu.rs index 88ab56d40..dd0cc065f 100644 --- a/vmm/src/cpu.rs +++ b/vmm/src/cpu.rs @@ -789,6 +789,7 @@ impl CpuManager { { let mut cpuid = self.cpuid.clone(); CpuidPatch::set_cpuid_reg(&mut cpuid, 0xb, None, CpuidReg::EDX, u32::from(cpu_id)); + CpuidPatch::set_cpuid_reg(&mut cpuid, 0x1f, None, CpuidReg::EDX, u32::from(cpu_id)); vcpu.lock() .unwrap()