Skip to content

Commit ce2b602

Browse files
Ricardo Kolleroupton
authored andcommitted
KVM: arm64: Add kvm_uninit_stage2_mmu()
Add kvm_uninit_stage2_mmu() and move kvm_free_stage2_pgd() into it. A future commit will add some more things to do inside of kvm_uninit_stage2_mmu(). Signed-off-by: Ricardo Koller <ricarkol@google.com> Reviewed-by: Shaoqin Huang <shahuang@redhat.com> Reviewed-by: Gavin Shan <gshan@redhat.com> Link: https://lore.kernel.org/r/20230426172330.1439644-9-ricarkol@google.com Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
1 parent 6bd92b9 commit ce2b602

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

arch/arm64/include/asm/kvm_mmu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ void __init free_hyp_pgds(void);
172172

173173
void stage2_unmap_vm(struct kvm *kvm);
174174
int kvm_init_stage2_mmu(struct kvm *kvm, struct kvm_s2_mmu *mmu, unsigned long type);
175+
void kvm_uninit_stage2_mmu(struct kvm *kvm);
175176
void kvm_free_stage2_pgd(struct kvm_s2_mmu *mmu);
176177
int kvm_phys_addr_ioremap(struct kvm *kvm, phys_addr_t guest_ipa,
177178
phys_addr_t pa, unsigned long size, bool writable);

arch/arm64/kvm/mmu.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,11 @@ int kvm_init_stage2_mmu(struct kvm *kvm, struct kvm_s2_mmu *mmu, unsigned long t
790790
return err;
791791
}
792792

793+
void kvm_uninit_stage2_mmu(struct kvm *kvm)
794+
{
795+
kvm_free_stage2_pgd(&kvm->arch.mmu);
796+
}
797+
793798
static void stage2_unmap_memslot(struct kvm *kvm,
794799
struct kvm_memory_slot *memslot)
795800
{
@@ -1893,7 +1898,7 @@ void kvm_arch_memslots_updated(struct kvm *kvm, u64 gen)
18931898

18941899
void kvm_arch_flush_shadow_all(struct kvm *kvm)
18951900
{
1896-
kvm_free_stage2_pgd(&kvm->arch.mmu);
1901+
kvm_uninit_stage2_mmu(kvm);
18971902
}
18981903

18991904
void kvm_arch_flush_shadow_memslot(struct kvm *kvm,

0 commit comments

Comments
 (0)