[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250226214853.3267057-4-sebastianene@google.com>
Date: Wed, 26 Feb 2025 21:48:53 +0000
From: Sebastian Ene <sebastianene@...gle.com>
To: catalin.marinas@....com, joey.gouly@....com, maz@...nel.org,
oliver.upton@...ux.dev, sebastianene@...gle.com, snehalreddy@...gle.com,
sudeep.holla@....com, suzuki.poulose@....com, vdonnefort@...gle.com,
will@...nel.org, yuzenghui@...wei.com
Cc: kvmarm@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, kernel-team@...roid.com,
Andrei Homescu <ahomescu@...gle.com>
Subject: [PATCH 3/3] KVM: arm64: Release the ownership of the hyp rx buffer to Trustzone
Introduce the release FF-A call to notify Trustzone that the hypervisor
has finished copying the data from the buffer shared with Trustzone to
the non-secure partition.
Reported-by: Andrei Homescu <ahomescu@...gle.com>
Signed-off-by: Sebastian Ene <sebastianene@...gle.com>
---
arch/arm64/kvm/hyp/nvhe/ffa.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c
index 861f24de97cb..7da0203f1ee9 100644
--- a/arch/arm64/kvm/hyp/nvhe/ffa.c
+++ b/arch/arm64/kvm/hyp/nvhe/ffa.c
@@ -725,6 +725,7 @@ static void do_ffa_part_get(struct arm_smccc_res *res,
DECLARE_REG(u32, uuid3, ctxt, 4);
DECLARE_REG(u32, flags, ctxt, 5);
u32 count, partition_sz, copy_sz;
+ struct arm_smccc_res _res;
hyp_spin_lock(&host_buffers.lock);
if (!host_buffers.rx) {
@@ -741,7 +742,7 @@ static void do_ffa_part_get(struct arm_smccc_res *res,
count = res->a2;
if (!count)
- goto out_unlock;
+ goto release_rx;
if (hyp_ffa_version > FFA_VERSION_1_0) {
/* Get the number of partitions deployed in the system */
@@ -757,10 +758,12 @@ static void do_ffa_part_get(struct arm_smccc_res *res,
copy_sz = partition_sz * count;
if (copy_sz > KVM_FFA_MBOX_NR_PAGES * PAGE_SIZE) {
ffa_to_smccc_res(res, FFA_RET_ABORTED);
- goto out_unlock;
+ goto release_rx;
}
memcpy(host_buffers.rx, hyp_buffers.rx, copy_sz);
+release_rx:
+ ffa_rx_release(&_res);
out_unlock:
hyp_spin_unlock(&host_buffers.lock);
}
--
2.48.1.658.g4767266eb4-goog
Powered by blists - more mailing lists