From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A62E43A640E for ; Thu, 14 May 2026 09:31:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778751086; cv=none; b=nvKWdIJieocj6fVxo1MrXfKwH2zFHrjZa1laMCiATFzcrOPzGnR/p4WmuiJNDkW9i+BVDzWGpZANr9leDMyNF83n1vyEugiv8xsDmY3Ks3IiDX1bgrcFL4PSKRtSTdK6DZ+y9Ck/N/gHXfKTwk+3JilOfq5H+pcg769Inw7lQs0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778751086; c=relaxed/simple; bh=Szhi4DCrVMTbowBda72sF3jcnYffCJVUI6kqx9OCt1c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bqGI8i5OqLENd4KA5nkfz2o2PTx9DnIUBjfzOyeOJsbB6Y0Gp9DzqSWxy7ziUIZVIT0sUefWlF270QYwKOjoKeelvKfYomQ84tM/cWSQ4+MQWs2uNB+WrF0fKeRwmlAlmHEyttALQavpJhdAL+NuMVeJGpzj1EtoAt5n78SAmV8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Aj3J/mC3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Aj3J/mC3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59CC8C2BCB3; Thu, 14 May 2026 09:31:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778751086; bh=Szhi4DCrVMTbowBda72sF3jcnYffCJVUI6kqx9OCt1c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Aj3J/mC3MBuxwesfKfl/BkZQvEqu+k+Bsu6C+HEOTcZNSnxk391cxb9lFWCjPMZrV Z4VZjipmw65C/6E3zUZuUSXA3OfYicv+YROnQOqMp0QGteYeZFmbhNcqcV3mVXpwRg N8zj8PGeFegC18eLapnUYsICSKwGubJn2nVpeV/ULp/ZQUbu4ZPYCzJ0guTsNfHEiv BQ//00RZyQT2n/YaTn0PoloinP/FIRXGSELbqDBoImyJBrEIL2LBJ2okD1fTskUbmG 55L8c3FO51RqxtEbbXrP2TCJ+UTdJa/IpZC0/rG/gzi8q9q4OPMTOmEBONNVbmu2oM 8r7qG5QsMAMuQ== Date: Thu, 14 May 2026 10:31:23 +0100 From: Sudeep Holla To: Jamie Nguyen Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla Subject: Re: [PATCH] firmware: arm_ffa: honor descriptor size in PARTITION_INFO_GET_REGS Message-ID: <20260514-generous-undetectable-mastiff-cc43d3@sudeepholla> References: <20260513032800.68807-1-jamien@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260513032800.68807-1-jamien@nvidia.com> On Tue, May 12, 2026 at 08:28:00PM -0700, Jamie Nguyen wrote: > __ffa_partition_info_get_regs() walks the response with a hardcoded > 24-byte stride (regs += 3) even though the SPMC tells us the actual > per-descriptor size via PARTITION_INFO_SZ in x2[63:48]. The size is > read into buf_sz and then thrown away. > > That works while every SPMC returns the FF-A v1.1 layout, but it falls > apart against a v1.3 SPMC returning the 48-byte descriptor. The loop > strides over half a descriptor at a time and ends up parsing every > other entry from a slice of two adjacent ones. > > The FF-A spec (v1.2, section 18.5) says that the producer should > report the descriptor size, and the consumer is supposed to stride by > that size and ignore any trailing fields it doesn't understand. The > non-REGS path (__ffa_partition_info_get) does this already, and the > REGS path should match. > > Use buf_sz for the stride, and bail out with -EPROTO if the SPMC > reports something we can't safely walk. > > Fixes: 7bc0f589c81d ("firmware: arm_ffa: Fix big-endian support in __ffa_partition_info_regs_get()") > Signed-off-by: Jamie Nguyen > --- > drivers/firmware/arm_ffa/driver.c | 35 ++++++++++++++++++++++++++++--- > 1 file changed, 32 insertions(+), 3 deletions(-) > > diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c > index c72ee4756585..b712e8a03dab 100644 > --- a/drivers/firmware/arm_ffa/driver.c > +++ b/drivers/firmware/arm_ffa/driver.c > @@ -321,6 +321,22 @@ __ffa_partition_info_get(u32 uuid0, u32 uuid1, u32 uuid2, u32 uuid3, > #define PART_INFO_ID(x) ((u16)(FIELD_GET(PART_INFO_ID_MASK, (x)))) > #define PART_INFO_EXEC_CXT(x) ((u16)(FIELD_GET(PART_INFO_EXEC_CXT_MASK, (x)))) > #define PART_INFO_PROPERTIES(x) ((u32)(FIELD_GET(PART_INFO_PROPS_MASK, (x)))) > + > +/* > + * FF-A v1.2 section 13.9 Table 13.40: registers x3..x17 carry the partition > + * descriptors, i.e. 15 u64 of payload per FFA_PARTITION_INFO_GET_REGS call. > + */ > +#define FFA_PART_INFO_REGS_PAYLOAD_U64 15 > + > +/* > + * FF-A v1.1 partition information descriptor (FF-A v1.2 section 6.2.1 > + * Table 6.1): id (2) + exec_ctxt (2) + properties (4) + UUID (16) = 24 > + * bytes. This is the minimum size the SPMC must report; the kernel reads > + * exactly these fields and ignores any trailing ones per the forward- > + * compatibility rules in FF-A v1.2 section 18.5. > + */ I can't see any such details is the above mention version and section. Can you confirm you are looking at [1] ? -- Regards, Sudeep [1] https://developer.arm.com/documentation/den0077/j