diff mbox series

[1/4] firmware: arm_ffa: Stash the partition properties for query purposes

Message ID 20240415-ffa_msg2_support-v1-1-a28c964b1b3f@arm.com (mailing list archive)
State New, archived
Headers show
Series firmware: arm_ffa: Support for MSG_SEND2 and minor harderning checks | expand

Commit Message

Sudeep Holla April 15, 2024, 4:05 p.m. UTC
The properies obtained from the partition information descriptor as
part of initial partitions discovery is useful as it contain info
if the partition
- Runs in AArch64 or AArch32 execution state
- Can send and/or receive direct requests
- Can send and receive indirect message
- Does support receipt of notifications.

These can be used for querying before attempting to do any of the
above operations.

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

Patch

diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
index 9bc2e10381af..d258d04c1eda 100644
--- a/drivers/firmware/arm_ffa/driver.c
+++ b/drivers/firmware/arm_ffa/driver.c
@@ -721,6 +721,7 @@  static int ffa_notification_get(u32 flags, struct ffa_notify_bitmaps *notify)
 }
 
 struct ffa_dev_part_info {
+	u32 properties;
 	ffa_sched_recv_cb callback;
 	void *cb_data;
 	rwlock_t rw_lock;
@@ -863,6 +864,17 @@  static void ffa_mode_32bit_set(struct ffa_device *dev)
 	dev->mode_32bit = true;
 }
 
+static bool ffa_partition_check_property(struct ffa_device *dev, u32 property)
+{
+	struct ffa_dev_part_info *partition;
+
+	partition = xa_load(&drv_info->partition_info, dev->vm_id);
+	if (!partition)
+		return false;
+
+	return partition->properties & property;
+}
+
 static int ffa_sync_send_receive(struct ffa_device *dev,
 				 struct ffa_send_direct_data *data)
 {
@@ -1236,6 +1248,8 @@  static int ffa_setup_partitions(void)
 			ffa_device_unregister(ffa_dev);
 			continue;
 		}
+
+		info->properties = tpbuf->properties;
 		rwlock_init(&info->rw_lock);
 		ret = xa_insert(&drv_info->partition_info, tpbuf->id,
 				info, GFP_KERNEL);