diff options
-rw-r--r-- | arch/x86/kvm/vmx.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 70bdcf946f95..e14c96e574ff 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -8206,6 +8206,18 @@ static void nested_ept_uninit_mmu_context(struct kvm_vcpu *vcpu) | |||
8206 | vcpu->arch.walk_mmu = &vcpu->arch.mmu; | 8206 | vcpu->arch.walk_mmu = &vcpu->arch.mmu; |
8207 | } | 8207 | } |
8208 | 8208 | ||
8209 | static bool nested_vmx_is_page_fault_vmexit(struct vmcs12 *vmcs12, | ||
8210 | u16 error_code) | ||
8211 | { | ||
8212 | bool inequality, bit; | ||
8213 | |||
8214 | bit = (vmcs12->exception_bitmap & (1u << PF_VECTOR)) != 0; | ||
8215 | inequality = | ||
8216 | (error_code & vmcs12->page_fault_error_code_mask) != | ||
8217 | vmcs12->page_fault_error_code_match; | ||
8218 | return inequality ^ bit; | ||
8219 | } | ||
8220 | |||
8209 | static void vmx_inject_page_fault_nested(struct kvm_vcpu *vcpu, | 8221 | static void vmx_inject_page_fault_nested(struct kvm_vcpu *vcpu, |
8210 | struct x86_exception *fault) | 8222 | struct x86_exception *fault) |
8211 | { | 8223 | { |
@@ -8213,8 +8225,7 @@ static void vmx_inject_page_fault_nested(struct kvm_vcpu *vcpu, | |||
8213 | 8225 | ||
8214 | WARN_ON(!is_guest_mode(vcpu)); | 8226 | WARN_ON(!is_guest_mode(vcpu)); |
8215 | 8227 | ||
8216 | /* TODO: also check PFEC_MATCH/MASK, not just EB.PF. */ | 8228 | if (nested_vmx_is_page_fault_vmexit(vmcs12, fault->error_code)) |
8217 | if (vmcs12->exception_bitmap & (1u << PF_VECTOR)) | ||
8218 | nested_vmx_vmexit(vcpu, to_vmx(vcpu)->exit_reason, | 8229 | nested_vmx_vmexit(vcpu, to_vmx(vcpu)->exit_reason, |
8219 | vmcs_read32(VM_EXIT_INTR_INFO), | 8230 | vmcs_read32(VM_EXIT_INTR_INFO), |
8220 | vmcs_readl(EXIT_QUALIFICATION)); | 8231 | vmcs_readl(EXIT_QUALIFICATION)); |