aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>2010-11-12 01:49:55 -0500
committerAvi Kivity <avi@redhat.com>2011-01-12 04:29:14 -0500
commitc4806acdcec020fe5bbb054ce9dc75aaecaf29dd (patch)
tree0fafeeb72efdb8985165fcab0a24ffcc5071653c /arch/x86
parent060c2abe6c5e0f90418baf0a43b48d8d9a5521fb (diff)
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: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/include/asm/kvm_host.h1
-rw-r--r--arch/x86/kvm/mmu.c1
-rw-r--r--arch/x86/kvm/x86.c3
3 files changed, 4 insertions, 1 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 116dac5e01d6..f1e8d5b99f5d 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -600,6 +600,7 @@ struct kvm_x86_ops {
600struct kvm_arch_async_pf { 600struct kvm_arch_async_pf {
601 u32 token; 601 u32 token;
602 gfn_t gfn; 602 gfn_t gfn;
603 bool direct_map;
603}; 604};
604 605
605extern struct kvm_x86_ops *kvm_x86_ops; 606extern struct kvm_x86_ops *kvm_x86_ops;
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index db0fd555a5a2..ab100a7e0c49 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2609,6 +2609,7 @@ static int kvm_arch_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn)
2609 struct kvm_arch_async_pf arch; 2609 struct kvm_arch_async_pf arch;
2610 arch.token = (vcpu->arch.apf.id++ << 12) | vcpu->vcpu_id; 2610 arch.token = (vcpu->arch.apf.id++ << 12) | vcpu->vcpu_id;
2611 arch.gfn = gfn; 2611 arch.gfn = gfn;
2612 arch.direct_map = vcpu->arch.mmu.direct_map;
2612 2613
2613 return kvm_setup_async_pf(vcpu, gva, gfn, &arch); 2614 return kvm_setup_async_pf(vcpu, gva, gfn, &arch);
2614} 2615}
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 9b875ff05410..c673e726fbdb 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6168,7 +6168,8 @@ void kvm_arch_async_page_ready(struct kvm_vcpu *vcpu, struct kvm_async_pf *work)
6168{ 6168{
6169 int r; 6169 int r;
6170 6170
6171 if (!vcpu->arch.mmu.direct_map || is_error_page(work->page)) 6171 if (!vcpu->arch.mmu.direct_map || !work->arch.direct_map ||
6172 is_error_page(work->page))
6172 return; 6173 return;
6173 6174
6174 r = kvm_mmu_reload(vcpu); 6175 r = kvm_mmu_reload(vcpu);