From nobody Mon Nov 3 18:14:03 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; dkim=pass header.i=dpsmith@apertussolutions.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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) ARC-Seal: i=2; a=rsa-sha256; t=1728251880; cv=pass; d=zohomail.com; s=zohoarc; b=eNmDx1FAZvFy47adXf4FSS2gu5Z1yr06IfYIjqKRWDDDCPzJrVutL9BhcnSDHC6GmF+ffFoZ6qS1pKgQpKho4fhuW30szuq+xPfeLwALTExVVTEkjdex6iE17sISNAFrKSDgaDxy9+0+L04O4a0QoBZ+iKdqi60/u0hbJztGObA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728251880; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QE3lxVGKOuPftRvukhIadN4V91ghc85ZfnuZPHZLmIo=; b=ertayGX73pxQ+Cpn8QvibjOphMkND56zxmJj66RAXBXp1QllSRYRGSY7ea/QC16t4L65fnF5cFpa08D5zJi0SPLavPUUZJWMwNhiCU4q9DvO3r691TFtX2pqn4qA+5MPnAmOjPYQfuRl2oxT1AKGVdSlBy4OvG/cMF/CTvc0Iyk= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 172825188037538.23089083124228; Sun, 6 Oct 2024 14:58:00 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.811421.1224267 (Exim 4.92) (envelope-from ) id 1sxZG1-0000EF-Kl; Sun, 06 Oct 2024 21:57:41 +0000 Received: by outflank-mailman (output) from mailman id 811421.1224267; Sun, 06 Oct 2024 21:57: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 1sxZG1-0000Do-Fv; Sun, 06 Oct 2024 21:57:41 +0000 Received: by outflank-mailman (input) for mailman id 811421; Sun, 06 Oct 2024 21:57:39 +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 1sxZAm-00051E-OF for xen-devel@lists.xenproject.org; Sun, 06 Oct 2024 21:52:16 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3ed2f10f-842d-11ef-99a2-01e77a169b0f; Sun, 06 Oct 2024 23:52:15 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 172825142194853.559157816554375; Sun, 6 Oct 2024 14:50:21 -0700 (PDT) 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: 3ed2f10f-842d-11ef-99a2-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1728251423; cv=none; d=zohomail.com; s=zohoarc; b=LLNk/4S0TYK3SgAjpsFQ+SoXPGn8bPocbqUn0KdQ/34RNWeoCb4cuQZZQk3qYZP9Gn6VonaXCa4nR+3iK8+CxB4pazWS3u+KBKyk+EEMAD3/p31VKkLTlIqlGLxjuERDg5Dge3GCykX4eGxOyMAbdlOpdVgl955fbsRA3T7huKg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728251423; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=QE3lxVGKOuPftRvukhIadN4V91ghc85ZfnuZPHZLmIo=; b=mJQz/cqEutJwHL/MYnPx7lLsDxEhaxyxVRNA28L/jPuxwF3Cl4ns0gSWJ/MOfU0QWCKjignlnA0sJoI0j/JYXzBewbqLiSf70UYG8PPDee7DZeUB5kUGOlblPIt5sxmPOwKPdCRR4WVy5hmD76FDhNCefC3asj5Ck9kLWXVwGHM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@apertussolutions.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1728251423; s=zoho; d=apertussolutions.com; i=dpsmith@apertussolutions.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=QE3lxVGKOuPftRvukhIadN4V91ghc85ZfnuZPHZLmIo=; b=qUUxBvfdPWSDGtnAhWNDYtp4F90sB0unDG/87/VgH/qrEyInYs/+VYtBc+m1yags OPXcMhoLhrz9CoPmrTmcl3KIJQT1Fdi74ikWcFdJ5ma/xz1WVXJy0oEMd1CS0SRXLEf oVi6qucOarqEGVOzO1smJCuXSCJO0iLbzl3p0Gzg= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v5 15/44] x86/boot: introduce boot module interator Date: Sun, 6 Oct 2024 17:49:26 -0400 Message-Id: <20241006214956.24339-16-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241006214956.24339-1-dpsmith@apertussolutions.com> References: <20241006214956.24339-1-dpsmith@apertussolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-ZohoMail-DKIM: pass (identity dpsmith@apertussolutions.com) X-ZM-MESSAGEID: 1728251882216116600 Content-Type: text/plain; charset="utf-8" Provide an iterator to go through boot module array searching based on type. Signed-off-by: Daniel P. Smith Reviewed-by: Jason Andryuk --- xen/arch/x86/include/asm/bootinfo.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 2ee0d5ad6d72..c79678840d31 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -54,8 +54,24 @@ struct boot_info { struct boot_module mods[MAX_NR_BOOTMODS + 1]; }; =20 -#endif /* __XEN_X86_BOOTINFO_H__ */ +static inline int __init next_boot_module_index( + const struct boot_info *bi, enum bootmod_type t, int offset) +{ + int i; + + for ( i =3D offset; i < bi->nr_modules; i++ ) + { + if ( bi->mods[i].type =3D=3D t ) + return i; + } + + return -1; +} =20 +#define first_boot_module_index(bi, t) \ + next_boot_module_index(bi, t, 0) + +#endif /* __XEN_X86_BOOTINFO_H__ */ /* * Local variables: * mode: C --=20 2.30.2