Revert "ANDROID: KVM: arm64: pkvm: Move memcache topup into a helper"

This reverts commit 339858e146.

Bug: 233587962
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I2bf7a17e413b212bc18f0a8ab688f968753a1e74
This commit is contained in:
Will Deacon
2022-07-07 15:51:21 +01:00
parent 781c407382
commit 94d5ecddf9

View File

@@ -39,16 +39,6 @@ static void handle_pvm_entry_wfx(struct kvm_vcpu *host_vcpu, struct kvm_vcpu *sh
shadow_vcpu->arch.flags |= host_vcpu->arch.flags & KVM_ARM64_INCREMENT_PC;
}
static int pkvm_refill_memcache(struct kvm_vcpu *shadow_vcpu,
struct kvm_vcpu *host_vcpu)
{
u64 nr_pages;
nr_pages = VTCR_EL2_LVLS(shadow_vcpu->arch.pkvm.shadow_vm->arch.vtcr) - 1;
return refill_memcache(&shadow_vcpu->arch.pkvm_memcache, nr_pages,
&host_vcpu->arch.pkvm_memcache);
}
static void handle_pvm_entry_psci(struct kvm_vcpu *host_vcpu, struct kvm_vcpu *shadow_vcpu)
{
u32 psci_fn = smccc_get_function(shadow_vcpu);
@@ -611,6 +601,7 @@ static void handle___pkvm_host_donate_guest(struct kvm_cpu_context *host_ctxt)
DECLARE_REG(struct kvm_vcpu *, vcpu, host_ctxt, 3);
struct pkvm_loaded_state *state;
int ret = -EINVAL;
u64 nr_pages;
if (!is_protected_kvm_enabled())
goto out;
@@ -621,7 +612,9 @@ static void handle___pkvm_host_donate_guest(struct kvm_cpu_context *host_ctxt)
goto out;
/* Topup shadow memcache with the host's */
ret = pkvm_refill_memcache(state->vcpu, vcpu);
nr_pages = VTCR_EL2_LVLS(state->vcpu->arch.pkvm.shadow_vm->arch.vtcr) - 1;
ret = refill_memcache(&state->vcpu->arch.pkvm_memcache, nr_pages,
&vcpu->arch.pkvm_memcache);
if (!ret)
ret = __pkvm_host_donate_guest(pfn, gfn, state->vcpu);
out: