x86_64: set APIC ID in CPUID EAX=0xB leaf

This leaf is used to identify the APIC ID on Intel systems.

Fixes guest kernel warnings of this type:

  [Firmware Bug]: CPU1: APIC id mismatch. Firmware: 1 APIC: 11

BUG=b:167714813
TEST=Boot Linux guest kernel; check dmesg

Change-Id: Icc3d32f5a382704c28ecc174b98c982c574bd2b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2402154
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
Daniel Verkamp 2020-09-09 17:44:34 -07:00 committed by Commit Bot
parent a5b30b2eea
commit 1f4d3c7ca3

View file

@ -84,6 +84,12 @@ fn filter_cpuid(
// Clear X86 EPB feature. No frequency selection in the hypervisor.
entry.ecx &= !(1 << ECX_EPB_SHIFT);
}
0xB | 0x1F => {
// Extended topology enumeration / V2 Extended topology enumeration
// NOTE: these will need to be split if any of the fields that differ between
// the two versions are to be set.
entry.edx = vcpu_id as u32; // x2APIC ID
}
_ => (),
}
}