When tdp is enabled cr2 passed to emulator is pga not gva, so no need to
call gva_to_gpa on it.

Signed-off-by: Gleb Natapov <[email protected]>
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index fb08316..721bf0a 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3944,10 +3944,13 @@ static bool reexecute_instruction(struct kvm_vcpu 
*vcpu, gva_t gva)
        if (kvm_mmu_unprotect_page_virt(vcpu, gva))
                return true;
 
-       gpa = kvm_mmu_gva_to_gpa_system(vcpu, gva, NULL);
+       if (!tdp_enabled) {
+               gpa = kvm_mmu_gva_to_gpa_system(vcpu, gva, NULL);
 
-       if (gpa == UNMAPPED_GVA)
-               return true; /* let cpu generate fault */
+               if (gpa == UNMAPPED_GVA)
+                       return true; /* let cpu generate fault */
+       } else
+               gpa = gva;
 
        if (!kvm_is_error_hva(gfn_to_hva(vcpu->kvm, gpa >> PAGE_SHIFT)))
                return true;
--
                        Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to