aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/svm.c3
-rw-r--r--arch/x86/kvm/vmx.c2
-rw-r--r--arch/x86/kvm/x86.h6
3 files changed, 8 insertions, 3 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 8b5ffbd55c11..ac3d5ba48d61 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1122,8 +1122,7 @@ static int pf_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
1122 if (npt_enabled) 1122 if (npt_enabled)
1123 svm_flush_tlb(&svm->vcpu); 1123 svm_flush_tlb(&svm->vcpu);
1124 else { 1124 else {
1125 if (svm->vcpu.arch.interrupt.pending || 1125 if (kvm_event_needs_reinjection(&svm->vcpu))
1126 svm->vcpu.arch.exception.pending)
1127 kvm_mmu_unprotect_page_virt(&svm->vcpu, fault_address); 1126 kvm_mmu_unprotect_page_virt(&svm->vcpu, fault_address);
1128 } 1127 }
1129 return kvm_mmu_page_fault(&svm->vcpu, fault_address, error_code); 1128 return kvm_mmu_page_fault(&svm->vcpu, fault_address, error_code);
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index f3ab27b5a6b2..8981654ad061 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2615,7 +2615,7 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
2615 cr2 = vmcs_readl(EXIT_QUALIFICATION); 2615 cr2 = vmcs_readl(EXIT_QUALIFICATION);
2616 KVMTRACE_3D(PAGE_FAULT, vcpu, error_code, (u32)cr2, 2616 KVMTRACE_3D(PAGE_FAULT, vcpu, error_code, (u32)cr2,
2617 (u32)((u64)cr2 >> 32), handler); 2617 (u32)((u64)cr2 >> 32), handler);
2618 if (vcpu->arch.interrupt.pending || vcpu->arch.exception.pending) 2618 if (kvm_event_needs_reinjection(vcpu))
2619 kvm_mmu_unprotect_page_virt(vcpu, cr2); 2619 kvm_mmu_unprotect_page_virt(vcpu, cr2);
2620 return kvm_mmu_page_fault(vcpu, cr2, error_code); 2620 return kvm_mmu_page_fault(vcpu, cr2, error_code);
2621 } 2621 }
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index 39350b252725..21203d421276 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -30,4 +30,10 @@ static inline u8 kvm_pop_irq(struct kvm_vcpu *vcpu)
30 clear_bit(word_index, &vcpu->arch.irq_summary); 30 clear_bit(word_index, &vcpu->arch.irq_summary);
31 return irq; 31 return irq;
32} 32}
33
34static inline bool kvm_event_needs_reinjection(struct kvm_vcpu *vcpu)
35{
36 return vcpu->arch.exception.pending || vcpu->arch.interrupt.pending ||
37 vcpu->arch.nmi_injected;
38}
33#endif 39#endif