From 14f9711eccb41d8530726ecfeb43d500cd666103 Mon Sep 17 00:00:00 2001 From: Vincent Donnefort Date: Wed, 16 Aug 2023 17:26:14 +0100 Subject: [PATCH] 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 --- arch/arm64/kvm/handle_exit.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c index d628269947e0..47fe2269f4be 100644 --- a/arch/arm64/kvm/handle_exit.c +++ b/arch/arm64/kvm/handle_exit.c @@ -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;