ensure that initial local apic id is sane on AMD 10h systems
authoravg <avg@FreeBSD.org>
Thu, 28 Apr 2016 08:29:57 +0000 (08:29 +0000)
committeravg <avg@FreeBSD.org>
Thu, 28 Apr 2016 08:29:57 +0000 (08:29 +0000)
commitf68c6e4879101214e4360d61e0024a8b757a81eb
tree61a66897b1d876de45e22aba2242568c9f02255f
parentd95042832b1b7a78248968385f591871a7d5ed98
ensure that initial local apic id is sane on AMD 10h systems

Summary:
The Initial Local APIC ID is returned by CPUID function 1 (in EBX).
On AMD Family 10h systems the way that ID is built is controlled by
an MSR bit (InitApicIdCpuIdLo).  BKDG instructs BIOS to set it in a
certain way, but a BIOS can be buggy.  In that case the ID can confuse
tools that use it, e.g. hwloc.
For example, on a system that I own real Local APIC IDs are configured
as 0, 1, 2, 3, but IDs reported via CPUID.1 are 0, 0x40, 0x80, 0xc0.
See: https://github.com/open-mpi/hwloc/issues/183

Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D6060
sys/amd64/amd64/initcpu.c