]> git.itanic.dy.fi Git - linux-stable/commitdiff
firmware: arm_ffa: Set up 32bit execution mode flag using partiion property
authorSudeep Holla <sudeep.holla@arm.com>
Wed, 7 Sep 2022 14:52:39 +0000 (15:52 +0100)
committerSudeep Holla <sudeep.holla@arm.com>
Thu, 8 Sep 2022 10:33:15 +0000 (11:33 +0100)
FF-A v1.1 adds a flag in the partition properties to indicate if the
partition runs in the AArch32 or AArch64 execution state. Use the same
to set-up the 32-bit execution flag mode in the ffa_dev automatically
if the detected firmware version is above v1.0 and ignore any requests
to do the same from the ffa_driver.

Link: https://lore.kernel.org/r/20220907145240.1683088-10-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 42bc22220c690a582d8fbc957380b5e4be5ddfbe..a530139083c4486fc19ca9faeb933b6f24b3b856 100644 (file)
@@ -648,11 +648,19 @@ static int ffa_partition_info_get(const char *uuid_str,
        return 0;
 }
 
-static void ffa_mode_32bit_set(struct ffa_device *dev)
+static void _ffa_mode_32bit_set(struct ffa_device *dev)
 {
        dev->mode_32bit = true;
 }
 
+static void ffa_mode_32bit_set(struct ffa_device *dev)
+{
+       if (drv_info->version > FFA_VERSION_1_0)
+               return;
+
+       _ffa_mode_32bit_set(dev);
+}
+
 static int ffa_sync_send_receive(struct ffa_device *dev,
                                 struct ffa_send_direct_data *data)
 {
@@ -744,6 +752,10 @@ static void ffa_setup_partitions(void)
                               __func__, tpbuf->id);
                        continue;
                }
+
+               if (drv_info->version > FFA_VERSION_1_0 &&
+                   !(tpbuf->properties & FFA_PARTITION_AARCH64_EXEC))
+                       _ffa_mode_32bit_set(ffa_dev);
        }
        kfree(pbuf);
 }
index 09567ffd1f491b65cca25d0549dc14276719319d..5964b610499618e7273b97ec7b390d40eab328f7 100644 (file)
@@ -106,6 +106,8 @@ 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 runs in the AArch64 execution state. */
+#define FFA_PARTITION_AARCH64_EXEC     BIT(8)
        u32 properties;
        u32 uuid[4];
 };