From nobody Tue Mar 3 04:56:17 2026 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 1772466300808840.5451563855943; Mon, 2 Mar 2026 07:45:00 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1244373.1543824 (Exim 4.92) (envelope-from ) id 1vx5Rp-0006Jp-84; Mon, 02 Mar 2026 15:44:41 +0000 Received: by outflank-mailman (output) from mailman id 1244373.1543824; Mon, 02 Mar 2026 15:44:41 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vx5Rp-0006JG-3P; Mon, 02 Mar 2026 15:44:41 +0000 Received: by outflank-mailman (input) for mailman id 1244373; Mon, 02 Mar 2026 15:44:39 +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 1vx5Rn-0006Gr-Ro for xen-devel@lists.xenproject.org; Mon, 02 Mar 2026 15:44:39 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id b6f7fd03-164e-11f1-b164-2bf370ae4941; Mon, 02 Mar 2026 16:44:36 +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 4E77F14BF; Mon, 2 Mar 2026 07:44:29 -0800 (PST) Received: from C3HXLD123V.arm.com (unknown [10.57.82.225]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5DC4A3F73B; Mon, 2 Mar 2026 07:44:34 -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: b6f7fd03-164e-11f1-b164-2bf370ae4941 From: Bertrand Marquis To: xen-devel@lists.xenproject.org Cc: Volodymyr Babchuk , Jens Wiklander , Stefano Stabellini , Julien Grall , Michal Orzel Subject: [PATCH v2 1/4] xen/arm: ffa: Add start_index to VM partinfo helper Date: Mon, 2 Mar 2026 16:44:10 +0100 Message-ID: <59113d382b0f31ae51152887a0afaeb10dcf8420.1772464956.git.bertrand.marquis@arm.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1772466302317158500 Content-Type: text/plain; charset="utf-8" Windowed GET_REGS retrieval needs to emit VM entries starting from an arbitrary index, but ffa_get_vm_partinfo() always starts from index 0. Add a start_index parameter to ffa_get_vm_partinfo() and skip entries until the local index reaches start_index. Update ffa_handle_partition_info_get() to pass start_index=3D0 to preserve existing behavior. No functional changes. Signed-off-by: Bertrand Marquis Reviewed-by: Jens Wiklander --- Changes since v1: - Add Jens R-b --- xen/arch/arm/tee/ffa_partinfo.c | 61 +++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinf= o.c index fdb03dae9a0c..6a6f3ffb822e 100644 --- a/xen/arch/arm/tee/ffa_partinfo.c +++ b/xen/arch/arm/tee/ffa_partinfo.c @@ -167,14 +167,15 @@ out: return ret; } =20 -static int32_t ffa_get_vm_partinfo(struct ffa_uuid uuid, uint32_t *vm_coun= t, - void **dst_buf, void *end_buf, - uint32_t dst_size) +static int32_t ffa_get_vm_partinfo(struct ffa_uuid uuid, uint32_t start_in= dex, + uint32_t *vm_count, void **dst_buf, + void *end_buf, uint32_t dst_size) { struct domain *d =3D current->domain; struct ffa_ctx *curr_ctx =3D d->arch.tee; struct ffa_ctx *dest_ctx; uint32_t count =3D 0; + uint32_t idx =3D 0; int32_t ret =3D FFA_RET_OK; /* * We do not have UUID info for VMs so use the 1.0 structure so that w= e set @@ -202,17 +203,21 @@ static int32_t ffa_get_vm_partinfo(struct ffa_uuid uu= id, uint32_t *vm_count, if ( ACCESS_ONCE(curr_ctx->guest_vers) >=3D FFA_VERSION_1_2 ) { /* Add caller VM information */ - info.id =3D curr_ctx->ffa_id; - info.execution_context =3D curr_ctx->num_vcpus; - info.partition_properties =3D FFA_PART_VM_PROP; - if ( is_64bit_domain(d) ) - info.partition_properties |=3D FFA_PART_PROP_AARCH64_STATE; - - ret =3D ffa_copy_info(dst_buf, end_buf, &info, dst_size, sizeof(in= fo)); - if ( ret ) - return ret; + if ( start_index =3D=3D 0) + { + info.id =3D curr_ctx->ffa_id; + info.execution_context =3D curr_ctx->num_vcpus; + info.partition_properties =3D FFA_PART_VM_PROP; + if ( is_64bit_domain(d) ) + info.partition_properties |=3D FFA_PART_PROP_AARCH64_STATE; =20 - count++; + ret =3D ffa_copy_info(dst_buf, end_buf, &info, dst_size, + sizeof(info)); + if ( ret ) + return ret; + count++; + } + idx++; } =20 if ( IS_ENABLED(CONFIG_FFA_VM_TO_VM) ) @@ -231,21 +236,25 @@ static int32_t ffa_get_vm_partinfo(struct ffa_uuid uu= id, uint32_t *vm_count, if ( dest_ctx =3D=3D curr_ctx ) continue; =20 - info.id =3D dest_ctx->ffa_id; - info.execution_context =3D dest_ctx->num_vcpus; - info.partition_properties =3D FFA_PART_VM_PROP; - if ( dest_ctx->is_64bit ) - info.partition_properties |=3D FFA_PART_PROP_AARCH64_STATE; - - ret =3D ffa_copy_info(dst_buf, end_buf, &info, dst_size, - sizeof(info)); - if ( ret ) + if ( idx >=3D start_index ) { - read_unlock(&ffa_ctx_list_rwlock); - return ret; + info.id =3D dest_ctx->ffa_id; + info.execution_context =3D dest_ctx->num_vcpus; + info.partition_properties =3D FFA_PART_VM_PROP; + if ( dest_ctx->is_64bit ) + info.partition_properties |=3D FFA_PART_PROP_AARCH64_S= TATE; + + ret =3D ffa_copy_info(dst_buf, end_buf, &info, dst_size, + sizeof(info)); + if ( ret ) + { + read_unlock(&ffa_ctx_list_rwlock); + return ret; + } + count++; } =20 - count++; + idx++; } read_unlock(&ffa_ctx_list_rwlock); } @@ -355,7 +364,7 @@ void ffa_handle_partition_info_get(struct cpu_user_regs= *regs) goto out_rx_release; } =20 - ret =3D ffa_get_vm_partinfo(uuid, &ffa_vm_count, &dst_buf, end_buf, + ret =3D ffa_get_vm_partinfo(uuid, 0, &ffa_vm_count, &dst_buf, end_buf, dst_size); =20 out_rx_release: --=20 2.52.0