Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4806acd authored by Xiao Guangrong's avatar Xiao Guangrong Committed by Avi Kivity
Browse files

KVM: MMU: fix apf prefault if nested guest is enabled



If apf is generated in L2 guest and is completed in L1 guest, it will
prefault this apf in L1 guest's mmu context.

Signed-off-by: default avatarXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent 060c2abe
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -600,6 +600,7 @@ struct kvm_x86_ops {
struct kvm_arch_async_pf {
	u32 token;
	gfn_t gfn;
	bool direct_map;
};

extern struct kvm_x86_ops *kvm_x86_ops;
+1 −0
Original line number Diff line number Diff line
@@ -2609,6 +2609,7 @@ static int kvm_arch_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn)
	struct kvm_arch_async_pf arch;
	arch.token = (vcpu->arch.apf.id++ << 12) | vcpu->vcpu_id;
	arch.gfn = gfn;
	arch.direct_map = vcpu->arch.mmu.direct_map;

	return kvm_setup_async_pf(vcpu, gva, gfn, &arch);
}
+2 −1
Original line number Diff line number Diff line
@@ -6168,7 +6168,8 @@ void kvm_arch_async_page_ready(struct kvm_vcpu *vcpu, struct kvm_async_pf *work)
{
	int r;

	if (!vcpu->arch.mmu.direct_map || is_error_page(work->page))
	if (!vcpu->arch.mmu.direct_map || !work->arch.direct_map ||
	      is_error_page(work->page))
		return;

	r = kvm_mmu_reload(vcpu);