mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-04 01:24:12 +08:00
KVM: Unprotect a page if #PF happens during NMI injection.
It is done for exception and interrupt already. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
51e4d5ab28
commit
3298b75c88
@ -1122,8 +1122,7 @@ static int pf_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
|
|||||||
if (npt_enabled)
|
if (npt_enabled)
|
||||||
svm_flush_tlb(&svm->vcpu);
|
svm_flush_tlb(&svm->vcpu);
|
||||||
else {
|
else {
|
||||||
if (svm->vcpu.arch.interrupt.pending ||
|
if (kvm_event_needs_reinjection(&svm->vcpu))
|
||||||
svm->vcpu.arch.exception.pending)
|
|
||||||
kvm_mmu_unprotect_page_virt(&svm->vcpu, fault_address);
|
kvm_mmu_unprotect_page_virt(&svm->vcpu, fault_address);
|
||||||
}
|
}
|
||||||
return kvm_mmu_page_fault(&svm->vcpu, fault_address, error_code);
|
return kvm_mmu_page_fault(&svm->vcpu, fault_address, error_code);
|
||||||
|
@ -2615,7 +2615,7 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
|
|||||||
cr2 = vmcs_readl(EXIT_QUALIFICATION);
|
cr2 = vmcs_readl(EXIT_QUALIFICATION);
|
||||||
KVMTRACE_3D(PAGE_FAULT, vcpu, error_code, (u32)cr2,
|
KVMTRACE_3D(PAGE_FAULT, vcpu, error_code, (u32)cr2,
|
||||||
(u32)((u64)cr2 >> 32), handler);
|
(u32)((u64)cr2 >> 32), handler);
|
||||||
if (vcpu->arch.interrupt.pending || vcpu->arch.exception.pending)
|
if (kvm_event_needs_reinjection(vcpu))
|
||||||
kvm_mmu_unprotect_page_virt(vcpu, cr2);
|
kvm_mmu_unprotect_page_virt(vcpu, cr2);
|
||||||
return kvm_mmu_page_fault(vcpu, cr2, error_code);
|
return kvm_mmu_page_fault(vcpu, cr2, error_code);
|
||||||
}
|
}
|
||||||
|
@ -30,4 +30,10 @@ static inline u8 kvm_pop_irq(struct kvm_vcpu *vcpu)
|
|||||||
clear_bit(word_index, &vcpu->arch.irq_summary);
|
clear_bit(word_index, &vcpu->arch.irq_summary);
|
||||||
return irq;
|
return irq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool kvm_event_needs_reinjection(struct kvm_vcpu *vcpu)
|
||||||
|
{
|
||||||
|
return vcpu->arch.exception.pending || vcpu->arch.interrupt.pending ||
|
||||||
|
vcpu->arch.nmi_injected;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user