From patchwork Wed Aug 14 13:48:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13763529 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 7E6CBC52D7B for ; Wed, 14 Aug 2024 13:51:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dREPgbVCJj2NGjs+soCAkcHWp7PucPGw8/me11+qV60=; b=asKx3AF3qrReG959+BJC0hPEPl NCWGU8kSugCSJCPieMQNWk8V9E1/+elieRjUsRoLtl/2iaRY49x6dxMGphYWIkRHI5lctIEMmdfDJ MVEmApdkp8cjYAOwJyvq6B5Fziu91nL1lAvJN1KJC5ZwZEfk2kDBcoN+yii1tV58yJ1YELn4vieK8 4jk3VPIOOjgIfv1EF37XlH4nJyvifdKAZ0Z5OPGB4/bBXOK7Xh6xmXbtZy+P4EEJHj5fziYEy8cPT dblohfb13le8g2FYDbfdbfXj4pbS2RPJITeSGjtfVzTtqNW2yXcrF/TnPVcK3HmXV0O1b0F323uix 6eUsUFPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seEPd-000000079jb-0Bou; Wed, 14 Aug 2024 13:51:41 +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 1seEND-00000007955-2BmF for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2024 13:49:12 +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 C5F0F15BF; Wed, 14 Aug 2024 06:49:36 -0700 (PDT) Received: from [127.0.1.1] (e107155-lin.cambridge.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5D01F3F6A8; Wed, 14 Aug 2024 06:49:10 -0700 (PDT) From: Sudeep Holla Date: Wed, 14 Aug 2024 14:48:52 +0100 Subject: [PATCH 3/7] firmware: arm_ffa: Move the function ffa_features() earlier MIME-Version: 1.0 Message-Id: <20240814-ffa_v1-2-v1-3-9e9abef69b21@arm.com> References: <20240814-ffa_v1-2-v1-0-9e9abef69b21@arm.com> In-Reply-To: <20240814-ffa_v1-2-v1-0-9e9abef69b21@arm.com> To: linux-arm-kernel@lists.infradead.org, Sudeep Holla , op-tee@lists.trustedfirmware.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2366; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=JYHCrLtGgatFltjBhhLyMDdhO6Vb08f7f51oc6GSqpI=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBmvLXTecjlT2DaNiL02SJtAzypgCxh9y0VpoLKi sB15KtkYbiJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZry10wAKCRAAQbq8MX7i mO9bD/4uIBS/sm2J8xLvY9l1XHhGH4cyLuQdLNYe7otYMrmUAsaNbPPRN19M4aK/LW6NrdL+YhT N80adDxwE92wIG7K3rI4kYe71zYtaZ2Sl/ylu1Va5uhsjs3o8qJxQ1tFfrkdTxDLMeQT1U/hqza t2OVpvLHtg4Xnt5LkcMF+FMn1sf4xWCk0zC/Jufj1ium5wwqBJUPNxf8Ci+Q0dIVCS1dXfZZt5i qchcrGOZNCABkM+wbGFtCY83AkqMliVEMy112giNhY9bNxYn0117EgRKg2mCPNqQRxC/Ih8GM43 vK8F7lMSKEjCkrshneJIY+MRUZ9eMUlOhht90YE78k0CrTO8iI3drwm7DBmCvLrOndchrMAp33m gcAF/UOszBW+EUPT0LDadjzUE/4IYMZTicxxHT4wMshz+0i0Jvn9gzPhjwlT1lNzdaGDXXwFnWj FJnfGzp4ZEWnWss4IW8E+EH7oprDlPEOJzeRxukJ9ZQRnuJ4rsSMoEyZlOYJjyLYMj0wVuki/2u RrscAnvsWbKDxb367MSJbFvLKlaOZ7q1zYLC1XUYkLaY3/QKNYWQ0T2coLxmUBGuCGQ8GOIPqMw 6OyRDh3ksMPu/blzwgAzp8Rrpev52NDLMO27aSR2Jp9FdUkJGSS1ooHXa2diSxnoi4eecmtxTQc KTMCtZu9z2bYlZQ== 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-20240814_064911_715512_8F98B4E5 X-CRM114-Status: GOOD ( 10.23 ) 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 We need to use ffa_features() in ffa_partition_probe() to detect if the newer FFA_PARTITION_INFO_GET_REGS API is supported in the platform or not. To avoid unnecessary forward declaration within the file, let us just move this ffa_features() earlier. No funtional change. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 52 +++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index be77e03578cc..91681933ece9 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -212,6 +212,32 @@ static int ffa_rxtx_unmap(u16 vm_id) return 0; } +static int ffa_features(u32 func_feat_id, u32 input_props, + u32 *if_props_1, u32 *if_props_2) +{ + ffa_value_t id; + + if (!ARM_SMCCC_IS_FAST_CALL(func_feat_id) && input_props) { + pr_err("%s: Invalid Parameters: %x, %x", __func__, + func_feat_id, input_props); + return ffa_to_linux_errno(FFA_RET_INVALID_PARAMETERS); + } + + invoke_ffa_fn((ffa_value_t){ + .a0 = FFA_FEATURES, .a1 = func_feat_id, .a2 = input_props, + }, &id); + + if (id.a0 == FFA_ERROR) + return ffa_to_linux_errno((int)id.a2); + + if (if_props_1) + *if_props_1 = id.a2; + if (if_props_2) + *if_props_2 = id.a3; + + return 0; +} + #define PARTITION_INFO_GET_RETURN_COUNT_ONLY BIT(0) /* buffer must be sizeof(struct ffa_partition_info) * num_partitions */ @@ -598,32 +624,6 @@ static int ffa_memory_reclaim(u64 g_handle, u32 flags) return 0; } -static int ffa_features(u32 func_feat_id, u32 input_props, - u32 *if_props_1, u32 *if_props_2) -{ - ffa_value_t id; - - if (!ARM_SMCCC_IS_FAST_CALL(func_feat_id) && input_props) { - pr_err("%s: Invalid Parameters: %x, %x", __func__, - func_feat_id, input_props); - return ffa_to_linux_errno(FFA_RET_INVALID_PARAMETERS); - } - - invoke_ffa_fn((ffa_value_t){ - .a0 = FFA_FEATURES, .a1 = func_feat_id, .a2 = input_props, - }, &id); - - if (id.a0 == FFA_ERROR) - return ffa_to_linux_errno((int)id.a2); - - if (if_props_1) - *if_props_1 = id.a2; - if (if_props_2) - *if_props_2 = id.a3; - - return 0; -} - static int ffa_notification_bitmap_create(void) { ffa_value_t ret;