Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Aug 2012 05:36:10 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r239560 - stable/9/sys/amd64/amd64
Message-ID:  <201208220536.q7M5aAQM073963@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Wed Aug 22 05:36:10 2012
New Revision: 239560
URL: http://svn.freebsd.org/changeset/base/239560

Log:
  MFC r239125:
  Do not apply errata 721 workaround when under hypervisor, since
  typical hypervisor does not implement access to the required MSR,
  causing #GP on boot.

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	Wed Aug 22 05:30:51 2012	(r239559)
+++ stable/9/sys/amd64/amd64/initcpu.c	Wed Aug 22 05:36:10 2012	(r239560)
@@ -91,11 +91,17 @@ init_amd(void)
 	 *
 	 * http://support.amd.com/us/Processor_TechDocs/41322_10h_Rev_Gd.pdf
 	 * http://support.amd.com/us/Processor_TechDocs/44739_12h_Rev_Gd.pdf
+	 *
+	 * Hypervisors do not provide access to the errata MSR,
+	 * causing #GP exception on attempt to apply the errata.  The
+	 * MSR write shall be done on host and persist globally
+	 * anyway, so do not try to do it when under virtualization.
 	 */
 	switch (CPUID_TO_FAMILY(cpu_id)) {
 	case 0x10:
 	case 0x12:
-		wrmsr(0xc0011029, rdmsr(0xc0011029) | 1);
+		if ((cpu_feature2 & CPUID2_HV) == 0)
+			wrmsr(0xc0011029, rdmsr(0xc0011029) | 1);
 		break;
 	}
 }



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