From patchwork Fri Apr 29 11:39:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 12831880 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 21FC1C433F5 for ; Fri, 29 Apr 2022 11:41:11 +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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ImMsgumZebuQK/R8j+4dLpcqPQoc6kIsfsADYnElxR4=; b=d6fMwu2xrLk7or Y7NBXiqCXTNWhgUBNd1+tzpndEFDTFJIB7Lz3a6tbtt0quw3Q8BLlMMWWy+VXtVO2H7W/QJQE5Joi iCYe38gmd5TsXacTTavaUOeYkko8CNGUsxvkOw/a+/oiOZFbvffFZ9AF68pso+ondTqGgdDAhbrxt qP1QuC1HxhRuxRnPDEtTnhxwt93LiD41fqg4pjIpbsylb3qSkQ32SVtyc+NLuimosgOB9xXh+JIfh zQDv9C8WNJ9ZSN5pRqA5oOYAaS3VoWg1l5Z1h07d1vGuNVo+C55RgDWI1qxLH4ixFEUdT/iQeWUyS abvxOiR0RbISOplKv/Zw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nkOyj-00AzAY-Aj; Fri, 29 Apr 2022 11:40:05 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nkOyg-00Az8N-QZ for linux-arm-kernel@lists.infradead.org; Fri, 29 Apr 2022 11:40:04 +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 6369F1063; Fri, 29 Apr 2022 04:39:59 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 732213F73B; Fri, 29 Apr 2022 04:39:58 -0700 (PDT) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, op-tee@lists.trustedfirmware.org Cc: Sudeep Holla , Arunachalam Ganapathy , Jens Wiklander , Sumit Garg Subject: [PATCH 1/4] firmware: arm_ffa: Fix uuid parameter to ffa_partition_probe Date: Fri, 29 Apr 2022 12:39:43 +0100 Message-Id: <20220429113946.2087145-1-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220429_044002_947784_F33D75FC X-CRM114-Status: GOOD ( 11.12 ) 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 While we pass uuid_null intentionally to ffa_partition_probe in ffa_setup_partitions to get the count of the partitions, it must not be uuid_null in ffa_partition_info_get which is used by the ffa_drivers to fetch the specific partition info passing the UUID of the partition. Fix ffa_partition_info_get by passing the received uuid down to ffa_partition_probe so that the correct partition information is fetched. Fixes: d0c0bce83122 ("firmware: arm_ffa: Setup in-kernel users of FFA partitions") Reported-by: Arunachalam Ganapathy Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index ccccecae615f..6a913ac91e8e 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -588,7 +588,7 @@ static int ffa_partition_info_get(const char *uuid_str, return -ENODEV; } - count = ffa_partition_probe(&uuid_null, &pbuf); + count = ffa_partition_probe(&uuid, &pbuf); if (count <= 0) return -ENOENT; From patchwork Fri Apr 29 11:39:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 12831882 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 80301C433EF for ; Fri, 29 Apr 2022 11:41:24 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ociAozhAQS5XrWNK6b1Faq81udt4w9P899szrVCuJ58=; b=xAwlPzbx2UDH9U +mECJpQoyfHIJySEiyQTTzC85xV7ym4OBdwXdcsJYxDnYcqrB8ZMAJQwQOSZPiNMTIGmpT94ukw0R 9Vbt6l7gLxbEuDfH7gf4a5thzEQpRTIllVHISVBg++1mvdk2w2l2jnrYa32Kr7Gr2bmb2A/vCLE76 J7EoCKOh7Timz+oa681tqdEEYY6G56T9VXdGzee247pHBjg3Fh8b6IQYl3VbhgMSL3+1Qjtq9QCTQ 3kVANg+s7WMyvt+OvC7dc5z2Wtgbq/JDQrC3uqUERS3hbnm4n19IMMH5gikRSCps6THZWG6zt7Qk+ wUrb48sbnEHirqfCA4+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nkOz5-00AzDk-IG; Fri, 29 Apr 2022 11:40:27 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nkOyh-00Az8U-DY for linux-arm-kernel@lists.infradead.org; Fri, 29 Apr 2022 11:40:05 +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 849F2106F; Fri, 29 Apr 2022 04:40:00 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 957733F73B; Fri, 29 Apr 2022 04:39:59 -0700 (PDT) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, op-tee@lists.trustedfirmware.org Cc: Sudeep Holla , Arunachalam Ganapathy , Jens Wiklander , Sumit Garg Subject: [PATCH 2/4] firmware: arm_ffa: Remove incorrect assignment of driver_data Date: Fri, 29 Apr 2022 12:39:44 +0100 Message-Id: <20220429113946.2087145-2-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220429113946.2087145-1-sudeep.holla@arm.com> References: <20220429113946.2087145-1-sudeep.holla@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220429_044003_535911_43D51ABF X-CRM114-Status: UNSURE ( 7.69 ) X-CRM114-Notice: Please train this message. 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 The ffa core driver currently assigns its own driver information to individual ffa device driver_data which is wrong. Firstly, it leaks this core driver information to individual ffa_device and hence to ffa_driver. Secondly the ffa_device driver_data is for use by individual ffa_driver and not for this core driver managing all those devices. Fixes: d0c0bce83122 ("firmware: arm_ffa: Setup in-kernel users of FFA partitions") Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index 6a913ac91e8e..ec731e9e942b 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -694,8 +694,6 @@ static void ffa_setup_partitions(void) __func__, tpbuf->id); continue; } - - ffa_dev_set_drvdata(ffa_dev, drv_info); } kfree(pbuf); } From patchwork Fri Apr 29 11:39:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 12831881 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 08B90C433F5 for ; Fri, 29 Apr 2022 11:41:16 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zjHQ8QBHbQYfrzIBOFjV86/ss3GUGT2yTlFRywh4XnM=; b=LIZna1K0ZnppWD b5neC51diBa71vPKiek1AqAqqy3fGTCe9lSQjpk0VxFjRfHhoiMY+0Bz7PD5yzGVyxUWf0vw6pYvT v85E1l80uQBtNoYwSUqzMBnP1jFOkXssTtygOCk4nfDLnxli4ZxE2lVMjBn6O/R+QTcSdnAh4BCK1 hcP9Ae3iAWw2hazzM1W/Rnz9RE75Jcmep0TF4hqrVfNJHAUnHXoOuaLiH+6jCyoXCLPNO1gQG84uS cGyhCHRy8mKI3ZV1pplEfp8Jf1aKM8vmZaKkHu7Z6wXop0BZ0DMY5NOWd9PM4RQSGj3qIj5Fo4LMM Lx/KaxSjjRaawe/Asn4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nkOyw-00AzC9-4g; Fri, 29 Apr 2022 11:40:18 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nkOyh-00Az9F-3s for linux-arm-kernel@lists.infradead.org; Fri, 29 Apr 2022 11:40:04 +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 A7BA111FB; Fri, 29 Apr 2022 04:40:01 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B6CD73F73B; Fri, 29 Apr 2022 04:40:00 -0700 (PDT) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, op-tee@lists.trustedfirmware.org Cc: Sudeep Holla , Arunachalam Ganapathy , Jens Wiklander , Sumit Garg Subject: [PATCH 3/4] firmware: arm_ffa: Add ffa_dev_get_drvdata helper function Date: Fri, 29 Apr 2022 12:39:45 +0100 Message-Id: <20220429113946.2087145-3-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220429113946.2087145-1-sudeep.holla@arm.com> References: <20220429113946.2087145-1-sudeep.holla@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220429_044003_243216_B2C5653A X-CRM114-Status: UNSURE ( 9.31 ) X-CRM114-Notice: Please train this message. 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 Add a helper function to fetch ffa_dev's driver_data using dev_get_drvdata. At the same time move existing ffa_dev_set_drvdata to use dev_set_drvdata. Suggested-by: Arunachalam Ganapathy Signed-off-by: Sudeep Holla --- include/linux/arm_ffa.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/arm_ffa.h b/include/linux/arm_ffa.h index 85651e41ded8..e5c76c1ef9ed 100644 --- a/include/linux/arm_ffa.h +++ b/include/linux/arm_ffa.h @@ -38,7 +38,12 @@ struct ffa_driver { static inline void ffa_dev_set_drvdata(struct ffa_device *fdev, void *data) { - fdev->dev.driver_data = data; + dev_set_drvdata(&fdev->dev, data); +} + +static inline void *ffa_dev_get_drvdata(struct ffa_device *fdev) +{ + return dev_get_drvdata(&fdev->dev); } #if IS_REACHABLE(CONFIG_ARM_FFA_TRANSPORT) From patchwork Fri Apr 29 11:39:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 12831883 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 E3A91C433F5 for ; Fri, 29 Apr 2022 11:41:34 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XuYQTeEJ7YU+hbToELr98xz4vGxa4UYv7eCAi/h4LvY=; b=1WV+OtUGYsLIv7 NXC+7etOmCuvgTJ86Cq1P4EeqqxqOMeOFYhFy4oRNgy39lM1R2s18sQsaLXCjnFuwr3ZbxLGdDHm4 gbHaIaxG/PU5t2AAX+nm/UwcOt7VtLPx0QTpmMEPgh3hg/18ux3klE/7QZ1yeUthuV2LNw7722N3K yx6hSaTzzaMj1koqvshqvOIrryYPRoyxavX9aqf55kzmvE7B2p0cL6dLN/RwdpvR0oX/jIXAni1W/ X8iNZ5iLoeQUPwDPaeQeI9J+cwaHXfxe+QDFTk5jRAXIVHu9F0CX0ljC/SvXsQ6Tox1wXbyuxrX2t DLi9No08+clCdj7t1OIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nkOzF-00AzFf-4O; Fri, 29 Apr 2022 11:40:37 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nkOyh-00Az9o-GO for linux-arm-kernel@lists.infradead.org; Fri, 29 Apr 2022 11:40:05 +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 C8ED31474; Fri, 29 Apr 2022 04:40:02 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D988B3F73B; Fri, 29 Apr 2022 04:40:01 -0700 (PDT) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, op-tee@lists.trustedfirmware.org Cc: Sudeep Holla , Arunachalam Ganapathy , Jens Wiklander , Sumit Garg Subject: [PATCH 4/4] tee: optee: Use ffa_dev_get_drvdata to fetch driver_data Date: Fri, 29 Apr 2022 12:39:46 +0100 Message-Id: <20220429113946.2087145-4-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220429113946.2087145-1-sudeep.holla@arm.com> References: <20220429113946.2087145-1-sudeep.holla@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220429_044003_624341_EFBF3D15 X-CRM114-Status: GOOD ( 10.19 ) 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 Due to lack of an helper like ffa_dev_get_drvdata, this driver was fetching driver_data directly accessing the structure member. Now that we have added an helper, just use the same instead. Signed-off-by: Sudeep Holla --- drivers/tee/optee/ffa_abi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.c index a5eb4ef46971..b819a65cf89d 100644 --- a/drivers/tee/optee/ffa_abi.c +++ b/drivers/tee/optee/ffa_abi.c @@ -759,7 +759,7 @@ static const struct optee_ops optee_ffa_ops = { static void optee_ffa_remove(struct ffa_device *ffa_dev) { - struct optee *optee = ffa_dev->dev.driver_data; + struct optee *optee = ffa_dev_get_drvdata(ffa_dev); optee_remove_common(optee);