From nobody Tue Mar 3 05:12:30 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 1772013765090872.9321268321338; Wed, 25 Feb 2026 02:02:45 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1240487.1541864 (Exim 4.92) (envelope-from ) id 1vvBiu-0004Zd-Rq; Wed, 25 Feb 2026 10:02:28 +0000 Received: by outflank-mailman (output) from mailman id 1240487.1541864; Wed, 25 Feb 2026 10:02:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vvBiu-0004ZS-Ox; Wed, 25 Feb 2026 10:02:28 +0000 Received: by outflank-mailman (input) for mailman id 1240487; Wed, 25 Feb 2026 10:02:27 +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 1vvBit-0004Lo-L1 for xen-devel@lists.xenproject.org; Wed, 25 Feb 2026 10:02:27 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-flk1.inumbo.com (Halon) with ESMTP id 13b4c061-1231-11f1-9ccf-f158ae23cfc8; Wed, 25 Feb 2026 11:02:22 +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 18F20165C; Wed, 25 Feb 2026 02:02:15 -0800 (PST) Received: from C3HXLD123V.arm.com (unknown [10.57.54.86]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0C3073F62B; Wed, 25 Feb 2026 02:02:19 -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: 13b4c061-1231-11f1-9ccf-f158ae23cfc8 From: Bertrand Marquis To: xen-devel@lists.xenproject.org Cc: Volodymyr Babchuk , Jens Wiklander , Stefano Stabellini , Julien Grall , Michal Orzel Subject: [PATCH 1/4] xen/arm: ffa: Add start_index to VM partinfo helper Date: Wed, 25 Feb 2026 10:57:43 +0100 Message-ID: <826eae4c8346e79a227c8cf418cd5f42ee3420a1.1772013062.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: 1772013766002158500 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 --- 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