From patchwork Thu Apr 11 12:57:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13625940 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 68EE1CD128A for ; Thu, 11 Apr 2024 12:58:08 +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=R3aw7ng0IDljZtHGn3FuSc38nFWoP1eN4El0db8cd1M=; b=Y8ugB//6uzb+VV Kl/2znVTmQu9844DWQVSEC9IXvhuXfRmTA1cwkI0OWKNKTFUwRGShOddZdETOH3YNglu/FIJRxevr nq5c+1YN/js9PkC5hj4a6mz7Hn5KISU3Qlb0yw3JqBy6GbAdFtQD9Sh+41ORuJlNt9+uBjWSPbrpz +OD4FvMArgqBSMMSZNmS0ZT5YP/VhuVkTVGKttKDwIkNwq4fO/HQ+gU25WSaokR4+yL09t9BtU9tN hh3z8utVKbmKeiz8GvdM3ZKkrtrwUAzNFW/HHRz89ZoO6KKvmbALFTc4T8Eu1+q6NTLKS6FfhFK2B y3rpIe/qKXFgLATLRYpw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruu02-0000000C2gV-11Nr; Thu, 11 Apr 2024 12:57:54 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rutzx-0000000C2eK-0ofQ for linux-arm-kernel@lists.infradead.org; Thu, 11 Apr 2024 12:57:50 +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 D5F8C11FB; Thu, 11 Apr 2024 05:58:15 -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 771A23F64C; Thu, 11 Apr 2024 05:57:45 -0700 (PDT) From: Sudeep Holla Date: Thu, 11 Apr 2024 13:57:32 +0100 Subject: [PATCH v2 1/3] firmware: arm_ffa: Skip creation of the notification bitmaps MIME-Version: 1.0 Message-Id: <20240411-ffa_npi_support-v2-1-927a670254e6@arm.com> References: <20240411-ffa_npi_support-v2-0-927a670254e6@arm.com> In-Reply-To: <20240411-ffa_npi_support-v2-0-927a670254e6@arm.com> To: linux-arm-kernel@lists.infradead.org Cc: Marc Bonnici , Olivier Deprez , Lorenzo Pieralisi , Bertrand Marquis , Jens Wiklander , Sudeep Holla X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1919; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=yYE2AimCAKquv8X253zD5tNeVF9AH66uvZSRJabNqIM=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBmF95HWp3g2c0MZCVwMs0vyyVul8amRC4FzjFyP vwtjVPreNCJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZhfeRwAKCRAAQbq8MX7i mPq2EACOthx7t4Xsm+cw+j4YfmHj/noqrGKFVixICbf6DjMGuMX+KlaVdAz6Ygfv+8vzv56yJZ/ tvUekWTa+BrWSl/dRdnXlpLpgX+qKyrLj62ULGT1sHV7naBaGflJvlQ+m2WbJha8LVx4pPsD5a1 7JiGbpMJSdfpQ/HKerFkaP3otaEqBzj5n+0HAyzNzOSPIgL1LO2FWGFH7XKNCm+Q9M3N0iAjJK5 fAFId/ecuQrF3OhHqWd7ipa06ZG5odfnXKJyi0WhT0oVK7CClrZeFIynQgWSeFh2zU27rZ8aE2/ NCz61/5lyhdVQpZ2A2UdBqLIwqjmbcpddzI3cRmUcCYbdzpq+JMJqA6yWrJIgcbu9A0Rdru7Elq zEk650/IhlpaN8Xycl1fGwkvuYz1YERgzvN+JKXS7+CxS7+BuAN02gkRCKwRNFli9Qu/ZESLIcB qZcwItFWTKw7b6HQ3HNF01hb/rr/8/CzKQJ6Xi+7EQhE3eu4/ykkPXww0vG8IJq6k3Hq2Kxrh/B ybwWZhP6elTgsQZiXnKxfrtdUaznpVEDBNMOIigtX86HrfNe+SWBbAXprAnlj+cqHdBMFnZpHM0 1UW6ugGMiL979ojS0jyXPs36vlyAorA2Zh2TmqN1q4ihWWmlydOjjgw6jrwkZZO034s8AnBO2UQ 02hVgjRVBbriteg== 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-20240411_055749_340291_CCCED27B X-CRM114-Status: GOOD ( 12.09 ) 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 From: Jens Wiklander When the FF-A driver is running inside a guest VM under an hypervisor, the driver/guest VM doesn't have the permission/capability to request the creation of notification bitmaps. For a VM, the hypervisor reserves memory for its VM and hypervisor framework notification bitmaps and the SPMC reserves memory for its SP and SPMC framework notification bitmaps before the hypervisor initializes it. The hypervisor does not initialize a VM if memory cannot be reserved for all its notification bitmaps. So the creation of all the necessary bitmaps are already done when the driver initialises and hence it can be skipped. We rely on FFA_FEATURES(FFA_NOTIFICATION_BITMAP_CREATE) to fail when running in the guest to handle this in the driver. Signed-off-by:Jens Wiklander [sudeep.holla: Updated the commit message] Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index f2556a8e9401..4a576af7b8fd 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -1442,17 +1442,15 @@ static void ffa_notifications_setup(void) int ret, irq; ret = ffa_features(FFA_NOTIFICATION_BITMAP_CREATE, 0, NULL, NULL); - if (ret) { - pr_info("Notifications not supported, continuing with it ..\n"); - return; - } + if (!ret) { + ret = ffa_notification_bitmap_create(); + if (ret) { + pr_info("Notification bitmap create error %d\n", ret); + return; + } - ret = ffa_notification_bitmap_create(); - if (ret) { - pr_info("Notification bitmap create error %d\n", ret); - return; + drv_info->bitmap_created = true; } - drv_info->bitmap_created = true; irq = ffa_sched_recv_irq_map(); if (irq <= 0) {