From nobody Thu Dec 18 09:45:38 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 176581545336366.22760462180315; Mon, 15 Dec 2025 08:17:33 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1187149.1508655 (Exim 4.92) (envelope-from ) id 1vV9tx-0007Nj-PH; Mon, 15 Dec 2025 14:50:17 +0000 Received: by outflank-mailman (output) from mailman id 1187149.1508655; Mon, 15 Dec 2025 14:50:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vV9tx-0007NA-F5; Mon, 15 Dec 2025 14:50:17 +0000 Received: by outflank-mailman (input) for mailman id 1187149; Mon, 15 Dec 2025 14:50:16 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vV9tw-00038W-EW for xen-devel@lists.xenproject.org; Mon, 15 Dec 2025 14:50:16 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-flk1.inumbo.com (Halon) with ESMTP id 5cd05a89-d9c5-11f0-9cce-f158ae23cfc8; Mon, 15 Dec 2025 15:50:14 +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 2D31D497; Mon, 15 Dec 2025 06:50:06 -0800 (PST) Received: from C3HXLD123V.arm.com (unknown [10.57.46.206]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 47E563F694; Mon, 15 Dec 2025 06:50:12 -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: 5cd05a89-d9c5-11f0-9cce-f158ae23cfc8 From: Bertrand Marquis To: xen-devel@lists.xenproject.org Cc: jens.wiklander@linaro.org, Volodymyr Babchuk , Stefano Stabellini , Julien Grall , Michal Orzel Subject: [PATCH v2 12/12] xen/arm: ffa: advertise FF-A v1.2 Date: Mon, 15 Dec 2025 15:49:29 +0100 Message-ID: X-Mailer: git-send-email 2.51.2 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1765815456375158500 Expose the RX/TX MAP capacity field only once a guest has negotiated FF-A v1.2. While there, drop the stale include. To comply with the wider v1.2 register ABI, zero registers x8=E2=80=93x17 w= hen responding to a v1.2 VM. The dispatcher also rejects SMCCC64 calls from AArch32 guests. Finally, bump Xen's FF-A version to 1.2. Signed-off-by: Bertrand Marquis Reviewed-by: Jens Wiklander --- Changes in v2: - add Jens R-b Changes in v1: - Remove advertising of YIELD/INTERRUPT/RUN which has now moved to patch adding FFA_RUN support and adapt commit message - Use ACCESS_ONCE to read guest_vers - Use is_64bit_domain instead of ctx->is_64bit --- xen/arch/arm/tee/ffa.c | 19 +++++++++++++++++-- xen/arch/arm/tee/ffa_private.h | 29 ++++++++++++++++++++--------- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c index 2c6443a7f6a4..ed18e76080d0 100644 --- a/xen/arch/arm/tee/ffa.c +++ b/xen/arch/arm/tee/ffa.c @@ -65,7 +65,6 @@ #include #include #include -#include #include =20 #include "ffa_private.h" @@ -296,7 +295,16 @@ static void handle_features(struct cpu_user_regs *regs) * differs from FFA_PAGE_SIZE (SZ_4K). */ BUILD_BUG_ON(PAGE_SIZE !=3D FFA_PAGE_SIZE); - ffa_set_regs_success(regs, 0, 0); + + /* + * From FFA v1.2, we can give the maximum number of pages we suppo= rt + * for the RX/TX buffers. + */ + if ( ACCESS_ONCE(ctx->guest_vers) < FFA_VERSION_1_2 ) + ffa_set_regs_success(regs, 0, 0); + else + ffa_set_regs_success(regs, FFA_MAX_RXTX_PAGE_COUNT << 16, 0); + break; case FFA_FEATURE_NOTIF_PEND_INTR: ffa_set_regs_success(regs, GUEST_FFA_NOTIF_PEND_INTR_ID, 0); @@ -329,6 +337,13 @@ static bool ffa_handle_call(struct cpu_user_regs *regs) if ( !ctx ) return false; =20 + if ( !is_64bit_domain(d) && smccc_is_conv_64(fid) ) + { + /* 32bit guests should only use 32bit convention calls */ + ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED); + return true; + } + /* A version must be negotiated first */ if ( !ACCESS_ONCE(ctx->guest_vers) ) { diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h index 1fbd3fc3a696..282c105f3bce 100644 --- a/xen/arch/arm/tee/ffa_private.h +++ b/xen/arch/arm/tee/ffa_private.h @@ -53,7 +53,7 @@ * that particular guest or SP. */ #define FFA_MY_VERSION_MAJOR 1U -#define FFA_MY_VERSION_MINOR 1U +#define FFA_MY_VERSION_MINOR 2U #define FFA_MY_VERSION MAKE_FFA_VERSION(FFA_MY_VERSION_MAJOR, \ FFA_MY_VERSION_MINOR) =20 @@ -519,14 +519,25 @@ static inline void ffa_set_regs(struct cpu_user_regs = *regs, register_t v0, register_t v4, register_t v5, register_t v= 6, register_t v7) { - set_user_reg(regs, 0, v0); - set_user_reg(regs, 1, v1); - set_user_reg(regs, 2, v2); - set_user_reg(regs, 3, v3); - set_user_reg(regs, 4, v4); - set_user_reg(regs, 5, v5); - set_user_reg(regs, 6, v6); - set_user_reg(regs, 7, v7); + struct domain *d =3D current->domain; + struct ffa_ctx *ctx =3D d->arch.tee; + int i; + + set_user_reg(regs, 0, v0); + set_user_reg(regs, 1, v1); + set_user_reg(regs, 2, v2); + set_user_reg(regs, 3, v3); + set_user_reg(regs, 4, v4); + set_user_reg(regs, 5, v5); + set_user_reg(regs, 6, v6); + set_user_reg(regs, 7, v7); + + if ( ctx && ACCESS_ONCE(ctx->guest_vers) >=3D FFA_VERSION_1_2 && + is_64bit_domain(d) ) + { + for (i =3D 8; i <=3D 17; i++) + set_user_reg(regs, i, 0); + } } =20 static inline void ffa_set_regs_error(struct cpu_user_regs *regs, --=20 2.51.2