]> err.no Git - linux-2.6/commitdiff
KVM: SVM: align shadow CR4.MCE with host
authorJoerg Roedel <joerg.roedel@amd.com>
Wed, 9 Apr 2008 12:15:29 +0000 (14:15 +0200)
committerAvi Kivity <avi@qumranet.com>
Sun, 27 Apr 2008 09:01:18 +0000 (12:01 +0300)
This patch aligns the host version of the CR4.MCE bit with the CR4 active in
the guest. This is necessary to get MCE exceptions when the guest is running.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
arch/x86/kvm/svm.c

index d7439ceb2ac2c9a77367aeadc7fe2c1f751dc854..8af463b91526cb48f190b25b1bf6ba6a4a9e62c1 100644 (file)
@@ -878,9 +878,12 @@ set:
 
 static void svm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
 {
+       unsigned long host_cr4_mce = read_cr4() & X86_CR4_MCE;
+
        vcpu->arch.cr4 = cr4;
        if (!npt_enabled)
                cr4 |= X86_CR4_PAE;
+       cr4 |= host_cr4_mce;
        to_svm(vcpu)->vmcb->save.cr4 = cr4;
 }