Commit 95f93af4 authored by Paolo Bonzini's avatar Paolo Bonzini Committed by Gleb Natapov

KVM: mmu: unify destroy_kvm_mmu with kvm_mmu_unload

They do the same thing, and destroy_kvm_mmu can be confused with
kvm_mmu_destroy.
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
parent d8d173da
...@@ -3861,18 +3861,11 @@ static int init_kvm_mmu(struct kvm_vcpu *vcpu) ...@@ -3861,18 +3861,11 @@ static int init_kvm_mmu(struct kvm_vcpu *vcpu)
return init_kvm_softmmu(vcpu); return init_kvm_softmmu(vcpu);
} }
static void destroy_kvm_mmu(struct kvm_vcpu *vcpu) int kvm_mmu_reset_context(struct kvm_vcpu *vcpu)
{ {
ASSERT(vcpu); ASSERT(vcpu);
if (VALID_PAGE(vcpu->arch.mmu.root_hpa)) {
mmu_free_roots(vcpu);
WARN_ON(VALID_PAGE(vcpu->arch.mmu.root_hpa));
}
}
int kvm_mmu_reset_context(struct kvm_vcpu *vcpu) kvm_mmu_unload(vcpu);
{
destroy_kvm_mmu(vcpu);
return init_kvm_mmu(vcpu); return init_kvm_mmu(vcpu);
} }
EXPORT_SYMBOL_GPL(kvm_mmu_reset_context); EXPORT_SYMBOL_GPL(kvm_mmu_reset_context);
...@@ -3898,6 +3891,7 @@ EXPORT_SYMBOL_GPL(kvm_mmu_load); ...@@ -3898,6 +3891,7 @@ EXPORT_SYMBOL_GPL(kvm_mmu_load);
void kvm_mmu_unload(struct kvm_vcpu *vcpu) void kvm_mmu_unload(struct kvm_vcpu *vcpu)
{ {
mmu_free_roots(vcpu); mmu_free_roots(vcpu);
WARN_ON(VALID_PAGE(vcpu->arch.mmu.root_hpa));
} }
EXPORT_SYMBOL_GPL(kvm_mmu_unload); EXPORT_SYMBOL_GPL(kvm_mmu_unload);
...@@ -4548,7 +4542,7 @@ void kvm_mmu_destroy(struct kvm_vcpu *vcpu) ...@@ -4548,7 +4542,7 @@ void kvm_mmu_destroy(struct kvm_vcpu *vcpu)
{ {
ASSERT(vcpu); ASSERT(vcpu);
destroy_kvm_mmu(vcpu); kvm_mmu_unload(vcpu);
free_mmu_pages(vcpu); free_mmu_pages(vcpu);
mmu_free_memory_caches(vcpu); mmu_free_memory_caches(vcpu);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment