svn commit: r300036 - stable/10/sys/amd64/amd64

Andriy Gapon avg at FreeBSD.org
Tue May 17 08:33:42 UTC 2016


Author: avg
Date: Tue May 17 08:33:40 2016
New Revision: 300036
URL: https://svnweb.freebsd.org/changeset/base/300036

Log:
  MFC r298736: ensure that initial local apic id is sane on AMD 10h systems

Modified:
  stable/10/sys/amd64/amd64/initcpu.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/amd64/initcpu.c
==============================================================================
--- stable/10/sys/amd64/amd64/initcpu.c	Tue May 17 08:31:54 2016	(r300035)
+++ stable/10/sys/amd64/amd64/initcpu.c	Tue May 17 08:33:40 2016	(r300036)
@@ -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);
+		}
+	}
 }
 
 /*


More information about the svn-src-all mailing list