From patchwork Tue Aug 20 14:27:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13770223 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 33D9EC531DC for ; Tue, 20 Aug 2024 14:32:01 +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=Vwq/B3xBS3u2ysyfe1yd8bThOp mvPuMH0CDhoukaQFWAlUbN0+mDRXsBOmCx1d/5Kb9nBAYcbpyE3zyTOHka7SATAAA9DtoWfjj6hSb BPKeShpSkS2x63HPlNud7ZFGb5d4WqYE54iw7WCa0QLCHi2UgcMX8/XAImjrCbYGgmP/ndQ+SFc4h wFbT+fm/LJ9hzgE2lvI0My2xoAsPEeSUeN1PoEDMeEEZ6VmVDwy5gtgmqCc0a08+bxZ8Zwr2yoCHx R0UhpukUR/aNRS/PaP3HQraRvvOv7NGD9CqkuVMHhCqG6O9k4vFSQQ4Yp95jpqIoenKdtlCa9k+5O oCjqD8hQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgPtn-00000005Yvi-2bav; Tue, 20 Aug 2024 14:31:51 +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 1sgPqx-00000005Y78-0sVL for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2024 14:28:57 +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 3C2261477; Tue, 20 Aug 2024 07:29:19 -0700 (PDT) Received: from [127.0.1.1] (e107155-lin.cambridge.arm.com [10.1.198.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C01A13F66E; Tue, 20 Aug 2024 07:28:52 -0700 (PDT) From: Sudeep Holla Date: Tue, 20 Aug 2024 15:27:56 +0100 Subject: [PATCH v2 3/7] firmware: arm_ffa: Move the function ffa_features() earlier MIME-Version: 1.0 Message-Id: <20240820-ffa_v1-2-v2-3-18c0c5f3c65e@arm.com> References: <20240820-ffa_v1-2-v2-0-18c0c5f3c65e@arm.com> In-Reply-To: <20240820-ffa_v1-2-v2-0-18c0c5f3c65e@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/ZANAwAIAQBBurwxfuKYAcsmYgBmxKghFPUAgNY+QC3sUqV8ljrlVXkYG0QGGSjxf +3pdbQWlpuJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZsSoIQAKCRAAQbq8MX7i mM7aD/9N4Ikcr9Nrpwcs6Aw0IuBM6+Jzhds204fQCbNqTePJeI4Ci2gPDmsTfIaxyBXUv2d8bor QLLu4CVCeOYLMfnjSfJQRFXZflDeOKga2RJYc6tTor9+LulTgUpPbyzVXm1/XWBPaTdEvB0yWq+ TImDS8QKBTH2B8NrgwEkGIDLGNLQBgbqSnepPdbvNEF/ZFt1+7a1z7ejO553fcQ6nUOSlGKElJ7 z2Akz36So1DaZR9X0gp4l++SPD3shiaKiiBhQaJah3hRNDSypZPUYNyMVeg4boiRuyo0dULDKRr ht/pTFxBVFxkaxxdP+u6QOpV84oe0OT+rlvNDTVU3JSBYC4RLAeCErForqtj6e90/tpBctA/+Sb WLVWT6/7di5mVQl8+JyX2U32wVlPlEwmXSZYZTHuPlGaeU+hwcOPwtEV9LY5x0dz2HF7aj6hFdu JCY3U1mzvEMoW/8BAlzwrYcQB21UZX5B5MGM5D6TEEBb+dwiy/Sf0pwP29HaOnJR4Vyfs+jbMT2 fiK+lqxmEAAmCWUa7mMWjxOKsGAjxHyn4kiZHKRkjorQY89R+FFOeibZtXJ72KamSt+KA3et+Jz BX/BNdVgRuQbDLvr3LKn5LY7wNsTxrTVeHFqb52sVLmaKZtEbffJdVPvzcMguPEj86vx5A4z7+C X85S7+WOqbwxerQ== 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-20240820_072855_385881_C1AE89FC X-CRM114-Status: GOOD ( 10.70 ) 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;