[PATCH] firmware: arm_ffa: remove vm_id argument in ffa_rxtx_unmap()

Yeoreum Yun posted 1 patch 1 month, 1 week ago
drivers/firmware/arm_ffa/driver.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
[PATCH] firmware: arm_ffa: remove vm_id argument in ffa_rxtx_unmap()
Posted by Yeoreum Yun 1 month, 1 week ago
According to the FF-A specification [0], section 13.7 (FFA_RXTX_UNMAP),
w1 must be zero when called from a guest:

  - w1: ID of the VM that allocated the RX/TX buffer. Only valid
        in the Non-secure physical FF-A instance. MBZ otherwise.

The w1 field is only meaningful when FFA_RXTX_UNMAP is invoked
from the hypervisor.

In the case of a Non-secure physical partition, the partition ID
is always 0. In the case of a VM, w1 must also be zero. Therefore,
there is no need to pass a vm_id (partition id) to ffa_rxtx_unmap();
doing so would result in FFA_INVALID_PARAMETER when vm_id > 0.

To address this, remove the vm_id argument from ffa_rxtx_unmap().

Fixes: 3bbfe9871005 ("firmware: arm_ffa: Add initial Arm FFA driver support")
Link: https://developer.arm.com/documentation/den0077/latest [0]
Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
---
 drivers/firmware/arm_ffa/driver.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
index 12a625387d6e..f2f94d4d533e 100644
--- a/drivers/firmware/arm_ffa/driver.c
+++ b/drivers/firmware/arm_ffa/driver.c
@@ -205,12 +205,12 @@ static int ffa_rxtx_map(phys_addr_t tx_buf, phys_addr_t rx_buf, u32 pg_cnt)
 	return 0;
 }

-static int ffa_rxtx_unmap(u16 vm_id)
+static int ffa_rxtx_unmap(void)
 {
 	ffa_value_t ret;

 	invoke_ffa_fn((ffa_value_t){
-		      .a0 = FFA_RXTX_UNMAP, .a1 = PACK_TARGET_INFO(vm_id, 0),
+		      .a0 = FFA_RXTX_UNMAP,
 		      }, &ret);

 	if (ret.a0 == FFA_ERROR)
@@ -2097,7 +2097,7 @@ static int __init ffa_init(void)

 	pr_err("failed to setup partitions\n");
 	ffa_notifications_cleanup();
-	ffa_rxtx_unmap(drv_info->vm_id);
+	ffa_rxtx_unmap();
 free_pages:
 	if (drv_info->tx_buffer)
 		free_pages_exact(drv_info->tx_buffer, rxtx_bufsz);
@@ -2112,7 +2112,7 @@ static void __exit ffa_exit(void)
 {
 	ffa_notifications_cleanup();
 	ffa_partitions_cleanup();
-	ffa_rxtx_unmap(drv_info->vm_id);
+	ffa_rxtx_unmap();
 	free_pages_exact(drv_info->tx_buffer, drv_info->rxtx_bufsz);
 	free_pages_exact(drv_info->rx_buffer, drv_info->rxtx_bufsz);
 	kfree(drv_info);
--
LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}
Re: [PATCH] firmware: arm_ffa: remove vm_id argument in ffa_rxtx_unmap()
Posted by Sudeep Holla 1 month ago
On Wed, 04 Mar 2026 12:09:53 +0000, Yeoreum Yun wrote:
> According to the FF-A specification [0], section 13.7 (FFA_RXTX_UNMAP),
> w1 must be zero when called from a guest:
> 
>   - w1: ID of the VM that allocated the RX/TX buffer. Only valid
>         in the Non-secure physical FF-A instance. MBZ otherwise.
> 
> The w1 field is only meaningful when FFA_RXTX_UNMAP is invoked
> from the hypervisor.
> 
> [...]

Applied to sudeep.holla/linux (for-next/ffa/updates), thanks!
(wih some rewording of commit message)

[1/1] firmware: arm_ffa: remove vm_id argument in ffa_rxtx_unmap()
      https://git.kernel.org/sudeep.holla/c/a4e8473b7751

--
Regards,
Sudeep