Revert "ANDROID: KVM: arm64: Expose topup_hyp_memcache() to the rest of KVM"

This reverts commit c3e455cd33.

Bug: 233587962
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I1d5d4253d594b2f78ce85dffe079e00b057cd8aa
This commit is contained in:
Will Deacon
2022-07-07 15:51:16 +01:00
parent ba9f3e3f2c
commit 68cc629d41
2 changed files with 5 additions and 8 deletions

View File

@@ -124,9 +124,6 @@ static inline void __free_hyp_memcache(struct kvm_hyp_memcache *mc,
free_fn(pop_hyp_memcache(mc, to_va), arg);
}
void free_hyp_memcache(struct kvm_hyp_memcache *mc);
int topup_hyp_memcache(struct kvm_vcpu *vcpu);
struct kvm_vmid {
/* The VMID generation used for the virt. memory system */
u64 vmid_gen;

View File

@@ -820,14 +820,13 @@ void free_hyp_memcache(struct kvm_hyp_memcache *mc)
kvm_host_va, NULL);
}
int topup_hyp_memcache(struct kvm_vcpu *vcpu)
static int topup_hyp_memcache(struct kvm_hyp_memcache *mc,
unsigned long min_pages)
{
if (!is_protected_kvm_enabled())
return 0;
return __topup_hyp_memcache(&vcpu->arch.pkvm_memcache,
kvm_mmu_cache_min_pages(vcpu->kvm),
hyp_mc_alloc_fn,
return __topup_hyp_memcache(mc, min_pages, hyp_mc_alloc_fn,
kvm_host_pa, NULL);
}
@@ -1162,6 +1161,7 @@ static int pkvm_host_donate_guest(u64 pfn, u64 gfn, struct kvm_vcpu *vcpu)
static int pkvm_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
unsigned long hva)
{
struct kvm_hyp_memcache *hyp_memcache = &vcpu->arch.pkvm_memcache;
struct mm_struct *mm = current->mm;
unsigned int flags = FOLL_FORCE |
FOLL_HWPOISON |
@@ -1173,7 +1173,7 @@ static int pkvm_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
u64 pfn;
int ret;
ret = topup_hyp_memcache(vcpu);
ret = topup_hyp_memcache(hyp_memcache, kvm_mmu_cache_min_pages(kvm));
if (ret)
return -ENOMEM;