]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
x86, cpu, amd: Fix WC+ workaround for older virtual hosts
authorBorislav Petkov <bp@suse.de>
Tue, 19 Feb 2013 18:33:12 +0000 (19:33 +0100)
committerH. Peter Anvin <hpa@linux.intel.com>
Tue, 19 Feb 2013 18:44:00 +0000 (10:44 -0800)
The WC+ workaround for F10h introduces a new MSR and kvm host #GPs
on accesses to unknown MSRs if paravirt is not compiled in. Use the
exception-handling MSR accessors so as not to break 3.8 and later guests
booting on older hosts.

Remove a redundant family check while at it.

Cc: Gleb Natapov <gleb@redhat.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: http://lkml.kernel.org/r/1361298793-31834-1-git-send-email-bp@alien8.de
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
arch/x86/kernel/cpu/amd.c

index 721ef3208eb56e1f1e2b8598dc05830d5b17111b..163af4a91d09f7cc0c24825219450caa09972f43 100644 (file)
@@ -723,12 +723,14 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
                 * performance degradation for certain nested-paging guests.
                 * Prevent this conversion by clearing bit 24 in
                 * MSR_AMD64_BU_CFG2.
+                *
+                * NOTE: we want to use the _safe accessors so as not to #GP kvm
+                * guests on older kvm hosts.
                 */
-               if (c->x86 == 0x10) {
-                       rdmsrl(MSR_AMD64_BU_CFG2, value);
-                       value &= ~(1ULL << 24);
-                       wrmsrl(MSR_AMD64_BU_CFG2, value);
-               }
+
+               rdmsrl_safe(MSR_AMD64_BU_CFG2, &value);
+               value &= ~(1ULL << 24);
+               wrmsrl_safe(MSR_AMD64_BU_CFG2, value);
        }
 
        rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy);