Author: avg
Date: Mon Aug 15 09:04:31 2016
New Revision: 304131
URL: https://svnweb.freebsd.org/changeset/base/304131

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

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 Mon Aug 15 09:04:13 2016        
(r304130)
+++ stable/10/sys/amd64/amd64/initcpu.c Mon Aug 15 09:04:31 2016        
(r304131)
@@ -125,6 +125,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);
+               }
+       }
 }
 
 /*
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to