firmware: arm_ffa: Stash the partition properties for query purposes
authorSudeep Holla <sudeep.holla@arm.com>
Wed, 17 Apr 2024 09:09:21 +0000 (10:09 +0100)
committerSudeep Holla <sudeep.holla@arm.com>
Thu, 18 Apr 2024 17:29:49 +0000 (18:29 +0100)
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.

Link: https://lore.kernel.org/r/20240417090921.2866447-1-sudeep.holla@arm.com
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_ffa/driver.c
include/linux/arm_ffa.h

index b64e8ee64bc2d0b099f80e23b81a99908221926b..99a23dd3d189c70b360526078d14edfcdd34cba2 100644 (file)
@@ -1228,6 +1228,8 @@ static int ffa_setup_partitions(void)
                        continue;
                }
 
+               ffa_dev->properties = tpbuf->properties;
+
                if (drv_info->version > FFA_VERSION_1_0 &&
                    !(tpbuf->properties & FFA_PARTITION_AARCH64_EXEC))
                        ffa_mode_32bit_set(ffa_dev);
index c906f666ff5d22007d1732bb0706d891ded27551..94a49612ecec2d235cf25486b9aff57d64e0ebaa 100644 (file)
 /* FFA Bus/Device/Driver related */
 struct ffa_device {
        u32 id;
+       u32 properties;
        int vm_id;
        bool mode_32bit;
        uuid_t uuid;
@@ -221,12 +222,29 @@ struct ffa_partition_info {
 #define FFA_PARTITION_DIRECT_SEND      BIT(1)
 /* partition can send and receive indirect messages. */
 #define FFA_PARTITION_INDIRECT_MSG     BIT(2)
+/* partition can receive notifications */
+#define FFA_PARTITION_NOTIFICATION_RECV        BIT(3)
 /* partition runs in the AArch64 execution state. */
 #define FFA_PARTITION_AARCH64_EXEC     BIT(8)
        u32 properties;
        u32 uuid[4];
 };
 
+static inline
+bool ffa_partition_check_property(struct ffa_device *dev, u32 property)
+{
+       return dev->properties & property;
+}
+
+#define ffa_partition_supports_notify_recv(dev)        \
+       ffa_partition_check_property(dev, FFA_PARTITION_NOTIFICATION_RECV)
+
+#define ffa_partition_supports_indirect_msg(dev)       \
+       ffa_partition_check_property(dev, FFA_PARTITION_INDIRECT_MSG)
+
+#define ffa_partition_supports_direct_recv(dev)        \
+       ffa_partition_check_property(dev, FFA_PARTITION_DIRECT_RECV)
+
 /* For use with FFA_MSG_SEND_DIRECT_{REQ,RESP} which pass data via registers */
 struct ffa_send_direct_data {
        unsigned long data0; /* w3/x3 */