| From 3d1bbe519609a18914363c561cdbc3f27d88a923 Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Fri, 21 Mar 2025 11:57:00 +0000 |
| Subject: firmware: arm_ffa: Skip Rx buffer ownership release if not acquired |
| MIME-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| From: Sudeep Holla <sudeep.holla@arm.com> |
| |
| [ Upstream commit 4567bdaaaaa1744da3d7da07d9aca2f941f5b4e5 ] |
| |
| Completion of the FFA_PARTITION_INFO_GET ABI transfers the ownership of |
| the caller’s Rx buffer from the producer(typically partition mnager) to |
| the consumer(this driver/OS). FFA_RX_RELEASE transfers the ownership |
| from the consumer back to the producer. |
| |
| However, when we set the flag to just return the count of partitions |
| deployed in the system corresponding to the specified UUID while |
| invoking FFA_PARTITION_INFO_GET, the Rx buffer ownership shouldn't be |
| transferred to this driver. We must be able to skip transferring back |
| the ownership to the partition manager when we request just to get the |
| count of the partitions as the buffers are not acquired in this case. |
| |
| Firmware may return FFA_RET_DENIED or other error for the ffa_rx_release() |
| in such cases. |
| |
| Fixes: bb1be7498500 ("firmware: arm_ffa: Add v1.1 get_partition_info support") |
| Message-Id: <20250321115700.3525197-1-sudeep.holla@arm.com> |
| Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| drivers/firmware/arm_ffa/driver.c | 3 ++- |
| 1 file changed, 2 insertions(+), 1 deletion(-) |
| |
| diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c |
| index e9f86b7573012..e1e278d431e97 100644 |
| --- a/drivers/firmware/arm_ffa/driver.c |
| +++ b/drivers/firmware/arm_ffa/driver.c |
| @@ -306,7 +306,8 @@ __ffa_partition_info_get(u32 uuid0, u32 uuid1, u32 uuid2, u32 uuid3, |
| memcpy(buffer + idx, drv_info->rx_buffer + idx * sz, |
| buf_sz); |
| |
| - ffa_rx_release(); |
| + if (!(flags & PARTITION_INFO_GET_RETURN_COUNT_ONLY)) |
| + ffa_rx_release(); |
| |
| mutex_unlock(&drv_info->rx_lock); |
| |
| -- |
| 2.39.5 |
| |