[...] > } > > void reclaim_guest_pages(struct kvm_shadow_vm *vm) > { > - unsigned long nr_pages; > + unsigned long nr_pages, pfn; > > nr_pages = kvm_pgtable_stage2_pgd_size(vm->kvm.arch.vtcr) >> PAGE_SHIFT; > - WARN_ON(__pkvm_hyp_donate_host(hyp_virt_to_pfn(vm->pgt.pgd), nr_pages)); > + pfn = hyp_virt_to_pfn(vm->pgt.pgd); > + > + guest_lock_component(vm); > + kvm_pgtable_stage2_destroy(&vm->pgt); > + vm->kvm.arch.mmu.pgd_phys = 0ULL; > + guest_unlock_component(vm); > + > + WARN_ON(__pkvm_hyp_donate_host(pfn, nr_pages)); > } The pfn introduction being removed in a subsequent patch, this is probably unecessary noise.