From nobody Sat Dec 13 06:21:02 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 176493108166896.20759459433589; Fri, 5 Dec 2025 02:38:01 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1178632.1502374 (Exim 4.92) (envelope-from ) id 1vRTC2-0005n7-Ll; Fri, 05 Dec 2025 10:37:42 +0000 Received: by outflank-mailman (output) from mailman id 1178632.1502374; Fri, 05 Dec 2025 10:37:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vRTC2-0005n0-I5; Fri, 05 Dec 2025 10:37:42 +0000 Received: by outflank-mailman (input) for mailman id 1178632; Fri, 05 Dec 2025 10:37:41 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vRTC1-0005j7-8r for xen-devel@lists.xenproject.org; Fri, 05 Dec 2025 10:37:41 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 6c23669e-d1c6-11f0-9d1b-b5c5bf9af7f9; Fri, 05 Dec 2025 11:37:40 +0100 (CET) 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 EDBC8339; Fri, 5 Dec 2025 02:37:31 -0800 (PST) Received: from C3HXLD123V.arm.com (unknown [10.57.45.211]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3EB5A3F86F; Fri, 5 Dec 2025 02:37:38 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 6c23669e-d1c6-11f0-9d1b-b5c5bf9af7f9 From: Bertrand Marquis To: xen-devel@lists.xenproject.org Cc: jens.wiklander@linaro.org, Volodymyr Babchuk , Stefano Stabellini , Julien Grall , Michal Orzel Subject: [PATCH v1 01/12] xen/arm: ffa: add FF-A v1.2 function IDs Date: Fri, 5 Dec 2025 11:36:34 +0100 Message-ID: <6832face6780228ac2704da70d5ddbd7f00dd385.1764930353.git.bertrand.marquis@arm.com> X-Mailer: git-send-email 2.51.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1764931083693019200 Content-Type: text/plain; charset="utf-8" Bring the FF-A headers up to the v1.2 baseline and fix the function-number range used for ABI discovery: - update FFA_FNUM_MAX_VALUE so the FF-A function-number window covers the full v1.2 range, and derive the ABI bitmap bounds from FFA_FNUM_MIN_VALUE/FFA_FNUM_MAX_VALUE instead of hard-coding FFA_ERROR/FFA_MSG_SEND2 - define the new v1.2 function IDs; CONSOLE_LOG_32/64 and PARTITION_INFO_GET_REGS are added for ABI discovery even though they are not implemented yet - extend the firmware ABI table to probe RUN and MSG_SEND_DIRECT_REQ2/RESP2 - while there, fix an off-by-one in ffa_fw_supports_fid(): the computed bit index must be strictly smaller than FFA_ABI_BITMAP_SIZE, so use >=3D in t= he bounds check - Also fix comment as call IDs reserved for FF-A are from 0x60 to 0xEF Keep FFA_MY_VERSION at 1.1 for now; we only advertise v1.2 once the implementation is fully compliant. Signed-off-by: Bertrand Marquis Reviewed-by: Jens Wiklander --- Changes in v1: - Add CONSOLE_LOG_64 and rename CONSOLE_LOG to CONSOLE_LOG_32 - Set MAX value to 0x8E which is the highest abi value available in 1.2 - Mention in ffa_private.h comment that SMCCC is actually reserving 0x60 to 0xEF included for FF-A (and fix previous FF which was wrong). --- xen/arch/arm/include/asm/tee/ffa.h | 3 ++- xen/arch/arm/tee/ffa.c | 4 ++++ xen/arch/arm/tee/ffa_private.h | 21 +++++++++++++-------- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/xen/arch/arm/include/asm/tee/ffa.h b/xen/arch/arm/include/asm/= tee/ffa.h index 24cd4d99c8f9..7acb541d1ff0 100644 --- a/xen/arch/arm/include/asm/tee/ffa.h +++ b/xen/arch/arm/include/asm/tee/ffa.h @@ -15,8 +15,9 @@ #include #include =20 +/* FF-A Function ID range (AArch32 function number field) as of FF-A v1.2 = */ #define FFA_FNUM_MIN_VALUE _AC(0x60,U) -#define FFA_FNUM_MAX_VALUE _AC(0x86,U) +#define FFA_FNUM_MAX_VALUE _AC(0x8E,U) =20 static inline bool is_ffa_fid(uint32_t fid) { diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c index 1d0239cf6950..2b4e24750d52 100644 --- a/xen/arch/arm/tee/ffa.c +++ b/xen/arch/arm/tee/ffa.c @@ -11,6 +11,8 @@ * https://developer.arm.com/documentation/den0077/a * FF-A-1.1-REL0: FF-A specification version 1.1 available at * https://developer.arm.com/documentation/den0077/e + * FF-A-1.2-REL0: FF-A specification version 1.2 available at + * https://developer.arm.com/documentation/den0077/j * TEEC-1.0C: TEE Client API Specification version 1.0c available at * https://globalplatform.org/specs-library/tee-client-api-spec= ification/ * @@ -102,6 +104,8 @@ static const struct ffa_fw_abi ffa_fw_abi_needed[] =3D { FW_ABI(FFA_MSG_SEND_DIRECT_REQ_32), FW_ABI(FFA_MSG_SEND_DIRECT_REQ_64), FW_ABI(FFA_MSG_SEND2), + FW_ABI(FFA_MSG_SEND_DIRECT_REQ2), + FW_ABI(FFA_RUN), }; =20 /* diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h index 6dbdb200d840..8d01da0009d3 100644 --- a/xen/arch/arm/tee/ffa_private.h +++ b/xen/arch/arm/tee/ffa_private.h @@ -15,6 +15,7 @@ #include #include #include +#include =20 /* Error codes */ #define FFA_RET_OK 0 @@ -42,6 +43,7 @@ =20 #define FFA_VERSION_1_0 MAKE_FFA_VERSION(1, 0) #define FFA_VERSION_1_1 MAKE_FFA_VERSION(1, 1) +#define FFA_VERSION_1_2 MAKE_FFA_VERSION(1, 2) /* The minimal FF-A version of the SPMC that can be supported */ #define FFA_MIN_SPMC_VERSION FFA_VERSION_1_1 =20 @@ -270,21 +272,24 @@ #define FFA_RX_ACQUIRE 0x84000084U #define FFA_SPM_ID_GET 0x84000085U #define FFA_MSG_SEND2 0x84000086U +#define FFA_CONSOLE_LOG_32 0x8400008AU +#define FFA_CONSOLE_LOG_64 0xC400008AU +#define FFA_PARTITION_INFO_GET_REGS 0x8400008BU +#define FFA_MSG_SEND_DIRECT_REQ2 0xC400008DU +#define FFA_MSG_SEND_DIRECT_RESP2 0xC400008EU =20 /** * Encoding of features supported or not by the fw in a bitmap: - * - Function IDs are going from 0x60 to 0xFF + * - Function IDs are going from 0x60 to 0xEF in SMCCC standard * - A function can be supported in 32 and/or 64bit * The bitmap has one bit for each function in 32 and 64 bit. */ #define FFA_ABI_ID(id) ((id) & ARM_SMCCC_FUNC_MASK) #define FFA_ABI_CONV(id) (((id) >> ARM_SMCCC_CONV_SHIFT) & BIT(0,U)) =20 -#define FFA_ABI_MIN FFA_ABI_ID(FFA_ERROR) -#define FFA_ABI_MAX FFA_ABI_ID(FFA_MSG_SEND2) - -#define FFA_ABI_BITMAP_SIZE (2 * (FFA_ABI_MAX - FFA_ABI_MIN + 1)) -#define FFA_ABI_BITNUM(id) ((FFA_ABI_ID(id) - FFA_ABI_MIN) << 1 | \ +#define FFA_ABI_BITMAP_SIZE (2 * (FFA_FNUM_MAX_VALUE - FFA_FNUM_MIN_VALU= E \ + + 1)) +#define FFA_ABI_BITNUM(id) ((FFA_ABI_ID(id) - FFA_FNUM_MIN_VALUE) << 1 = | \ FFA_ABI_CONV(id)) =20 /* Constituent memory region descriptor */ @@ -549,9 +554,9 @@ static inline int32_t ffa_hyp_rx_release(void) =20 static inline bool ffa_fw_supports_fid(uint32_t fid) { - BUILD_BUG_ON(FFA_ABI_MIN > FFA_ABI_MAX); + BUILD_BUG_ON(FFA_FNUM_MIN_VALUE > FFA_FNUM_MAX_VALUE); =20 - if ( FFA_ABI_BITNUM(fid) > FFA_ABI_BITMAP_SIZE) + if ( FFA_ABI_BITNUM(fid) >=3D FFA_ABI_BITMAP_SIZE) return false; return test_bit(FFA_ABI_BITNUM(fid), ffa_fw_abi_supported); } --=20 2.51.2