summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2016-08-15 09:04:31 +0000
committeravg <avg@FreeBSD.org>2016-08-15 09:04:31 +0000
commit5461062c89ec72873f44569b5cb7ecfe0670a2e5 (patch)
tree1632fd90e150fe6e29c1b019242aff56ad0582af
parent8e2eec3c89d9c5e578b86b6968c4b471ce23566a (diff)
downloadFreeBSD-src-5461062c89ec72873f44569b5cb7ecfe0670a2e5.zip
FreeBSD-src-5461062c89ec72873f44569b5cb7ecfe0670a2e5.tar.gz
MFC r302835: fix-up for configuration of AMD Family 10h processors
borrowed from Linux
-rw-r--r--sys/amd64/amd64/initcpu.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/amd64/amd64/initcpu.c b/sys/amd64/amd64/initcpu.c
index 8868cd3..e20a271 100644
--- a/sys/amd64/amd64/initcpu.c
+++ b/sys/amd64/amd64/initcpu.c
@@ -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);
+ }
+ }
}
/*
OpenPOWER on IntegriCloud