aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2013-10-02 10:56:10 -0400
committerGleb Natapov <gleb@redhat.com>2013-10-03 08:43:56 -0400
commit206260941fd4b6f25f28ecf4e267b2f9a0ba72d7 (patch)
tree951e3e7767bd5c5ef9ec811813f2e80de45a0385 /arch/x86
parent4344ee981e21990f8ea14d3c9e3890b9b7b06279 (diff)
KVM: mmu: remove uninteresting MMU "free" callbacks
The free MMU callback has been a wrapper for mmu_free_roots since mmu_free_roots itself was introduced (commit 17ac10a, [PATCH] KVM: MU: Special treatment for shadow pae root pages, 2007-01-05), and has always been the same for all MMU cases. Remove the indirection as it is useless. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/include/asm/kvm_host.h1
-rw-r--r--arch/x86/kvm/mmu.c22
2 files changed, 4 insertions, 19 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 52110d0ceb13..671c6f0bea51 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -261,7 +261,6 @@ struct kvm_mmu {
261 bool prefault); 261 bool prefault);
262 void (*inject_page_fault)(struct kvm_vcpu *vcpu, 262 void (*inject_page_fault)(struct kvm_vcpu *vcpu,
263 struct x86_exception *fault); 263 struct x86_exception *fault);
264 void (*free)(struct kvm_vcpu *vcpu);
265 gpa_t (*gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t gva, u32 access, 264 gpa_t (*gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t gva, u32 access,
266 struct x86_exception *exception); 265 struct x86_exception *exception);
267 gpa_t (*translate_gpa)(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access); 266 gpa_t (*translate_gpa)(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access);
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index cf95cfe050a6..1c4d580ba347 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -3424,18 +3424,12 @@ out_unlock:
3424 return 0; 3424 return 0;
3425} 3425}
3426 3426
3427static void nonpaging_free(struct kvm_vcpu *vcpu)
3428{
3429 mmu_free_roots(vcpu);
3430}
3431
3432static int nonpaging_init_context(struct kvm_vcpu *vcpu, 3427static int nonpaging_init_context(struct kvm_vcpu *vcpu,
3433 struct kvm_mmu *context) 3428 struct kvm_mmu *context)
3434{ 3429{
3435 context->new_cr3 = nonpaging_new_cr3; 3430 context->new_cr3 = nonpaging_new_cr3;
3436 context->page_fault = nonpaging_page_fault; 3431 context->page_fault = nonpaging_page_fault;
3437 context->gva_to_gpa = nonpaging_gva_to_gpa; 3432 context->gva_to_gpa = nonpaging_gva_to_gpa;
3438 context->free = nonpaging_free;
3439 context->sync_page = nonpaging_sync_page; 3433 context->sync_page = nonpaging_sync_page;
3440 context->invlpg = nonpaging_invlpg; 3434 context->invlpg = nonpaging_invlpg;
3441 context->update_pte = nonpaging_update_pte; 3435 context->update_pte = nonpaging_update_pte;
@@ -3471,11 +3465,6 @@ static void inject_page_fault(struct kvm_vcpu *vcpu,
3471 vcpu->arch.mmu.inject_page_fault(vcpu, fault); 3465 vcpu->arch.mmu.inject_page_fault(vcpu, fault);
3472} 3466}
3473 3467
3474static void paging_free(struct kvm_vcpu *vcpu)
3475{
3476 nonpaging_free(vcpu);
3477}
3478
3479static bool sync_mmio_spte(struct kvm *kvm, u64 *sptep, gfn_t gfn, 3468static bool sync_mmio_spte(struct kvm *kvm, u64 *sptep, gfn_t gfn,
3480 unsigned access, int *nr_present) 3469 unsigned access, int *nr_present)
3481{ 3470{
@@ -3683,7 +3672,6 @@ static int paging64_init_context_common(struct kvm_vcpu *vcpu,
3683 context->sync_page = paging64_sync_page; 3672 context->sync_page = paging64_sync_page;
3684 context->invlpg = paging64_invlpg; 3673 context->invlpg = paging64_invlpg;
3685 context->update_pte = paging64_update_pte; 3674 context->update_pte = paging64_update_pte;
3686 context->free = paging_free;
3687 context->shadow_root_level = level; 3675 context->shadow_root_level = level;
3688 context->root_hpa = INVALID_PAGE; 3676 context->root_hpa = INVALID_PAGE;
3689 context->direct_map = false; 3677 context->direct_map = false;
@@ -3709,7 +3697,6 @@ static int paging32_init_context(struct kvm_vcpu *vcpu,
3709 context->new_cr3 = paging_new_cr3; 3697 context->new_cr3 = paging_new_cr3;
3710 context->page_fault = paging32_page_fault; 3698 context->page_fault = paging32_page_fault;
3711 context->gva_to_gpa = paging32_gva_to_gpa; 3699 context->gva_to_gpa = paging32_gva_to_gpa;
3712 context->free = paging_free;
3713 context->sync_page = paging32_sync_page; 3700 context->sync_page = paging32_sync_page;
3714 context->invlpg = paging32_invlpg; 3701 context->invlpg = paging32_invlpg;
3715 context->update_pte = paging32_update_pte; 3702 context->update_pte = paging32_update_pte;
@@ -3732,7 +3719,6 @@ static int init_kvm_tdp_mmu(struct kvm_vcpu *vcpu)
3732 context->base_role.word = 0; 3719 context->base_role.word = 0;
3733 context->new_cr3 = nonpaging_new_cr3; 3720 context->new_cr3 = nonpaging_new_cr3;
3734 context->page_fault = tdp_page_fault; 3721 context->page_fault = tdp_page_fault;
3735 context->free = nonpaging_free;
3736 context->sync_page = nonpaging_sync_page; 3722 context->sync_page = nonpaging_sync_page;
3737 context->invlpg = nonpaging_invlpg; 3723 context->invlpg = nonpaging_invlpg;
3738 context->update_pte = nonpaging_update_pte; 3724 context->update_pte = nonpaging_update_pte;
@@ -3812,7 +3798,6 @@ int kvm_init_shadow_ept_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *context,
3812 context->sync_page = ept_sync_page; 3798 context->sync_page = ept_sync_page;
3813 context->invlpg = ept_invlpg; 3799 context->invlpg = ept_invlpg;
3814 context->update_pte = ept_update_pte; 3800 context->update_pte = ept_update_pte;
3815 context->free = paging_free;
3816 context->root_level = context->shadow_root_level; 3801 context->root_level = context->shadow_root_level;
3817 context->root_hpa = INVALID_PAGE; 3802 context->root_hpa = INVALID_PAGE;
3818 context->direct_map = false; 3803 context->direct_map = false;
@@ -3890,9 +3875,10 @@ static int init_kvm_mmu(struct kvm_vcpu *vcpu)
3890static void destroy_kvm_mmu(struct kvm_vcpu *vcpu) 3875static void destroy_kvm_mmu(struct kvm_vcpu *vcpu)
3891{ 3876{
3892 ASSERT(vcpu); 3877 ASSERT(vcpu);
3893 if (VALID_PAGE(vcpu->arch.mmu.root_hpa)) 3878 if (VALID_PAGE(vcpu->arch.mmu.root_hpa)) {
3894 /* mmu.free() should set root_hpa = INVALID_PAGE */ 3879 mmu_free_roots(vcpu);
3895 vcpu->arch.mmu.free(vcpu); 3880 WARN_ON(VALID_PAGE(vcpu->arch.mmu.root_hpa));
3881 }
3896} 3882}
3897 3883
3898int kvm_mmu_reset_context(struct kvm_vcpu *vcpu) 3884int kvm_mmu_reset_context(struct kvm_vcpu *vcpu)