From nobody Fri Oct 31 04:06:27 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1751998092; cv=pass; d=zohomail.com; s=zohoarc; b=nPFFoxlc36F80BHPKAS+4jz0r4iICl4Z7pYjRoUAJCga1r8TMzJd0UH1bmTkqFUZeAkwVp6lGMzsQPOtkuZXPt3EdT3YT2I4QMz89Hx/EcOgubx/jVU04fO4NEe8qv0xbdKE4GdSMk/Jn9rVCbtP71NPmkUdutQtrvQpdYH0p2o= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751998092; h=Content-Type: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=O1ExVy8nhroR1dVMZr/rltfqr8RSNSYjn10HqrXbGOY=; b=gOKFRtVoSMzDYVj2C7OF3R9nypgsOS0dakgaAFS4/bK1v9Aak4Uj1m9w8Kak8Qza+ZLEAOGVSUx0udq3dPqnW4YJ6IS94SIsyd0a0cbhggaXCDGgTWZOYYYK//3Aw6fMpQVMR+DoP9hoiVtTzK8XxIkuJPdkd5X2376bxyKxFiI= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1751998092701253.8157980799175; Tue, 8 Jul 2025 11:08:12 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1037025.1409695 (Exim 4.92) (envelope-from ) id 1uZCjS-0005zY-8H; Tue, 08 Jul 2025 18:07:54 +0000 Received: by outflank-mailman (output) from mailman id 1037025.1409695; Tue, 08 Jul 2025 18:07:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uZCjS-0005zP-5S; Tue, 08 Jul 2025 18:07:54 +0000 Received: by outflank-mailman (input) for mailman id 1037025; Tue, 08 Jul 2025 18:07:52 +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 1uZCjQ-0005Uq-Ne for xen-devel@lists.xenproject.org; Tue, 08 Jul 2025 18:07:52 +0000 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on20605.outbound.protection.outlook.com [2a01:111:f403:2414::605]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 7583ef87-5c26-11f0-b894-0df219b8e170; Tue, 08 Jul 2025 20:07:50 +0200 (CEST) Received: from BYAPR06CA0013.namprd06.prod.outlook.com (2603:10b6:a03:d4::26) by CH1PPF73CDB1C12.namprd12.prod.outlook.com (2603:10b6:61f:fc00::615) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.23; Tue, 8 Jul 2025 18:07:45 +0000 Received: from CY4PEPF0000FCC2.namprd03.prod.outlook.com (2603:10b6:a03:d4:cafe::15) by BYAPR06CA0013.outlook.office365.com (2603:10b6:a03:d4::26) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8901.27 via Frontend Transport; Tue, 8 Jul 2025 18:07:44 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000FCC2.mail.protection.outlook.com (10.167.242.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8901.15 via Frontend Transport; Tue, 8 Jul 2025 18:07:44 +0000 Received: from xcbagarciav01.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 8 Jul 2025 13:07:41 -0500 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: 7583ef87-5c26-11f0-b894-0df219b8e170 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=D2pYq2XaSkjoF7vo/iKqt5MwrSf60AWb/MzhWph1nSL0yH5ZdEjaP3aoGZbzDdkqFiVPpg2ZY09wvncxu2vdSeyWlxmXDseur1NbmJqQYG/kN9UkMBtM5JHPzDb3QIaeeg7qkppYzP540mWOtl9B6UB8i//AA733bftWt2OhbQYKj45JXsYNLPkLsHhxctHZLrpcYe623oavAwvOIg01aZn7Np77TCCPHhV1e+Hl4YXnBORMZiegEvOvMI5wefr2O2qIizLQjQ0xEb/sLwpioQY8AObJUt63AiNplNT8Tl2/iDvceJXyfSI1BMS0iTZfYC3DQvqRNKhRI04m2801ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=O1ExVy8nhroR1dVMZr/rltfqr8RSNSYjn10HqrXbGOY=; b=NAYXTK8n3B5fzb7Tey0aUAkMiTxgYbeL3Zoo6YuGGkhr4X8YLGe/5uGx/kH4oOyFsCTCCewDQMID8XRLkurJFVrn1BRzeFlOZNc5zbPLSeXwKBAbuzMcNSWR8AGJur2ZpV/leukh5Lh+l4Af8bPAfELdQuXNpdROA5ZdiDM3A4va2N0hUA49azk8d8zXoUfsVy/DpH7KGz6vPXstaKQk6Hs0RmiBw7NcyH7PptAOlErZ8iCyxcwG9FlHm4/d0bV3oVvc2KLkO0a92KCnohaWv2yZ0kPvqW0eka7fakaSmgH6fQD86ShUcuF+jmbefe9yqZNC62aSSgFHOmomA18uvw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=O1ExVy8nhroR1dVMZr/rltfqr8RSNSYjn10HqrXbGOY=; b=THZob/7QBRDiGacxft0iZW0WTk5+TU+IdQYD/MyHv8etrq9ba5/fUUlRE+CtURXdDXt5X1q2I/9quRBrr0L5vTsHPJyo7lcaRwuFgVSvi9GWPLyzwe6L5wYKo1fckpONdTgNIrqNwHC0pCdsdVJsaCc7twIHGvuJDw+JlnP16hg= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C From: Alejandro Vallejo To: CC: Alejandro Vallejo , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Stefano Stabellini" , Julien Grall , "Bertrand Marquis" , Michal Orzel , "Daniel P. Smith" Subject: [PATCH v6 02/11] x86: Replace arch-specific boot_module with common one Date: Tue, 8 Jul 2025 20:07:11 +0200 Message-ID: <20250708180721.2338036-3-alejandro.garciavallejo@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250708180721.2338036-1-alejandro.garciavallejo@amd.com> References: <20250708180721.2338036-1-alejandro.garciavallejo@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC2:EE_|CH1PPF73CDB1C12:EE_ X-MS-Office365-Filtering-Correlation-Id: 8e346d4b-0176-4214-44b3-08ddbe4a56b9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?2x4rkXIiyttIUflhlj6+nqEbr2yQRMr78IjZY4mh9Gz8dO2SHyOvQ2BnICka?= =?us-ascii?Q?9E7tSbEFXIJEMkNunSinStgIjyP9auRD+Kwezo5FjNl+ydk0iNmYhvaWnG3s?= =?us-ascii?Q?Ksuq23EfkLrjnDE7Y9i5IvTa823fb5aY5+C1TdEG7B77NaOqe44bg/qe4ZFV?= =?us-ascii?Q?sDijLQNUhx45pDqMxs+qDCm9LzYCVD1fVcPxAFSOuFGefytwbFSWgCXUkjiq?= =?us-ascii?Q?urYC1E2eQ7GJWUb9xdt4jczprqIhC6TPGjX5OVMaq/Ofdp3xjYe+nkf1m8zl?= =?us-ascii?Q?vxFAy94/X+b5acOZyGScDE6dQ10X+qsFBX/6cZ3HzCFuGqoUPs96zXC+Vufb?= =?us-ascii?Q?EPOwcEBnswowu76mGJfOolTaLk329EJsmmGFzouEAoiSI6kAAlkD0pRCY1fu?= =?us-ascii?Q?mMisr1fI0kk0/xIVtLG7uPjHPvg0ocMxJMDIXwrgcs0oxsZ9GqNIrzdF/uRF?= =?us-ascii?Q?kHDG2quxbIGec0WoSuDErwPUfULGAVYby28h03CEIzOHzwXa3MMEqBdCJXJ5?= =?us-ascii?Q?Quf2uz71CYqpyC4hL4PmabGS4me7LvYl2qSYoNnVyECLFamJhg8zf5+VVrO5?= =?us-ascii?Q?GzYuNiNWdtAcw3TlnvNa0hXmHUh/H2pXuLAZnVajs/S/MSVLGObL3UxsyFtK?= =?us-ascii?Q?R7/VWfFONDdvjhXqmL4q+R194AGfpNFqX/drwsFP4P9cTLFomNGRhyRQ7Zq4?= =?us-ascii?Q?fAAKywqzMbdIsxx5o83X6yHfl470zbsYuhmS3fBdcOYz0s9Ovp4s6d64Nci8?= =?us-ascii?Q?xCuQ+XuO9snh2HZk+k8ZPs9RHUVCIDALLyO6Tr1fe+DxW4B/PHusES/wNxsS?= =?us-ascii?Q?i8f2/M75zVBANtWrJGTTa5voQm1f32BcvytavGccEJ6Z/bEhCxdB+XEcz2j5?= =?us-ascii?Q?BlKX+DUfRlAw2u2pYhbDdDsvNfvRGvUQGkUDjCkyLt9LKLlNtMEGzpK+A+0g?= =?us-ascii?Q?gK77g+b0OXrRtq/6eOcSBNpMf0Wvq1u3Wjd5RHjjAJYZqITN1NQuRzgSVc8w?= =?us-ascii?Q?DSsT3p5wevjyfqzJ0nlTzrKpLwxApdh0YMBlraCgazO9KgoD3iAwYKXtso4t?= =?us-ascii?Q?BkC/haafSfTtiu6+gut4DAUGsH2C2rarwQQaQGVDvOZhfIsp+2isIao9dMKU?= =?us-ascii?Q?4f/k265pMk9QC+Pjg80jONUw1qeSXKpogeZDiIFVSPZT1FtDtQgxZSj8gA5F?= =?us-ascii?Q?MRyw1aUoBFWjql9qGjrIcazQJspYfl1PL7GLsFkJnt5yxTgzljB+Qha0q/60?= =?us-ascii?Q?Iz56WrrkoCIvo7snrSHfLw48YLjloHoJrwARCDLZStxNZH/jWKYk0KAgd8Si?= =?us-ascii?Q?6sU3NkuGW0sUxXAl05CvomhGJpOEopjj7Jx7XiF2c0m4FXIL4+Hz8rFxu2nv?= =?us-ascii?Q?eQ86T/TJZnZncucqhtHDOssJuWctpsTACEvYhcblNZCxaxJIIowkRrTTfHmc?= =?us-ascii?Q?pUYfvGpsfw2tM5bGL+f8IEoxLiFju+lMYYcIOBMYSUSBnXJCcjksqeqqtafv?= =?us-ascii?Q?YAfMolhOX5f3Zmad147NZ3kFPSHCxyVVgQmB?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2025 18:07:44.7439 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8e346d4b-0176-4214-44b3-08ddbe4a56b9 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000FCC2.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH1PPF73CDB1C12 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1751998095158116600 Content-Type: text/plain; charset="utf-8" From: Alejandro Vallejo These types resemble each other very closely in layout and intent, and with "struct boot_module" already in common code it makes perfect sense to merge them. In order to do so, rename identical fields with conflicting names. No functional change intended. Signed-off-by: Alejandro Vallejo Reviewed-by: Stefano Stabellini Acked-by: Jan Beulich --- v6: * Moved the introduction of the "arch" subfield to the previous patch --- xen/arch/x86/cpu/microcode/core.c | 7 ++-- xen/arch/x86/hvm/dom0_build.c | 6 ++-- xen/arch/x86/include/asm/bootfdt.h | 50 ++++++++++++++++++++++++++ xen/arch/x86/include/asm/bootinfo.h | 56 +++-------------------------- xen/arch/x86/pv/dom0_build.c | 4 +-- xen/arch/x86/setup.c | 43 +++++++++++----------- xen/include/xen/bootfdt.h | 8 +++++ xen/xsm/xsm_policy.c | 2 +- 8 files changed, 93 insertions(+), 83 deletions(-) create mode 100644 xen/arch/x86/include/asm/bootfdt.h diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode= /core.c index 34a94cd25b..816e9bfe40 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -764,8 +764,7 @@ static int __init early_microcode_load(struct boot_info= *bi) struct cpio_data cd; =20 /* Search anything unclaimed or likely to be a CPIO archive. */ - if ( bm->type !=3D BOOTMOD_UNKNOWN && - bm->type !=3D BOOTMOD_RAMDISK ) + if ( bm->kind !=3D BOOTMOD_UNKNOWN && bm->kind !=3D BOOTMOD_RA= MDISK ) continue; =20 size =3D bm->size; @@ -815,12 +814,12 @@ static int __init early_microcode_load(struct boot_in= fo *bi) return -ENODEV; } =20 - if ( bi->mods[idx].type !=3D BOOTMOD_UNKNOWN ) + if ( bi->mods[idx].kind !=3D BOOTMOD_UNKNOWN ) { printk(XENLOG_WARNING "Microcode: Chosen module %d already use= d\n", idx); return -ENODEV; } - bi->mods[idx].type =3D BOOTMOD_MICROCODE; + bi->mods[idx].kind =3D BOOTMOD_MICROCODE; =20 size =3D bi->mods[idx].size; data =3D bootstrap_map_bm(&bi->mods[idx]); diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c index a038e58c11..2bb8ef355c 100644 --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -650,7 +650,7 @@ static int __init pvh_load_kernel( struct boot_module *image =3D bd->kernel; struct boot_module *initrd =3D bd->module; void *image_base =3D bootstrap_map_bm(image); - void *image_start =3D image_base + image->headroom; + void *image_start =3D image_base + image->arch.headroom; unsigned long image_len =3D image->size; unsigned long initrd_len =3D initrd ? initrd->size : 0; size_t cmdline_len =3D bd->cmdline ? strlen(bd->cmdline) + 1 : 0; @@ -721,9 +721,9 @@ static int __init pvh_load_kernel( { size_t initrd_space =3D elf_round_up(&elf, initrd_len); =20 - if ( initrd->cmdline_pa ) + if ( initrd->arch.cmdline_pa ) { - initrd_cmdline =3D __va(initrd->cmdline_pa); + initrd_cmdline =3D __va(initrd->arch.cmdline_pa); if ( !*initrd_cmdline ) initrd_cmdline =3D NULL; } diff --git a/xen/arch/x86/include/asm/bootfdt.h b/xen/arch/x86/include/asm/= bootfdt.h new file mode 100644 index 0000000000..a4c4bf30b9 --- /dev/null +++ b/xen/arch/x86/include/asm/bootfdt.h @@ -0,0 +1,50 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef X86_BOOTFDT_H +#define X86_BOOTFDT_H + +#include + +struct arch_boot_module +{ + /* + * Module State Flags: + * relocated: indicates module has been relocated in memory. + * released: indicates module's pages have been freed. + */ + bool relocated:1; + bool released:1; + + /* + * A boot module may need decompressing by Xen. Headroom is an estima= te of + * the additional space required to decompress the module. + * + * Headroom is accounted for at the start of the module. Decompressin= g is + * done in-place with input=3Dstart, output=3Dstart-headroom, expectin= g the + * pointers to become equal (give or take some rounding) when decompre= ssion + * is complete. + * + * Memory layout at boot: + * + * start ----+ + * v + * |<-----headroom------>|<------size------->| + * +-------------------+ + * | Compressed Module | + * +---------------------+-------------------+ + * | Decompressed Module | + * +-----------------------------------------+ + */ + unsigned long headroom; + paddr_t cmdline_pa; +}; + +#endif /* X86_BOOTFDT_H */ + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 3afc214c17..d33b100e04 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -8,6 +8,7 @@ #ifndef X86_BOOTINFO_H #define X86_BOOTINFO_H =20 +#include #include #include #include @@ -19,55 +20,6 @@ /* Max number of boot domains that Xen can construct */ #define MAX_NR_BOOTDOMS 1 =20 -/* Boot module binary type / purpose */ -enum bootmod_type { - BOOTMOD_UNKNOWN, - BOOTMOD_XEN, - BOOTMOD_KERNEL, - BOOTMOD_RAMDISK, - BOOTMOD_MICROCODE, - BOOTMOD_XSM_POLICY, -}; - -struct boot_module { - enum bootmod_type type; - - /* - * Module State Flags: - * relocated: indicates module has been relocated in memory. - * released: indicates module's pages have been freed. - */ - bool relocated:1; - bool released:1; - - /* - * A boot module may need decompressing by Xen. Headroom is an estima= te of - * the additional space required to decompress the module. - * - * Headroom is accounted for at the start of the module. Decompressin= g is - * done in-place with input=3Dstart, output=3Dstart-headroom, expectin= g the - * pointers to become equal (give or take some rounding) when decompre= ssion - * is complete. - * - * Memory layout at boot: - * - * start ----+ - * v - * |<-----headroom------>|<------size------->| - * +-------------------+ - * | Compressed Module | - * +---------------------+-------------------+ - * | Decompressed Module | - * +-----------------------------------------+ - */ - unsigned long headroom; - - paddr_t cmdline_pa; - - paddr_t start; - size_t size; -}; - /* * Xen internal representation of information provided by the * bootloader/environment, or derived from the information. @@ -94,16 +46,16 @@ struct boot_info { * Failure - a value greater than MAX_NR_BOOTMODS */ static inline unsigned int __init next_boot_module_index( - const struct boot_info *bi, enum bootmod_type t, unsigned int start) + const struct boot_info *bi, boot_module_kind k, unsigned int start) { unsigned int i; =20 - if ( t =3D=3D BOOTMOD_XEN ) + if ( k =3D=3D BOOTMOD_XEN ) return bi->nr_modules; =20 for ( i =3D start; i < bi->nr_modules; i++ ) { - if ( bi->mods[i].type =3D=3D t ) + if ( bi->mods[i].kind =3D=3D k ) return i; } =20 diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c index e1b78d47c2..a4b5362357 100644 --- a/xen/arch/x86/pv/dom0_build.c +++ b/xen/arch/x86/pv/dom0_build.c @@ -422,7 +422,7 @@ static int __init dom0_construct(const struct boot_doma= in *bd) =20 image_base =3D bootstrap_map_bm(image); image_len =3D image->size; - image_start =3D image_base + image->headroom; + image_start =3D image_base + image->arch.headroom; =20 d->max_pages =3D ~0U; =20 @@ -659,7 +659,7 @@ static int __init dom0_construct(const struct boot_doma= in *bd) * pages. Tell the boot_module handling that we've freed it, s= o the * memory is left alone. */ - initrd->released =3D true; + initrd->arch.released =3D true; } =20 iommu_memory_setup(d, "initrd", mfn_to_page(_mfn(initrd_mfn)), diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 24e4f5ac7f..7e70b46332 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -303,7 +303,7 @@ struct boot_info __initdata xen_boot_info =3D { * * The extra entry exists to be able to add the Xen image as a module. */ - .mods =3D { [0 ... MAX_NR_BOOTMODS] =3D { .type =3D BOOTMOD_UNKNOWN } = }, + .mods =3D { [0 ... MAX_NR_BOOTMODS] =3D { .kind =3D BOOTMOD_UNKNOWN } = }, }; =20 static struct boot_info *__init multiboot_fill_boot_info( @@ -338,7 +338,7 @@ static struct boot_info *__init multiboot_fill_boot_inf= o( */ for ( i =3D 0; i < MAX_NR_BOOTMODS && i < bi->nr_modules; i++ ) { - bi->mods[i].cmdline_pa =3D mods[i].string; + bi->mods[i].arch.cmdline_pa =3D mods[i].string; =20 if ( efi_enabled(EFI_LOADER) ) { @@ -361,7 +361,7 @@ static struct boot_info *__init multiboot_fill_boot_inf= o( } =20 /* Variable 'i' should be one entry past the last module. */ - bi->mods[i].type =3D BOOTMOD_XEN; + bi->mods[i].kind =3D BOOTMOD_XEN; =20 return bi; } @@ -388,11 +388,11 @@ unsigned long __init initial_images_nrpages(nodeid_t = node) =20 void __init release_boot_module(struct boot_module *bm) { - ASSERT(!bm->released); + ASSERT(!bm->arch.released); =20 init_domheap_pages(bm->start, bm->start + PAGE_ALIGN(bm->size)); =20 - bm->released =3D true; + bm->arch.released =3D true; } =20 void __init free_boot_modules(void) @@ -402,7 +402,7 @@ void __init free_boot_modules(void) =20 for ( i =3D 0; i < bi->nr_modules; ++i ) { - if ( bi->mods[i].released ) + if ( bi->mods[i].arch.released ) continue; =20 release_boot_module(&bi->mods[i]); @@ -997,8 +997,8 @@ static size_t __init domain_cmdline_size(const struct b= oot_info *bi, { size_t s =3D 0; =20 - if ( bd->kernel->cmdline_pa ) - s +=3D strlen(__va(bd->kernel->cmdline_pa)); + if ( bd->kernel->arch.cmdline_pa ) + s +=3D strlen(__va(bd->kernel->arch.cmdline_pa)); =20 if ( bi->kextra ) s +=3D strlen(bi->kextra); @@ -1065,9 +1065,10 @@ static struct domain *__init create_dom0(struct boot= _info *bi) if ( !(cmdline =3D xzalloc_array(char, cmdline_size)) ) panic("Error allocating cmdline buffer for %pd\n", d); =20 - if ( bd->kernel->cmdline_pa ) + if ( bd->kernel->arch.cmdline_pa ) strlcpy(cmdline, - cmdline_cook(__va(bd->kernel->cmdline_pa), bi->loader), + cmdline_cook(__va(bd->kernel->arch.cmdline_pa), + bi->loader), cmdline_size); =20 if ( bi->kextra ) @@ -1089,7 +1090,7 @@ static struct domain *__init create_dom0(struct boot_= info *bi) strlcat(cmdline, " acpi=3D", cmdline_size); strlcat(cmdline, acpi_param, cmdline_size); } - bd->kernel->cmdline_pa =3D 0; + bd->kernel->arch.cmdline_pa =3D 0; bd->cmdline =3D cmdline; } =20 @@ -1302,7 +1303,7 @@ void asmlinkage __init noreturn __start_xen(void) } =20 /* Dom0 kernel is always first */ - bi->mods[0].type =3D BOOTMOD_KERNEL; + bi->mods[0].kind =3D BOOTMOD_KERNEL; bi->domains[0].kernel =3D &bi->mods[0]; =20 if ( pvh_boot ) @@ -1486,7 +1487,7 @@ void asmlinkage __init noreturn __start_xen(void) xen->size =3D __2M_rwdata_end - _stext; } =20 - bi->mods[0].headroom =3D + bi->mods[0].arch.headroom =3D bzimage_headroom(bootstrap_map_bm(&bi->mods[0]), bi->mods[0].size); bootstrap_unmap(); =20 @@ -1568,9 +1569,9 @@ void asmlinkage __init noreturn __start_xen(void) for ( j =3D bi->nr_modules - 1; j >=3D 0; j-- ) { struct boot_module *bm =3D &bi->mods[j]; - unsigned long size =3D PAGE_ALIGN(bm->headroom + bm->size); + unsigned long size =3D PAGE_ALIGN(bm->arch.headroom + bm->size= ); =20 - if ( bm->relocated ) + if ( bm->arch.relocated ) continue; =20 /* Don't overlap with other modules (or Xen itself). */ @@ -1580,12 +1581,12 @@ void asmlinkage __init noreturn __start_xen(void) if ( highmem_start && end > highmem_start ) continue; =20 - if ( s < end && (bm->headroom || (end - size) > bm->start) ) + if ( s < end && (bm->arch.headroom || (end - size) > bm->start= ) ) { - move_memory(end - size + bm->headroom, bm->start, bm->size= ); + move_memory(end - size + bm->arch.headroom, bm->start, bm-= >size); bm->start =3D (end - size); - bm->size +=3D bm->headroom; - bm->relocated =3D true; + bm->size +=3D bm->arch.headroom; + bm->arch.relocated =3D true; } } =20 @@ -1611,7 +1612,7 @@ void asmlinkage __init noreturn __start_xen(void) #endif } =20 - if ( bi->mods[0].headroom && !bi->mods[0].relocated ) + if ( bi->mods[0].arch.headroom && !bi->mods[0].arch.relocated ) panic("Not enough memory to relocate the dom0 kernel image\n"); for ( i =3D 0; i < bi->nr_modules; ++i ) { @@ -2169,7 +2170,7 @@ void asmlinkage __init noreturn __start_xen(void) initrdidx =3D first_boot_module_index(bi, BOOTMOD_UNKNOWN); if ( initrdidx < MAX_NR_BOOTMODS ) { - bi->mods[initrdidx].type =3D BOOTMOD_RAMDISK; + bi->mods[initrdidx].kind =3D BOOTMOD_RAMDISK; bi->domains[0].module =3D &bi->mods[initrdidx]; if ( first_boot_module_index(bi, BOOTMOD_UNKNOWN) < MAX_NR_BOOTMOD= S ) printk(XENLOG_WARNING diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h index 7f49d0ccdd..1b19069833 100644 --- a/xen/include/xen/bootfdt.h +++ b/xen/include/xen/bootfdt.h @@ -7,6 +7,10 @@ #include #include =20 +#if __has_include() +#include +#endif + #define MIN_FDT_ALIGN 8 =20 #define NR_MEM_BANKS 256 @@ -110,6 +114,10 @@ struct boot_module { #endif paddr_t start; paddr_t size; + +#if __has_include() + struct arch_boot_module arch; +#endif }; =20 /* DT_MAX_NAME is the node name max length according the DT spec */ diff --git a/xen/xsm/xsm_policy.c b/xen/xsm/xsm_policy.c index 1f88b4fc5a..1b4030edb4 100644 --- a/xen/xsm/xsm_policy.c +++ b/xen/xsm/xsm_policy.c @@ -53,7 +53,7 @@ int __init xsm_multiboot_policy_init( printk("Policy len %#lx, start at %p.\n", _policy_len,_policy_start); =20 - bm->type =3D BOOTMOD_XSM_POLICY; + bm->kind =3D BOOTMOD_XSM; break; =20 } --=20 2.43.0