From patchwork Tue Oct 24 10:56:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13434223 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E6B0DC00A8F for ; Tue, 24 Oct 2023 10:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=C5zEBIJGDfq5EtQc9TsT5W7dXoZWBVClx8+Ww6w2Px8=; b=omsq4sQZU5uf52 pdS/jdgw+vT3/o32KZKOrBkHqBYfIHYRmzhHpQ1t7yuWzhE53Z0a17DM0IqxWdKmNUI6uK+i7r9+S s2c3qB8L8e9SDyefXzdu3YIgBXeHnHmGanpW3kTmglkdAFbSM6oorqM8RuES5Pa+G88okmVu7nrl5 szI7RuWZ3yOvxbLsman7BPeiaj2+DAz3fsZB6U9FaJSqn//vw564JvrL7vd5fBVMlxfOrjnZxyBXo 1MdzfOjF1uSRaUVCZ9jHsKRZxe5uw06XFSfWzY4vWRBh+cL/CoLBqKDmWm4n7b21BqDfd/l8hHUlq HTJf/qTrkDKYQl8C9myg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qvF5T-009bKx-3D; Tue, 24 Oct 2023 10:56:40 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qvF5L-009bFl-1n for linux-arm-kernel@lists.infradead.org; Tue, 24 Oct 2023 10:56:33 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D7D3C1424; Tue, 24 Oct 2023 03:57:09 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 165EC3F64C; Tue, 24 Oct 2023 03:56:27 -0700 (PDT) From: Sudeep Holla Date: Tue, 24 Oct 2023 11:56:18 +0100 Subject: [PATCH 2/4] firmware: arm_ffa: Setup the partitions after the notification initialisation MIME-Version: 1.0 Message-Id: <20231024-ffa-notification-fixes-v1-2-d552c0ec260d@arm.com> References: <20231024-ffa-notification-fixes-v1-0-d552c0ec260d@arm.com> In-Reply-To: <20231024-ffa-notification-fixes-v1-0-d552c0ec260d@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Jens Wiklander , Coboy Chen , Lorenzo Pieralisi X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1808; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=3aXcRjKfbSWHb8DoeLoTEHJIg2fFmreeDpN2RSMCi4I=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlN6LZLEQG8QC6qdL+oXai0m2YRoseXesNT1eBd mkxD38jUYeJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZTei2QAKCRAAQbq8MX7i mPcQEACPjeCJeGI2k7cfqoZsiAJxlaLTuatUGBnRApRiAi8yn8g//buZpcNTlVmo+p7ME9hnHJj 4cnb4hTyW9eG/jmYBI1KIo9kTVwS74GLNZ2JeSMQAunc9O0SVfnfOsMB9mcxh8e8Yenr3/FRD3M eiftmxTmBZJy7YXr+PCChncMZOUHIRqJtjWJT3PngbvTgfnXGPZ3USHiqofP3vI7aKhaCP2rQMC 6pVkhVEb60R8B7BE9BWhdWOCO47NUR26WzY193Tufwnhh7PDmG/PTw3tCWaBw2QfgZnCFUo1glj FHsSLsAvkZr338EA7YZ+opkqd4F4m17cQ9LaTrN8zZwkZS0Gv++jLCwzutL6udNvM1bMysQZ5/1 UaxKdgohtul2Esp+0fqxAZCUjPhR29opNBbVlPpB6VMgJhGH5RxjV9e/GMLp3nmTCHTLHLWRyOI 523KXa+W8pTCghTikElmQycWj41QyU0JaqwD3r69wrTztdTmHlMPtBZNrmkBq1yLT63n7/TTlIG MmyKnmWxd4somSJUWbX7rq9k7mJdJbUrFjENZt1XOgXhRHMWfHF6AunmO2hw2R8K/CIGbZ9E3zG d8JSftbzO+j+j1sh4OnB90VTCsM/zsr2nXm/nofJb+CN4gDqgLLOF1nnBJcz3ULWFU62RpGqGaS yUaiT867UnQLfmg== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231024_035631_687808_BC733500 X-CRM114-Status: GOOD ( 10.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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)