mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-25 21:02:25 +00:00
arch: x86_64: Populate the APIC Id
Program the APIC ID (CPUID leaf 0x1 EBX) with the CPU id. This resolves an issue where the EDKII firmware expects the APIC ID to vary per-CPU. Fixes: #5475 Signed-off-by: Jianyong Wu <jianyong.wu@arm.com> (cherry picked from commit 57fdaa3a39fc9536ffd2665c470c33476dbdd931)
This commit is contained in:
parent
574d86dd4d
commit
ec56f07316
@ -753,6 +753,13 @@ pub fn configure_vcpu(
|
||||
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));
|
||||
|
||||
// Set ApicId in cpuid for each vcpu
|
||||
// SAFETY: get host cpuid when eax=1
|
||||
let mut cpu_ebx = unsafe { core::arch::x86_64::__cpuid(1) }.ebx;
|
||||
cpu_ebx &= 0xffffff;
|
||||
cpu_ebx |= (id as u32) << 24;
|
||||
CpuidPatch::set_cpuid_reg(&mut cpuid, 0x1, None, CpuidReg::EBX, cpu_ebx);
|
||||
|
||||
// The TSC frequency CPUID leaf should not be included when running with HyperV emulation
|
||||
if !kvm_hyperv {
|
||||
if let Some(tsc_khz) = vcpu.tsc_khz().map_err(Error::GetTscFrequency)? {
|
||||
|
Loading…
x
Reference in New Issue
Block a user