ANDROID: KVM: arm64: pkvm: Share memory with non-protected guests

Instead of donating memory to non-pVMs, share the memory, which
gives us a good enough approximation of the usual behaviour.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Bug: 209580772
Change-Id: I47213754613110a6fb8157806eb96ddf92ead346
Signed-off-by: Will Deacon <willdeacon@google.com>
This commit is contained in:
Marc Zyngier
2022-01-05 18:39:37 +00:00
committed by Will Deacon
parent 4fe4fd6746
commit 3336b8073a

View File

@@ -734,8 +734,12 @@ static void handle___pkvm_host_donate_guest(struct kvm_cpu_context *host_ctxt)
/* Topup shadow memcache with the host's */
ret = pkvm_refill_memcache(state->vcpu, vcpu);
if (!ret)
ret = __pkvm_host_donate_guest(pfn, gfn, state->vcpu);
if (!ret) {
if (state->is_protected)
ret = __pkvm_host_donate_guest(pfn, gfn, state->vcpu);
else
ret = __pkvm_host_share_guest(pfn, gfn, state->vcpu);
}
out:
cpu_reg(host_ctxt, 1) = ret;
}