diff options
author | kib <kib@FreeBSD.org> | 2012-08-07 08:36:10 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2012-08-07 08:36:10 +0000 |
commit | 1187e5b624e0b9654c2c266a43ac9367aefe2577 (patch) | |
tree | e7205cd97271e7299e270bd91588759dc93146e7 | |
parent | 1f3be6fa900a1d5743869baa3e94975ea7702945 (diff) | |
download | FreeBSD-src-1187e5b624e0b9654c2c266a43ac9367aefe2577.zip FreeBSD-src-1187e5b624e0b9654c2c266a43ac9367aefe2577.tar.gz |
Do not apply errata 721 workaround when under hypervisor, since
typical hypervisor does not implement access to the required MSR,
causing #GP on boot.
Reported and tested by: olgeni
PR: amd64/170388
MFC after: 3 days
-rw-r--r-- | sys/amd64/amd64/initcpu.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/amd64/amd64/initcpu.c b/sys/amd64/amd64/initcpu.c index 3890551..dbeaec6 100644 --- a/sys/amd64/amd64/initcpu.c +++ b/sys/amd64/amd64/initcpu.c @@ -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; } } |