mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
Revert "ANDROID: KVM: arm64: move kvm_shadow_destroy to pkvm.c for symmetry with create_el2_shadow"
This reverts commit aaf5614200.
Bug: 233587962
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: If565eea895d34a27d2633d707c5faa17d66e6382
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
int kvm_arm_vm_ioctl_pkvm(struct kvm *kvm, struct kvm_enable_cap *cap);
|
||||
int kvm_init_pvm(struct kvm *kvm, unsigned long type);
|
||||
int create_el2_shadow(struct kvm *kvm);
|
||||
void kvm_shadow_destroy(struct kvm *kvm);
|
||||
|
||||
/*
|
||||
* Definitions for features to be allowed or restricted for guest virtual
|
||||
|
||||
@@ -195,6 +195,31 @@ vm_fault_t kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
|
||||
return VM_FAULT_SIGBUS;
|
||||
}
|
||||
|
||||
void free_hyp_memcache(struct kvm_hyp_memcache *mc);
|
||||
static void kvm_shadow_destroy(struct kvm *kvm)
|
||||
{
|
||||
struct kvm_pinned_page *ppage, *tmp;
|
||||
struct mm_struct *mm = current->mm;
|
||||
struct list_head *ppages;
|
||||
|
||||
if (kvm->arch.pkvm.shadow_handle)
|
||||
WARN_ON(kvm_call_hyp_nvhe(__pkvm_teardown_shadow, kvm));
|
||||
|
||||
free_hyp_memcache(&kvm->arch.pkvm.teardown_mc);
|
||||
|
||||
ppages = &kvm->arch.pkvm.pinned_pages;
|
||||
list_for_each_entry_safe(ppage, tmp, ppages, link) {
|
||||
WARN_ON(kvm_call_hyp_nvhe(__pkvm_host_reclaim_page,
|
||||
page_to_pfn(ppage->page)));
|
||||
cond_resched();
|
||||
|
||||
account_locked_vm(mm, 1, false);
|
||||
unpin_user_pages_dirty_lock(&ppage->page, 1, true);
|
||||
list_del(&ppage->link);
|
||||
kfree(ppage);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* kvm_arch_destroy_vm - destroy the VM data structure
|
||||
* @kvm: pointer to the KVM struct
|
||||
|
||||
@@ -196,30 +196,6 @@ int create_el2_shadow(struct kvm *kvm)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void kvm_shadow_destroy(struct kvm *kvm)
|
||||
{
|
||||
struct kvm_pinned_page *ppage, *tmp;
|
||||
struct mm_struct *mm = current->mm;
|
||||
struct list_head *ppages;
|
||||
|
||||
if (kvm->arch.pkvm.shadow_handle)
|
||||
WARN_ON(kvm_call_hyp_nvhe(__pkvm_teardown_shadow, kvm));
|
||||
|
||||
free_hyp_memcache(&kvm->arch.pkvm.teardown_mc);
|
||||
|
||||
ppages = &kvm->arch.pkvm.pinned_pages;
|
||||
list_for_each_entry_safe(ppage, tmp, ppages, link) {
|
||||
WARN_ON(kvm_call_hyp_nvhe(__pkvm_host_reclaim_page,
|
||||
page_to_pfn(ppage->page)));
|
||||
cond_resched();
|
||||
|
||||
account_locked_vm(mm, 1, false);
|
||||
unpin_user_pages_dirty_lock(&ppage->page, 1, true);
|
||||
list_del(&ppage->link);
|
||||
kfree(ppage);
|
||||
}
|
||||
}
|
||||
|
||||
static int __init pkvm_firmware_rmem_err(struct reserved_mem *rmem,
|
||||
const char *reason)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user