diff options
author | Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> | 2010-11-12 01:49:11 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-01-12 04:29:13 -0500 |
commit | 060c2abe6c5e0f90418baf0a43b48d8d9a5521fb (patch) | |
tree | 5e7ac2a9f7d41c2eda10dc2180d8e2bb79aa98cf | |
parent | e5f3f027960128035a5fa176877b5e9160b35397 (diff) |
KVM: MMU: support apf for nonpaing guest
Let's support apf for nonpaing guest
Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | arch/x86/kvm/mmu.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index df465f6d7d8f..db0fd555a5a2 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -2286,7 +2286,11 @@ static int kvm_handle_bad_page(struct kvm *kvm, gfn_t gfn, pfn_t pfn) | |||
2286 | return 1; | 2286 | return 1; |
2287 | } | 2287 | } |
2288 | 2288 | ||
2289 | static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, int write, gfn_t gfn) | 2289 | static bool try_async_pf(struct kvm_vcpu *vcpu, bool no_apf, gfn_t gfn, |
2290 | gva_t gva, pfn_t *pfn, bool write, bool *writable); | ||
2291 | |||
2292 | static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, int write, gfn_t gfn, | ||
2293 | bool no_apf) | ||
2290 | { | 2294 | { |
2291 | int r; | 2295 | int r; |
2292 | int level; | 2296 | int level; |
@@ -2307,7 +2311,9 @@ static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, int write, gfn_t gfn) | |||
2307 | 2311 | ||
2308 | mmu_seq = vcpu->kvm->mmu_notifier_seq; | 2312 | mmu_seq = vcpu->kvm->mmu_notifier_seq; |
2309 | smp_rmb(); | 2313 | smp_rmb(); |
2310 | pfn = gfn_to_pfn_prot(vcpu->kvm, gfn, write, &map_writable); | 2314 | |
2315 | if (try_async_pf(vcpu, no_apf, gfn, v, &pfn, write, &map_writable)) | ||
2316 | return 0; | ||
2311 | 2317 | ||
2312 | /* mmio */ | 2318 | /* mmio */ |
2313 | if (is_error_pfn(pfn)) | 2319 | if (is_error_pfn(pfn)) |
@@ -2595,7 +2601,7 @@ static int nonpaging_page_fault(struct kvm_vcpu *vcpu, gva_t gva, | |||
2595 | gfn = gva >> PAGE_SHIFT; | 2601 | gfn = gva >> PAGE_SHIFT; |
2596 | 2602 | ||
2597 | return nonpaging_map(vcpu, gva & PAGE_MASK, | 2603 | return nonpaging_map(vcpu, gva & PAGE_MASK, |
2598 | error_code & PFERR_WRITE_MASK, gfn); | 2604 | error_code & PFERR_WRITE_MASK, gfn, no_apf); |
2599 | } | 2605 | } |
2600 | 2606 | ||
2601 | static int kvm_arch_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn) | 2607 | static int kvm_arch_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn) |