Index: head/sys/amd64/amd64/initcpu.c =================================================================== --- head/sys/amd64/amd64/initcpu.c +++ head/sys/amd64/amd64/initcpu.c @@ -80,6 +80,19 @@ wrmsr(0xc0011029, rdmsr(0xc0011029) | 1); break; } + + /* + * BIOS may fail to set InitApicIdCpuIdLo to 1 as it should per BKDG. + * So, do it here or otherwise some tools could be confused by + * Initial Local APIC ID reported with CPUID Function 1 in EBX. + */ + if (CPUID_TO_FAMILY(cpu_id) == 0x10) { + if ((cpu_feature2 & CPUID2_HV) == 0) { + msr = rdmsr(MSR_NB_CFG1); + msr |= (uint64_t)1 << 54; + wrmsr(MSR_NB_CFG1, msr); + } + } } /*