Thread (45 messages) 45 messages, 6 authors, 2022-07-29

Re: [PATCH v2 18/24] KVM: arm64: Instantiate guest stage-2 page-tables at EL2

From: Will Deacon <will@kernel.org>
Date: 2022-07-20 18:27:44
Also in: kvm, kvmarm

On Tue, Jul 19, 2022 at 02:32:18PM +0100, Vincent Donnefort wrote:
[...]
quoted
 }
 
 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.
Quite right, that should be left as-is. Will fix.

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help