Commit 0cd665bd authored by Paolo Bonzini's avatar Paolo Bonzini

KVM: x86: cleanup kvm_inject_emulated_page_fault

To reconstruct the kvm_mmu to be used for page fault injection, we
can simply use fault->nested_page_fault.  This matches how
fault->nested_page_fault is assigned in the first place by
FNAME(walk_addr_generic).
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 5efac074
...@@ -4353,12 +4353,6 @@ static unsigned long get_cr3(struct kvm_vcpu *vcpu) ...@@ -4353,12 +4353,6 @@ static unsigned long get_cr3(struct kvm_vcpu *vcpu)
return kvm_read_cr3(vcpu); return kvm_read_cr3(vcpu);
} }
static void inject_page_fault(struct kvm_vcpu *vcpu,
struct x86_exception *fault)
{
vcpu->arch.mmu->inject_page_fault(vcpu, fault);
}
static bool sync_mmio_spte(struct kvm_vcpu *vcpu, u64 *sptep, gfn_t gfn, static bool sync_mmio_spte(struct kvm_vcpu *vcpu, u64 *sptep, gfn_t gfn,
unsigned int access, int *nr_present) unsigned int access, int *nr_present)
{ {
......
...@@ -812,7 +812,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gpa_t addr, u32 error_code, ...@@ -812,7 +812,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gpa_t addr, u32 error_code,
if (!r) { if (!r) {
pgprintk("%s: guest page fault\n", __func__); pgprintk("%s: guest page fault\n", __func__);
if (!prefault) if (!prefault)
inject_page_fault(vcpu, &walker.fault); kvm_inject_emulated_page_fault(vcpu, &walker.fault);
return RET_PF_RETRY; return RET_PF_RETRY;
} }
......
...@@ -614,12 +614,12 @@ EXPORT_SYMBOL_GPL(kvm_inject_page_fault); ...@@ -614,12 +614,12 @@ EXPORT_SYMBOL_GPL(kvm_inject_page_fault);
bool kvm_inject_emulated_page_fault(struct kvm_vcpu *vcpu, bool kvm_inject_emulated_page_fault(struct kvm_vcpu *vcpu,
struct x86_exception *fault) struct x86_exception *fault)
{ {
struct kvm_mmu *fault_mmu;
WARN_ON_ONCE(fault->vector != PF_VECTOR); WARN_ON_ONCE(fault->vector != PF_VECTOR);
if (mmu_is_nested(vcpu) && !fault->nested_page_fault) fault_mmu = fault->nested_page_fault ? vcpu->arch.mmu :
vcpu->arch.nested_mmu.inject_page_fault(vcpu, fault); vcpu->arch.walk_mmu;
else fault_mmu->inject_page_fault(vcpu, fault);
vcpu->arch.mmu->inject_page_fault(vcpu, fault);
return fault->nested_page_fault; return fault->nested_page_fault;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment