summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2008-04-09 14:15:29 +0200
committerAvi Kivity <avi@qumranet.com>2008-04-27 12:01:18 +0300
commit6394b6494c0a352a2db3ea3e891ba7aeea7c1441 (patch)
tree71c4d3e7cda2adcdfd3717bc40aa4e2b89c87e53
parentec077263b2bb841d973d82342b7fbc07bbad4246 (diff)
KVM: SVM: align shadow CR4.MCE with host
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>
-rw-r--r--arch/x86/kvm/svm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index d7439ceb2ac..8af463b9152 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -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;
}