mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
firmware: arm_ffa: Handle ffa_notification_get correctly at virtual FF-A instance
Currently it is assumed that the driver always calls ffa_notification_get() at the NS physical FF-A instance to request the SPMC to return pending SP or SPM Framework notifications. However, in order to support the driver invoking ffa_notification_get() at virtual FF-A instance, we need to make sure correct bits are enabled in the bitmaps enable flag. It is expected to have hypervisor framework and VM notifications bitmap to be zero at the non-secure physical FF-A instance. Message-Id: <20250217-ffa_updates-v3-19-bd1d9de615e7@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
This commit is contained in:
@@ -841,8 +841,12 @@ enum notify_type {
|
||||
#define NON_SECURE_VM_BITMAP_ENABLE BIT(NON_SECURE_VM)
|
||||
#define SPM_FRAMEWORK_BITMAP_ENABLE BIT(SPM_FRAMEWORK)
|
||||
#define NS_HYP_FRAMEWORK_BITMAP_ENABLE BIT(NS_HYP_FRAMEWORK)
|
||||
#define FFA_BITMAP_ENABLE_MASK \
|
||||
#define FFA_BITMAP_SECURE_ENABLE_MASK \
|
||||
(SECURE_PARTITION_BITMAP_ENABLE | SPM_FRAMEWORK_BITMAP_ENABLE)
|
||||
#define FFA_BITMAP_NS_ENABLE_MASK \
|
||||
(NON_SECURE_VM_BITMAP_ENABLE | NS_HYP_FRAMEWORK_BITMAP_ENABLE)
|
||||
#define FFA_BITMAP_ALL_ENABLE_MASK \
|
||||
(FFA_BITMAP_SECURE_ENABLE_MASK | FFA_BITMAP_NS_ENABLE_MASK)
|
||||
|
||||
#define FFA_SECURE_PARTITION_ID_FLAG BIT(15)
|
||||
|
||||
@@ -914,9 +918,15 @@ static int ffa_notification_get(u32 flags, struct ffa_notify_bitmaps *notify)
|
||||
else if (ret.a0 != FFA_SUCCESS)
|
||||
return -EINVAL; /* Something else went wrong. */
|
||||
|
||||
notify->sp_map = PACK_NOTIFICATION_BITMAP(ret.a2, ret.a3);
|
||||
notify->vm_map = PACK_NOTIFICATION_BITMAP(ret.a4, ret.a5);
|
||||
notify->arch_map = PACK_NOTIFICATION_BITMAP(ret.a6, ret.a7);
|
||||
if (flags & SECURE_PARTITION_BITMAP_ENABLE)
|
||||
notify->sp_map = PACK_NOTIFICATION_BITMAP(ret.a2, ret.a3);
|
||||
if (flags & NON_SECURE_VM_BITMAP_ENABLE)
|
||||
notify->vm_map = PACK_NOTIFICATION_BITMAP(ret.a4, ret.a5);
|
||||
if (flags & SPM_FRAMEWORK_BITMAP_ENABLE)
|
||||
notify->arch_map = SPM_FRAMEWORK_BITMAP(ret.a6);
|
||||
if (flags & NS_HYP_FRAMEWORK_BITMAP_ENABLE)
|
||||
notify->arch_map = PACK_NOTIFICATION_BITMAP(notify->arch_map,
|
||||
ret.a7);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1444,12 +1454,19 @@ static void handle_fwk_notif_callbacks(u32 bitmap)
|
||||
kfree(buf);
|
||||
}
|
||||
|
||||
static void notif_get_and_handle(void *unused)
|
||||
static void notif_get_and_handle(void *cb_data)
|
||||
{
|
||||
int rc;
|
||||
struct ffa_notify_bitmaps bitmaps;
|
||||
u32 flags;
|
||||
struct ffa_drv_info *info = cb_data;
|
||||
struct ffa_notify_bitmaps bitmaps = { 0 };
|
||||
|
||||
rc = ffa_notification_get(FFA_BITMAP_ENABLE_MASK, &bitmaps);
|
||||
if (info->vm_id == 0) /* Non secure physical instance */
|
||||
flags = FFA_BITMAP_SECURE_ENABLE_MASK;
|
||||
else
|
||||
flags = FFA_BITMAP_ALL_ENABLE_MASK;
|
||||
|
||||
rc = ffa_notification_get(flags, &bitmaps);
|
||||
if (rc) {
|
||||
pr_err("Failed to retrieve notifications with %d!\n", rc);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user