svn commit: r300037 - stable/9/sys/amd64/amd64
Andriy Gapon
avg at FreeBSD.org
Tue May 17 08:36:13 UTC 2016
Author: avg
Date: Tue May 17 08:36:12 2016
New Revision: 300037
URL: https://svnweb.freebsd.org/changeset/base/300037
Log:
MFC r298736,298737: ensure that initial local apic id is sane on AMD 10h systems
Modified:
stable/9/sys/amd64/amd64/initcpu.c
Directory Properties:
stable/9/sys/ (props changed)
Modified: stable/9/sys/amd64/amd64/initcpu.c
==============================================================================
--- stable/9/sys/amd64/amd64/initcpu.c Tue May 17 08:33:40 2016 (r300036)
+++ stable/9/sys/amd64/amd64/initcpu.c Tue May 17 08:36:12 2016 (r300037)
@@ -84,6 +84,7 @@ SYSCTL_UINT(_hw, OID_AUTO, via_feature_x
static void
init_amd(void)
{
+ uint64_t msr;
/*
* Work around Erratum 721 for Family 10h and 12h processors.
@@ -106,6 +107,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);
+ }
+ }
}
/*
More information about the svn-src-stable-9
mailing list