From patchwork Tue Sep 19 17:41:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391645 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 18795CE79A8 for ; Tue, 19 Sep 2023 17:42: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: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:In-Reply-To:References:Message-Id: 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=oxLWMz+mdkz7kSds90qdYexabkWOZN77KYApxVUmxyk=; b=faCYMRPM+HJkKU FW7ddxPh/lnXwn+feOQjG6IA5s/TBhS9O21SqQs7E7tfVKfkAmMlwa4CRzhqWl+N69IM+g1zTBVzD PIYggxVW+AihrxeOlaJ0aKLub1jIMA3vxqaUrYZX07GhgNp2JEmMh4UfzGKVFJiK9v1icM/UEczCT /KaBy1Qu8VDb9/txZkdZ9aASB3BSPF3JtwEa7RCNyRZoFWsl/uCDof9aPOMoJW6MOG29MWPXDME/U TuLs50DfE2m8vwo4yMm+hSGNmnyltoyH4c8UJe8+2xXJns1g+1nVH2psOx7DCcWDZ4GCxsHA8ioim Ae69z3KKR9L+duaPpBCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejx-000xpF-1L; Tue, 19 Sep 2023 17:42:25 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejD-000xDs-1U for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:41 +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 6C695FEC; Tue, 19 Sep 2023 10:42: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 211EE3F5A1; Tue, 19 Sep 2023 10:41:37 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:41:04 +0100 Subject: [PATCH RFT v2 16/18] firmware: arm_ffa: Switch to using ffa_mem_desc_offset() accessor MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-16-6f3a3ca3923c@arm.com> References: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> In-Reply-To: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jens Wiklander , Marc Bonnici , Coboy Chen , Lorenzo Pieralisi , Olivier Deprez X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1661; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=/nzYxWrUxzHK+XjBQnZCak5Tu7ZPAtOKWE4ng7bZFvM=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlCd08+RU27qx9u4qlmHu5SskWVsSlzbICaDn0o 3rd3FniYD2JAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndPAAKCRAAQbq8MX7i mA4yD/9hjEpdMqMosmD8LUJdH4SJxBtddl7+/7uL6RU2cGhDKblyXWch/1gW2B0EKSDdU7FjHTb PmKWu8dIhpdbB4nToZJCsHkiaqblO8MmKaP4ICLvRqPSbii3UVjZf+780Zb6/UAmEtYk3PqFzcF XTL4wKwnqtCfuixxzssUi2SujyWB2Nril8gwOp4HRaI6n/nPpBgbb5Ve5JTmyA2otiFLMyOM3E7 nBnfiuGQ92dAhfbpR/B77g2K8s9A/gNm9xaLKday0PFR1bJagGj3k3Apn8TkQ8Q41ei+eHs9QpZ MsvHi2mCLdI+LVxrHF6zj/2pwoc6aaxiKYLizCT+rP3CevVB2k9Einpw+g1tEdUxRchHnAunYeI rk1H9h+TsYWphTZdOy11JIn3HEwq/qDrUgaoBtwr+G5KoBWMxeVjmRyFQ3a0kIfUfUMoSqLfM8H bxAAK2yRt15MNn9fTRdtjcqPysD/c5Umyt2x6SP3zSg1Y+wHdwWWAi6yXzfan7t/+quoOQ4+UpL zFhOwZ5TyzEOSwrymIt6bkIKuIwtxQNJpkez/Yo0OIJ42v9m5KhlJ1dLnC6nxc0L8E9XD9XYgnU QMpmPqZeJ5KMcWJMMTmcO/L1k6cdVwOZtnv8rlHRyaI/Q++AGFnlLga9Te4/IzBfIBV5uywmXpf tTJNV2Ndw0vnNKg== 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-20230919_104139_545590_12845E7E X-CRM114-Status: GOOD ( 11.89 ) 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 In preparation to add support to the new memory transaction descriptor, the ep_mem_access member needs to be removed and hence even the macro COMPOSITE_OFFSET(). Let us switch to using the new ffa_mem_desc_offset() accessor in ffa_setup_and_transmit(). This will enable adding the support for new format transparently without any changes here again. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index dadd56d17c20..e0a0c7cedd90 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -449,14 +449,15 @@ ffa_setup_and_transmit(u32 func_id, void *buffer, u32 max_fragsize, struct ffa_composite_mem_region *composite; struct ffa_mem_region_addr_range *constituents; struct ffa_mem_region_attributes *ep_mem_access; + bool mdesc_v1 = drv_info->version <= FFA_VERSION_1_0; u32 idx, frag_len, length, buf_sz = 0, num_entries = sg_nents(args->sg); mem_region->tag = args->tag; mem_region->flags = args->flags; mem_region->sender_id = drv_info->vm_id; mem_region->attributes = ffa_memory_attributes_get(func_id); - ep_mem_access = buffer + COMPOSITE_OFFSET(0); - composite_offset = COMPOSITE_OFFSET(args->nattrs); + ep_mem_access = buffer + ffa_mem_desc_offset(buffer, 0, mdesc_v1); + composite_offset = ffa_mem_desc_offset(buffer, args->nattrs, mdesc_v1); for (idx = 0; idx < args->nattrs; idx++, ep_mem_access++) { ep_mem_access->receiver = args->attrs[idx].receiver;