]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
KVM: MMU: Use different shadows when EFER.NXE changes
authorAvi Kivity <avi@redhat.com>
Mon, 3 Aug 2009 17:57:54 +0000 (14:57 -0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 9 Sep 2009 03:33:31 +0000 (20:33 -0700)
(cherry picked from commit 9645bb56b31a1b70ab9e470387b5264cafc04aa9)

A pte that is shadowed when the guest EFER.NXE=1 is not valid when
EFER.NXE=0; if bit 63 is set, the pte should cause a fault, and since the
shadow EFER always has NX enabled, this won't happen.

Fix by using a different shadow page table for different EFER.NXE bits.  This
allows vcpus to run correctly with different values of EFER.NXE, and for
transitions on this bit to be handled correctly without requiring a full
flush.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/x86.c

index a9471db9b6926aba5f7313e45927f473484f1c0a..9a9efb031c82a075b3630cd1bd57998a2b4fb9f6 100644 (file)
@@ -185,6 +185,7 @@ union kvm_mmu_page_role {
                unsigned access:3;
                unsigned invalid:1;
                unsigned cr4_pge:1;
+               unsigned nxe:1;
        };
 };
 
index b3c4b0be441445e6224792d9261e92a26a6957ec..bbacdce35c4d51bd068375528c5acf4cecc5a61f 100644 (file)
@@ -523,6 +523,9 @@ static void set_efer(struct kvm_vcpu *vcpu, u64 efer)
        efer |= vcpu->arch.shadow_efer & EFER_LMA;
 
        vcpu->arch.shadow_efer = efer;
+
+       vcpu->arch.mmu.base_role.nxe = (efer & EFER_NX) && !tdp_enabled;
+       kvm_mmu_reset_context(vcpu);
 }
 
 void kvm_enable_efer_bits(u64 mask)