Revert "ANDROID: KVM: arm64: Reclaim vm state pages in teardown memcache"

This reverts commit 4fc088eb4d.

Bug: 233587962
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: Ib501d33a02db97c1f6baea30799f5bb2a5e199b6
This commit is contained in:
Will Deacon
2022-07-07 15:51:29 +01:00
parent 595bc3a9a9
commit 53126fcffe

View File

@@ -588,14 +588,11 @@ err:
int __pkvm_teardown_shadow(struct kvm *kvm)
{
struct kvm_hyp_memcache *mc;
struct kvm_shadow_vm *vm;
struct kvm *host_kvm;
size_t shadow_size;
int shadow_handle;
u64 pfn;
u64 nr_pages;
void *addr;
kvm = kern_hyp_va(kvm);
@@ -608,18 +605,13 @@ int __pkvm_teardown_shadow(struct kvm *kvm)
shadow_size = vm->shadow_area_size;
/* Reclaim guest pages, and page-table pages */
mc = &vm->host_kvm->arch.pkvm.teardown_mc;
reclaim_guest_pages(vm, mc);
remove_shadow_table(shadow_handle);
reclaim_guest_pages(vm, &vm->host_kvm->arch.pkvm.teardown_mc);
unpin_host_vcpus(vm);
hyp_unpin_shared_mem(vm->host_kvm, vm->host_kvm + 1);
remove_shadow_table(shadow_handle);
/* Push the metadata pages to the teardown memcache */
host_kvm = vm->host_kvm;
/* Clear the shadow memory since hyp is releasing it back to host. */
memset(vm, 0, shadow_size);
for (addr = vm; addr < ((void *)vm + shadow_size); addr += PAGE_SIZE)
push_hyp_memcache(mc, addr, hyp_virt_to_phys);
hyp_unpin_shared_mem(host_kvm, host_kvm + 1);
pfn = hyp_phys_to_pfn(__hyp_pa(vm));
nr_pages = shadow_size >> PAGE_SHIFT;