From patchwork Thu Apr 20 15:06:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13218901 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 047D7C77B73 for ; Thu, 20 Apr 2023 15:07:22 +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=iNOLj4tx2n3m8JUHkymL46pD+2ZQEXmVqDSBb+Z4WhE=; b=JYkPqGdX/lDcrj pdkdlO23HXurDfeySbG8sMPFgamgk3RmnIiuYSuj29cPDPlLe5eN+7ydf6jt+7AvCPk+EDkfApEbp qRDAvdcgGbciASh2jvKTmsAXIoLIdyrH1f3TzoGBP3U7Ugn/ZOEdu6hJTcOvPch5iDADKuNlBAcfa HDjXLjVKhbp2wZmWQ09t+K0TShjTJtr5LNOVAJdJJxf0kkohJZ/pPDhekgZ7EwbnLO27w4wbre8u6 33r4qamF48zyt4jyCn/vJtw6aQsGrhIYntXgAyquf1CcTXZuoPo5WOvPaujGWKPgdSsTHHoMyCUcx afkvC9+PoIvY4kQYNC7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ppVri-008N8w-21; Thu, 20 Apr 2023 15:06:30 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ppVrf-008N7b-2c for linux-arm-kernel@lists.infradead.org; Thu, 20 Apr 2023 15:06:29 +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 6F2B81595; Thu, 20 Apr 2023 08:07:09 -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 F13493F6C4; Thu, 20 Apr 2023 08:06:24 -0700 (PDT) From: Sudeep Holla Date: Thu, 20 Apr 2023 16:06:02 +0100 Subject: [PATCH v2 2/3] firmware: arm_ffa: Fix usage of partition info get count flag MIME-Version: 1.0 Message-Id: <20230419-ffa_fixes_6-4-v2-2-d9108e43a176@arm.com> References: <20230419-ffa_fixes_6-4-v2-0-d9108e43a176@arm.com> In-Reply-To: <20230419-ffa_fixes_6-4-v2-0-d9108e43a176@arm.com> To: linux-arm-kernel@lists.infradead.org Cc: Sudeep Holla , Marc Bonnici , Jens Wiklander , Lucian Paul-Trifu X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1724; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=KD0BembRM3K0Vn1WqbMtK1d3oXGcdslUVZPlLwtZpPs=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBkQVTuaqnzN9N9kXsFhjKq29OrvQXM+APRnYs3f q7sKyLa5SuJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZEFU7gAKCRAAQbq8MX7i mDimEACBA4gPYaLh5eHZK99gPu5QL0GT0LOKiITmgv+IFfvB7PDYBoaNyOYywmwGa8wBEb+NQss P7ogo4nFkT9TbtHT1nwIjkKG90R7Deci7Y00OvjAvCRJgUjckN+pmmTD988ikA13ud33nBgg8eA YydSF3eYLwY2uCp5Qrdeirl9qEztBxiUsdd1ZderIIQLVy8fHq+UU4sD5nG+ukxtXSSQpgzUwWY pbqoN7KYQQ/dh1HOgEsCoRsv//rPefYCxkSE0tldq1nx3fANV5PlF+PJDjjIViJj1hc1pN0e9ns LyCL1JHzJ9X97oJFCLsvjg2SwXg7V+xWJEsRMilcFwVlv8S/if/08KdKybvBBpwsGPHIBuvb0Mz BKDcVJBnkUi2O4yQqNdzDgTZqqNfJoRrTXgUejpVffdM10YPyVMchcCH38LcyPF4ejs+vJWSVy4 UchCwigI0anvzLswPZb5m9UfMGmOwBPKTSDJS+c56FEjB0DoESnM7dylQfXMEtmtnebmQqY/Eix o+5QusxEInvDZ9wmEigKvJUHOMlccOIc1cZfKhZuY4OWawIg+vhxjaABuBUPurEI2LMNaBJzOsW ghN/KPhJO27xp1mTkacAvy2m2TV8YBQt3hxBfBk0m0WU1vC+9BERcUgUkb8X/Cyim3/wFWV4ssR qe6s3dG340fqlrg== 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-20230420_080627_918844_52C7CE1A X-CRM114-Status: GOOD ( 12.24 ) 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 Commit bb1be7498500 ("firmware: arm_ffa: Add v1.1 get_partition_info support") adds support to discovery the UUIDs of the partitions or just fetch the partition count using the PARTITION_INFO_GET_RETURN_COUNT_ONLY flag. However the commit doesn't handle the fact that the older version doesn't understand the flag and must be MBZ which results in firmware returning invalid parameter error. That results in the failure of the driver probe which is in correct. Limit the usage of the PARTITION_INFO_GET_RETURN_COUNT_ONLY flag for the versions above v1.0(i.e v1.1 and onwards) which fixes the issue. Fixes: bb1be7498500 ("firmware: arm_ffa: Add v1.1 get_partition_info support") Reported-by: Jens Wiklander Reported-by: Marc Bonnici Tested-by: Jens Wiklander Reviewed-by: Jens Wiklander Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index fa85c64d3ded..4aced2e5b772 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -193,7 +193,8 @@ __ffa_partition_info_get(u32 uuid0, u32 uuid1, u32 uuid2, u32 uuid3, int idx, count, flags = 0, sz, buf_sz; ffa_value_t partition_info; - if (!buffer || !num_partitions) /* Just get the count for now */ + if (drv_info->version > FFA_VERSION_1_0 && + (!buffer || !num_partitions)) /* Just get the count for now */ flags = PARTITION_INFO_GET_RETURN_COUNT_ONLY; mutex_lock(&drv_info->rx_lock);