KVM: x86/mmu: Reconstruct shadow page root if the guest PDPTEs is changed
[linux-2.6-microblaze.git] / arch / x86 / kvm / x86.c
index 074a057..9ddad94 100644 (file)
@@ -841,6 +841,13 @@ int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3)
                }
        }
 
+       /*
+        * Marking VCPU_EXREG_PDPTR dirty doesn't work for !tdp_enabled.
+        * Shadow page roots need to be reconstructed instead.
+        */
+       if (!tdp_enabled && memcmp(mmu->pdptrs, pdpte, sizeof(mmu->pdptrs)))
+               kvm_mmu_free_roots(vcpu, mmu, KVM_MMU_ROOT_CURRENT);
+
        memcpy(mmu->pdptrs, pdpte, sizeof(mmu->pdptrs));
        kvm_register_mark_dirty(vcpu, VCPU_EXREG_PDPTR);
        kvm_make_request(KVM_REQ_LOAD_MMU_PGD, vcpu);