linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: <linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>
Subject: Re: [PATCH v2 18/18] firmware: arm_ffa: Allow multiple UUIDs per partition to register SRI callback
Date: Wed, 12 Feb 2025 11:05:54 +0000	[thread overview]
Message-ID: <Z6yAkmNZFnQW5TBZ@bogus> (raw)
In-Reply-To: <20250131-ffa_updates-v2-18-544ba4e35387@arm.com>

On Fri, Jan 31, 2025 at 11:24:18AM +0000, Sudeep Holla wrote:
> A partition can implement multiple UUIDs and currently we successfully
> register each UUID service as a FF-A device. However when adding the
> same partition info to the XArray which tracks the SRI callbacks more
> than once, it fails.
> 
> In order to allow multiple UUIDs per partition to register SRI callbacks
> the partition information stored in the XArray needs to be extended to
> a listed list.
> 
> A function to remove the list of partition information in the XArray
> is not added as there are no users at the time. All the partitions are
> added at probe/initialisation and removed at cleanup stage.
> 
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  drivers/firmware/arm_ffa/driver.c | 157 ++++++++++++++++++++++++++++----------
>  1 file changed, 116 insertions(+), 41 deletions(-)
> 

[...]

>  static void ffa_partitions_cleanup(void)
>  {
> -	struct ffa_dev_part_info *info;
> +	struct ffa_dev_part_info *info, *tmp;
>  	unsigned long idx;
>  
>  	/* Clean up/free all registered devices */
>  	ffa_devices_unregister();
>  
>  	xa_for_each(&drv_info->partition_info, idx, info) {
> +		struct list_head *phead = (struct list_head *)idx;
> +
>  		xa_erase(&drv_info->partition_info, idx);
> -		kfree(info);
> +		list_for_each_entry_safe(info, tmp, phead, node) {
> +			list_del(&info->node);
> +			kfree(info);
> +		}
> +		kfree(phead);

Issue was discovered when testing it as module(that's when cleanup
gets executed). It is now fixed here[1] with the below patch.

Regards,
Sudeep

[1] https://git.kernel.org/sudeep.holla/l/ffa_updates

-->8

diff --git c/drivers/firmware/arm_ffa/driver.c w/drivers/firmware/arm_ffa/driver.c
index 3c49ab3fe118..c184a220147f 100644
--- c/drivers/firmware/arm_ffa/driver.c
+++ w/drivers/firmware/arm_ffa/driver.c
@@ -1644,14 +1644,14 @@ static int ffa_setup_host_partition(int vm_id)
 
 static void ffa_partitions_cleanup(void)
 {
-       struct ffa_dev_part_info *info, *tmp;
+       struct list_head *phead;
        unsigned long idx;
 
        /* Clean up/free all registered devices */
        ffa_devices_unregister();
 
-       xa_for_each(&drv_info->partition_info, idx, info) {
-               struct list_head *phead = (struct list_head *)idx;
+       xa_for_each(&drv_info->partition_info, idx, phead) {
+               struct ffa_dev_part_info *info, *tmp;
 
                xa_erase(&drv_info->partition_info, idx);
                list_for_each_entry_safe(info, tmp, phead, node) {



  reply	other threads:[~2025-02-12 11:10 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-31 11:24 [PATCH v2 00/18] firmware: arm_ffa: Framework notification support + other updates and fixes Sudeep Holla
2025-01-31 11:24 ` [PATCH v2 01/18] firmware: arm_ffa: Replace SCMI by FF-A in the macro Sudeep Holla
2025-01-31 11:24 ` [PATCH v2 02/18] firmware: arm_ffa: Replace UUID buffer to standard UUID format Sudeep Holla
2025-01-31 11:24 ` [PATCH v2 03/18] firmware: arm_ffa: Align sync_send_receive{,2} function prototypes Sudeep Holla
2025-01-31 11:24 ` [PATCH v2 04/18] firmware: arm_ffa: Fix big-endian support in __ffa_partition_info_get() Sudeep Holla
2025-01-31 11:24 ` [PATCH v2 05/18] firmware: arm_ffa: Fix big-endian support in __ffa_partition_info_regs_get() Sudeep Holla
2025-01-31 11:24 ` [PATCH v2 06/18] firmware: arm_ffa: Refactor addition of partition information into XArray Sudeep Holla
2025-02-14  4:50   ` Viresh Kumar
2025-02-17 14:13     ` Sudeep Holla
2025-01-31 11:24 ` [PATCH v2 07/18] firmware: arm_ffa: Handle the presence of host partition in the partition info Sudeep Holla
2025-01-31 11:24 ` [PATCH v2 08/18] firmware: arm_ffa: Unregister the FF-A devices when cleaning up the partitions Sudeep Holla
2025-01-31 11:24 ` [PATCH v2 09/18] firmware: arm_ffa: Helper to check if a partition can receive REQUEST2 messages Sudeep Holla
2025-01-31 11:24 ` [PATCH v2 10/18] firmware: arm_ffa: Add support for passing UUID in FFA_MSG_SEND2 Sudeep Holla
2025-01-31 11:24 ` [PATCH v2 11/18] firmware: arm_ffa: Upgrade FF-A version to v1.2 in the driver Sudeep Holla
2025-01-31 11:24 ` [PATCH v2 12/18] firmware: arm_ffa: Reject higher major version as incompatible Sudeep Holla
2025-01-31 11:24 ` [PATCH v2 13/18] firmware: arm_ffa: Remove unnecessary declaration of ffa_partitions_cleanup() Sudeep Holla
2025-01-31 11:24 ` [PATCH v2 14/18] firmware: arm_ffa: Refactoring to prepare for framework notification support Sudeep Holla
2025-01-31 11:24 ` [PATCH v2 15/18] firmware: arm_ffa: Stash ffa_device instead of notify_type in notifier_cb_info Sudeep Holla
2025-01-31 11:24 ` [PATCH v2 16/18] firmware: arm_ffa: Add support for {un,}registration of framework notifications Sudeep Holla
2025-01-31 11:24 ` [PATCH v2 17/18] firmware: arm_ffa: Add support for handling " Sudeep Holla
2025-02-10 10:17   ` Viresh Kumar
2025-02-12 10:57     ` Sudeep Holla
2025-01-31 11:24 ` [PATCH v2 18/18] firmware: arm_ffa: Allow multiple UUIDs per partition to register SRI callback Sudeep Holla
2025-02-12 11:05   ` Sudeep Holla [this message]
2025-02-14 11:36 ` [PATCH v2 00/18] firmware: arm_ffa: Framework notification support + other updates and fixes Viresh Kumar
2025-02-17 14:14   ` 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=Z6yAkmNZFnQW5TBZ@bogus \
    --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;
as well as URLs for NNTP newsgroup(s).