summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2016-05-17 08:33:40 +0000
committeravg <avg@FreeBSD.org>2016-05-17 08:33:40 +0000
commitcfc033758184eb39393821536f7673443bc76aad (patch)
tree3984d0be7d1771694729b4f66f1f9b6d6f24dc15 /sys
parentcc2f72017246c147643746cd741cc777f317bb5c (diff)
downloadFreeBSD-src-cfc033758184eb39393821536f7673443bc76aad.zip
FreeBSD-src-cfc033758184eb39393821536f7673443bc76aad.tar.gz
MFC r298736: ensure that initial local apic id is sane on AMD 10h systems
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/initcpu.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/amd64/amd64/initcpu.c b/sys/amd64/amd64/initcpu.c
index 36f2d0f..f1d81cb 100644
--- a/sys/amd64/amd64/initcpu.c
+++ b/sys/amd64/amd64/initcpu.c
@@ -111,6 +111,19 @@ init_amd(void)
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);
+ }
+ }
}
/*
OpenPOWER on IntegriCloud