Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 May 2016 08:33:40 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r300036 - stable/10/sys/amd64/amd64
Message-ID:  <201605170833.u4H8XeAd056294@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
+		}
+	}
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605170833.u4H8XeAd056294>