[PATCH 2/4] firmware: arm_ffa: Check if receiving direct requests are supported before sending

Sudeep Holla sudeep.holla at arm.com
Mon Apr 15 09:05:23 PDT 2024


Add check to see if the target partition can receive the direct requests
before sending any message to the partition.

Signed-off-by: Sudeep Holla <sudeep.holla at arm.com>
---
 drivers/firmware/arm_ffa/driver.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
index d258d04c1eda..52379885a403 100644
--- a/drivers/firmware/arm_ffa/driver.c
+++ b/drivers/firmware/arm_ffa/driver.c
@@ -875,9 +875,15 @@ static bool ffa_partition_check_property(struct ffa_device *dev, u32 property)
 	return partition->properties & property;
 }
 
+#define ffa_partition_supports_direct_recv(dev)	\
+	ffa_partition_check_property(dev, FFA_PARTITION_DIRECT_RECV)
+
 static int ffa_sync_send_receive(struct ffa_device *dev,
 				 struct ffa_send_direct_data *data)
 {
+	if (!ffa_partition_supports_direct_recv(dev))
+		return -EOPNOTSUPP;
+
 	return ffa_msg_send_direct_req(drv_info->vm_id, dev->vm_id,
 				       dev->mode_32bit, data);
 }

-- 
2.43.2




More information about the linux-arm-kernel mailing list