KVM: x86: Avoid guest page table walk when gpa_available is set
When a guest causes a page fault which requires emulation, the vcpu->arch.gpa_available flag is set to indicate that cr2 contains a valid GPA. Currently, emulator_read_write_onepage() makes use of gpa_available flag to avoid a guest page walk for a known MMIO regions. Lets not limit the gpa_available optimization to just MMIO region. The patch extends the check to avoid page walk whenever gpa_available flag is set. Signed-off-by:Brijesh Singh <brijesh.singh@amd.com> [Fix EPT=0 according to Wanpeng Li's fix, plus ensure VMX also uses the new code. - Paolo] Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Reviewed-by:
David Hildenbrand <david@redhat.com> [Moved "ret < 0" to the else brach, as per David's review. - Radim] Signed-off-by:
Radim Krčmář <rkrcmar@redhat.com>
Showing
- arch/x86/include/asm/kvm_host.h 2 additions, 1 deletionarch/x86/include/asm/kvm_host.h
- arch/x86/kvm/mmu.c 6 additions, 0 deletionsarch/x86/kvm/mmu.c
- arch/x86/kvm/svm.c 0 additions, 2 deletionsarch/x86/kvm/svm.c
- arch/x86/kvm/vmx.c 0 additions, 4 deletionsarch/x86/kvm/vmx.c
- arch/x86/kvm/x86.c 9 additions, 15 deletionsarch/x86/kvm/x86.c
Please register or sign in to comment