Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Aug 2016 09:04:13 +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-11@freebsd.org
Subject:   svn commit: r304130 - stable/11/sys/amd64/amd64
Message-ID:  <201608150904.u7F94DSK061120@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Mon Aug 15 09:04:13 2016
New Revision: 304130
URL: https://svnweb.freebsd.org/changeset/base/304130

Log:
  MFC r302835: fix-up for configuration of AMD Family 10h processors
  borrowed from Linux

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

Modified: stable/11/sys/amd64/amd64/initcpu.c
==============================================================================
--- stable/11/sys/amd64/amd64/initcpu.c	Mon Aug 15 09:03:05 2016	(r304129)
+++ stable/11/sys/amd64/amd64/initcpu.c	Mon Aug 15 09:04:13 2016	(r304130)
@@ -94,6 +94,20 @@ init_amd(void)
 			wrmsr(MSR_NB_CFG1, msr);
 		}
 	}
+
+	/*
+	 * BIOS may configure Family 10h processors to convert WC+ cache type
+	 * to CD.  That can hurt performance of guest VMs using nested paging.
+	 * The relevant MSR bit is not documented in the BKDG,
+	 * the fix is borrowed from Linux.
+	 */
+	if (CPUID_TO_FAMILY(cpu_id) == 0x10) {
+		if ((cpu_feature2 & CPUID2_HV) == 0) {
+			msr = rdmsr(0xc001102a);
+			msr &= ~((uint64_t)1 << 24);
+			wrmsr(0xc001102a, msr);
+		}
+	}
 }
 
 /*



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