aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>2012-10-16 08:10:59 -0400
committerMarcelo Tosatti <mtosatti@redhat.com>2012-10-29 18:31:04 -0400
commit81c52c56e2b43589091ee29038bcf793d3f184ab (patch)
tree763236629eb034e519db87d8568946883499a155 /arch/x86/kvm
parent19bf7f8ac3f8131100027281c495dbbe00cd5ae0 (diff)
KVM: do not treat noslot pfn as a error pfn
This patch filters noslot pfn out from error pfns based on Marcelo comment: noslot pfn is not a error pfn After this patch, - is_noslot_pfn indicates that the gfn is not in slot - is_error_pfn indicates that the gfn is in slot but the error is occurred when translate the gfn to pfn - is_error_noslot_pfn indicates that the pfn either it is error pfns or it is noslot pfn And is_invalid_pfn can be removed, it makes the code more clean Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/mmu.c4
-rw-r--r--arch/x86/kvm/paging_tmpl.h2
-rw-r--r--arch/x86/kvm/x86.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index aabb1289ff04..b875a9ed9b8e 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2699,7 +2699,7 @@ static void transparent_hugepage_adjust(struct kvm_vcpu *vcpu,
2699 * PT_PAGE_TABLE_LEVEL and there would be no adjustment done 2699 * PT_PAGE_TABLE_LEVEL and there would be no adjustment done
2700 * here. 2700 * here.
2701 */ 2701 */
2702 if (!is_error_pfn(pfn) && !kvm_is_mmio_pfn(pfn) && 2702 if (!is_error_noslot_pfn(pfn) && !kvm_is_mmio_pfn(pfn) &&
2703 level == PT_PAGE_TABLE_LEVEL && 2703 level == PT_PAGE_TABLE_LEVEL &&
2704 PageTransCompound(pfn_to_page(pfn)) && 2704 PageTransCompound(pfn_to_page(pfn)) &&
2705 !has_wrprotected_page(vcpu->kvm, gfn, PT_DIRECTORY_LEVEL)) { 2705 !has_wrprotected_page(vcpu->kvm, gfn, PT_DIRECTORY_LEVEL)) {
@@ -2733,7 +2733,7 @@ static bool handle_abnormal_pfn(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn,
2733 bool ret = true; 2733 bool ret = true;
2734 2734
2735 /* The pfn is invalid, report the error! */ 2735 /* The pfn is invalid, report the error! */
2736 if (unlikely(is_invalid_pfn(pfn))) { 2736 if (unlikely(is_error_pfn(pfn))) {
2737 *ret_val = kvm_handle_bad_page(vcpu, gfn, pfn); 2737 *ret_val = kvm_handle_bad_page(vcpu, gfn, pfn);
2738 goto exit; 2738 goto exit;
2739 } 2739 }
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index d17decaf1db9..891eb6d93b8b 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -323,7 +323,7 @@ FNAME(prefetch_gpte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
323 protect_clean_gpte(&pte_access, gpte); 323 protect_clean_gpte(&pte_access, gpte);
324 pfn = pte_prefetch_gfn_to_pfn(vcpu, gfn, 324 pfn = pte_prefetch_gfn_to_pfn(vcpu, gfn,
325 no_dirty_log && (pte_access & ACC_WRITE_MASK)); 325 no_dirty_log && (pte_access & ACC_WRITE_MASK));
326 if (is_invalid_pfn(pfn)) 326 if (is_error_pfn(pfn))
327 return false; 327 return false;
328 328
329 /* 329 /*
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 6e5f069bee30..49fa1f0e59bd 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4504,7 +4504,7 @@ static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t gva)
4504 * instruction -> ... 4504 * instruction -> ...
4505 */ 4505 */
4506 pfn = gfn_to_pfn(vcpu->kvm, gpa_to_gfn(gpa)); 4506 pfn = gfn_to_pfn(vcpu->kvm, gpa_to_gfn(gpa));
4507 if (!is_error_pfn(pfn)) { 4507 if (!is_error_noslot_pfn(pfn)) {
4508 kvm_release_pfn_clean(pfn); 4508 kvm_release_pfn_clean(pfn);
4509 return true; 4509 return true;
4510 } 4510 }