Skip to content

Commit 3c258bf

Browse files
committed
firmware: arm_ffa: Stash the partition properties for query purposes
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/[email protected] Signed-off-by: Sudeep Holla <[email protected]>
1 parent 0370fb1 commit 3c258bf

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

drivers/firmware/arm_ffa/driver.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,6 +1228,8 @@ static int ffa_setup_partitions(void)
12281228
continue;
12291229
}
12301230

1231+
ffa_dev->properties = tpbuf->properties;
1232+
12311233
if (drv_info->version > FFA_VERSION_1_0 &&
12321234
!(tpbuf->properties & FFA_PARTITION_AARCH64_EXEC))
12331235
ffa_mode_32bit_set(ffa_dev);

include/linux/arm_ffa.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@
126126
/* FFA Bus/Device/Driver related */
127127
struct ffa_device {
128128
u32 id;
129+
u32 properties;
129130
int vm_id;
130131
bool mode_32bit;
131132
uuid_t uuid;
@@ -221,12 +222,29 @@ struct ffa_partition_info {
221222
#define FFA_PARTITION_DIRECT_SEND BIT(1)
222223
/* partition can send and receive indirect messages. */
223224
#define FFA_PARTITION_INDIRECT_MSG BIT(2)
225+
/* partition can receive notifications */
226+
#define FFA_PARTITION_NOTIFICATION_RECV BIT(3)
224227
/* partition runs in the AArch64 execution state. */
225228
#define FFA_PARTITION_AARCH64_EXEC BIT(8)
226229
u32 properties;
227230
u32 uuid[4];
228231
};
229232

233+
static inline
234+
bool ffa_partition_check_property(struct ffa_device *dev, u32 property)
235+
{
236+
return dev->properties & property;
237+
}
238+
239+
#define ffa_partition_supports_notify_recv(dev) \
240+
ffa_partition_check_property(dev, FFA_PARTITION_NOTIFICATION_RECV)
241+
242+
#define ffa_partition_supports_indirect_msg(dev) \
243+
ffa_partition_check_property(dev, FFA_PARTITION_INDIRECT_MSG)
244+
245+
#define ffa_partition_supports_direct_recv(dev) \
246+
ffa_partition_check_property(dev, FFA_PARTITION_DIRECT_RECV)
247+
230248
/* For use with FFA_MSG_SEND_DIRECT_{REQ,RESP} which pass data via registers */
231249
struct ffa_send_direct_data {
232250
unsigned long data0; /* w3/x3 */

0 commit comments

Comments
 (0)