mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: Sudeep Holla <sudeep.holla@arm.com>,
	Jens Wiklander <jens.wiklander@linaro.org>,
	Coboy Chen <coboy.chen@mediatek.com>,
	Lorenzo Pieralisi <lpieralisi@kernel.org>
Subject: [PATCH 2/4] firmware: arm_ffa: Setup the partitions after the notification initialisation
Date: Tue, 24 Oct 2023 11:56:18 +0100	[thread overview]
Message-ID: <20231024-ffa-notification-fixes-v1-2-d552c0ec260d@arm.com> (raw)
In-Reply-To: <20231024-ffa-notification-fixes-v1-0-d552c0ec260d@arm.com>

Currently the notifications are setup of the partitions are probed and
FF-A devices are added on the FF-A bus. The FF-A driver probe can be
called even before the FF-A notification setup happens which is wrong
and may result in failure or misbehaviour in the FF-A partition device
probe.

In order to ensure the FF-A notifications are setup before the FF-A
devices are probed, let us move the FF-A partition setup after the
completion of FF-A notification setup.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/firmware/arm_ffa/driver.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
index b4ba52d674e5..0ab30b571a69 100644
--- a/drivers/firmware/arm_ffa/driver.c
+++ b/drivers/firmware/arm_ffa/driver.c
@@ -1422,11 +1422,7 @@ static void ffa_notifications_setup(void)
 	hash_init(drv_info->notifier_hash);
 	mutex_init(&drv_info->notify_lock);
 
-	/* Register internal scheduling callback */
-	ret = ffa_sched_recv_cb_update(drv_info->vm_id, ffa_self_notif_handle,
-				       drv_info, true);
-	if (!ret)
-		return;
+	return;
 cleanup:
 	pr_info("Notification setup failed %d, not enabled\n", ret);
 	ffa_notifications_cleanup();
@@ -1484,12 +1480,17 @@ static int __init ffa_init(void)
 	mutex_init(&drv_info->rx_lock);
 	mutex_init(&drv_info->tx_lock);
 
-	ffa_setup_partitions();
-
 	ffa_set_up_mem_ops_native_flag();
 
 	ffa_notifications_setup();
 
+	ffa_setup_partitions();
+
+	ret = ffa_sched_recv_cb_update(drv_info->vm_id, ffa_self_notif_handle,
+				       drv_info, true);
+	if (ret)
+		pr_info("Failed to register driver sched callback %d\n", ret);
+
 	return 0;
 free_pages:
 	if (drv_info->tx_buffer)

-- 
2.42.0


  parent reply	other threads:[~2023-10-24 10:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24 10:56 [PATCH 0/4] firmware: arm_ffa: Few fixes for FF-A notification support Sudeep Holla
2023-10-24 10:56 ` [PATCH 1/4] firmware: arm_ffa: Allow FF-A initialisation even when notification fails Sudeep Holla
2023-10-25  7:10   ` Jens Wiklander
2023-10-25  9:50     ` Sudeep Holla
2023-10-24 10:56 ` Sudeep Holla [this message]
2023-10-24 10:56 ` [PATCH 3/4] firmware: arm_ffa: Add checks for the notification enabled state Sudeep Holla
2023-10-24 10:56 ` [PATCH 4/4] firmware: arm_ffa: Fix FFA notifications cleanup path Sudeep Holla
2023-10-25 11:55 ` [PATCH 0/4] firmware: arm_ffa: Few fixes for FF-A notification support Jens Wiklander
2023-10-25 13:47   ` Sudeep Holla
2023-11-13 12:25 ` 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=20231024-ffa-notification-fixes-v1-2-d552c0ec260d@arm.com \
    --to=sudeep.holla@arm.com \
    --cc=coboy.chen@mediatek.com \
    --cc=jens.wiklander@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lpieralisi@kernel.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

all inboxes | Powered by JetHome®