From: Sudeep Holla <sudeep.holla@arm.com>
To: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Sudeep Holla <sudeep.holla@arm.com>,
Viresh Kumar <viresh.kumar@linaro.org>
Subject: [PATCH v3 15/19] firmware: arm_ffa: Stash ffa_device instead of notify_type in notifier_cb_info
Date: Mon, 17 Feb 2025 15:38:56 +0000 [thread overview]
Message-ID: <20250217-ffa_updates-v3-15-bd1d9de615e7@arm.com> (raw)
In-Reply-To: <20250217-ffa_updates-v3-0-bd1d9de615e7@arm.com>
Currently, we store the type of the notification in the notifier_cb_info
structure that is put into the hast list to identify if the notification
block is for the secure partition or the non secure VM.
In order to support framework notifications to reuse the hash list and
to avoid creating one for each time, we need store the ffa_device pointer
itself as the same notification ID in framework notifications can be
registered by multiple FF-A devices.
Tested-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
drivers/firmware/arm_ffa/driver.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
index 0abbf08bc8d39c701947366bdf9c8fac8e64cf64..5863272f45d9c075d8e86d45a90ac6b1fb743c98 100644
--- a/drivers/firmware/arm_ffa/driver.c
+++ b/drivers/firmware/arm_ffa/driver.c
@@ -1116,9 +1116,9 @@ static int ffa_memory_lend(struct ffa_mem_ops_args *args)
struct notifier_cb_info {
struct hlist_node hnode;
+ struct ffa_device *dev;
ffa_notifier_cb cb;
void *cb_data;
- enum notify_type type;
};
static int ffa_sched_recv_cb_update(u16 part_id, ffa_sched_recv_cb callback,
@@ -1187,17 +1187,18 @@ notifier_hash_node_get(u16 notify_id, enum notify_type type)
struct notifier_cb_info *node;
hash_for_each_possible(drv_info->notifier_hash, node, hnode, notify_id)
- if (type == node->type)
+ if (type == ffa_notify_type_get(node->dev->vm_id))
return node;
return NULL;
}
static int
-update_notifier_cb(int notify_id, enum notify_type type, ffa_notifier_cb cb,
+update_notifier_cb(struct ffa_device *dev, int notify_id, ffa_notifier_cb cb,
void *cb_data, bool is_registration)
{
struct notifier_cb_info *cb_info = NULL;
+ enum notify_type type = ffa_notify_type_get(dev->vm_id);
bool cb_found;
cb_info = notifier_hash_node_get(notify_id, type);
@@ -1211,7 +1212,7 @@ update_notifier_cb(int notify_id, enum notify_type type, ffa_notifier_cb cb,
if (!cb_info)
return -ENOMEM;
- cb_info->type = type;
+ cb_info->dev = dev;
cb_info->cb = cb;
cb_info->cb_data = cb_data;
@@ -1226,7 +1227,6 @@ update_notifier_cb(int notify_id, enum notify_type type, ffa_notifier_cb cb,
static int ffa_notify_relinquish(struct ffa_device *dev, int notify_id)
{
int rc;
- enum notify_type type = ffa_notify_type_get(dev->vm_id);
if (ffa_notifications_disabled())
return -EOPNOTSUPP;
@@ -1236,7 +1236,7 @@ static int ffa_notify_relinquish(struct ffa_device *dev, int notify_id)
mutex_lock(&drv_info->notify_lock);
- rc = update_notifier_cb(notify_id, type, NULL, NULL, false);
+ rc = update_notifier_cb(dev, notify_id, NULL, NULL, false);
if (rc) {
pr_err("Could not unregister notification callback\n");
mutex_unlock(&drv_info->notify_lock);
@@ -1255,7 +1255,6 @@ static int ffa_notify_request(struct ffa_device *dev, bool is_per_vcpu,
{
int rc;
u32 flags = 0;
- enum notify_type type = ffa_notify_type_get(dev->vm_id);
if (ffa_notifications_disabled())
return -EOPNOTSUPP;
@@ -1274,7 +1273,7 @@ static int ffa_notify_request(struct ffa_device *dev, bool is_per_vcpu,
return rc;
}
- rc = update_notifier_cb(notify_id, type, cb, cb_data, true);
+ rc = update_notifier_cb(dev, notify_id, cb, cb_data, true);
if (rc) {
pr_err("Failed to register callback for %d - %d\n",
notify_id, rc);
--
2.34.1
next prev parent reply other threads:[~2025-02-17 15:39 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-17 15:38 [PATCH v3 00/19] firmware: arm_ffa: Framework notification support + other updates and fixes Sudeep Holla
2025-02-17 15:38 ` [PATCH v3 01/19] firmware: arm_ffa: Replace SCMI by FF-A in the macro Sudeep Holla
2025-02-17 15:38 ` [PATCH v3 02/19] firmware: arm_ffa: Replace UUID buffer to standard UUID format Sudeep Holla
2025-02-17 15:38 ` [PATCH v3 03/19] firmware: arm_ffa: Align sync_send_receive{,2} function prototypes Sudeep Holla
2025-02-17 15:38 ` [PATCH v3 04/19] firmware: arm_ffa: Fix big-endian support in __ffa_partition_info_get() Sudeep Holla
2025-02-17 15:38 ` [PATCH v3 05/19] firmware: arm_ffa: Fix big-endian support in __ffa_partition_info_regs_get() Sudeep Holla
2025-02-17 15:38 ` [PATCH v3 06/19] firmware: arm_ffa: Refactor addition of partition information into XArray Sudeep Holla
2025-02-17 15:38 ` [PATCH v3 07/19] firmware: arm_ffa: Handle the presence of host partition in the partition info Sudeep Holla
2025-02-17 15:38 ` [PATCH v3 08/19] firmware: arm_ffa: Unregister the FF-A devices when cleaning up the partitions Sudeep Holla
2025-02-17 15:38 ` [PATCH v3 09/19] firmware: arm_ffa: Helper to check if a partition can receive REQUEST2 messages Sudeep Holla
2025-02-17 15:38 ` [PATCH v3 10/19] firmware: arm_ffa: Add support for passing UUID in FFA_MSG_SEND2 Sudeep Holla
2025-02-17 15:38 ` [PATCH v3 11/19] firmware: arm_ffa: Upgrade FF-A version to v1.2 in the driver Sudeep Holla
2025-02-17 15:38 ` [PATCH v3 12/19] firmware: arm_ffa: Reject higher major version as incompatible Sudeep Holla
2025-02-17 15:38 ` [PATCH v3 13/19] firmware: arm_ffa: Remove unnecessary declaration of ffa_partitions_cleanup() Sudeep Holla
2025-02-17 15:38 ` [PATCH v3 14/19] firmware: arm_ffa: Refactoring to prepare for framework notification support Sudeep Holla
2025-02-17 15:38 ` Sudeep Holla [this message]
2025-02-17 15:38 ` [PATCH v3 16/19] firmware: arm_ffa: Add support for {un,}registration of framework notifications Sudeep Holla
2025-02-17 15:38 ` [PATCH v3 17/19] firmware: arm_ffa: Add support for handling " Sudeep Holla
2025-02-17 15:38 ` [PATCH v3 18/19] firmware: arm_ffa: Allow multiple UUIDs per partition to register SRI callback Sudeep Holla
2025-02-17 15:39 ` [PATCH v3 19/19] firmware: arm_ffa: Handle ffa_notification_get correctly at virtual FF-A instance Sudeep Holla
2025-02-21 11:41 ` [PATCH v3 00/19] firmware: arm_ffa: Framework notification support + other updates and fixes Sudeep Holla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250217-ffa_updates-v3-15-bd1d9de615e7@arm.com \
--to=sudeep.holla@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox