ANDROID: KVM: arm64: Handle pKVM map HYP_REQ in the host

Now we have a way of mapping an entire range of memory for a guest
stage-2, let's handle the HYP_REQ_MAP requests.

Bug: 357781595
Bug: 243642516
Change-Id: Ia321a0675330739368c0c229fb82794dbc6a0b40
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
This commit is contained in:
Vincent Donnefort
2023-08-16 17:26:14 +01:00
parent a10ad1c2c4
commit 14f9711ecc
+9
View File
@@ -386,6 +386,12 @@ static int handle_hyp_req_mem(struct kvm_vcpu *vcpu,
return -EINVAL;
}
static int handle_hyp_req_map(struct kvm_vcpu *vcpu,
struct kvm_hyp_req *req)
{
return pkvm_mem_abort_range(vcpu, req->map.guest_ipa, req->map.size);
}
static int handle_hyp_req(struct kvm_vcpu *vcpu)
{
struct kvm_hyp_req *hyp_req = vcpu->arch.hyp_reqs;
@@ -399,6 +405,9 @@ static int handle_hyp_req(struct kvm_vcpu *vcpu)
case KVM_HYP_REQ_TYPE_MEM:
ret = handle_hyp_req_mem(vcpu, hyp_req);
break;
case KVM_HYP_REQ_TYPE_MAP:
ret = handle_hyp_req_map(vcpu, hyp_req);
break;
default:
pr_warn("Unknown kvm_hyp_req type: %d\n", hyp_req->type);
ret = -EINVAL;