From nobody Wed Dec 4 08:19:00 2024 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=1725054501; cv=pass; d=zohomail.com; s=zohoarc; b=P3RYu0yvCLhz4SPpGYTTLyQYq9zdh20GPl1vXfVkrP0q3jyl+kXdGQ+Gmj93BIjKZbyGr/xSUF7BDDt6b7LKr1Xr66s5Jn/83WY8byW3imeCp244NeL0p9qyzJS3DlL11PpDI3t4CkoXEBhG278gXFZ5AH/Q/TlMkeip5emZZQk= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054501; 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=M4W1+EbYZ1Civ9bhjGdGJrVHK5yOv98KXuuX61z+p3g=; b=FmSxV3qZNmLeSMClaOsznPFUuP4m5Zxfkp+SbCCUBdMIIWFqQjXHtD22baboqq/mclmb+o3eAGoC3l5bL0+NVk7ZSbZOyPl/4aQLdYbQV7HS8blTQbnL0Db45mX22HTKo1PQifo4oVbV2YgIjXviiHSuy+qlcvRzSvouecyjPJg= 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 1725054501374820.5518035957754; Fri, 30 Aug 2024 14:48:21 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786651.1196255 (Exim 4.92) (envelope-from ) id 1sk9TH-0004R9-Dp; Fri, 30 Aug 2024 21:47:55 +0000 Received: by outflank-mailman (output) from mailman id 786651.1196255; Fri, 30 Aug 2024 21:47:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9TH-0004R2-8x; Fri, 30 Aug 2024 21:47:55 +0000 Received: by outflank-mailman (input) for mailman id 786651; Fri, 30 Aug 2024 21:47:53 +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 1sk9TF-0004BO-Gl for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:47:53 +0000 Received: from sender3-of-o57.zoho.com (sender3-of-o57.zoho.com [136.143.184.57]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 80cc9cb1-6719-11ef-99a1-01e77a169b0f; Fri, 30 Aug 2024 23:47:51 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054460817330.6426605494462; Fri, 30 Aug 2024 14:47:40 -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: 80cc9cb1-6719-11ef-99a1-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1725054462; cv=none; d=zohomail.com; s=zohoarc; b=VVb9AQHQzWR0Xi2YBkK8F9dotHc22hwmVT/LlesQD8Ep099R821c1DgywspI4LquG1hX93Kne+sbnH/DjXwPEPRdyxUN08DnabgJAXPouP59ITtCwrG2jpwejvBzQdo6GEOZO8VqHMDWQ5mqVHVzTaFmcYuDKA2y16NmlXCqWyg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054462; 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=M4W1+EbYZ1Civ9bhjGdGJrVHK5yOv98KXuuX61z+p3g=; b=cUpNh9U8LgPdyvJKQS3ji/lxd+zIM1Y9zDvfRHx3XDvMvc7/7OX1siznfG8ykfEmXHn7/4LNt8fKcUHr/BpB5snOhE4we4wysUw/fbxgciUHjPFu4I0CcOMf8LN/7hyz7LpZmzo74DaAciz4vK1cYWBWBYmjWHQOypEfbhGT25M= 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=1725054462; 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=M4W1+EbYZ1Civ9bhjGdGJrVHK5yOv98KXuuX61z+p3g=; b=sHHzHCuGHGQltokKpd4X2yRE+MQNFBUIgXNLNgudjrJQNsTEkIGzdG7ZgX53oL3G Bs570rYESGeIxMHp8DV4M1l39KusyOgGHF9Chuq8gA7oP2a0fLWfRdBdShtfHYeT/9G hpZ8ncIhIEf19P9+zBm6Hp478IrYnKcZY0nOar8Y= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: Christopher Clark , jason.andryuk@amd.com, "Daniel P . Smith" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 01/44] x86/boot: move x86 boot module counting into a new boot_info struct Date: Fri, 30 Aug 2024 17:46:46 -0400 Message-Id: <20240830214730.1621-2-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054502746116600 Content-Type: text/plain; charset="utf-8" From: Christopher Clark An initial step towards a non-multiboot internal representation of boot modules for common code, starting with x86 setup and converting the fields that are accessed for the startup calculations. Introduce a new header, , and populate it with a new boot_info structure initially containing a count of the number of boot modules. No functional change intended. Signed-off-by: Christopher Clark Signed-off-by: Daniel P. Smith --- xen/arch/x86/include/asm/bootinfo.h | 25 +++++++++++++ xen/arch/x86/setup.c | 58 +++++++++++++++++------------ 2 files changed, 59 insertions(+), 24 deletions(-) create mode 100644 xen/arch/x86/include/asm/bootinfo.h diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h new file mode 100644 index 000000000000..e850f80d26a7 --- /dev/null +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2024 Christopher Clark + * Copyright (c) 2024 Apertus Solutions, LLC + * Author: Daniel P. Smith + */ + +#ifndef __XEN_X86_BOOTINFO_H__ +#define __XEN_X86_BOOTINFO_H__ + +struct boot_info { + unsigned int nr_mods; +}; + +#endif + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index eee20bb1753c..dd94ee2e736b 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -32,6 +32,7 @@ #include #endif #include +#include #include #include #include @@ -276,7 +277,16 @@ static int __init cf_check parse_acpi_param(const char= *s) custom_param("acpi", parse_acpi_param); =20 static const module_t *__initdata initial_images; -static unsigned int __initdata nr_initial_images; +static struct boot_info __initdata *boot_info; + +static void __init multiboot_to_bootinfo(multiboot_info_t *mbi) +{ + static struct boot_info __initdata info; + + info.nr_mods =3D mbi->mods_count; + + boot_info =3D &info; +} =20 unsigned long __init initial_images_nrpages(nodeid_t node) { @@ -285,7 +295,7 @@ unsigned long __init initial_images_nrpages(nodeid_t no= de) unsigned long nr; unsigned int i; =20 - for ( nr =3D i =3D 0; i < nr_initial_images; ++i ) + for ( nr =3D i =3D 0; i < boot_info->nr_mods; ++i ) { unsigned long start =3D initial_images[i].mod_start; unsigned long end =3D start + PFN_UP(initial_images[i].mod_end); @@ -301,7 +311,7 @@ void __init discard_initial_images(void) { unsigned int i; =20 - for ( i =3D 0; i < nr_initial_images; ++i ) + for ( i =3D 0; i < boot_info->nr_mods; ++i ) { uint64_t start =3D (uint64_t)initial_images[i].mod_start << PAGE_S= HIFT; =20 @@ -309,7 +319,7 @@ void __init discard_initial_images(void) start + PAGE_ALIGN(initial_images[i].mod_end)); } =20 - nr_initial_images =3D 0; + boot_info->nr_mods =3D 0; initial_images =3D NULL; } =20 @@ -1034,9 +1044,10 @@ void asmlinkage __init noreturn __start_xen(unsigned= long mbi_p) mod =3D __va(mbi->mods_addr); } =20 + multiboot_to_bootinfo(mbi); + loader =3D (mbi->flags & MBI_LOADERNAME) ? __va(mbi->boot_loader_name) : "unknown"; - /* Parse the command-line options. */ if ( mbi->flags & MBI_CMDLINE ) cmdline =3D cmdline_cook(__va(mbi->cmdline), loader); @@ -1141,18 +1152,18 @@ void asmlinkage __init noreturn __start_xen(unsigne= d long mbi_p) bootsym(boot_edd_info_nr)); =20 /* Check that we have at least one Multiboot module. */ - if ( !(mbi->flags & MBI_MODULES) || (mbi->mods_count =3D=3D 0) ) + if ( !(mbi->flags & MBI_MODULES) || (boot_info->nr_mods =3D=3D 0) ) panic("dom0 kernel not specified. Check bootloader configuration\n= "); =20 /* Check that we don't have a silly number of modules. */ - if ( mbi->mods_count > sizeof(module_map) * 8 ) + if ( boot_info->nr_mods > sizeof(module_map) * 8 ) { - mbi->mods_count =3D sizeof(module_map) * 8; + boot_info->nr_mods =3D sizeof(module_map) * 8; printk("Excessive multiboot modules - using the first %u only\n", - mbi->mods_count); + boot_info->nr_mods); } =20 - bitmap_fill(module_map, mbi->mods_count); + bitmap_fill(module_map, boot_info->nr_mods); __clear_bit(0, module_map); /* Dom0 kernel is always first */ =20 if ( pvh_boot ) @@ -1325,9 +1336,8 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) kexec_reserve_area(); =20 initial_images =3D mod; - nr_initial_images =3D mbi->mods_count; =20 - for ( i =3D 0; !efi_enabled(EFI_LOADER) && i < mbi->mods_count; i++ ) + for ( i =3D 0; !efi_enabled(EFI_LOADER) && i < boot_info->nr_mods; i++= ) { if ( mod[i].mod_start & (PAGE_SIZE - 1) ) panic("Bootloader didn't honor module alignment request\n"); @@ -1351,8 +1361,8 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) * respective reserve_e820_ram() invocation below. No need to * query efi_boot_mem_unused() here, though. */ - mod[mbi->mods_count].mod_start =3D virt_to_mfn(_stext); - mod[mbi->mods_count].mod_end =3D __2M_rwdata_end - _stext; + mod[boot_info->nr_mods].mod_start =3D virt_to_mfn(_stext); + mod[boot_info->nr_mods].mod_end =3D __2M_rwdata_end - _stext; } =20 modules_headroom =3D bzimage_headroom(bootstrap_map(mod), mod->mod_end= ); @@ -1412,7 +1422,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) { /* Don't overlap with modules. */ end =3D consider_modules(s, e, reloc_size + mask, - mod, mbi->mods_count, -1); + mod, boot_info->nr_mods, -1); end &=3D ~mask; } else @@ -1433,7 +1443,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) } =20 /* Is the region suitable for relocating the multiboot modules? */ - for ( j =3D mbi->mods_count - 1; j >=3D 0; j-- ) + for ( j =3D boot_info->nr_mods - 1; j >=3D 0; j-- ) { /* * 'headroom' is a guess for the decompressed size and @@ -1448,7 +1458,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) =20 /* Don't overlap with other modules (or Xen itself). */ end =3D consider_modules(s, e, size, mod, - mbi->mods_count + relocated, j); + boot_info->nr_mods + relocated, j); =20 if ( highmem_start && end > highmem_start ) continue; @@ -1475,7 +1485,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) { /* Don't overlap with modules (or Xen itself). */ e =3D consider_modules(s, e, PAGE_ALIGN(kexec_crash_area.size)= , mod, - mbi->mods_count + relocated, -1); + boot_info->nr_mods + relocated, -1); if ( s >=3D e ) break; if ( e > kexec_crash_area_limit ) @@ -1490,7 +1500,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) =20 if ( modules_headroom && !mod->reserved ) panic("Not enough memory to relocate the dom0 kernel image\n"); - for ( i =3D 0; i < mbi->mods_count; ++i ) + for ( i =3D 0; i < boot_info->nr_mods; ++i ) { uint64_t s =3D (uint64_t)mod[i].mod_start << PAGE_SHIFT; =20 @@ -1570,7 +1580,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) ASSERT(j); } map_e =3D boot_e820.map[j].addr + boot_e820.map[j].size; - for ( j =3D 0; j < mbi->mods_count; ++j ) + for ( j =3D 0; j < boot_info->nr_mods; ++j ) { uint64_t end =3D pfn_to_paddr(mod[j].mod_start) + mod[j].mod_end; @@ -1645,7 +1655,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) } } =20 - for ( i =3D 0; i < mbi->mods_count; ++i ) + for ( i =3D 0; i < boot_info->nr_mods; ++i ) { set_pdx_range(mod[i].mod_start, mod[i].mod_start + PFN_UP(mod[i].mod_end)); @@ -2032,8 +2042,8 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) cpu_has_nx ? XENLOG_INFO : XENLOG_WARNING "Warning: ", cpu_has_nx ? "" : "not "); =20 - initrdidx =3D find_first_bit(module_map, mbi->mods_count); - if ( bitmap_weight(module_map, mbi->mods_count) > 1 ) + initrdidx =3D find_first_bit(module_map, boot_info->nr_mods); + if ( bitmap_weight(module_map, boot_info->nr_mods) > 1 ) printk(XENLOG_WARNING "Multiple initrd candidates, picking module #%u\n", initrdidx); @@ -2043,7 +2053,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) * above our heap. The second module, if present, is an initrd ramdisk. */ dom0 =3D create_dom0(mod, modules_headroom, - initrdidx < mbi->mods_count ? mod + initrdidx : NUL= L, + initrdidx < boot_info->nr_mods ? mod + initrdidx : = NULL, kextra, loader); if ( !dom0 ) panic("Could not set up DOM0 guest OS\n"); --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054502; cv=pass; d=zohomail.com; s=zohoarc; b=U4aQ8l+tPyQ1uqM+jC7dXaU/5BqNu30CsQiOhbZ/UuwIq5L7kufEObplx7rppTKSgbPn/ZPZYdEN38GJ1I+sShyKKcfIWHSMS9/igSVfWrQqz1q7kfqqmV8cW2j+t5763Ya/hSXo1TBmD8dBfd2200aV7HDcQV4ywPec9xZxXl0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054502; 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=KAESHRPaE5VWyf1xY+l5m4fxgSkS1FQVX7bHFI04M2Y=; b=fWLM+ddGnF+kJd8DG5ASp/53hxVF9sOyYOgS3MeQuG8hhZEgVc/Scx+HI0jPuHCLdm5yimi9cfN2F6acljQw4jws9S+6t7FX89d1knzUeawnMSmcHcE94w7NwWApQkJmMK+ceTPMbFR8q+dOj3ilAJ2W7vJOZnolCmWZ6fQjiTg= 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 1725054502426380.2422611732819; Fri, 30 Aug 2024 14:48:22 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786652.1196264 (Exim 4.92) (envelope-from ) id 1sk9TN-0004j1-JD; Fri, 30 Aug 2024 21:48:01 +0000 Received: by outflank-mailman (output) from mailman id 786652.1196264; Fri, 30 Aug 2024 21:48:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9TN-0004iu-Gb; Fri, 30 Aug 2024 21:48:01 +0000 Received: by outflank-mailman (input) for mailman id 786652; Fri, 30 Aug 2024 21:48:00 +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 1sk9TM-0004BO-Ro for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:48:00 +0000 Received: from sender3-of-o57.zoho.com (sender3-of-o57.zoho.com [136.143.184.57]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 8533de97-6719-11ef-99a1-01e77a169b0f; Fri, 30 Aug 2024 23:47:59 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 17250544619691020.6911507983529; Fri, 30 Aug 2024 14:47:41 -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: 8533de97-6719-11ef-99a1-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1725054464; cv=none; d=zohomail.com; s=zohoarc; b=k1d4FRK7F8uwIJpTqyE+y8FsdfwNHiKb4oG6Oj8svyS1Mx4mDuDzj19fAv+wcAmM2M39G8drszEFyHOiFTG6mwqy/QERRlEgF81z7KCQw7mU3Xf6zYH1p0TLX6TEiA8XknDnJoM8tH/ySx3fLc6rBSm9qZ4BxHP7hOuO2tnqc+g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054464; 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=KAESHRPaE5VWyf1xY+l5m4fxgSkS1FQVX7bHFI04M2Y=; b=R7s9lqaXfp3RhPrhyRGwVnNU8DPAuxC7iNMeymPgEDC+t5G3AHbojj351+eycFhBc+e0SosR6a2pyhOva+H1Dqt1qn5JLxJgzXdsZFWVLTfRMkdhmzw9Uvl0H0PVdLaElz6gYLi+/bSAjBeFu7i5vli00Qx3ueakrcGNnb/VQQw= 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=1725054464; 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=KAESHRPaE5VWyf1xY+l5m4fxgSkS1FQVX7bHFI04M2Y=; b=T0tOh+gFQViOt10PluDy2w7iaysThBZ5A1a3OMU14qMJs2f9DaSBNrdVV6804hfw QcuGVnmJzdePaI7RlJ+/Db2p7hKfPkZGl17xOBGQJy/12DhpRvcoHJC2foVDCAqqv56 TC0Ns/xjvRu1xtGzSXiQkbOA1dVPIYtPo8FEEhmY= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 02/44] x86/boot: move boot loader name to boot info Date: Fri, 30 Aug 2024 17:46:47 -0400 Message-Id: <20240830214730.1621-3-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054504577116600 Content-Type: text/plain; charset="utf-8" Transition the incoming boot loader name to be held in struct boot_info. No functional change intended. Signed-off-by: Daniel P. Smith --- xen/arch/x86/include/asm/bootinfo.h | 2 ++ xen/arch/x86/setup.c | 15 ++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index e850f80d26a7..e69feb1bb8be 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -10,6 +10,8 @@ =20 struct boot_info { unsigned int nr_mods; + + const char *boot_loader_name; }; =20 #endif diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index dd94ee2e736b..432b7d1701e4 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -285,6 +285,9 @@ static void __init multiboot_to_bootinfo(multiboot_info= _t *mbi) =20 info.nr_mods =3D mbi->mods_count; =20 + info.boot_loader_name =3D (mbi->flags & MBI_LOADERNAME) ? + __va(mbi->boot_loader_name) : "unknown"; + boot_info =3D &info; } =20 @@ -993,7 +996,7 @@ static struct domain *__init create_dom0(const module_t= *image, =20 void asmlinkage __init noreturn __start_xen(unsigned long mbi_p) { - const char *memmap_type =3D NULL, *loader, *cmdline =3D ""; + const char *memmap_type =3D NULL, *cmdline =3D ""; char *kextra; void *bsp_stack; struct cpu_info *info =3D get_cpu_info(), *bsp_info; @@ -1046,11 +1049,9 @@ void asmlinkage __init noreturn __start_xen(unsigned= long mbi_p) =20 multiboot_to_bootinfo(mbi); =20 - loader =3D (mbi->flags & MBI_LOADERNAME) ? __va(mbi->boot_loader_name) - : "unknown"; /* Parse the command-line options. */ if ( mbi->flags & MBI_CMDLINE ) - cmdline =3D cmdline_cook(__va(mbi->cmdline), loader); + cmdline =3D cmdline_cook(__va(mbi->cmdline), boot_info->boot_loade= r_name); =20 if ( (kextra =3D strstr(cmdline, " -- ")) !=3D NULL ) { @@ -1091,7 +1092,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) if ( pvh_boot ) pvh_print_info(); =20 - printk("Bootloader: %s\n", loader); + printk("Bootloader: %s\n", boot_info->boot_loader_name); =20 printk("Command line: %s\n", cmdline); =20 @@ -1184,7 +1185,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) l3_bootmap[l3_table_offset(BOOTSTRAP_MAP_BASE)] =3D l3e_from_paddr(__pa(l2_bootmap), __PAGE_HYPERVISOR); =20 - memmap_type =3D loader; + memmap_type =3D boot_info->boot_loader_name; } else if ( efi_enabled(EFI_BOOT) ) memmap_type =3D "EFI"; @@ -2054,7 +2055,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) */ dom0 =3D create_dom0(mod, modules_headroom, initrdidx < boot_info->nr_mods ? mod + initrdidx : = NULL, - kextra, loader); + kextra, boot_info->boot_loader_name); if ( !dom0 ) panic("Could not set up DOM0 guest OS\n"); =20 --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054508; cv=pass; d=zohomail.com; s=zohoarc; b=mitTNRCiQeikkuli8ipCGkFafJS3CkulZ/XU58maSxa4lICG4HyUKLQPN3nxT1Ev5aOUwJF1WBlQ+4Sc29P4718hm5aDIJSR/Mv4+ZEpIEiYP0/9yjUFGK0R6ftsoRcGJ7Ky8wKYHNg67p9+54a1gX11xulrWeOjsE0v7215VUQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054508; 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=Qexd3Ieo0x5aB7CkcPEqhzSRdIxc4KHzWNUKGdjfDMk=; b=MKvfEZX8hQCxOE1cWAiI9IADVmHUn20TzMBaIOCuEd/jpPWduVgXqJ7pReo8lCgj9mMW6m+EshBEPs/KNhAXRRfhKFw9xMjywbLYk6MXwT+s/KBHK58d+jF+5a4IvoJaGmnC1qMyBjCNoPy6+Qv9uPOEAfM/FoQ7Fj2hausfF/U= 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 1725054508787516.7323194929277; Fri, 30 Aug 2024 14:48:28 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786653.1196274 (Exim 4.92) (envelope-from ) id 1sk9TV-00056r-T1; Fri, 30 Aug 2024 21:48:09 +0000 Received: by outflank-mailman (output) from mailman id 786653.1196274; Fri, 30 Aug 2024 21:48:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9TV-00056i-PW; Fri, 30 Aug 2024 21:48:09 +0000 Received: by outflank-mailman (input) for mailman id 786653; Fri, 30 Aug 2024 21:48:08 +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 1sk9TU-0004BO-Qk for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:48:08 +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 89e4a070-6719-11ef-99a1-01e77a169b0f; Fri, 30 Aug 2024 23:48:07 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054463025557.548854351013; Fri, 30 Aug 2024 14:47:43 -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: 89e4a070-6719-11ef-99a1-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1725054465; cv=none; d=zohomail.com; s=zohoarc; b=kZfzSBiAOcWM1nNWw8G6aWDYpPkIo63VSHznsMdZ2tqCKj39rJ5gHMuBO18irh/KNd7mnxlzwXRgiMzhsOOTs/FPMtu497XfFgODVZAmSVjeCYoNseK5XEWWbfM0FinWWFw+vvzBmdhXaNeUAvjiF+CePNUbqszKR0tCF4sblEY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054465; 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=Qexd3Ieo0x5aB7CkcPEqhzSRdIxc4KHzWNUKGdjfDMk=; b=L8nQ3JmrkA4ybkEhwkoZFrMqtzpmqd8nXSww2zkjd2cp3Wi9cCR8ny91f6MqwV1v/7+lkj+2DUCgLXYEjVmBsh9RkbHQIY0WZ/yiK1apwAiDkTyuNvQrVaVB9VUH1fnPS6ltTzCQhWfdSWXA/egn1z7/HY2P95RKHv6Vvyp3Uk4= 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=1725054465; 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=Qexd3Ieo0x5aB7CkcPEqhzSRdIxc4KHzWNUKGdjfDMk=; b=kKDzBb+ZDpO2+u840lmHk+yzp84/29Qyboj/exo/kudo2h9Ieg65aP9GRtqhDxzJ 07MU7U9q62rJim9GQL4XzZ91lUKyL8HpU799r2HDgAa8e18oHwI3EjZTddjgDofF6IO TrmJmuTTm6OuTZkg0VhLOg1bE2qVgI7i+I7Pgi+A= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 03/44] x86/boot: move cmdline to boot info Date: Fri, 30 Aug 2024 17:46:48 -0400 Message-Id: <20240830214730.1621-4-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054510599116600 Content-Type: text/plain; charset="utf-8" Transition Xen's command line to being held in struct boot_info. No functional change intended. Signed-off-by: Daniel P. Smith Acked-by: Andrew Cooper --- xen/arch/x86/include/asm/bootinfo.h | 1 + xen/arch/x86/setup.c | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index e69feb1bb8be..d2ca077d2356 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -12,6 +12,7 @@ struct boot_info { unsigned int nr_mods; =20 const char *boot_loader_name; + const char *cmdline; }; =20 #endif diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 432b7d1701e4..a945fa10555f 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -276,6 +276,8 @@ static int __init cf_check parse_acpi_param(const char = *s) } custom_param("acpi", parse_acpi_param); =20 +static const char *cmdline_cook(const char *p, const char *loader_name); + static const module_t *__initdata initial_images; static struct boot_info __initdata *boot_info; =20 @@ -288,6 +290,13 @@ static void __init multiboot_to_bootinfo(multiboot_inf= o_t *mbi) info.boot_loader_name =3D (mbi->flags & MBI_LOADERNAME) ? __va(mbi->boot_loader_name) : "unknown"; =20 + /* Parse the command-line options. */ + if ( mbi->flags & MBI_CMDLINE ) + info.cmdline =3D cmdline_cook(__va(mbi->cmdline), + info.boot_loader_name); + else + info.cmdline =3D ""; + boot_info =3D &info; } =20 @@ -996,7 +1005,7 @@ static struct domain *__init create_dom0(const module_= t *image, =20 void asmlinkage __init noreturn __start_xen(unsigned long mbi_p) { - const char *memmap_type =3D NULL, *cmdline =3D ""; + const char *memmap_type =3D NULL; char *kextra; void *bsp_stack; struct cpu_info *info =3D get_cpu_info(), *bsp_info; @@ -1049,11 +1058,7 @@ void asmlinkage __init noreturn __start_xen(unsigned= long mbi_p) =20 multiboot_to_bootinfo(mbi); =20 - /* Parse the command-line options. */ - if ( mbi->flags & MBI_CMDLINE ) - cmdline =3D cmdline_cook(__va(mbi->cmdline), boot_info->boot_loade= r_name); - - if ( (kextra =3D strstr(cmdline, " -- ")) !=3D NULL ) + if ( (kextra =3D strstr(boot_info->cmdline, " -- ")) !=3D NULL ) { /* * Options after ' -- ' separator belong to dom0. @@ -1064,7 +1069,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) kextra +=3D 3; while ( kextra[1] =3D=3D ' ' ) kextra++; } - cmdline_parse(cmdline); + cmdline_parse(boot_info->cmdline); =20 /* Must be after command line argument parsing and before * allocing any xenheap structures wanted in lower memory. */ @@ -1094,7 +1099,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) =20 printk("Bootloader: %s\n", boot_info->boot_loader_name); =20 - printk("Command line: %s\n", cmdline); + printk("Command line: %s\n", boot_info->cmdline); =20 printk("Xen image load base address: %#lx\n", xen_phys_start); if ( hypervisor_name ) --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054513; cv=pass; d=zohomail.com; s=zohoarc; b=kcKQ+BB81LjAxXfrwbZmq8vu7KZiTW3Qq3WtQSjKjl+WZk5nLSH/5U2girVnLlFZGLb8tnJ9kM+8H+dj8reL9kdErt7yh8Nktk3Bud98zPtoLp1ze2mXgVZ2ZSokU7Fc68mKKDA2ao1DCzyP7gTFbSQRdFQdITzzzEdDvyW5hKM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054513; 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=AHDLb8T/b80h/7jv5pdrXG2adOVOnBNwTs0CHWLNuOc=; b=Ks4QQMTJxqk9yPBVdLY/C8lVeYxGE7DzNpvnFuwESS2uncR9a1DsC6pHKxw1oTGKX5NNn4+x0LAlfl0GZTk3hlKRHb2iu0wg0W8BVaE2SBIRrLrZKeuneGIBsxXul8A8VvdkpKi7LLo5DMYirNE7RYgzcR+t5JBtZnr/W3eDY0w= 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 172505451305932.755344185448735; Fri, 30 Aug 2024 14:48:33 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786657.1196284 (Exim 4.92) (envelope-from ) id 1sk9Td-0005dp-6n; Fri, 30 Aug 2024 21:48:17 +0000 Received: by outflank-mailman (output) from mailman id 786657.1196284; Fri, 30 Aug 2024 21:48: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 1sk9Td-0005di-1v; Fri, 30 Aug 2024 21:48:17 +0000 Received: by outflank-mailman (input) for mailman id 786657; Fri, 30 Aug 2024 21:48: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 1sk9Tc-0004BO-3H for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:48: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 8e3c4ba0-6719-11ef-99a1-01e77a169b0f; Fri, 30 Aug 2024 23:48:14 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054464189234.4870791649007; Fri, 30 Aug 2024 14:47:44 -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: 8e3c4ba0-6719-11ef-99a1-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1725054466; cv=none; d=zohomail.com; s=zohoarc; b=GCB88FNkVAkVJ4OErzRK+V0XldeNho6qax4qz6noXdyBPG+ZAZnwX9dhj0fBKxmgtsHfJryPRpR2X8e/kS/NQzK3rnNmBK8tJ71U1lZjsHcNWa8EVJeVFlTI9PXxEdql7U7vIId4Tg21Fnj8GUmNAV2SC0fslgMKHqHBQ5jy1/8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054466; 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=AHDLb8T/b80h/7jv5pdrXG2adOVOnBNwTs0CHWLNuOc=; b=Scg75RdV6n6c7HabrT/rBUhqT/e7pXIXZnfox1qAgmkzEhp3nkLluGFwHQGv5mlTEO603hc5MbAAvLhtFhtQMJegvxX218U/sCfc3dzGWL8H+j+O6ZVXHRQOymGekBx7CmyPbe0Wn9nJOgPdxTEqqDg3UvnoOzZG8lNQvcsOkpM= 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=1725054466; 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=AHDLb8T/b80h/7jv5pdrXG2adOVOnBNwTs0CHWLNuOc=; b=X1YUFfg/0Gkk09gpid6a1UXiO/0l3eDj08+fSxYHIxheOGJHh8uxik4mGZemS9X7 DhfYvj6pFSP7crpfiAvd/PKM0yQgmQ3X9bnI1Kzg+VT6NK/fIkdOIFrKqu791PxFD6E LEKVCa7zdRbCstp3wa9P0IFqhuOrmwZ8vpm3WzAs= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 04/44] x86/boot: move mmap info to boot info Date: Fri, 30 Aug 2024 17:46:49 -0400 Message-Id: <20240830214730.1621-5-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054514595116600 Content-Type: text/plain; charset="utf-8" Transition the memory map info to be held in struct boot_info. No functional change intended. Signed-off-by: Daniel P. Smith --- xen/arch/x86/include/asm/bootinfo.h | 5 +++++ xen/arch/x86/setup.c | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index d2ca077d2356..e785ed1c5982 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -8,11 +8,16 @@ #ifndef __XEN_X86_BOOTINFO_H__ #define __XEN_X86_BOOTINFO_H__ =20 +#include + struct boot_info { unsigned int nr_mods; =20 const char *boot_loader_name; const char *cmdline; + + paddr_t mmap_addr; + uint32_t mmap_length; }; =20 #endif diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index a945fa10555f..c6b45ced00ae 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -297,6 +297,12 @@ static void __init multiboot_to_bootinfo(multiboot_inf= o_t *mbi) else info.cmdline =3D ""; =20 + if ( mbi->flags & MBI_MEMMAP ) + { + info.mmap_addr =3D mbi->mmap_addr; + info.mmap_length =3D mbi->mmap_length; + } + boot_info =3D &info; } =20 @@ -1200,13 +1206,13 @@ void asmlinkage __init noreturn __start_xen(unsigne= d long mbi_p) { memmap_type =3D "Xen-e820"; } - else if ( mbi->flags & MBI_MEMMAP ) + else if ( boot_info->mmap_addr ) { memmap_type =3D "Multiboot-e820"; - while ( bytes < mbi->mmap_length && + while ( bytes < boot_info->mmap_length && e820_raw.nr_map < ARRAY_SIZE(e820_raw.map) ) { - memory_map_t *map =3D __va(mbi->mmap_addr + bytes); + memory_map_t *map =3D __va(boot_info->mmap_addr + bytes); =20 /* * This is a gross workaround for a BIOS bug. Some bootloaders= do --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054521; cv=pass; d=zohomail.com; s=zohoarc; b=amqsvP5qHdezicG+7uVhGnhxNubyEqZnd7qoqNabXKoPq5iPajJB0UnGfNXwM7VeAVR7/Zom0XLPiNxHXmqKIfvKUAYz7oS3ignDoepb5zgHoeqKwIj7lFCRrB4H/6273ARijxxv8pag3sXFEuMFXydt1EXpnv4JbuCLaxqvgAc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054521; 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=mTJb7A779pFDFU65rSxPgwx1Pg9D5EASEmZIOVhMBEs=; b=K7YuQDWi6MpPrz6cxHfLZARRZLNUBYU/wZ8mElQD9uPKoRPZciut6yGEu06mwZGKQ31/9zFCF1CgN1ACMdLXBq42354E+YSkp1ap+u5PzKC6I63YY6U9rx/MAH2OqKvZR/4/Mh0naRpB0mno2dNqD8BW0p2JYNcQ1nkdZi41dqQ= 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 1725054521101929.1839350868396; Fri, 30 Aug 2024 14:48:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786664.1196294 (Exim 4.92) (envelope-from ) id 1sk9Tn-0006FY-JU; Fri, 30 Aug 2024 21:48:27 +0000 Received: by outflank-mailman (output) from mailman id 786664.1196294; Fri, 30 Aug 2024 21:48:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9Tn-0006FR-GI; Fri, 30 Aug 2024 21:48:27 +0000 Received: by outflank-mailman (input) for mailman id 786664; Fri, 30 Aug 2024 21:48:26 +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 1sk9Tm-00065G-3m for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:48:26 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 93724ef6-6719-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:48:23 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054465277157.3636748835229; Fri, 30 Aug 2024 14:47:45 -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: 93724ef6-6719-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054467; cv=none; d=zohomail.com; s=zohoarc; b=hkPK0sEs6w6MyzjfL5eePRMtOl+7XRDZXnXEysR6hOmPZQp0i+YqQHaopu079OxveECVPhSL9jqzwNax5Z6hyI/xw7d+eXO3fthnnZvNpKjEgS2jUHN9zBOn3s63OpOYSh6m1JBYxXOg1cSJCvophvdgaza9z47Fv6XREhpyMEM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054467; 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=mTJb7A779pFDFU65rSxPgwx1Pg9D5EASEmZIOVhMBEs=; b=hFIlEOzWBo5HwsMzBvPdqr6stCKeAeAK6RteSAIa2+Mom5JQSymXgd+e3NkL7xp4uNTCJfbq6+7SMcpb0gxazsElqTTzrnIKKBKRyxK/Ak5LIY3O42T9Ua+Fn5o9shioPpyU0mO8GS2psmjELq94h+lwxz/uwrnlZRKLiSzUSyY= 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=1725054467; 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=mTJb7A779pFDFU65rSxPgwx1Pg9D5EASEmZIOVhMBEs=; b=BnDNhT6E9IBxgN1VXSPCDDdxGikEmeMUGoqL9KYXIeObS5b5kpkTR5msUBxhNbmy 6kY/dk05jjaEQVwq9gL2a0Mp/UtNVS8+m03p9EhZx1PCitPVB+iuHxGyPD7VLCKGwC6 xiACIYvbAf4JE8euEXCZAB7GkkYX+m8PGb/3Ftms= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 05/44] x86/boot: introduce struct boot_module Date: Fri, 30 Aug 2024 17:46:50 -0400 Message-Id: <20240830214730.1621-6-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054522668116600 Content-Type: text/plain; charset="utf-8" This will introduce a new struct boot_module to provide a rich state representation around modules provided by the boot loader. Support is for 64 boot modules, one held in reserve for Xen, and up to 63 can be provided by = the boot loader. The array of struct boot_modules will be accessible via a reference held in struct boot_info. A temporary `early_mod` parameter is included in struct boot_module to ease= the transition from using Multiboot v1 structures over to struct boot_module. O= nce the transition is complete, the parameter will be dropped from the structur= e. Signed-off-by: Daniel P. Smith --- xen/arch/x86/include/asm/bootinfo.h | 6 ++++++ xen/arch/x86/setup.c | 19 ++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index e785ed1c5982..844262495962 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -8,10 +8,16 @@ #ifndef __XEN_X86_BOOTINFO_H__ #define __XEN_X86_BOOTINFO_H__ =20 +#include #include =20 +struct boot_module { + module_t *early_mod; +}; + struct boot_info { unsigned int nr_mods; + struct boot_module *mods; =20 const char *boot_loader_name; const char *cmdline; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index c6b45ced00ae..28fdbf4d4c2b 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -278,12 +278,17 @@ custom_param("acpi", parse_acpi_param); =20 static const char *cmdline_cook(const char *p, const char *loader_name); =20 +/* Max number of boot modules a bootloader can provide in addition to Xen = */ +#define MAX_NR_BOOTMODS 63 + static const module_t *__initdata initial_images; static struct boot_info __initdata *boot_info; =20 -static void __init multiboot_to_bootinfo(multiboot_info_t *mbi) +static void __init multiboot_to_bootinfo(multiboot_info_t *mbi, module_t *= mods) { static struct boot_info __initdata info; + static struct boot_module __initdata boot_mods[MAX_NR_BOOTMODS + 1]; + unsigned int i; =20 info.nr_mods =3D mbi->mods_count; =20 @@ -303,6 +308,14 @@ static void __init multiboot_to_bootinfo(multiboot_inf= o_t *mbi) info.mmap_length =3D mbi->mmap_length; } =20 + info.mods =3D boot_mods; + + for ( i=3D0; i < info.nr_mods; i++ ) + boot_mods[i].early_mod =3D &mods[i]; + + /* map the last mb module for xen entry */ + boot_mods[info.nr_mods].early_mod =3D &mods[info.nr_mods]; + boot_info =3D &info; } =20 @@ -1062,7 +1075,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) mod =3D __va(mbi->mods_addr); } =20 - multiboot_to_bootinfo(mbi); + multiboot_to_bootinfo(mbi, mod); =20 if ( (kextra =3D strstr(boot_info->cmdline, " -- ")) !=3D NULL ) { @@ -1164,7 +1177,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) bootsym(boot_edd_info_nr)); =20 /* Check that we have at least one Multiboot module. */ - if ( !(mbi->flags & MBI_MODULES) || (boot_info->nr_mods =3D=3D 0) ) + if ( boot_info->nr_mods =3D=3D 0 ) panic("dom0 kernel not specified. Check bootloader configuration\n= "); =20 /* Check that we don't have a silly number of modules. */ --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054526; cv=pass; d=zohomail.com; s=zohoarc; b=K+CsBGCExK/fYfU//X+fLmMUnIataRnJAyDqHenDA0krt+mw9W1l8wdgxb2y/5jLC/MEkpqjxghBVmpLhoVs6HyJV73S1Qsw+R2xD1XMwCHPGefW5vb8k8Arjky9qtHsYE48jM+T3+IY4vi/tyQ+fY3wkAcJtglFzcdR4z1qtck= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054526; 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=0gXaC5isg4IrQFsCJP9Fq77RhO29MxC4nrBXRRPDF6A=; b=YTqe46T8bgG31llyiwAosH96T2jm5iwhxyw153pce47O18tlroJidp7vHbHZYUlWoyZ4Ncbm4qUOvV1z26T2YZewNiu2GyD0za+t/tu06iVpbMrMoHpSF5C6b9h6RF4az+7O5QLQtWhHsyKaqd1BmuUBR7RvXAvglBcVts9wcrU= 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 1725054526940953.9452354435521; Fri, 30 Aug 2024 14:48:46 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786670.1196304 (Exim 4.92) (envelope-from ) id 1sk9Ts-0006f6-Ra; Fri, 30 Aug 2024 21:48:32 +0000 Received: by outflank-mailman (output) from mailman id 786670.1196304; Fri, 30 Aug 2024 21:48:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9Ts-0006ex-OG; Fri, 30 Aug 2024 21:48:32 +0000 Received: by outflank-mailman (input) for mailman id 786670; Fri, 30 Aug 2024 21:48:31 +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 1sk9Tr-00065G-NV for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:48:31 +0000 Received: from sender3-of-o57.zoho.com (sender3-of-o57.zoho.com [136.143.184.57]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 97c23d19-6719-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:48:30 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054466365953.1827755781716; Fri, 30 Aug 2024 14:47:46 -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: 97c23d19-6719-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054468; cv=none; d=zohomail.com; s=zohoarc; b=n1vzAdrh/oyymzXFaRv9pOKnwJwtAiTcbY4L6gTtrg/4p6m6n+KMDsrPryMXD1gkFIdQ5LtNdUXOSZbXgH1Pahaq8ObLts0809zhLFn01lUmynhWs33LZ7EpTOEPqOZKm79E1f9iPdL5KLOUKP/uGhxAZA7UqStmpeM578wkoMg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054468; 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=0gXaC5isg4IrQFsCJP9Fq77RhO29MxC4nrBXRRPDF6A=; b=Krfmu32iuu+u5S+3VHWecVIFHkV/yyapQqzJo6sUO2gTafSnjBR6FwLhjimkCHfWLeWU3pJ9QqxXZZwJna6Lu7vTJHOhSk91BqWsxtFoFnSIOoXAr+nkMGKjfYZ5DecZeJyQ4ssTI+FDY8rfJBifDxqi2hQeR3axKWIqjwm3Ypo= 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=1725054468; 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=0gXaC5isg4IrQFsCJP9Fq77RhO29MxC4nrBXRRPDF6A=; b=uppunk61v82ki+dFT/FCqIqRyq9dWDem9hk0pXj+dXLWsp6ezjWIq+I2UskrmvIn rHWO5A+QYDLGf7b3dQv9GxPETcA7lXWMtEbFzUCOxSkegebHf69BtdQbYh6E/N+Dzt+ 4gAx0rkCsmgHbg0dSI2SmCqG7EkIycZ0wDJGTENw= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 06/44] x86/boot: convert consider_modules to struct boot_module Date: Fri, 30 Aug 2024 17:46:51 -0400 Message-Id: <20240830214730.1621-7-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054528649116600 Content-Type: text/plain; charset="utf-8" To start transitioning consider_modules() over to struct boot_module, begin with taking the array of struct boot_modules but use the temporary struct element early_mod. No functional change intended. Signed-off-by: Daniel P. Smith --- xen/arch/x86/setup.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 28fdbf4d4c2b..8912956ee7f1 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -632,7 +632,7 @@ static void __init noinline move_xen(void) #undef BOOTSTRAP_MAP_LIMIT =20 static uint64_t __init consider_modules( - uint64_t s, uint64_t e, uint32_t size, const module_t *mod, + uint64_t s, uint64_t e, uint32_t size, const struct boot_module *mods, unsigned int nr_mods, unsigned int this_mod) { unsigned int i; @@ -642,20 +642,20 @@ static uint64_t __init consider_modules( =20 for ( i =3D 0; i < nr_mods ; ++i ) { - uint64_t start =3D (uint64_t)mod[i].mod_start << PAGE_SHIFT; - uint64_t end =3D start + PAGE_ALIGN(mod[i].mod_end); + uint64_t start =3D (uint64_t)mods[i].early_mod->mod_start << PAGE_= SHIFT; + uint64_t end =3D start + PAGE_ALIGN(mods[i].early_mod->mod_end); =20 if ( i =3D=3D this_mod ) continue; =20 if ( s < end && start < e ) { - end =3D consider_modules(end, e, size, mod + i + 1, + end =3D consider_modules(end, e, size, &mods[i + 1], nr_mods - i - 1, this_mod - i - 1); if ( end ) return end; =20 - return consider_modules(s, start, size, mod + i + 1, + return consider_modules(s, start, size, &mods[i + 1], nr_mods - i - 1, this_mod - i - 1); } } @@ -1447,7 +1447,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) { /* Don't overlap with modules. */ end =3D consider_modules(s, e, reloc_size + mask, - mod, boot_info->nr_mods, -1); + boot_info->mods, boot_info->nr_mods, -1= ); end &=3D ~mask; } else @@ -1482,7 +1482,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) continue; =20 /* Don't overlap with other modules (or Xen itself). */ - end =3D consider_modules(s, e, size, mod, + end =3D consider_modules(s, e, size, boot_info->mods, boot_info->nr_mods + relocated, j); =20 if ( highmem_start && end > highmem_start ) @@ -1509,7 +1509,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) while ( !kexec_crash_area.start ) { /* Don't overlap with modules (or Xen itself). */ - e =3D consider_modules(s, e, PAGE_ALIGN(kexec_crash_area.size)= , mod, + e =3D consider_modules(s, e, PAGE_ALIGN(kexec_crash_area.size)= , boot_info->mods, boot_info->nr_mods + relocated, -1); if ( s >=3D e ) break; --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054531; cv=pass; d=zohomail.com; s=zohoarc; b=czTbz5Ts0Owl0rcNQE4O14n7sR8hPRO6rmR704JFoWKICvbUwIz43UM5g4zeRmypHywYokhZBfxSq4dA9xNMuvWtA32p7uCeIBiCaC7sN4rvrf6yQEwu0Ge0AzDiSvg0+SaFuVxHSgw86SJ1JKfgnbDgFsY/Xi1bZZ6gJrENQUs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054531; 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=fxUow580sXI5NW+SdFuYYRTiCwP+vMd1bOEnrXKFUj4=; b=M7XQYt7PYUb7RhcpZNd/GKOAh1My58stJioGdzMA4Viem/+9jPq8s1oGaE21ERVXyIdPW1Gf4U/v4bmFEDmHjhYbydmOZ1CRemOkTuclyf6Kl0UFPKYgsCqx+E81LKaBECCVL/cWr3EpnTQB6n+5hvtF0+NkKnU62oa//nBK2Rs= 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 1725054531690278.20413169490496; Fri, 30 Aug 2024 14:48:51 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786674.1196313 (Exim 4.92) (envelope-from ) id 1sk9U0-0007DY-4R; Fri, 30 Aug 2024 21:48:40 +0000 Received: by outflank-mailman (output) from mailman id 786674.1196313; Fri, 30 Aug 2024 21:48:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9U0-0007D9-0h; Fri, 30 Aug 2024 21:48:40 +0000 Received: by outflank-mailman (input) for mailman id 786674; Fri, 30 Aug 2024 21:48: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 1sk9Tz-00065G-3d for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:48:39 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 9c1d208c-6719-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:48:37 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054467441405.8525706873397; Fri, 30 Aug 2024 14:47:47 -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: 9c1d208c-6719-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054469; cv=none; d=zohomail.com; s=zohoarc; b=hIA7N2SJZp89HintuCk+GAjbeXw1wAB4oYeGTSk2lJS5U9LoFNlQZzBCdw/eYsYnnZXkNN3pNzeNuWTkoeLuu1ppCn+UE22Ct2rq89eZI04Z6S0+WhIJQzlU5V46M4F/A+crL8HnA+pGB9tASmU6dtYuOLDzCkSO5+4ZjV22rZg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054469; 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=fxUow580sXI5NW+SdFuYYRTiCwP+vMd1bOEnrXKFUj4=; b=mCMqZzAeeWwKuBQbud9mZdBYmAMGXR3G3uMXd8c3M3LwJ6UX2YfQW9uzjiwEJ5A7Z41uhRE2QbY0mqMY9x9krSETPoBTaFghijgkEOtqPC4iNCUmf0Ph9xwUNOKeGG89OS7zAXMGs9FPO1IfHiSb4WNpW4xchDgNz32IlVLFHBk= 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=1725054469; 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=fxUow580sXI5NW+SdFuYYRTiCwP+vMd1bOEnrXKFUj4=; b=nAiTT+NBAuq1xI+ZCeVXuPl9MrtoOoqzE4vnjoPfgYSGwDZWEbPI+yFmlVkogkpK x6Ha9alBUZJbRDFd7WPTlP4LBNUqq3uAfXrA6g0A79+q0Z/06zExLPPhvPWV2DeRHHY YwnsUSmN2k8KU3kfXl8jBWYE3tMuz5PHE3pC8hsc= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 07/44] x86/boot: move headroom to boot modules Date: Fri, 30 Aug 2024 17:46:52 -0400 Message-Id: <20240830214730.1621-8-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054532670116600 Content-Type: text/plain; charset="utf-8" The purpose of struct boot_module is to encapsulate the state of boot modul= es. Doing locates boot module state with its respective boot module, reduces globals and multiple state variables being passed around. It also lays the ground work for hyperlaunch where more multiple instances of these state variables like headroom will be needed. Signed-off-by: Daniel P. Smith --- xen/arch/x86/include/asm/bootinfo.h | 1 + xen/arch/x86/setup.c | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 844262495962..3e0e36df096b 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -13,6 +13,7 @@ =20 struct boot_module { module_t *early_mod; + unsigned long headroom; }; =20 struct boot_info { diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 8912956ee7f1..fd6cc7fac907 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1031,7 +1031,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) unsigned int initrdidx, num_parked =3D 0; multiboot_info_t *mbi; module_t *mod; - unsigned long nr_pages, raw_max_page, modules_headroom, module_map[1]; + unsigned long nr_pages, raw_max_page, module_map[1]; int i, j, e820_warn =3D 0, bytes =3D 0; unsigned long eb_start, eb_end; bool acpi_boot_table_init_done =3D false, relocated =3D false; @@ -1390,7 +1390,9 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) mod[boot_info->nr_mods].mod_end =3D __2M_rwdata_end - _stext; } =20 - modules_headroom =3D bzimage_headroom(bootstrap_map(mod), mod->mod_end= ); + boot_info->mods[0].headroom =3D bzimage_headroom( + bootstrap_map(boot_info->mods[0].early_mod), + boot_info->mods[0].early_mod->mod_end); bootstrap_map(NULL); =20 #ifndef highmem_start @@ -1475,8 +1477,10 @@ void asmlinkage __init noreturn __start_xen(unsigned= long mbi_p) * decompressor overheads of mod[0] (the dom0 kernel). When we * move mod[0], we incorporate this as extra space at the star= t. */ - unsigned long headroom =3D j ? 0 : modules_headroom; - unsigned long size =3D PAGE_ALIGN(headroom + mod[j].mod_end); + struct boot_module *bm =3D &boot_info->mods[j]; + unsigned long size; + + size =3D PAGE_ALIGN(bm->headroom + mod[j].mod_end); =20 if ( mod[j].reserved ) continue; @@ -1489,14 +1493,14 @@ void asmlinkage __init noreturn __start_xen(unsigne= d long mbi_p) continue; =20 if ( s < end && - (headroom || + (bm->headroom || ((end - size) >> PAGE_SHIFT) > mod[j].mod_start) ) { - move_memory(end - size + headroom, + move_memory(end - size + bm->headroom, (uint64_t)mod[j].mod_start << PAGE_SHIFT, mod[j].mod_end); mod[j].mod_start =3D (end - size) >> PAGE_SHIFT; - mod[j].mod_end +=3D headroom; + mod[j].mod_end +=3D bm->headroom; mod[j].reserved =3D 1; } } @@ -1523,7 +1527,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) #endif } =20 - if ( modules_headroom && !mod->reserved ) + if ( boot_info->mods[0].headroom && !mod->reserved ) panic("Not enough memory to relocate the dom0 kernel image\n"); for ( i =3D 0; i < boot_info->nr_mods; ++i ) { @@ -2077,7 +2081,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) * We're going to setup domain0 using the module(s) that we stashed sa= fely * above our heap. The second module, if present, is an initrd ramdisk. */ - dom0 =3D create_dom0(mod, modules_headroom, + dom0 =3D create_dom0(mod, boot_info->mods[0].headroom, initrdidx < boot_info->nr_mods ? mod + initrdidx : = NULL, kextra, boot_info->boot_loader_name); if ( !dom0 ) --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054542; cv=pass; d=zohomail.com; s=zohoarc; b=mUcpjHxaBIhMiYeB5mVNKswUYZqghTUcJIT9Aunx2Bj+3Twjwv45J2Mf3Shj268CaBdg2NStYpWICmbA9TEna4JFdvlSH4M48Glou87KDFzcRR9WDTWKyPteg8Q/WjFnDYFuUXg+adkJ+yArrDRWof1dAkcIpDo391bn9gw3kkM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054542; 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=bHmAH7Z09uDCvq9Lv4ibJKqcWjY/D6qrWQ62O+CCfoc=; b=OV7fK2CcuWFS/Vy6PhgjEWIPIbVTGu5OImH7DRuZFU2ToMOqzxCZByQ0tiWqmy+RijPb2T/tzJl2pcVa4yE4lKYgpSA8TfmcbcY4X89duldg5QV3KTAXEVEgExGkvHlnYyIy00jBDd+saN7mfyzaRnsqn1PqWSlh2eJXOGsTNlA= 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 1725054542390835.3900115626395; Fri, 30 Aug 2024 14:49:02 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786680.1196324 (Exim 4.92) (envelope-from ) id 1sk9U7-0007mk-DW; Fri, 30 Aug 2024 21:48:47 +0000 Received: by outflank-mailman (output) from mailman id 786680.1196324; Fri, 30 Aug 2024 21:48:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9U7-0007mX-9J; Fri, 30 Aug 2024 21:48:47 +0000 Received: by outflank-mailman (input) for mailman id 786680; Fri, 30 Aug 2024 21:48:45 +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 1sk9U5-00065G-RD for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:48:45 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a038ab1a-6719-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:48:44 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 172505446851348.39122552142521; Fri, 30 Aug 2024 14:47:48 -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: a038ab1a-6719-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054470; cv=none; d=zohomail.com; s=zohoarc; b=ETp14un5/oRlpw59XDSha+sLCsPX7dzvMDm6v/B7GqUW/ai3XLcyLu9VlqpQz0FLlPwTAMuR31saMVgpnMG7tGcTffPRfVYvbl0HdiqMRONVF3bViygDQjaiS5UkH6VGz3EaAbBz42ueYxMvhbD8EnY1GSK1/FBJjZ/Wf0X4Giw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054470; 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=bHmAH7Z09uDCvq9Lv4ibJKqcWjY/D6qrWQ62O+CCfoc=; b=hy/WDeoEtxLbSTVg1Y/K8RabOYXbLJTQs5snF3J8mwJtPiQrZYi85HgcKfyqJVQzEY80BD03AbuFnKxVozodPxvEDhSWeDf1jVFW1eo4erv4sBYU7tM3TlLHqjqaQ0Ymk8XTrng8ZPln9aLN8FUbB7rKZUYf0BZVVn0r1HK3IMY= 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=1725054470; 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=bHmAH7Z09uDCvq9Lv4ibJKqcWjY/D6qrWQ62O+CCfoc=; b=vWIFzzwO5EKR5BbYzso1Z775SxcdDEpJVFG4Jllb+38PeR2RIWaO8nofWBvRSmQV LXeJL5myJc/YX+175AdpzdModS4G4fpDYGvAon/4d9gClKDo/bxCWd8QhoevMIuYYJi 4ZnIM2bZg8v5wfOHJtX31khvPjxBKqUasTk7ZzhE= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 08/44] x86/boot: convert setup.c mod refs to early_mod Date: Fri, 30 Aug 2024 17:46:53 -0400 Message-Id: <20240830214730.1621-9-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054542749116600 Content-Type: text/plain; charset="utf-8" To allow a slow conversion of x86 over to struct boot_module, start with replacing all references to struct mod to the early_mod element of struct boot_module. These serves twofold, first to allow the incremental transition from struct mod fields to struct boot_module fields. The second is to allow the conversion of function definitions from taking struct mod parameters to accepting struct boot_module as needed when a transitioned field will be accessed. Signed-off-by: Daniel P. Smith --- xen/arch/x86/setup.c | 61 ++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index fd6cc7fac907..82a4375683d2 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1360,15 +1360,15 @@ void asmlinkage __init noreturn __start_xen(unsigne= d long mbi_p) set_kexec_crash_area_size((u64)nr_pages << PAGE_SHIFT); kexec_reserve_area(); =20 - initial_images =3D mod; + initial_images =3D boot_info->mods[0].early_mod; =20 for ( i =3D 0; !efi_enabled(EFI_LOADER) && i < boot_info->nr_mods; i++= ) { - if ( mod[i].mod_start & (PAGE_SIZE - 1) ) + if ( boot_info->mods[i].early_mod->mod_start & (PAGE_SIZE - 1) ) panic("Bootloader didn't honor module alignment request\n"); - mod[i].mod_end -=3D mod[i].mod_start; - mod[i].mod_start >>=3D PAGE_SHIFT; - mod[i].reserved =3D 0; + boot_info->mods[i].early_mod->mod_end -=3D boot_info->mods[i].earl= y_mod->mod_start; + boot_info->mods[i].early_mod->mod_start >>=3D PAGE_SHIFT; + boot_info->mods[i].early_mod->reserved =3D 0; } =20 /* @@ -1379,6 +1379,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) =20 if ( xen_phys_start ) { + int idx =3D boot_info->nr_mods; relocated =3D true; =20 /* @@ -1386,8 +1387,8 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) * respective reserve_e820_ram() invocation below. No need to * query efi_boot_mem_unused() here, though. */ - mod[boot_info->nr_mods].mod_start =3D virt_to_mfn(_stext); - mod[boot_info->nr_mods].mod_end =3D __2M_rwdata_end - _stext; + boot_info->mods[idx].early_mod->mod_start =3D virt_to_mfn(_stext); + boot_info->mods[idx].early_mod->mod_end =3D __2M_rwdata_end - _ste= xt; } =20 boot_info->mods[0].headroom =3D bzimage_headroom( @@ -1480,9 +1481,9 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) struct boot_module *bm =3D &boot_info->mods[j]; unsigned long size; =20 - size =3D PAGE_ALIGN(bm->headroom + mod[j].mod_end); + size =3D PAGE_ALIGN(bm->headroom + bm->early_mod->mod_end); =20 - if ( mod[j].reserved ) + if ( boot_info->mods[j].early_mod->reserved ) continue; =20 /* Don't overlap with other modules (or Xen itself). */ @@ -1494,14 +1495,14 @@ void asmlinkage __init noreturn __start_xen(unsigne= d long mbi_p) =20 if ( s < end && (bm->headroom || - ((end - size) >> PAGE_SHIFT) > mod[j].mod_start) ) + ((end - size) >> PAGE_SHIFT) > bm->early_mod->mod_start)= ) { move_memory(end - size + bm->headroom, - (uint64_t)mod[j].mod_start << PAGE_SHIFT, - mod[j].mod_end); - mod[j].mod_start =3D (end - size) >> PAGE_SHIFT; - mod[j].mod_end +=3D bm->headroom; - mod[j].reserved =3D 1; + (uint64_t)bm->early_mod->mod_start << PAGE_SHI= FT, + bm->early_mod->mod_end); + bm->early_mod->mod_start =3D (end - size) >> PAGE_SHIFT; + bm->early_mod->mod_end +=3D bm->headroom; + bm->early_mod->reserved =3D 1; } } =20 @@ -1527,13 +1528,15 @@ void asmlinkage __init noreturn __start_xen(unsigne= d long mbi_p) #endif } =20 - if ( boot_info->mods[0].headroom && !mod->reserved ) + if ( boot_info->mods[0].headroom && !boot_info->mods[0].early_mod->res= erved ) panic("Not enough memory to relocate the dom0 kernel image\n"); for ( i =3D 0; i < boot_info->nr_mods; ++i ) { - uint64_t s =3D (uint64_t)mod[i].mod_start << PAGE_SHIFT; + uint64_t s =3D (uint64_t)boot_info->mods[i].early_mod->mod_start + << PAGE_SHIFT; =20 - reserve_e820_ram(&boot_e820, s, s + PAGE_ALIGN(mod[i].mod_end)); + reserve_e820_ram(&boot_e820, s, + s + PAGE_ALIGN(boot_info->mods[i].early_mod->mod_= end)); } =20 if ( !xen_phys_start ) @@ -1611,8 +1614,9 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) map_e =3D boot_e820.map[j].addr + boot_e820.map[j].size; for ( j =3D 0; j < boot_info->nr_mods; ++j ) { - uint64_t end =3D pfn_to_paddr(mod[j].mod_start) + - mod[j].mod_end; + uint64_t end =3D pfn_to_paddr( + boot_info->mods[j].early_mod->mod_start= ) + + boot_info->mods[j].early_mod->mod_end; =20 if ( map_e < end ) map_e =3D end; @@ -1686,11 +1690,13 @@ void asmlinkage __init noreturn __start_xen(unsigne= d long mbi_p) =20 for ( i =3D 0; i < boot_info->nr_mods; ++i ) { - set_pdx_range(mod[i].mod_start, - mod[i].mod_start + PFN_UP(mod[i].mod_end)); - map_pages_to_xen((unsigned long)mfn_to_virt(mod[i].mod_start), - _mfn(mod[i].mod_start), - PFN_UP(mod[i].mod_end), PAGE_HYPERVISOR); + set_pdx_range(boot_info->mods[i].early_mod->mod_start, + boot_info->mods[i].early_mod->mod_start + + PFN_UP(boot_info->mods[i].early_mod->mod_end)); + map_pages_to_xen( + (unsigned long)mfn_to_virt(boot_info->mods[i].early_mod->mod_s= tart), + _mfn(boot_info->mods[i].early_mod->mod_start), + PFN_UP(boot_info->mods[i].early_mod->mod_end), PAGE_HYPERVISOR= ); } =20 #ifdef CONFIG_KEXEC @@ -2081,8 +2087,9 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) * We're going to setup domain0 using the module(s) that we stashed sa= fely * above our heap. The second module, if present, is an initrd ramdisk. */ - dom0 =3D create_dom0(mod, boot_info->mods[0].headroom, - initrdidx < boot_info->nr_mods ? mod + initrdidx : = NULL, + dom0 =3D create_dom0(boot_info->mods[0].early_mod, boot_info->mods[0].= headroom, + initrdidx < boot_info->nr_mods ? + boot_info->mods[initrdidx].early_mod : NULL, kextra, boot_info->boot_loader_name); if ( !dom0 ) panic("Could not set up DOM0 guest OS\n"); --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725055035; cv=pass; d=zohomail.com; s=zohoarc; b=J9IOKetszipn3Ze1faBAVsaxblqp9Hjsvtl9rYVGtL44A1X40FUDRNIni5VE9p5xD0DrvotXRdl8nTcJI9nvFiNQo+L0JdCemXwlVxnD6/0ZlWyiF5ugPlqmxFmt/Osdx1GEIN1UtGGwCj/Wh6PPHCV14hsafP/zaWAr87azm8o= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725055035; 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=Rr9hHCtWc2lrRTZc+Cw5XDkXel6MHlg11c0GsYwyIeY=; b=mMdkLLtwrxohZO9sTot8+bh9xz3672ow05dXhNHrl6YWCSchfOsTkEq/QA/eH10TbxOwRHXKD4ZJMNGE4/U/jWM3pMM/CyrZJo3pr5mm0qfpplvxc7wZmLhzg3PCO7weXRSztNbqrTolTtF0MhSDcQVFmPtKiKMgL5WIVrjSrcA= 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 1725055035788401.54705967793313; Fri, 30 Aug 2024 14:57:15 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786836.1196644 (Exim 4.92) (envelope-from ) id 1sk9bx-0001vn-TH; Fri, 30 Aug 2024 21:56:53 +0000 Received: by outflank-mailman (output) from mailman id 786836.1196644; Fri, 30 Aug 2024 21:56:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9bx-0001v6-NO; Fri, 30 Aug 2024 21:56:53 +0000 Received: by outflank-mailman (input) for mailman id 786836; Fri, 30 Aug 2024 21:56:52 +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 1sk9UE-00065G-M1 for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:48:54 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a554d6ac-6719-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:48:53 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 172505446971316.97653174204663; Fri, 30 Aug 2024 14:47:49 -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: a554d6ac-6719-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054471; cv=none; d=zohomail.com; s=zohoarc; b=hHj7CnoyPUwHL2we26yrGRBkLa+C6Tfl+J2xTIeFDxw04Gh5hyGvL8FtkCH0ii1VirKxvnOEd43qMLBka8KNihEdeVAgldD/Vp2yN6/w6EW2O6Tumu/oh7iM9TBaa9q6PqrPzJLE2YydT/ydXLdtkBgT7kkb6Xwyn2PGRzX/PeY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054471; 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=Rr9hHCtWc2lrRTZc+Cw5XDkXel6MHlg11c0GsYwyIeY=; b=mJKWP48CQM2TVPXSnpmc6D6RvEmbtJbe/V8AePBbOwTgu5+yBMyl7JC6v6KUqFrTyR3/mUwgO9cZnYus0RHlIje0xZ17e5ew5YOCPybBBmmY/Z+XmnliPkkJvJ2J4OEqBLPd3P/xxzGDrcxgPx/SNVpLrlTjpMbedOmUss0+I7U= 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=1725054471; 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=Rr9hHCtWc2lrRTZc+Cw5XDkXel6MHlg11c0GsYwyIeY=; b=DzIWdZhCLOVB5scc2EYji95CnsXAZG5GMStqp6sZ5SQqgiHzPD19Pnf8WqC2dXL6 VTmNJqTQfYCb+eb+O0/QC3qrfVzo3r4xxpfDntVkWBTBojXyYItS3nU34BtCQxEIbRi Ul7nGtap4QYWs/4eM6QZ8KVicBxP8FT9R3YvO00w= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: Andrew Cooper , jason.andryuk@amd.com, christopher.w.clark@gmail.com, "Daniel P . Smith" , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 09/44] x86/boot: split bootstrap_map_addr() out of bootstrap_map() Date: Fri, 30 Aug 2024 17:46:54 -0400 Message-Id: <20240830214730.1621-10-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725055037202116600 Content-Type: text/plain; charset="utf-8" From: Andrew Cooper Using an interface based on addresses directly, not modules. No functional change. Signed-off-by: Andrew Cooper Signed-off-by: Daniel P. Smith --- xen/arch/x86/include/asm/setup.h | 1 + xen/arch/x86/setup.c | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/se= tup.h index d75589178b91..15dcb62cb5ac 100644 --- a/xen/arch/x86/include/asm/setup.h +++ b/xen/arch/x86/include/asm/setup.h @@ -34,6 +34,7 @@ void setup_io_bitmap(struct domain *d); =20 unsigned long initial_images_nrpages(nodeid_t node); void discard_initial_images(void); +void *bootstrap_map_addr(uint64_t start, uint64_t end); void *bootstrap_map(const module_t *mod); =20 int remove_xen_ranges(struct rangeset *r); diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 82a4375683d2..d4f557b4c50d 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -436,24 +436,22 @@ static void __init normalise_cpu_order(void) * Ensure a given physical memory range is present in the bootstrap mappin= gs. * Use superpage mappings to ensure that pagetable memory needn't be alloc= ated. */ -void *__init bootstrap_map(const module_t *mod) +void *__init bootstrap_map_addr(uint64_t start, uint64_t end) { static unsigned long __initdata map_cur =3D BOOTSTRAP_MAP_BASE; - uint64_t start, end, mask =3D (1L << L2_PAGETABLE_SHIFT) - 1; + uint64_t mask =3D (1L << L2_PAGETABLE_SHIFT) - 1; void *ret; =20 if ( system_state !=3D SYS_STATE_early_boot ) - return mod ? mfn_to_virt(mod->mod_start) : NULL; + return end ? maddr_to_virt(start) : NULL; =20 - if ( !mod ) + if ( !end ) { destroy_xen_mappings(BOOTSTRAP_MAP_BASE, BOOTSTRAP_MAP_LIMIT); map_cur =3D BOOTSTRAP_MAP_BASE; return NULL; } =20 - start =3D (uint64_t)mod->mod_start << PAGE_SHIFT; - end =3D start + mod->mod_end; if ( start >=3D end ) return NULL; =20 @@ -469,6 +467,15 @@ void *__init bootstrap_map(const module_t *mod) return ret; } =20 +void *__init bootstrap_map(const module_t *mod) +{ + if ( !mod ) + return bootstrap_map_addr(0, 0); + + return bootstrap_map_addr(pfn_to_paddr(mod->mod_start), + pfn_to_paddr(mod->mod_start) + mod->mod_end); +} + static void __init move_memory( uint64_t dst, uint64_t src, unsigned int size) { --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054998; cv=pass; d=zohomail.com; s=zohoarc; b=QyZsYQcwJuBCLMZ88NBUr//54UX5ImkhttU+xa7uboay/p5Nd+32fSCblSXfIK5VUeGSrO4jdYS5XmfXUpqBSBAzMWXLg9IEfupu6RiogWWvgL0QFoGK0xILc6riP3zocTKzX6GQs5OKic73s4CqJxmweqbnusd5tducipKU9gQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054998; 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=Q0pSe2RfpDMnhePm+Qzlz8IPsCD571W7svuapogeYRE=; b=JHxm9F33a2ZEpEoB+PLy5/x2YUzU0B/BMVHb2v3IjjooQIOmbmSwQsgia8JUO+QW1UlcDWvTPB82BOE2Z12mcuqIt6U4DTDxZRdJ0wR8rclo8poUJjto/LRCCFdzc+ZvGcACKcVXdAFeCdRuK4ReUO8FBpgdn6W3lyFlGKqr890= 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 1725054998835503.20723299521865; Fri, 30 Aug 2024 14:56:38 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786759.1196515 (Exim 4.92) (envelope-from ) id 1sk9bS-0002nK-M0; Fri, 30 Aug 2024 21:56:22 +0000 Received: by outflank-mailman (output) from mailman id 786759.1196515; Fri, 30 Aug 2024 21:56:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9bS-0002kK-CL; Fri, 30 Aug 2024 21:56:22 +0000 Received: by outflank-mailman (input) for mailman id 786759; Fri, 30 Aug 2024 21:56:21 +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 1sk9UM-00065G-PO for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:49:02 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id aa3bf009-6719-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:49:01 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 172505447081714.54061475318008; Fri, 30 Aug 2024 14:47:50 -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: aa3bf009-6719-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054472; cv=none; d=zohomail.com; s=zohoarc; b=W+sWhKs2BNLPpb3UGBqNNQ3s/h+I85dvSqj/MVRDT2a5B2IcR6G/dUXEvuH598i1uSjBYpDqoak4a8XnMdVnH33X01k6etUA+eOsvpi92Ye9NyD/uhOrS78rt52nzgJ1guNzH3SDCBUW/KXVVvP4WKpPKt11maAxQQEePsZTXqQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054472; 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=Q0pSe2RfpDMnhePm+Qzlz8IPsCD571W7svuapogeYRE=; b=Dr2m674YWJRHRI16wy+9BAmDVULJAzf01TaxRpWrAH+JuvG1KmL3xIPpogks/IgFqgCAojJ17pKTJEhPCZR/GNF9wj/JrS+Ffyoo/SIvsi28vFJPmWULj8MsIT+DpZHSHWVdtBZscxTWlJLre0cRKBTwAOWH3WVjCTIJPe18aQM= 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=1725054472; 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=Q0pSe2RfpDMnhePm+Qzlz8IPsCD571W7svuapogeYRE=; b=eWCZwr2S5GiGAD7qVm/FCN7HABPeVPVJae/4sfYLd200e0RqIwEMjN1MDQ1mVm3g /K+37OG7ZRnaXJBtMaIHTgK2PhWMFZ9yDctGj4zbjOed6BcJeRcG1VYYbhq1rQJuiHf iQX5dj6JmgNPB4MNOwpOdcOVUvVKOdxqzRsjW6tI= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 10/44] x86/boot: introduce boot module types Date: Fri, 30 Aug 2024 17:46:55 -0400 Message-Id: <20240830214730.1621-11-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054999003116600 Content-Type: text/plain; charset="utf-8" This commit introduces module types of xen, kernel, and ramdisk to allow bo= ot module detect code to tag the purpose of a boot module. This reduces the ne= ed for hard coded order assumptions and global variables to be used by consume= rs of boot modules, such as domain construction. Signed-off-by: Daniel P. Smith --- xen/arch/x86/include/asm/bootinfo.h | 9 +++++++++ xen/arch/x86/setup.c | 3 +++ 2 files changed, 12 insertions(+) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 3e0e36df096b..1b1b640f83f7 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -11,9 +11,18 @@ #include #include =20 +/* Boot module binary type / purpose */ +enum bootmod_type { + BOOTMOD_UNKNOWN, + BOOTMOD_XEN, + BOOTMOD_KERNEL, + BOOTMOD_RAMDISK, +}; + struct boot_module { module_t *early_mod; unsigned long headroom; + enum bootmod_type type; }; =20 struct boot_info { diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index d4f557b4c50d..8d5450c981a8 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -314,6 +314,7 @@ static void __init multiboot_to_bootinfo(multiboot_info= _t *mbi, module_t *mods) boot_mods[i].early_mod =3D &mods[i]; =20 /* map the last mb module for xen entry */ + boot_mods[info.nr_mods].type =3D BOOTMOD_XEN; boot_mods[info.nr_mods].early_mod =3D &mods[info.nr_mods]; =20 boot_info =3D &info; @@ -1197,6 +1198,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) =20 bitmap_fill(module_map, boot_info->nr_mods); __clear_bit(0, module_map); /* Dom0 kernel is always first */ + boot_info->mods[0].type =3D BOOTMOD_KERNEL; =20 if ( pvh_boot ) { @@ -2085,6 +2087,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) cpu_has_nx ? "" : "not "); =20 initrdidx =3D find_first_bit(module_map, boot_info->nr_mods); + boot_info->mods[initrdidx].type =3D BOOTMOD_RAMDISK; if ( bitmap_weight(module_map, boot_info->nr_mods) > 1 ) printk(XENLOG_WARNING "Multiple initrd candidates, picking module #%u\n", --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725055015; cv=pass; d=zohomail.com; s=zohoarc; b=nCmvH4fHjLqSuyauIgWj8+35JARGgsVeM1yZ/Sbv1EuZwueNnWR5sIr/H8vPQ3gGtAl9G9YqyRmcjR2y4oeMiS50N34TsPaGlyINaPrULof0TC2b+NUCCuzqH0Dgbma6JCu4c9dO7VT+KUPVUxzHUUDgs4EORCzS+H41dC0TTP8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725055015; 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=5tRW/AonFx6PkMudQZ5UfviW7yOCGUwEDitNjDx5cYw=; b=bvsoPgdEp2BxC4gX+HT8gxyC6m2a+ZdAy8vHoZHtIPPW2Edoc01mhIftw4WBMIlwPWX6YqB/kuKY1VbyxqgmoIQaVZqyERJyZ1Zv4qJw0LA1qtLl910nuX8Fk+DLsuqirKbMI0eMOljeuNU/v+ccFARP8hl/eQ5oJ3yZVH3A4qY= 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 1725055015801369.4043304361021; Fri, 30 Aug 2024 14:56:55 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786794.1196584 (Exim 4.92) (envelope-from ) id 1sk9bh-0006QF-Q3; Fri, 30 Aug 2024 21:56:37 +0000 Received: by outflank-mailman (output) from mailman id 786794.1196584; Fri, 30 Aug 2024 21:56:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9bh-0006PL-J6; Fri, 30 Aug 2024 21:56:37 +0000 Received: by outflank-mailman (input) for mailman id 786794; Fri, 30 Aug 2024 21:56:37 +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 1sk9UU-00065G-P4 for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:49:10 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id af0b5679-6719-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:49:09 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054471893456.85203276225536; Fri, 30 Aug 2024 14:47:51 -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: af0b5679-6719-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054474; cv=none; d=zohomail.com; s=zohoarc; b=lasNya4BFw/XtdtSGjwfRiCwlJ2VNmaP/DFwPqwMxuNlpnFaYBJBhFgki3cfogDxU9wZYf3sUP2yDsT6xSYk7Efsvn+j0zHp59BdR6GcpVpgSjjETUkRpT0qWonoxJ/5mPk6bV0H/C25eSmuy0/Im70MrNAskpaEUf5ZHQ6PKQQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054474; 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=5tRW/AonFx6PkMudQZ5UfviW7yOCGUwEDitNjDx5cYw=; b=P2RZyBCBWzg0mXe89rpIkcQ59rMsls/HXUJftpwSGUiGPS0zBhrAevJorYsL+HSroAlas1NIBhfkBtsXAvV5LSEo9zqvPkEltsIp1t1HTaDRy/DRO7VaOwsE3LSi+VgN3NW7Z3ESgpgAE0e5L6ObQQSqIaONU0ZjLGzrEvCBtEE= 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=1725054474; 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=5tRW/AonFx6PkMudQZ5UfviW7yOCGUwEDitNjDx5cYw=; b=BNiO0Zw2VJ1gTey+LPtH+bszYg/zKQgmqw12d7w3C7FDRgty38trREA9D0XrAzVf e9ushTYSMZsYQnQMMAeh8QBW4teIaKM+qgiPA9Jyp9CLFMc0RFnEVC4Zw/u5nldabKy SUysyMO272fQbZGub475DGGOCmYI4IeMOsVcrA28= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 11/44] x86/boot: introduce boot module flags Date: Fri, 30 Aug 2024 17:46:56 -0400 Message-Id: <20240830214730.1621-12-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725055017133116600 Content-Type: text/plain; charset="utf-8" The existing startup code employs various ad-hoc state tracking about certa= in boot module types by each area of the code. A boot module flags is added to enable tracking these different states. The first state to be transition by this commit is module relocation. Signed-off-by: Daniel P. Smith --- xen/arch/x86/include/asm/bootinfo.h | 4 ++++ xen/arch/x86/setup.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 1b1b640f83f7..baf6d74db754 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -23,6 +23,10 @@ struct boot_module { module_t *early_mod; unsigned long headroom; enum bootmod_type type; + + uint32_t flags; +#define BOOTMOD_FLAG_X86_RELOCATED (1U << 0) + }; =20 struct boot_info { diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 8d5450c981a8..47e4fcc2a8ce 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1377,7 +1377,6 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) panic("Bootloader didn't honor module alignment request\n"); boot_info->mods[i].early_mod->mod_end -=3D boot_info->mods[i].earl= y_mod->mod_start; boot_info->mods[i].early_mod->mod_start >>=3D PAGE_SHIFT; - boot_info->mods[i].early_mod->reserved =3D 0; } =20 /* @@ -1492,7 +1491,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) =20 size =3D PAGE_ALIGN(bm->headroom + bm->early_mod->mod_end); =20 - if ( boot_info->mods[j].early_mod->reserved ) + if ( boot_info->mods[j].flags & BOOTMOD_FLAG_X86_RELOCATED ) continue; =20 /* Don't overlap with other modules (or Xen itself). */ @@ -1511,7 +1510,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) bm->early_mod->mod_end); bm->early_mod->mod_start =3D (end - size) >> PAGE_SHIFT; bm->early_mod->mod_end +=3D bm->headroom; - bm->early_mod->reserved =3D 1; + bm->flags |=3D BOOTMOD_FLAG_X86_RELOCATED; } } =20 @@ -1537,7 +1536,8 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) #endif } =20 - if ( boot_info->mods[0].headroom && !boot_info->mods[0].early_mod->res= erved ) + if ( boot_info->mods[0].headroom && + !(boot_info->mods[0].flags & BOOTMOD_FLAG_X86_RELOCATED) ) panic("Not enough memory to relocate the dom0 kernel image\n"); for ( i =3D 0; i < boot_info->nr_mods; ++i ) { --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725055018; cv=pass; d=zohomail.com; s=zohoarc; b=RS8dkF6v7P2VSuX1/3KxsF2+MD6jy8/AkQbYxP+jYbYQRID1J3UcpbOJwXKwxAEqfyQES/NjQhpuAB4la4fFvPUdf5zxqok8xX7Jdd6qimP64G2DyU9AbA+Ck9ZRCZ5VBTYGJ7qcR3fTCmnXa3w3zj5BcWpxtOusrRZaqaU6BCw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725055018; 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=hMDag8iJyDBnao+fi0n8bnFwJVAPf0gtfWYWCLly+Do=; b=cElcw1KTsnUtbTOFKWsRsJrctUFDOhJ7L6vT/SRhQh/MxlvaZxH40HtuYViNEpXRZ/mCYjLFIhBaOW7ddRyG4bq9N1W7x5AaD8sTCH3J4QIYOGJtZyeDtcqYQiCB/zxx0yMza7+GEj3rGx04O+sge2mpG8mZiBvozzpVxbDGAs8= 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 1725055018116881.6712959748742; Fri, 30 Aug 2024 14:56:58 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786796.1196593 (Exim 4.92) (envelope-from ) id 1sk9bj-0006nI-4T; Fri, 30 Aug 2024 21:56:39 +0000 Received: by outflank-mailman (output) from mailman id 786796.1196593; Fri, 30 Aug 2024 21:56:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9bi-0006lv-V6; Fri, 30 Aug 2024 21:56:38 +0000 Received: by outflank-mailman (input) for mailman id 786796; Fri, 30 Aug 2024 21:56:38 +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 1sk9Ub-00065G-HM for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:49:17 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b30bd153-6719-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:49:16 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054472969909.2016091326745; Fri, 30 Aug 2024 14:47:52 -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: b30bd153-6719-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054475; cv=none; d=zohomail.com; s=zohoarc; b=KUfmCtxNnGmntY9ieNlaQabAEenLPhdpW++jT/YEBx4k5VZcX7A7kJ+4Up2Xell391zbwyXvHuHDIcVKKMHsocxEeo/tzJSvO7PvW6Vx6pVjCq8nFZxjppUoznhZAfzHNVIJCRmz1e6pmDGCrDBDA8JyijGA/By6udcoDG3Wgfg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054475; 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=hMDag8iJyDBnao+fi0n8bnFwJVAPf0gtfWYWCLly+Do=; b=FulD+ajNsq2Sratk39+2vvEScHrSK04+ijZU34RHXjflMYw4eMszCASSZy3Aren4gYfyXQfxck3QWmKGiGQycaLf6d7cebuWbXv14WPaSoCMwhh3l7PcU1JhPmcMPX1alQO18CeJ/2g1uPDo0/rLdhUSbBlN775TSIXRN063loQ= 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=1725054475; 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=hMDag8iJyDBnao+fi0n8bnFwJVAPf0gtfWYWCLly+Do=; b=UsCkLTR/qZ20iBtGI+FDIwx165HevcceSuvREt9dKW8qc097SFWGR8Brzw/EOc8p 20fcveaBonum0QXiLuLdo2CM0bJqUcg2SoxLEc3/kjxyakCcQlT0mx7YPWMdovCKe4C TVO5hh40fPtHPOFqps2fgPL53scx3c/Ak37cn55M= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 12/44] x86/boot: add start and size fields to struct boot_module Date: Fri, 30 Aug 2024 17:46:57 -0400 Message-Id: <20240830214730.1621-13-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725055019074116600 Content-Type: text/plain; charset="utf-8" This commit introduces the start and size fields to struct boot_module and = adds a corresponding bootstrap mapping function, bootstrap_map_bm. Signed-off-by: Daniel P. Smith --- xen/arch/x86/include/asm/bootinfo.h | 2 ++ xen/arch/x86/include/asm/setup.h | 2 ++ xen/arch/x86/setup.c | 13 +++++++++++++ 3 files changed, 17 insertions(+) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index baf6d74db754..37132afb4e6a 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -27,6 +27,8 @@ struct boot_module { uint32_t flags; #define BOOTMOD_FLAG_X86_RELOCATED (1U << 0) =20 + paddr_t start; + size_t size; }; =20 struct boot_info { diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/se= tup.h index 15dcb62cb5ac..165ca744ba34 100644 --- a/xen/arch/x86/include/asm/setup.h +++ b/xen/arch/x86/include/asm/setup.h @@ -2,6 +2,7 @@ #define __X86_SETUP_H_ =20 #include +#include #include =20 extern const char __2M_text_start[], __2M_text_end[]; @@ -36,6 +37,7 @@ unsigned long initial_images_nrpages(nodeid_t node); void discard_initial_images(void); void *bootstrap_map_addr(uint64_t start, uint64_t end); void *bootstrap_map(const module_t *mod); +void *bootstrap_map_bm(const struct boot_module *bm); =20 int remove_xen_ranges(struct rangeset *r); =20 diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 47e4fcc2a8ce..021c5699f86c 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -311,8 +311,13 @@ static void __init multiboot_to_bootinfo(multiboot_inf= o_t *mbi, module_t *mods) info.mods =3D boot_mods; =20 for ( i=3D0; i < info.nr_mods; i++ ) + { boot_mods[i].early_mod =3D &mods[i]; =20 + boot_mods[i].start =3D (paddr_t)mods[i].mod_start; + boot_mods[i].size =3D mods[i].mod_end - mods[i].mod_start; + } + /* map the last mb module for xen entry */ boot_mods[info.nr_mods].type =3D BOOTMOD_XEN; boot_mods[info.nr_mods].early_mod =3D &mods[info.nr_mods]; @@ -477,6 +482,14 @@ void *__init bootstrap_map(const module_t *mod) pfn_to_paddr(mod->mod_start) + mod->mod_end); } =20 +void *__init bootstrap_map_bm(const struct boot_module *bm) +{ + if ( !bm ) + return bootstrap_map_addr(0, 0); + + return bootstrap_map_addr(bm->start, bm->start + bm->size); +} + static void __init move_memory( uint64_t dst, uint64_t src, unsigned int size) { --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725055025; cv=pass; d=zohomail.com; s=zohoarc; b=nfhfj98l13O1EPH3pGWZ+dwztHwNWWcE325x9rZl6ru3tBzO8GgA7duKmpU5lv+gqxLn3jLAT8jzeIiFNHOIOhySi70rMeVYKVk+kAlqMDo9PWgcGpz8lVUwvRho5MxzReYoUa+JSP5a4tlUyARuwdCIZo2O95TDVnjWny2mbac= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725055025; 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=vMlkGiuGcxaWfLc66KQ7uFjoPq32SrNVLlk/N0KOM60=; b=Emq0an0dATBc25mSDquyXUVfGiSE2I2B5B3UGwqw3+whwVUXQ03uTo5qjgi3WqhPb4rmV/dc3035LSXHF9dJy+VZHDlGdgLGdX9zFpxMLlWJT3XL5+9OkgecD+f+mrnqwEUE5ph+6G4XW40PE/OwLiFuMZIE0cYkg5XGRrf8P8w= 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 172505502568794.93562047551757; Fri, 30 Aug 2024 14:57:05 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786823.1196634 (Exim 4.92) (envelope-from ) id 1sk9bs-0000p6-Ky; Fri, 30 Aug 2024 21:56:48 +0000 Received: by outflank-mailman (output) from mailman id 786823.1196634; Fri, 30 Aug 2024 21:56:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9bs-0000nT-Bf; Fri, 30 Aug 2024 21:56:48 +0000 Received: by outflank-mailman (input) for mailman id 786823; Fri, 30 Aug 2024 21:56:47 +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 1sk9Uh-00065G-SA for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:49:23 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b6d802c6-6719-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:49:22 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054474029613.6614984690195; Fri, 30 Aug 2024 14:47:54 -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: b6d802c6-6719-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054476; cv=none; d=zohomail.com; s=zohoarc; b=OqXVWMl7VaK78DNscKnrvJshV2lLeRxJIRCTAN5X0CgXklka61qAYSml/8DkGzuOxyD9BvlGER25Ai10Uol2gbB1DsirSLX9l7oCeq9X1wcuYsPJG0mRR106kwAMqpyD6k7vfcFjg0r/mqBJHYOfMEiXIR4ISuVIj/JG6Jb1qYE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054476; 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=vMlkGiuGcxaWfLc66KQ7uFjoPq32SrNVLlk/N0KOM60=; b=NGq0XhVOBECsmQ6LU85OvMFXVEPB9xNZ1U9G0ZnqmUu7ncfoN53tMnfbcwekmMhp5i08d9AoQkcl3J4IVdlQnkLF5nLqEuy+VrMg8XgEyD1eSfUtfC48BUcGRqDB7Q64hZBOIoZ/wPEPrC4DYrjwso+lM0Ya7t0fOCATB3MwTBY= 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=1725054476; 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=vMlkGiuGcxaWfLc66KQ7uFjoPq32SrNVLlk/N0KOM60=; b=Q7/nsgQyLuK3bygbmw0vF7wqJhUdup2FoXX66y36jqPe03uVNLFpT1+U6DdIADwy AlXAp227+zkOpIJHGZc5iqJNQlWpzYH378zrS8RA3hOFL00XsUf1443Pgwh6nyiDl47 mobJUlJlHT9l1yKrNKpCHE7dC6msK/PvbqzkUEcM= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 13/44] x86/boot: update struct boot_module on module relocation Date: Fri, 30 Aug 2024 17:46:58 -0400 Message-Id: <20240830214730.1621-14-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725055027116116600 Content-Type: text/plain; charset="utf-8" When a boot module is relocated, ensure struct boot_module start and size fields are updated along with early_mod. Signed-off-by: Daniel P. Smith --- xen/arch/x86/setup.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 021c5699f86c..27517d24b2ea 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1408,8 +1408,10 @@ void asmlinkage __init noreturn __start_xen(unsigned= long mbi_p) * respective reserve_e820_ram() invocation below. No need to * query efi_boot_mem_unused() here, though. */ - boot_info->mods[idx].early_mod->mod_start =3D virt_to_mfn(_stext); - boot_info->mods[idx].early_mod->mod_end =3D __2M_rwdata_end - _ste= xt; + boot_info->mods[idx].start =3D boot_info->mods[idx].early_mod->mod= _start + =3D virt_to_mfn(_stext); + boot_info->mods[idx].size =3D boot_info->mods[idx].early_mod->mod_= end + =3D __2M_rwdata_end - _stext; } =20 boot_info->mods[0].headroom =3D bzimage_headroom( --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725055005; cv=pass; d=zohomail.com; s=zohoarc; b=c36cphnfwiomQDwKfugdSpAbZ1zUQIXOBsgcNnjlNWIIDta2jBYs/2bf7UrxtPCbZeI4Eu9VTN9QEXDPIZk3UTZqpkWDd3iHndMz7aRvrY5QvYXkTD75yD7vDKEHWLkbPrlIKySwuGpnlSPwdGvGh5LJg91XqaWm+Z0YR6TtjZ0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725055005; 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=NPlHbwKF+a8HLFZ7J6H7myDoAP2mw8XIrCc9sG0+8Xw=; b=XTPSACru4Izu4fFNeU+ZIsDTgP1Aq3PUobZFlfldOPbjk5FW+aPBPyFe1uBMDMZwuGKV2RzmduWiaY2a18tzAbTspZL3CXeebyGCmYBP2DxhgdQPU3S2YJLPzh9E1Q9QxQ4I7H6ek9NCf1KY86kRPIa6AF3GDUfUjxIQi6jWL60= 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 1725055005172140.35454379763007; Fri, 30 Aug 2024 14:56:45 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786760.1196534 (Exim 4.92) (envelope-from ) id 1sk9bW-0003h4-19; Fri, 30 Aug 2024 21:56:26 +0000 Received: by outflank-mailman (output) from mailman id 786760.1196534; Fri, 30 Aug 2024 21:56:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9bV-0003gn-TW; Fri, 30 Aug 2024 21:56:25 +0000 Received: by outflank-mailman (input) for mailman id 786760; Fri, 30 Aug 2024 21:56:24 +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 1sk9Up-00065G-Iu for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:49:31 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id bb685fb0-6719-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:49:30 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054475097108.05435664404672; Fri, 30 Aug 2024 14:47:55 -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: bb685fb0-6719-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054477; cv=none; d=zohomail.com; s=zohoarc; b=d6e5Wiun1gTE7j1u305GpLy+PnGIYCDEeqFN7m+gLdij3t0rEtBwcb3OiCVckj8DTOWRO8qK5H3w0yPnohT1XbpZ28Nj2hA+U6Jn1lP85AtWl8JeuzgXR6vXvqwzx3L23fi75b2hWZevYeThQtaJQvfoHmygabe2rM1PsLFA8Z8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054477; 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=NPlHbwKF+a8HLFZ7J6H7myDoAP2mw8XIrCc9sG0+8Xw=; b=drgHp7d0UZBIxKvtKXmu5vBs1jw/dBMIELB7R0JMq5GXeohFfAp6EVjmTZtGO5ajvoCmaGr0ngBlMMUcR9uiFMwpD3Ob/hMKrwY2XZTe2u+0ABkf6NVu0EeIdyHsbPO899lLcKcDWEFJsPfUGm+W8fF89KDXkM/Q+sFA8Qkf0xw= 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=1725054477; 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=NPlHbwKF+a8HLFZ7J6H7myDoAP2mw8XIrCc9sG0+8Xw=; b=ZrHpK9XluX96/QQzpIf4M+PhnWfXDiEKHA0xQyvs2MQ/jR+FbgSPkKfdyw+YExhC U49/hNB7GSPsEhI9EdfRNwr5hQjSs9TN7gYC5kKmB357anBhPjZpF0dH40sDduEdarY MwRtC/UxlQPO6ASsQzl7jXJGntqeflL2/IYAM4Ek= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 14/44] x86/boot: transition relocation calculations to struct boot_module Date: Fri, 30 Aug 2024 17:46:59 -0400 Message-Id: <20240830214730.1621-15-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725055007243116600 Content-Type: text/plain; charset="utf-8" Use struct boot_module fields, start and size, when calculating the relocat= ion address and size. It also ensures that early_mod references are kept in syn= c. Signed-off-by: Daniel P. Smith --- xen/arch/x86/setup.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 27517d24b2ea..0b6bde9ce7e3 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1504,7 +1504,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) struct boot_module *bm =3D &boot_info->mods[j]; unsigned long size; =20 - size =3D PAGE_ALIGN(bm->headroom + bm->early_mod->mod_end); + size =3D PAGE_ALIGN(bm->headroom + bm->size); =20 if ( boot_info->mods[j].flags & BOOTMOD_FLAG_X86_RELOCATED ) continue; @@ -1518,13 +1518,12 @@ void asmlinkage __init noreturn __start_xen(unsigne= d long mbi_p) =20 if ( s < end && (bm->headroom || - ((end - size) >> PAGE_SHIFT) > bm->early_mod->mod_start)= ) + paddr_to_pfn(end - size) > paddr_to_pfn(bm->start)) ) { - move_memory(end - size + bm->headroom, - (uint64_t)bm->early_mod->mod_start << PAGE_SHI= FT, - bm->early_mod->mod_end); - bm->early_mod->mod_start =3D (end - size) >> PAGE_SHIFT; - bm->early_mod->mod_end +=3D bm->headroom; + move_memory(end - size + bm->headroom, bm->start, bm->size= ); + bm->start =3D (end - size); + bm->early_mod->mod_start =3D paddr_to_pfn(bm->start); + bm->size =3D bm->early_mod->mod_end +=3D bm->headroom; bm->flags |=3D BOOTMOD_FLAG_X86_RELOCATED; } } @@ -1556,11 +1555,10 @@ void asmlinkage __init noreturn __start_xen(unsigne= d long mbi_p) panic("Not enough memory to relocate the dom0 kernel image\n"); for ( i =3D 0; i < boot_info->nr_mods; ++i ) { - uint64_t s =3D (uint64_t)boot_info->mods[i].early_mod->mod_start - << PAGE_SHIFT; + uint64_t s =3D (uint64_t)boot_info->mods[i].start; =20 reserve_e820_ram(&boot_e820, s, - s + PAGE_ALIGN(boot_info->mods[i].early_mod->mod_= end)); + s + PAGE_ALIGN(boot_info->mods[i].size)); } =20 if ( !xen_phys_start ) @@ -1638,9 +1636,8 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) map_e =3D boot_e820.map[j].addr + boot_e820.map[j].size; for ( j =3D 0; j < boot_info->nr_mods; ++j ) { - uint64_t end =3D pfn_to_paddr( - boot_info->mods[j].early_mod->mod_start= ) + - boot_info->mods[j].early_mod->mod_end; + uint64_t end =3D boot_info->mods[j].start + + boot_info->mods[j].size; =20 if ( map_e < end ) map_e =3D end; @@ -1714,13 +1711,13 @@ void asmlinkage __init noreturn __start_xen(unsigne= d long mbi_p) =20 for ( i =3D 0; i < boot_info->nr_mods; ++i ) { - set_pdx_range(boot_info->mods[i].early_mod->mod_start, - boot_info->mods[i].early_mod->mod_start + + set_pdx_range(paddr_to_pfn(boot_info->mods[i].start), + paddr_to_pfn(boot_info->mods[i].start) + PFN_UP(boot_info->mods[i].early_mod->mod_end)); map_pages_to_xen( - (unsigned long)mfn_to_virt(boot_info->mods[i].early_mod->mod_s= tart), - _mfn(boot_info->mods[i].early_mod->mod_start), - PFN_UP(boot_info->mods[i].early_mod->mod_end), PAGE_HYPERVISOR= ); + (unsigned long)maddr_to_virt(boot_info->mods[i].start), + maddr_to_mfn(boot_info->mods[i].start), + PFN_UP(boot_info->mods[i].size), PAGE_HYPERVISOR); } =20 #ifdef CONFIG_KEXEC --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054986; cv=pass; d=zohomail.com; s=zohoarc; b=gY4EjV2v6RLf608Dq+ps0wwWVMC29VOazFV+z4OY7kqYDf3pQOhHdbg+R/g6bC+CuXMyy4iOZIHpTeRXjwd/XuTe+s34zH6YPxAvZ+5JYBWiiugdPUN6BvSk1TU889eNC30ZMrGsXNgPIpE+WtsCI8c31EOrGqyp6C5qDWgvLBs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054986; 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=GvFaYALw+a+2+o8Vrk1YWy2xkmV+m8u1BbaORy59Yw0=; b=WjB5bdJaF6QBtOKTXv6kRB5BEe1Z471d1WYDpQb926brx/PJCSx8dCN1qVf3+VaNqQHppERnZ+eJVKf23jnUr6HvDqNSDhJftNULPiVxe6MDQcsOUPwyZXHgMoPxLn4nZBecX7PpRRqUQkpZMbDUKycGXf2bciO2DfGw3ZWh0YU= 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 1725054986917844.3230110979761; Fri, 30 Aug 2024 14:56:26 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786749.1196494 (Exim 4.92) (envelope-from ) id 1sk9bK-0001Nh-Ie; Fri, 30 Aug 2024 21:56:14 +0000 Received: by outflank-mailman (output) from mailman id 786749.1196494; Fri, 30 Aug 2024 21:56:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9bK-0001Mg-Ey; Fri, 30 Aug 2024 21:56:14 +0000 Received: by outflank-mailman (input) for mailman id 786749; Fri, 30 Aug 2024 21:56:12 +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 1sk9Ux-00065G-IL for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:49:39 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c03a5813-6719-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:49:38 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 172505447615751.84400849252813; Fri, 30 Aug 2024 14:47:56 -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: c03a5813-6719-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054478; cv=none; d=zohomail.com; s=zohoarc; b=RIu98M/WjNAwh4rLsJQmTFkd35kOFhff7JsaX/iK85SOqYY06ORXt/xFUWNEvlfh6B33v14uU7wQz6RwFPxR+TsHQfMFpJzQERPfT+dHhWetGnaeZBYtDa4GupoykX4+Z/XHdvHyIE2bhywkPHXlc/eUGyXH7KxA8h5CnwqrVsM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054478; 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=GvFaYALw+a+2+o8Vrk1YWy2xkmV+m8u1BbaORy59Yw0=; b=J5g2d2wowLdc3DYvH5cYpHNrxOw4dfexDFJ4GFVcWQZtEIdFwfxKhnrUKUeVvwP44Z7wcgwkdz8JCg31zLLK9Iya309wWL+KiLhsgBsmfxzt2xmkTwo+FKdHFQdcREsn/2tkBUFU9szTVCyK1dM9FX9F3RJPpx5N7VHDrIaSuCM= 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=1725054478; 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=GvFaYALw+a+2+o8Vrk1YWy2xkmV+m8u1BbaORy59Yw0=; b=lVdd8f1HD9/Y6RqiitV5mlXw/b1xDdSLSvKtBcHfn9Mb3XIf3q1E6nW3TZ7OYd8G VEchoyyGW9DgTYbXTT9g4gLSzIvt+Xw3ojzCKmH635rsyuJCPj796vDkYYUxRCKVr3B xKcMW/AU/AYNtK5HB6JTcisTFAfDuYjONcwbzWhQ= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 15/44] x86/boot: introduce boot module interator Date: Fri, 30 Aug 2024 17:47:00 -0400 Message-Id: <20240830214730.1621-16-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054988956116600 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 --- 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 37132afb4e6a..99f8c9b83b25 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -42,8 +42,24 @@ struct boot_info { uint32_t mmap_length; }; =20 -#endif +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_mods; 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 /* * Local variables: * mode: C --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725055004; cv=pass; d=zohomail.com; s=zohoarc; b=lyICZQJsxplBZIuMBlp7vqOXLiPP4YaSR3kswN21OMpMzWtxnr0FVd/6rxAf+oMoJCKxfDoI4TNl+sxhGsFTG99vHGdnTm/pBUm1nMWRReRNX4F4iCt/6OzajeQKZTZgpWo0H/9syvBYi7fkbq5CTsM6HQidLgL70f7WcOQlwTY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725055004; 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=bVRjWgn0rJXMNoedI0B0emnthNEBUMt5tP4JhrqFCck=; b=K6PteSX1I8ud8cUmU4tF1x0rsco3HZ+9SHKnj6a+p6mx8i1WKuf0QVVXfKtlmAA9pt3PbHSsL/YuWTb1lPHJodBDcXPCnnlI8NjJjpPtu7PyO0iuD6F2XocdYDaS1jGfmicJOTNlAe1hZRr5W92LOOO8cbiGuLRH9Ze36+wssBI= 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 1725055004666309.64649425909283; Fri, 30 Aug 2024 14:56:44 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786770.1196554 (Exim 4.92) (envelope-from ) id 1sk9bZ-0004WM-34; Fri, 30 Aug 2024 21:56:29 +0000 Received: by outflank-mailman (output) from mailman id 786770.1196554; Fri, 30 Aug 2024 21:56:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9bY-0004Vz-SQ; Fri, 30 Aug 2024 21:56:28 +0000 Received: by outflank-mailman (input) for mailman id 786770; Fri, 30 Aug 2024 21:56:27 +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 1sk9V4-00065G-Cw for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:49:46 +0000 Received: from sender3-of-o57.zoho.com (sender3-of-o57.zoho.com [136.143.184.57]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c4583564-6719-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:49:45 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054477221407.77333741442715; Fri, 30 Aug 2024 14:47:57 -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: c4583564-6719-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054479; cv=none; d=zohomail.com; s=zohoarc; b=Ru3p5X5v6TlDJEMWI+9LyYX324Xjv8m84ceJlv3IYp+7xQzTqB/gdRUrXVNf6MFRUQok2KtkRl0zCj0kzNQJuhfKPwvXF9dOMLPtrz0oAy+QeIbYkSPshMJoxPWxAKM9HKF1/rLZlGV2SMRDdZo+RYyEP9ECLLymkgau2zf6bAA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054479; 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=bVRjWgn0rJXMNoedI0B0emnthNEBUMt5tP4JhrqFCck=; b=PoQmeXORo1oDLnmlw1vnvJyFufOxxOybxKsklwFZN730rSXEQ6rEE98TEymWkStYuD+Cl/wgsTAFFX3eP5c94pZuY+VhSS2vWYeF9KVEjsE/F2fIzVhutZ5JIdzbjkiNApzQTzgVDcrxvMyP8EmLhLHE9a44cqO+si9ILezEWi4= 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=1725054479; 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=bVRjWgn0rJXMNoedI0B0emnthNEBUMt5tP4JhrqFCck=; b=d75Ha3abZDe4oPlyicA6qJ2en6+xikcXvyGnaiCzezvMag0Y8fSQyflJRJesYTxd qOLkUE2Fukh2HCjJMkHpl/XybwFizBZuF8AGBv7IrqEsDIhizSCz0i28Amfo4Zgwdn5 7yF4NBqr5n1v+OSjEbaRc9/chi1Oy2h/7iqCZtoE= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 16/44] x86/boot: introduce consumed flag for struct boot_module Date: Fri, 30 Aug 2024 17:47:01 -0400 Message-Id: <20240830214730.1621-17-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725055005045116600 Content-Type: text/plain; charset="utf-8" Allow the tracking of when a boot module has been consumed by a handler in = the hypervisor independent of when it is claimed. The instances where the hypervisor does nothing beyond claiming, the dom0 kernel, dom0 ramdisk, and= a placeholder for itself, are updated as being consumed at the time of being claimed. Signed-off-by: Daniel P. Smith --- xen/arch/x86/include/asm/bootinfo.h | 1 + xen/arch/x86/setup.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 99f8c9b83b25..740308693629 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -26,6 +26,7 @@ struct boot_module { =20 uint32_t flags; #define BOOTMOD_FLAG_X86_RELOCATED (1U << 0) +#define BOOTMOD_FLAG_X86_CONSUMED (1U << 1) =20 paddr_t start; size_t size; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 0b6bde9ce7e3..da75dfce083d 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -320,6 +320,7 @@ static void __init multiboot_to_bootinfo(multiboot_info= _t *mbi, module_t *mods) =20 /* map the last mb module for xen entry */ boot_mods[info.nr_mods].type =3D BOOTMOD_XEN; + boot_mods[info.nr_mods].flags |=3D BOOTMOD_FLAG_X86_CONSUMED; boot_mods[info.nr_mods].early_mod =3D &mods[info.nr_mods]; =20 boot_info =3D &info; @@ -1212,6 +1213,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) bitmap_fill(module_map, boot_info->nr_mods); __clear_bit(0, module_map); /* Dom0 kernel is always first */ boot_info->mods[0].type =3D BOOTMOD_KERNEL; + boot_info->mods[0].flags |=3D BOOTMOD_FLAG_X86_CONSUMED; =20 if ( pvh_boot ) { @@ -2100,6 +2102,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) =20 initrdidx =3D find_first_bit(module_map, boot_info->nr_mods); boot_info->mods[initrdidx].type =3D BOOTMOD_RAMDISK; + boot_info->mods[initrdidx].flags |=3D BOOTMOD_FLAG_X86_CONSUMED; if ( bitmap_weight(module_map, boot_info->nr_mods) > 1 ) printk(XENLOG_WARNING "Multiple initrd candidates, picking module #%u\n", --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725055007; cv=pass; d=zohomail.com; s=zohoarc; b=K9HZ1VhYVRe+a9eaIJlh2r/JxtybBIkc9qf2vCAotWsH3W5yJewjb1KIx/Rz1oisQ5Wpmv3PuJ23OjDalYsfusxz5rjmRiGaqIT/ZvAZ7kcWQUlU7kNkAWp7iq12XX6Oz0SkFYHgQ9rYpObZwUKDuQ0XXP8+3aUBmVM+GSr2+so= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725055007; 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=kpui6t02X83Vt5ycf0OvPFAWFtuSlnhdgDe57IspVC4=; b=bb+flMxZaXrJ1/WJGoQw63xDdCcJAk4nB48Ox1S3Iqx6cTVmf85xtrduOo+oRXZBnzkRHKMkxpFoUrx2aQMBQqDy/xhpjSq5auAeYwb561ajbj//r9eCOpzIOrruBK7+KllxOy+N1Qx/jN+CraBNTZSrNu5bljJJRJiTcC1GALU= 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 1725055007922890.4423246932488; Fri, 30 Aug 2024 14:56:47 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786778.1196574 (Exim 4.92) (envelope-from ) id 1sk9bd-0005SW-09; Fri, 30 Aug 2024 21:56:33 +0000 Received: by outflank-mailman (output) from mailman id 786778.1196574; Fri, 30 Aug 2024 21:56:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9bc-0005SC-Q0; Fri, 30 Aug 2024 21:56:32 +0000 Received: by outflank-mailman (input) for mailman id 786778; Fri, 30 Aug 2024 21:56:31 +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 1sk9VB-00065G-Hn for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:49:53 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c894741f-6719-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:49:52 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054478301324.8472500488509; Fri, 30 Aug 2024 14:47:58 -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: c894741f-6719-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054480; cv=none; d=zohomail.com; s=zohoarc; b=aHPpeIVNL0p7qiPf3/PYT+YdR6pGnPsfotpzxAxe9GUrjvMnDEtSTs4Dk7hTqj5wy3JyImccl2jqZR1xratTWf8HWFUK+p8kdn8bt6PapBN9+LUIF0dzdjZ5D8plYKrSzXWUwRnbjgOp9UvYGyUzJbjaWvoJyDiCqhCVXOb17uw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054480; 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=kpui6t02X83Vt5ycf0OvPFAWFtuSlnhdgDe57IspVC4=; b=OCoZcvqymaIice8IHgu574wZY7TeKr1nbbVPrk7vxy4EqMBByu+A6/LA19hgJkc9F4KrZyOAMpSR/VYLlGNWe6X6UJnEtIMWJ122jphDwZR90nyrXwb0RB1KqeRWvO1mJueAZdT3ZKUaWNWw76O4ipQWjZobTMYNy14SXtvSS00= 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=1725054480; 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=kpui6t02X83Vt5ycf0OvPFAWFtuSlnhdgDe57IspVC4=; b=asyp2iG7GLWIyAHoBvsqrdEJxpqLGDn8v/EQGypHao6+NgVAPgY9HEf/WtRcea/A La6bCLcPWupK4OAoTQKQ5isgBTlaNw5y9Mtjx8N6n6ngvm17DlAWKtw7K2W6ux5SqB7 4HSImcYDn9PusSujYjI4tl2gg/TdPeVZ/2vacvPg= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 17/44] x86/boot: convert microcode loading to consume struct boot_info Date: Fri, 30 Aug 2024 17:47:02 -0400 Message-Id: <20240830214730.1621-18-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725055009143116600 Content-Type: text/plain; charset="utf-8" Convert the microcode loading functions to take struct boot_info, and then using struct boot_module to map and check for microcode. To keep the changes focused, continue using the struct mod to hold the reference to the microco= de that is used by the late microcode logic. Signed-off-by: Daniel P. Smith --- xen/arch/x86/cpu/microcode/core.c | 37 +++++++++++++--------------- xen/arch/x86/include/asm/bootinfo.h | 1 + xen/arch/x86/include/asm/microcode.h | 14 ++++++----- xen/arch/x86/setup.c | 4 +-- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode= /core.c index 8a9e744489b9..653a725173ba 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -35,6 +35,7 @@ #include =20 #include +#include #include #include #include @@ -152,10 +153,8 @@ static int __init cf_check parse_ucode(const char *s) custom_param("ucode", parse_ucode); =20 static void __init microcode_scan_module( - unsigned long *module_map, - const multiboot_info_t *mbi) + unsigned long *module_map, const struct boot_info *bi) { - module_t *mod =3D (module_t *)__va(mbi->mods_addr); uint64_t *_blob_start; unsigned long _blob_size; struct cpio_data cd; @@ -177,16 +176,16 @@ static void __init microcode_scan_module( /* * Try all modules and see whichever could be the microcode blob. */ - for ( i =3D 1 /* Ignore dom0 kernel */; i < mbi->mods_count; i++ ) + for ( i =3D 1 /* Ignore dom0 kernel */; i < bi->nr_mods; i++ ) { if ( !test_bit(i, module_map) ) continue; =20 - _blob_start =3D bootstrap_map(&mod[i]); - _blob_size =3D mod[i].mod_end; + _blob_start =3D bootstrap_map_bm(&bi->mods[i]); + _blob_size =3D bi->mods[i].size; if ( !_blob_start ) { - printk("Could not map multiboot module #%d (size: %ld)\n", + printk("Could not map boot module #%d (size: %ld)\n", i, _blob_size); continue; } @@ -204,20 +203,18 @@ static void __init microcode_scan_module( } =20 static void __init microcode_grab_module( - unsigned long *module_map, - const multiboot_info_t *mbi) + unsigned long *module_map, const struct boot_info *bi) { - module_t *mod =3D (module_t *)__va(mbi->mods_addr); - if ( ucode_mod_idx < 0 ) - ucode_mod_idx +=3D mbi->mods_count; - if ( ucode_mod_idx <=3D 0 || ucode_mod_idx >=3D mbi->mods_count || + ucode_mod_idx +=3D bi->nr_mods; + if ( ucode_mod_idx <=3D 0 || ucode_mod_idx >=3D bi->nr_mods || !__test_and_clear_bit(ucode_mod_idx, module_map) ) goto scan; - ucode_mod =3D mod[ucode_mod_idx]; + bi->mods[ucode_mod_idx].type =3D BOOTMOD_MICROCODE; + ucode_mod =3D *bi->mods[ucode_mod_idx].early_mod; scan: if ( ucode_scan ) - microcode_scan_module(module_map, mbi); + microcode_scan_module(module_map, bi); } =20 static struct microcode_ops __ro_after_init ucode_ops; @@ -805,8 +802,8 @@ static int __init early_update_cache(const void *data, = size_t len) return rc; } =20 -int __init microcode_init_cache(unsigned long *module_map, - const struct multiboot_info *mbi) +int __init microcode_init_cache( + unsigned long *module_map, const struct boot_info *bi) { int rc =3D 0; =20 @@ -815,7 +812,7 @@ int __init microcode_init_cache(unsigned long *module_m= ap, =20 if ( ucode_scan ) /* Need to rescan the modules because they might have been relocat= ed */ - microcode_scan_module(module_map, mbi); + microcode_scan_module(module_map, bi); =20 if ( ucode_mod.mod_end ) rc =3D early_update_cache(bootstrap_map(&ucode_mod), @@ -862,7 +859,7 @@ static int __init early_microcode_update_cpu(void) } =20 int __init early_microcode_init(unsigned long *module_map, - const struct multiboot_info *mbi) + const struct boot_info *bi) { const struct cpuinfo_x86 *c =3D &boot_cpu_data; int rc =3D 0; @@ -905,7 +902,7 @@ int __init early_microcode_init(unsigned long *module_m= ap, return -ENODEV; } =20 - microcode_grab_module(module_map, mbi); + microcode_grab_module(module_map, bi); =20 if ( ucode_mod.mod_end || ucode_blob.size ) rc =3D early_microcode_update_cpu(); diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 740308693629..1cef48457c66 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -17,6 +17,7 @@ enum bootmod_type { BOOTMOD_XEN, BOOTMOD_KERNEL, BOOTMOD_RAMDISK, + BOOTMOD_MICROCODE, }; =20 struct boot_module { diff --git a/xen/arch/x86/include/asm/microcode.h b/xen/arch/x86/include/as= m/microcode.h index 57c08205d475..02fdb56bb82b 100644 --- a/xen/arch/x86/include/asm/microcode.h +++ b/xen/arch/x86/include/asm/microcode.h @@ -4,6 +4,8 @@ #include #include =20 +#include + #include =20 struct multiboot_info; @@ -22,12 +24,12 @@ struct cpu_signature { DECLARE_PER_CPU(struct cpu_signature, cpu_sig); =20 void microcode_set_module(unsigned int idx); -int microcode_update(XEN_GUEST_HANDLE(const_void) buf, - unsigned long len, unsigned int flags); -int early_microcode_init(unsigned long *module_map, - const struct multiboot_info *mbi); -int microcode_init_cache(unsigned long *module_map, - const struct multiboot_info *mbi); +int microcode_update( + XEN_GUEST_HANDLE(const_void) buf, unsigned long len, unsigned int flag= s); +int early_microcode_init( + unsigned long *module_map, const struct boot_info *bi); +int microcode_init_cache( + unsigned long *module_map, const struct boot_info *bi); int microcode_update_one(void); =20 #endif /* ASM_X86__MICROCODE_H */ diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index da75dfce083d..6495ab393576 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1398,7 +1398,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) * TODO: load ucode earlier once multiboot modules become accessible * at an earlier stage. */ - early_microcode_init(module_map, mbi); + early_microcode_init(module_map, boot_info); =20 if ( xen_phys_start ) { @@ -1952,7 +1952,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) =20 timer_init(); =20 - microcode_init_cache(module_map, mbi); /* Needs xmalloc() */ + microcode_init_cache(module_map, boot_info); /* Needs xmalloc() */ =20 tsx_init(); /* Needs microcode. May change HLE/RTM feature bits. */ =20 --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054616; cv=pass; d=zohomail.com; s=zohoarc; b=hKPY0Hzwdi7/wIeyfZNoL0bvXhM2jacfQN72friFth2If00XuOTZ4kKPCWRTtldCrV0izUCsRZMlnh4VZYBTlf1DIeiT2n0uzx3N1TSuhU7MM+hDyVriRRBiU1TS0D2WEwmwl9GtamZ+LLw3dfdg3O/ToL8ahMYtdqqgTzum6ec= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054616; 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=x7EA1HjwHFmnd4GnZ7Gub2RJOomQt0q62OXf51BcXpM=; b=D2dem3v7irAFqIS/bgRRHHjsRn2jXS5CdP793YeZNBHPhUnGTgHgHeKfmz3FNjTQDiA+4aulAOboQ3xb6s8MaW3cmd2XKDS+/zr/ZNym3UxXP9RmUDrIUqA5UVBVnUtDTnBlCzAlPZjacI6QHszZidVFPHJErh9lq5SH23BnZxA= 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 1725054616336635.4651731688173; Fri, 30 Aug 2024 14:50:16 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786687.1196335 (Exim 4.92) (envelope-from ) id 1sk9VM-0000tj-0D; Fri, 30 Aug 2024 21:50:04 +0000 Received: by outflank-mailman (output) from mailman id 786687.1196335; Fri, 30 Aug 2024 21:50:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9VL-0000t8-QH; Fri, 30 Aug 2024 21:50:03 +0000 Received: by outflank-mailman (input) for mailman id 786687; Fri, 30 Aug 2024 21:50:02 +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 1sk9VK-0000Zf-8u for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:50:02 +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 cd2154f2-6719-11ef-99a1-01e77a169b0f; Fri, 30 Aug 2024 23:50:00 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054479373585.778896678308; Fri, 30 Aug 2024 14:47:59 -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: cd2154f2-6719-11ef-99a1-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1725054481; cv=none; d=zohomail.com; s=zohoarc; b=FEGmLK6fu+9wYmYqWZCJ3D208mCbv5w+ovSDVze+c93yVuEgwNzEFii9v59Wx5bpIEEMGUgbHjCAdvfj7aNsUmqk2mOtCqz97RxBYjVJmYp09LSaPwrUzP9kJ3xhNB6cS8sJxCePDWzNOQhqaJ0di9OUGRr3dUsi0tg8FaKN3Dw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054481; 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=x7EA1HjwHFmnd4GnZ7Gub2RJOomQt0q62OXf51BcXpM=; b=VTWhRAdCMXgT8oyOCjAtvVXa52eqKZG3JRjIxN7XwVgt7uj7MIzsvWHQpT26VvERP+105AzH6hlMz+/vDnTZO/x1BqPi//6ndjGHYzLmzswtQbWPzlnXocPsG+uKw8NLffuyZBnHLfAQ/0Qdex4AZeMhpaw7GPRK8OAxdCz8fIQ= 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=1725054481; 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=x7EA1HjwHFmnd4GnZ7Gub2RJOomQt0q62OXf51BcXpM=; b=pSth6LFRIXPSZKfgsmM1u9uCXbxqB+1eHdVwKjkXPw+NDTySyaXzTiji8PL5zIyr vro1JEqgTsOTLFlxGB0xBSEvQQsdASY1ErOql689Syj+lq3sch1gJ2Aim2iZy47/eCZ BuzKKeWDSuwqp02/CvQHW4cdaGGTaVthiIpWXFBo= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 18/44] x86/boot: convert late microcode loading to struct boot_module Date: Fri, 30 Aug 2024 17:47:03 -0400 Message-Id: <20240830214730.1621-19-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054617178116600 Content-Type: text/plain; charset="utf-8" Remove the use of struct mod to hold the reference for the microcode, converting the code to work with a struct boot_module. Signed-off-by: Daniel P. Smith --- xen/arch/x86/cpu/microcode/core.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode= /core.c index 653a725173ba..cedb03beea54 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -59,7 +58,7 @@ */ #define MICROCODE_UPDATE_TIMEOUT_US 1000000 =20 -static module_t __initdata ucode_mod; +static struct boot_module __initdata ucode_mod; static signed int __initdata ucode_mod_idx; static bool __initdata ucode_mod_forced; static unsigned int nr_cores; @@ -93,7 +92,7 @@ struct ucode_mod_blob { =20 static struct ucode_mod_blob __initdata ucode_blob; /* - * By default we will NOT parse the multiboot modules to see if there is + * By default we will NOT parse the boot modules to see if there is * cpio image with the microcode images. */ static bool __initdata ucode_scan; @@ -198,7 +197,7 @@ static void __init microcode_scan_module( ucode_blob.data =3D cd.data; break; } - bootstrap_map(NULL); + bootstrap_map_bm(NULL); } } =20 @@ -211,7 +210,7 @@ static void __init microcode_grab_module( !__test_and_clear_bit(ucode_mod_idx, module_map) ) goto scan; bi->mods[ucode_mod_idx].type =3D BOOTMOD_MICROCODE; - ucode_mod =3D *bi->mods[ucode_mod_idx].early_mod; + ucode_mod =3D bi->mods[ucode_mod_idx]; scan: if ( ucode_scan ) microcode_scan_module(module_map, bi); @@ -749,14 +748,14 @@ static int __init cf_check microcode_init(void) */ if ( ucode_blob.size ) { - bootstrap_map(NULL); + bootstrap_map_bm(NULL); ucode_blob.size =3D 0; ucode_blob.data =3D NULL; } - else if ( ucode_mod.mod_end ) + else if ( ucode_mod.size ) { - bootstrap_map(NULL); - ucode_mod.mod_end =3D 0; + bootstrap_map_bm(NULL); + ucode_mod.size =3D 0; } =20 return 0; @@ -814,9 +813,9 @@ int __init microcode_init_cache( /* Need to rescan the modules because they might have been relocat= ed */ microcode_scan_module(module_map, bi); =20 - if ( ucode_mod.mod_end ) - rc =3D early_update_cache(bootstrap_map(&ucode_mod), - ucode_mod.mod_end); + if ( ucode_mod.size ) + rc =3D early_update_cache(bootstrap_map_bm(&ucode_mod), + ucode_mod.size); else if ( ucode_blob.size ) rc =3D early_update_cache(ucode_blob.data, ucode_blob.size); =20 @@ -835,10 +834,10 @@ static int __init early_microcode_update_cpu(void) len =3D ucode_blob.size; data =3D ucode_blob.data; } - else if ( ucode_mod.mod_end ) + else if ( ucode_mod.size ) { - len =3D ucode_mod.mod_end; - data =3D bootstrap_map(&ucode_mod); + len =3D ucode_mod.size; + data =3D bootstrap_map_bm(&ucode_mod); } =20 if ( !data ) @@ -904,7 +903,7 @@ int __init early_microcode_init(unsigned long *module_m= ap, =20 microcode_grab_module(module_map, bi); =20 - if ( ucode_mod.mod_end || ucode_blob.size ) + if ( ucode_mod.size || ucode_blob.size ) rc =3D early_microcode_update_cpu(); =20 /* --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054623; cv=pass; d=zohomail.com; s=zohoarc; b=EpJ8JT6NQuX072pEEg85YEivnmIZZCmMmLncISsQFkOVP2PRtsorWVVSgKE9UgkVfsXrQQDq+ZFzd2NlL7T3BI0LekK49/PMdZATI3Z2qrn5TpPbAL+IdMbFNz4GH2XQ19+uKacaWoThNf77+0YbIaT+Jc+vvd2jFgdUUb/egM8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054623; 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=LvQN4/ZeUGHQXB1oFQeKAxyDBFEc9pZ1Jq2e0h2a0EA=; b=AUUnuRwYvIYA1lrl8ic6P42MK7MtpysPzKgxXlaWNbfzpfLmkM28wGCsoF4eCRc7eYywPYW0tkB/NmpSA2QwTW/G1luxl7wn2+tVGHkq/efpmPMTLhFobCDsTmOqwsfiZAsTkZMTZmbos5mw8WldFy1wBV/D7LcdZ4sDSv+FQHE= 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 1725054623406502.5868999596231; Fri, 30 Aug 2024 14:50:23 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786688.1196344 (Exim 4.92) (envelope-from ) id 1sk9VS-0001bx-5C; Fri, 30 Aug 2024 21:50:10 +0000 Received: by outflank-mailman (output) from mailman id 786688.1196344; Fri, 30 Aug 2024 21:50:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9VS-0001bq-2Y; Fri, 30 Aug 2024 21:50:10 +0000 Received: by outflank-mailman (input) for mailman id 786688; Fri, 30 Aug 2024 21:50:09 +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 1sk9VR-0000Zf-FW for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:50:09 +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 d1d1e673-6719-11ef-99a1-01e77a169b0f; Fri, 30 Aug 2024 23:50:07 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 172505448043769.83491652747614; Fri, 30 Aug 2024 14:48:00 -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: d1d1e673-6719-11ef-99a1-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1725054482; cv=none; d=zohomail.com; s=zohoarc; b=XTnfnMMm4v6l8bgXkrImzcmzW4zs0WOeye4Wvyn/3qtPDFmtYslJfbzmsHztcRJrBrXcUdp8HkyNIxuXbyT6L6h5ZRs80F8cn2GJBR1F/wlCulfd042UqUvOqfSMaIt3jtqczW34RQ0BpB+IcoVlZ6k9S8z5j9tjtdAsa92owW0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054482; 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=LvQN4/ZeUGHQXB1oFQeKAxyDBFEc9pZ1Jq2e0h2a0EA=; b=PwZwn/ShaCUjoquhIDwC/pWauonn6EskybZSDF0kJECtc4ykfm8siRTP2Hu7yuBVPejf15P6bJKNFHopZdLQZiiTrUjFaUij77/nGSR2yjIKVgj5uh0iMmucnKSUfJVZGdnQycXXReNKz+e8i6sBiu8gvAvTIxYDuTqdoxV4xzE= 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=1725054482; 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=LvQN4/ZeUGHQXB1oFQeKAxyDBFEc9pZ1Jq2e0h2a0EA=; b=W/Gl4cgwewEQRRVLEyJntP9FHXJtsY8Bg50wNRAiItjTUSUQ4QV4d/aJmgozlJdt 2pUEavy2UhYy5r/kroq/mqALqBSw4r2+wFArYhplNMjL4QjZWsNJRWSEuwexTL3ESRe fGvhnScPUX3CVOece3XxRKakOQrReni3BC+MSiB0= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 19/44] x86/boot: use consumed boot module flag for microcode Date: Fri, 30 Aug 2024 17:47:04 -0400 Message-Id: <20240830214730.1621-20-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054624974116600 Content-Type: text/plain; charset="utf-8" To track if the microcode boot module was loaded, a copy of the boot module= is kept. The size element of this copy is set to zero as the indicator that the microcode was loaded. A side effect is that the modules have to be rescanne= d to find the boot module post-relocation, so the cache copy can be created. Use the consumed boot module flag to track the loading of the microcode boot module. This removes the need to manipulate the boot module size element, no longer requiring the copy, thus allowing it to be replaced by a reference. = As a result it is no longer necessary to rescan the boot modules after relocation has occurred. Signed-off-by: Daniel P. Smith --- xen/arch/x86/cpu/microcode/core.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode= /core.c index cedb03beea54..83dd8bbe9fb1 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -58,7 +58,7 @@ */ #define MICROCODE_UPDATE_TIMEOUT_US 1000000 =20 -static struct boot_module __initdata ucode_mod; +static struct boot_module __initdata *ucode_mod; static signed int __initdata ucode_mod_idx; static bool __initdata ucode_mod_forced; static unsigned int nr_cores; @@ -210,7 +210,7 @@ static void __init microcode_grab_module( !__test_and_clear_bit(ucode_mod_idx, module_map) ) goto scan; bi->mods[ucode_mod_idx].type =3D BOOTMOD_MICROCODE; - ucode_mod =3D bi->mods[ucode_mod_idx]; + ucode_mod =3D &bi->mods[ucode_mod_idx]; scan: if ( ucode_scan ) microcode_scan_module(module_map, bi); @@ -752,10 +752,10 @@ static int __init cf_check microcode_init(void) ucode_blob.size =3D 0; ucode_blob.data =3D NULL; } - else if ( ucode_mod.size ) + else if ( ucode_mod && !(ucode_mod->flags & BOOTMOD_FLAG_X86_CONSUMED)= ) { bootstrap_map_bm(NULL); - ucode_mod.size =3D 0; + ucode_mod->flags |=3D BOOTMOD_FLAG_X86_CONSUMED; } =20 return 0; @@ -809,14 +809,14 @@ int __init microcode_init_cache( if ( !ucode_ops.apply_microcode ) return -ENODEV; =20 - if ( ucode_scan ) - /* Need to rescan the modules because they might have been relocat= ed */ + /* Scan if microcode was not detected earlier */ + if ( !ucode_mod ) microcode_scan_module(module_map, bi); =20 - if ( ucode_mod.size ) - rc =3D early_update_cache(bootstrap_map_bm(&ucode_mod), - ucode_mod.size); - else if ( ucode_blob.size ) + if ( ucode_mod && !(ucode_mod->flags & BOOTMOD_FLAG_X86_CONSUMED) ) + rc =3D early_update_cache(bootstrap_map_bm(ucode_mod), + ucode_mod->size); + else if ( ucode_mod && ucode_blob.size ) rc =3D early_update_cache(ucode_blob.data, ucode_blob.size); =20 return rc; @@ -834,10 +834,10 @@ static int __init early_microcode_update_cpu(void) len =3D ucode_blob.size; data =3D ucode_blob.data; } - else if ( ucode_mod.size ) + else if ( ucode_mod && !(ucode_mod->flags & BOOTMOD_FLAG_X86_CONSUMED)= ) { - len =3D ucode_mod.size; - data =3D bootstrap_map_bm(&ucode_mod); + len =3D ucode_mod->size; + data =3D bootstrap_map_bm(ucode_mod); } =20 if ( !data ) @@ -903,7 +903,7 @@ int __init early_microcode_init(unsigned long *module_m= ap, =20 microcode_grab_module(module_map, bi); =20 - if ( ucode_mod.size || ucode_blob.size ) + if ( ucode_mod || ucode_blob.size ) rc =3D early_microcode_update_cpu(); =20 /* --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054628; cv=pass; d=zohomail.com; s=zohoarc; b=QB3GGltr5V44Xa/8hYvJnGXs3vKE6J2IvxQyrLZsROZMNvpVPTdWtgMDkTl9t7de4GLhal3cUsez0FQJkr3N/q0fUn7zZIFkrxL/LlesQOhDfBRiY0yC2ZXiq9rkRMDZ6vdOKowTPMzoNAoGFPFvb68lYxDtLTk2Tt93CNZoJuk= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054628; 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=HBuvBxLu0927SlqbG8RcjS/3s6UZxSTS/pkLGNBX224=; b=NlITrZh/ePaVQq1jvVAs/KiO1RdfABtu+ASO1yi9LuQBRZXD6Rn/iByudrLnRmQmGRyP0052Qn+7dpLSkiUqQLO4m3BmxMWK4tzlsv9ZKeCYzO1ScbIrR3hisIndRyicGZJtpgDOIXbwTeXmODYO/9+6sH0GxcLZe1Pt54oL/a0= 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 1725054628911268.24223190446935; Fri, 30 Aug 2024 14:50:28 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786690.1196354 (Exim 4.92) (envelope-from ) id 1sk9Va-00022c-Bu; Fri, 30 Aug 2024 21:50:18 +0000 Received: by outflank-mailman (output) from mailman id 786690.1196354; Fri, 30 Aug 2024 21:50:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9Va-00022U-8f; Fri, 30 Aug 2024 21:50:18 +0000 Received: by outflank-mailman (input) for mailman id 786690; Fri, 30 Aug 2024 21:50:17 +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 1sk9VZ-0000Zf-3p for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:50:17 +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 d62f24fe-6719-11ef-99a1-01e77a169b0f; Fri, 30 Aug 2024 23:50:15 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054481581187.92876924816562; Fri, 30 Aug 2024 14:48:01 -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: d62f24fe-6719-11ef-99a1-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1725054483; cv=none; d=zohomail.com; s=zohoarc; b=MImAxhfwNPeS3w8pWcKg4XRtc6oggkouWyA+B/FXA+UfZHI5QNwG88fQIgbAVE4DgNVLQGltY3LuT4QqILVlht22rkpTdj6mMO4jhPzdVSaXjs+qKhsuGVhW+KC5tqCbwR0+gzwwb21AqlKClpkSY/4easU3xmNdiN0oIOrSPXA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054483; 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=HBuvBxLu0927SlqbG8RcjS/3s6UZxSTS/pkLGNBX224=; b=Q7BjRw5S14bOAYEyGSFlzxeebkGQJecgUnPtlDQuIOluyU6LMt+UJM51CsScplaQZLcxl17Ya3N+qBBe9VFmzZoB4mgCQ/maSLrSZ9ywYYPpFBY2nf8jbmA3yJeNRqxEQOOHKUrzkTpxzkZU0g33j2lnPHAFsBuR47VUxHtR0NM= 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=1725054483; 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=HBuvBxLu0927SlqbG8RcjS/3s6UZxSTS/pkLGNBX224=; b=aVD2dDfuU1kn0SnndaUHLfFEXQNIof6L+lN7Z97oJQI1DViGz+HiERFQ3I5JoPXv JYUUKI0v6VU1/YITg0yn/n5Fqlo+BqGOK4ooymMWQoY5vsk/uLeXavzfzuIJydYk7U9 XzTy9BZo+dlFeId/fJGhZH89euiM0sZyJTzasB8g= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 20/44] x86/boot: convert xsm policy loading to struct boot_module Date: Fri, 30 Aug 2024 17:47:05 -0400 Message-Id: <20240830214730.1621-21-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054631036116600 Content-Type: text/plain; charset="utf-8" Iterate through the unclaimed struct boot_module to see if any are an XSM F= LASK policy. If one is located, mark it as an xsm policy. Signed-off-by: Daniel P. Smith --- xen/arch/x86/include/asm/bootinfo.h | 1 + xen/arch/x86/setup.c | 2 +- xen/include/xsm/xsm.h | 11 +++++++---- xen/xsm/xsm_core.c | 13 +++++++++++-- xen/xsm/xsm_policy.c | 15 ++++++++------- 5 files changed, 28 insertions(+), 14 deletions(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 1cef48457c66..1a325f66b3ba 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -18,6 +18,7 @@ enum bootmod_type { BOOTMOD_KERNEL, BOOTMOD_RAMDISK, BOOTMOD_MICROCODE, + BOOTMOD_XSM_POLICY, }; =20 struct boot_module { diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 6495ab393576..28b39d23f644 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1878,7 +1878,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) mmio_ro_ranges =3D rangeset_new(NULL, "r/o mmio ranges", RANGESETF_prettyprint_hex); =20 - xsm_multiboot_init(module_map, mbi); + xsm_multiboot_init(module_map, boot_info); =20 /* * IOMMU-related ACPI table parsing may require some of the system dom= ains diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h index 627c0d2731af..9e511ef8878c 100644 --- a/xen/include/xsm/xsm.h +++ b/xen/include/xsm/xsm.h @@ -17,7 +17,10 @@ =20 #include #include -#include + +#ifdef CONFIG_MULTIBOOT +#include +#endif =20 /* policy magic number (defined by XSM_MAGIC) */ typedef uint32_t xsm_magic_t; @@ -779,9 +782,9 @@ static inline int xsm_argo_send(const struct domain *d,= const struct domain *t) =20 #ifdef CONFIG_MULTIBOOT int xsm_multiboot_init( - unsigned long *module_map, const multiboot_info_t *mbi); + unsigned long *module_map, const struct boot_info *bi); int xsm_multiboot_policy_init( - unsigned long *module_map, const multiboot_info_t *mbi, + unsigned long *module_map, const struct boot_info *bi, void **policy_buffer, size_t *policy_size); #endif =20 @@ -829,7 +832,7 @@ static const inline struct xsm_ops *silo_init(void) =20 #ifdef CONFIG_MULTIBOOT static inline int xsm_multiboot_init ( - unsigned long *module_map, const multiboot_info_t *mbi) + unsigned long *module_map, const struct boot_info *bi) { return 0; } diff --git a/xen/xsm/xsm_core.c b/xen/xsm/xsm_core.c index eaa028109bde..9f87ec4f6754 100644 --- a/xen/xsm/xsm_core.c +++ b/xen/xsm/xsm_core.c @@ -21,6 +21,7 @@ #ifdef CONFIG_XSM =20 #ifdef CONFIG_MULTIBOOT +#include #include #endif =20 @@ -140,7 +141,7 @@ static int __init xsm_core_init(const void *policy_buff= er, size_t policy_size) =20 #ifdef CONFIG_MULTIBOOT int __init xsm_multiboot_init( - unsigned long *module_map, const multiboot_info_t *mbi) + unsigned long *module_map, const struct boot_info *bi) { int ret =3D 0; void *policy_buffer =3D NULL; @@ -150,7 +151,7 @@ int __init xsm_multiboot_init( =20 if ( XSM_MAGIC ) { - ret =3D xsm_multiboot_policy_init(module_map, mbi, &policy_buffer, + ret =3D xsm_multiboot_policy_init(module_map, bi, &policy_buffer, &policy_size); if ( ret ) { @@ -161,6 +162,14 @@ int __init xsm_multiboot_init( } =20 ret =3D xsm_core_init(policy_buffer, policy_size); + if ( ret =3D=3D 0 ) + { + int idx =3D first_boot_module_index(bi, BOOTMOD_XSM_POLICY); + + /* If the policy was loaded from a boot module, mark it consumed */ + if ( idx >=3D 0 ) + bi->mods[idx].flags |=3D BOOTMOD_FLAG_X86_CONSUMED; + } bootstrap_map(NULL); =20 return 0; diff --git a/xen/xsm/xsm_policy.c b/xen/xsm/xsm_policy.c index 8dafbc93810f..e4c94afd108d 100644 --- a/xen/xsm/xsm_policy.c +++ b/xen/xsm/xsm_policy.c @@ -21,6 +21,7 @@ #include #ifdef CONFIG_MULTIBOOT #include +#include #include #endif #include @@ -31,11 +32,10 @@ =20 #ifdef CONFIG_MULTIBOOT int __init xsm_multiboot_policy_init( - unsigned long *module_map, const multiboot_info_t *mbi, + unsigned long *module_map, const struct boot_info *bi, void **policy_buffer, size_t *policy_size) { int i; - module_t *mod =3D (module_t *)__va(mbi->mods_addr); int rc =3D 0; u32 *_policy_start; unsigned long _policy_len; @@ -44,13 +44,13 @@ int __init xsm_multiboot_policy_init( * Try all modules and see whichever could be the binary policy. * Adjust module_map for the module that is the binary policy. */ - for ( i =3D mbi->mods_count-1; i >=3D 1; i-- ) + for ( i =3D bi->nr_mods-1; i >=3D 1; i-- ) { - if ( !test_bit(i, module_map) ) + if ( bi->mods[i].type !=3D BOOTMOD_UNKNOWN ) continue; =20 - _policy_start =3D bootstrap_map(mod + i); - _policy_len =3D mod[i].mod_end; + _policy_start =3D bootstrap_map_bm(&bi->mods[i]); + _policy_len =3D bi->mods[i].size; =20 if ( (xsm_magic_t)(*_policy_start) =3D=3D XSM_MAGIC ) { @@ -61,11 +61,12 @@ int __init xsm_multiboot_policy_init( _policy_len,_policy_start); =20 __clear_bit(i, module_map); + bi->mods[i].type =3D BOOTMOD_XSM_POLICY; break; =20 } =20 - bootstrap_map(NULL); + bootstrap_map_bm(NULL); } =20 return rc; --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054639; cv=pass; d=zohomail.com; s=zohoarc; b=T2GyN5VyQ0xKQVCElFGPgffQexWPq8PbH8f1BUXs11YGmdJ4iGozLLuA3a4RxegLcBhOJ/yLGRdPv6YHaxN848dpNdXa9TaPib8vhMVZ4vNsPer2WaAFJoInowzFr4FfcZDNjajRuOEwkN9rirg6QUHhnTrNtVXvyeu6MRdgDAM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054639; 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=eet/JYMlrz1AXMqNeYAuxYWhlWnTzhzkBPRDYkxgQbw=; b=kydE+W3UzP2HG02vtrIBNKQnRj6P7nzNZdnnDDLWsdNE7CV1mkEUqqTwSamCnga47icxNur4RX7tZn4lMBBdT1w5KpYDrL8jU1WDkctdldzafPTNeUE46dwCDikgjKeKswLgaAN/uMgnxlKUeLOWtnY5GloiPjmnLgcKSKvCItQ= 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 1725054639586198.1797444955555; Fri, 30 Aug 2024 14:50:39 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786695.1196363 (Exim 4.92) (envelope-from ) id 1sk9Vi-0002Ta-Kv; Fri, 30 Aug 2024 21:50:26 +0000 Received: by outflank-mailman (output) from mailman id 786695.1196363; Fri, 30 Aug 2024 21:50:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9Vi-0002Sx-HO; Fri, 30 Aug 2024 21:50:26 +0000 Received: by outflank-mailman (input) for mailman id 786695; Fri, 30 Aug 2024 21:50:25 +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 1sk9Vh-0000Zf-8P for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:50:25 +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 db15f88e-6719-11ef-99a1-01e77a169b0f; Fri, 30 Aug 2024 23:50:23 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054482625863.6026282912172; Fri, 30 Aug 2024 14:48:02 -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: db15f88e-6719-11ef-99a1-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1725054484; cv=none; d=zohomail.com; s=zohoarc; b=ZpQugvle45rdXeAfWV4kID5LyxhjVsZlWkEtcWbbKHNTJ6+e9VOPH12tT2oLZN5emnI68vHZva7ndgNSiupWfe4RHjHJzhnNkfGgXFTXr3Fiqyq6rOWIOl3zQ26SbwSixa9Ba4ih70XLObXQ/rN4tIKy9GBpoV06Yg1kkOyJy+o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054484; 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=eet/JYMlrz1AXMqNeYAuxYWhlWnTzhzkBPRDYkxgQbw=; b=Q0HBGubFwAyK2Z2xulPWBWP9X2bwB3YDmZvqXYGhleo6vL37DEs3hAKcMmC8HNLWKnOHtddDHsGFwHW1Xtpyb7O8Dr8kjaZlFj1hzSVOIRnwcAjbLC2/jgYX7cDRyS7dLYw0hKJCQQDQ6jok50SS5VfHX/+aNOKEvMOmxqbn9mo= 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=1725054484; 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=eet/JYMlrz1AXMqNeYAuxYWhlWnTzhzkBPRDYkxgQbw=; b=oIpDnyve5SvNNVceia88lUtSdHiR3zWs3MlNAlJ+EVtl/HShQfvig0ZsXlY3SPCd 8Ad13IouLhb+4CmMKSFYzxW7pVpLXfCF2f3X8uL88S815QfP8e851eH4OWRSme1KFlv BdTnjPqR76Ke5Q8+3Pkz+FTujWmLJoKZFHEW0Kt4= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 21/44] x86/boot: convert ramdisk locating to struct boot_module Date: Fri, 30 Aug 2024 17:47:06 -0400 Message-Id: <20240830214730.1621-22-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054641031116600 Content-Type: text/plain; charset="utf-8" Locate the first unclaimed struct boot_module and mark it as ramdisk. If th= ere are any remaining unclaimed struct boot_module instances, report to the console. Signed-off-by: Daniel P. Smith --- xen/arch/x86/setup.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 28b39d23f644..189c45302fab 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -2100,20 +2100,30 @@ void asmlinkage __init noreturn __start_xen(unsigne= d long mbi_p) cpu_has_nx ? XENLOG_INFO : XENLOG_WARNING "Warning: ", cpu_has_nx ? "" : "not "); =20 - initrdidx =3D find_first_bit(module_map, boot_info->nr_mods); - boot_info->mods[initrdidx].type =3D BOOTMOD_RAMDISK; - boot_info->mods[initrdidx].flags |=3D BOOTMOD_FLAG_X86_CONSUMED; - if ( bitmap_weight(module_map, boot_info->nr_mods) > 1 ) - printk(XENLOG_WARNING - "Multiple initrd candidates, picking module #%u\n", - initrdidx); + /* + * At this point all capabilities that consume boot modules should have + * claimed their boot modules. Find the first unclaimed boot module and + * claim it as the initrd ramdisk. Do a second search to see if there = are + * any remaining unclaimed boot modules, and report them as unusued in= itrd + * candidates. + */ + initrdidx =3D first_boot_module_index(boot_info, BOOTMOD_UNKNOWN); + if ( initrdidx >=3D 0 ) + { + boot_info->mods[initrdidx].type =3D BOOTMOD_RAMDISK; + boot_info->mods[initrdidx].flags |=3D BOOTMOD_FLAG_X86_CONSUMED; + if ( first_boot_module_index(boot_info, BOOTMOD_UNKNOWN) >=3D 0 ) + printk(XENLOG_WARNING + "Multiple initrd candidates, picking module #%u\n", + initrdidx); + } =20 /* * We're going to setup domain0 using the module(s) that we stashed sa= fely * above our heap. The second module, if present, is an initrd ramdisk. */ dom0 =3D create_dom0(boot_info->mods[0].early_mod, boot_info->mods[0].= headroom, - initrdidx < boot_info->nr_mods ? + (initrdidx >=3D 0 && initrdidx < boot_info->nr_mods= ) ? boot_info->mods[initrdidx].early_mod : NULL, kextra, boot_info->boot_loader_name); if ( !dom0 ) --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054644; cv=pass; d=zohomail.com; s=zohoarc; b=WUMq3uB7xe65Yih0PMgOIJzoFgYk1kdBLLWI00Q6+koRKyPDc5xkAr3GB2la7xRG7BshFTD2u/2++aXtLR0duWXMrQKkKXcz1vvVFoqIGVELHn0P+SoN1J9wZhXYDUBFxktbtwcOdaAqtUiZctJ2gqllq8U6q77PsLx8Ps54TXg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054644; 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=9VY/wyQt4O/me1dGYDFEc+UYgABFvTmTG94v1OX5tlk=; b=V/O07knTer15pWRuOEhqlwqHLmUKEi+IP4hVM2y3yEr4P87TMtdJ7vEs175ZRA3tjPou2nU9LfXo/GWhsvsgbdb06ougXLgboq2RDq1V9IbmB1nkrvrMWe8esSjB09KiXq3VwVUMx0x1jyPcn7o9C4KdWOVf9FoSgr4JPD4f96k= 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 1725054644918860.0582775600541; Fri, 30 Aug 2024 14:50:44 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786701.1196374 (Exim 4.92) (envelope-from ) id 1sk9Vq-0002ua-TW; Fri, 30 Aug 2024 21:50:34 +0000 Received: by outflank-mailman (output) from mailman id 786701.1196374; Fri, 30 Aug 2024 21:50:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9Vq-0002uT-Qj; Fri, 30 Aug 2024 21:50:34 +0000 Received: by outflank-mailman (input) for mailman id 786701; Fri, 30 Aug 2024 21:50:33 +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 1sk9Vp-0002pb-Q4 for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:50:33 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id dffef035-6719-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:50:31 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054483861421.2034253922176; Fri, 30 Aug 2024 14:48:03 -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: dffef035-6719-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054485; cv=none; d=zohomail.com; s=zohoarc; b=ia6wGt9t5HuBaQqNQZ55WRnAQOdNnd9zqfY1qg9OixdfEMmT1wNje3s6Q/q5BhgBMfDWXZTTN4LYwoEoAigRMgQt275/Gv6+yHbGe1kTnb9GPV7fCOc1+V5D8M+xbfuYC6yAnytFTD+oPN0G6yLo3CQUpsVq7CGSXcqVueFbjNE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054485; 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=9VY/wyQt4O/me1dGYDFEc+UYgABFvTmTG94v1OX5tlk=; b=KLZYeWk/gNdHKm7R1TsLTdZnnfd8Pqld01RmdseUqYSB4176FVTlWN1YBPRka9dlzAc+cAJ6V2NEl9QZKTnwPuY4m59HUJ57JjTZ3n/feNlfemlOeYXz9GfxWYCtnvzMYcajOzov85JazR5b/M+sB/LFajIHJywr5S6tfrqhVGM= 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=1725054485; 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=9VY/wyQt4O/me1dGYDFEc+UYgABFvTmTG94v1OX5tlk=; b=dF8UFFgbdH1r41iLKSnyhdODKsMso2k76i9ie9JTslPQtsE3jMsvPBNpVZj4g+uK uqEJTlaujfMdz+wn+o2J0xj5U6TskKUwhWHmUWqWk937G3c0SPd8vfbHjyWwhrjdblf TX7n9XXtYAoQbM4TLZq9EYdpQ2vNTrNF7GkEbBPk= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 22/44] x86/boot: remove module_map usage from microcode loading Date: Fri, 30 Aug 2024 17:47:07 -0400 Message-Id: <20240830214730.1621-23-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054647226116600 Content-Type: text/plain; charset="utf-8" With all consumers of module_map converted, remove usage of it by the microcode loading logic. Signed-off-by: Daniel P. Smith --- xen/arch/x86/cpu/microcode/core.c | 22 +++++++++------------- xen/arch/x86/include/asm/microcode.h | 6 ++---- xen/arch/x86/setup.c | 4 ++-- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode= /core.c index 83dd8bbe9fb1..a465a676d176 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -151,8 +151,7 @@ static int __init cf_check parse_ucode(const char *s) } custom_param("ucode", parse_ucode); =20 -static void __init microcode_scan_module( - unsigned long *module_map, const struct boot_info *bi) +static void __init microcode_scan_module(const struct boot_info *bi) { uint64_t *_blob_start; unsigned long _blob_size; @@ -177,7 +176,7 @@ static void __init microcode_scan_module( */ for ( i =3D 1 /* Ignore dom0 kernel */; i < bi->nr_mods; i++ ) { - if ( !test_bit(i, module_map) ) + if ( bi->mods[i].type !=3D BOOTMOD_UNKNOWN ) continue; =20 _blob_start =3D bootstrap_map_bm(&bi->mods[i]); @@ -201,19 +200,18 @@ static void __init microcode_scan_module( } } =20 -static void __init microcode_grab_module( - unsigned long *module_map, const struct boot_info *bi) +static void __init microcode_grab_module(const struct boot_info *bi) { if ( ucode_mod_idx < 0 ) ucode_mod_idx +=3D bi->nr_mods; if ( ucode_mod_idx <=3D 0 || ucode_mod_idx >=3D bi->nr_mods || - !__test_and_clear_bit(ucode_mod_idx, module_map) ) + (bi->mods[ucode_mod_idx].type !=3D BOOTMOD_UNKNOWN) ) goto scan; bi->mods[ucode_mod_idx].type =3D BOOTMOD_MICROCODE; ucode_mod =3D &bi->mods[ucode_mod_idx]; scan: if ( ucode_scan ) - microcode_scan_module(module_map, bi); + microcode_scan_module(bi); } =20 static struct microcode_ops __ro_after_init ucode_ops; @@ -801,8 +799,7 @@ static int __init early_update_cache(const void *data, = size_t len) return rc; } =20 -int __init microcode_init_cache( - unsigned long *module_map, const struct boot_info *bi) +int __init microcode_init_cache(const struct boot_info *bi) { int rc =3D 0; =20 @@ -811,7 +808,7 @@ int __init microcode_init_cache( =20 /* Scan if microcode was not detected earlier */ if ( !ucode_mod ) - microcode_scan_module(module_map, bi); + microcode_scan_module(bi); =20 if ( ucode_mod && !(ucode_mod->flags & BOOTMOD_FLAG_X86_CONSUMED) ) rc =3D early_update_cache(bootstrap_map_bm(ucode_mod), @@ -857,8 +854,7 @@ static int __init early_microcode_update_cpu(void) return microcode_update_cpu(patch); } =20 -int __init early_microcode_init(unsigned long *module_map, - const struct boot_info *bi) +int __init early_microcode_init(const struct boot_info *bi) { const struct cpuinfo_x86 *c =3D &boot_cpu_data; int rc =3D 0; @@ -901,7 +897,7 @@ int __init early_microcode_init(unsigned long *module_m= ap, return -ENODEV; } =20 - microcode_grab_module(module_map, bi); + microcode_grab_module(bi); =20 if ( ucode_mod || ucode_blob.size ) rc =3D early_microcode_update_cpu(); diff --git a/xen/arch/x86/include/asm/microcode.h b/xen/arch/x86/include/as= m/microcode.h index 02fdb56bb82b..6abd6c1ff510 100644 --- a/xen/arch/x86/include/asm/microcode.h +++ b/xen/arch/x86/include/asm/microcode.h @@ -26,10 +26,8 @@ DECLARE_PER_CPU(struct cpu_signature, cpu_sig); void microcode_set_module(unsigned int idx); int microcode_update( XEN_GUEST_HANDLE(const_void) buf, unsigned long len, unsigned int flag= s); -int early_microcode_init( - unsigned long *module_map, const struct boot_info *bi); -int microcode_init_cache( - unsigned long *module_map, const struct boot_info *bi); +int early_microcode_init(const struct boot_info *bi); +int microcode_init_cache(const struct boot_info *bi); int microcode_update_one(void); =20 #endif /* ASM_X86__MICROCODE_H */ diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 189c45302fab..541a956923d3 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1398,7 +1398,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) * TODO: load ucode earlier once multiboot modules become accessible * at an earlier stage. */ - early_microcode_init(module_map, boot_info); + early_microcode_init(boot_info); =20 if ( xen_phys_start ) { @@ -1952,7 +1952,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) =20 timer_init(); =20 - microcode_init_cache(module_map, boot_info); /* Needs xmalloc() */ + microcode_init_cache(boot_info); /* Needs xmalloc() */ =20 tsx_init(); /* Needs microcode. May change HLE/RTM feature bits. */ =20 --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054653; cv=pass; d=zohomail.com; s=zohoarc; b=Xt5kBe3lDlCat1Uo7jgnreHIu+2eH33BLU4QmMW1/gW0+d1ZhEajqSck+Tts0PZYIUx6tKbX23t71MvjqdPqQgxirYBLXGeAl1hreJ0L1r1S4fMQoKV6ig82Uph5PTqG0vWC4hF5szc4hmBeUpoww9TBYXho8ZyQ3oCl9H3pQyo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054653; 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=CWEMixDJY7x4MLnQ/ZkZHLIFrIhvLWgtbDqN9QKbuu4=; b=cwZbBXd86eKtKSenlpXrcbWOFVN59+lL85vzRBVkKSgbaHKpry+mWGHTxKLVsOrYJDNdqp6eqHwDB1Tikcl78GK2qfMkQHHN5ZBpJZiX84D5wT1H/8grseQoJgFMR19W7grs8U32DfqrA1CzJ8fJ/UQPfi5yhWddgw6yVq7QbRE= 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 172505465339637.212631064048196; Fri, 30 Aug 2024 14:50:53 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786705.1196384 (Exim 4.92) (envelope-from ) id 1sk9Vx-0003Mf-AZ; Fri, 30 Aug 2024 21:50:41 +0000 Received: by outflank-mailman (output) from mailman id 786705.1196384; Fri, 30 Aug 2024 21:50: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 1sk9Vx-0003MY-7h; Fri, 30 Aug 2024 21:50:41 +0000 Received: by outflank-mailman (input) for mailman id 786705; Fri, 30 Aug 2024 21:50:40 +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 1sk9Vw-0002pb-GT for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:50:40 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e4722501-6719-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:50:39 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054484953288.2781406902028; Fri, 30 Aug 2024 14:48:04 -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: e4722501-6719-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054486; cv=none; d=zohomail.com; s=zohoarc; b=fMBteAsI13MSUK4JhY2EasizYgJhcij4MN1c+5n7gd7nE0l0SsZ39qCofDWdb6+oc1ziSm+bhYHl7Tqhpp1jAWILiIsY4EJl5Iqzl+vFt1coeIA01Glqcj88pXe4SAZ6HMDk6EOg71np5el8QBgH6VBeFZYcdCWHCWNBiRRNPZU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054486; 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=CWEMixDJY7x4MLnQ/ZkZHLIFrIhvLWgtbDqN9QKbuu4=; b=QolIQEHusFGH/1c7zyLjewOEij4pwbIQ/uWsxESAEJNd6uDb3Lc9h36BVXidVBERvSGb8c2HLTynoBN+5KUbTUCjSPdhbZZjeKO/YTJhXY3Xuc+rqXejjtuLRYpCH9f4j2RhNRJ+IJ5W4d6a+/8JK0HC/9yzY6j199exdjt/Ups= 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=1725054486; 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=CWEMixDJY7x4MLnQ/ZkZHLIFrIhvLWgtbDqN9QKbuu4=; b=gsUanQnsMQJRxhBKO4nK+31N6TJynts15cxFfqcmbWbFQv7dk50npWV3qnrlwqzs NVnQ+aBuuQU01qZX3glUcgQrcVwcvxaFnOqXRv602/idE0jzHlt0ER55B0y6X15ruBw jBhn8VggWGLyLrrlGqgRSlJ/3dLAq8PQHscyZxBI= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 23/44] x86/boot: remove module_map usage from xsm policy loading Date: Fri, 30 Aug 2024 17:47:08 -0400 Message-Id: <20240830214730.1621-24-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054655097116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel P. Smith --- xen/arch/x86/setup.c | 2 +- xen/include/xsm/xsm.h | 9 +++------ xen/xsm/xsm_core.c | 6 ++---- xen/xsm/xsm_policy.c | 5 +---- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 541a956923d3..90c2ddb3728a 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1878,7 +1878,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) mmio_ro_ranges =3D rangeset_new(NULL, "r/o mmio ranges", RANGESETF_prettyprint_hex); =20 - xsm_multiboot_init(module_map, boot_info); + xsm_multiboot_init(boot_info); =20 /* * IOMMU-related ACPI table parsing may require some of the system dom= ains diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h index 9e511ef8878c..3f05d09880d8 100644 --- a/xen/include/xsm/xsm.h +++ b/xen/include/xsm/xsm.h @@ -781,11 +781,9 @@ static inline int xsm_argo_send(const struct domain *d= , const struct domain *t) #endif /* XSM_NO_WRAPPERS */ =20 #ifdef CONFIG_MULTIBOOT -int xsm_multiboot_init( - unsigned long *module_map, const struct boot_info *bi); +int xsm_multiboot_init(const struct boot_info *bi); int xsm_multiboot_policy_init( - unsigned long *module_map, const struct boot_info *bi, - void **policy_buffer, size_t *policy_size); + const struct boot_info *bi, void **policy_buffer, size_t *policy_size); #endif =20 #ifdef CONFIG_HAS_DEVICE_TREE @@ -831,8 +829,7 @@ static const inline struct xsm_ops *silo_init(void) #include =20 #ifdef CONFIG_MULTIBOOT -static inline int xsm_multiboot_init ( - unsigned long *module_map, const struct boot_info *bi) +static inline int xsm_multiboot_init(const struct boot_info *bi) { return 0; } diff --git a/xen/xsm/xsm_core.c b/xen/xsm/xsm_core.c index 9f87ec4f6754..f816c94fb5aa 100644 --- a/xen/xsm/xsm_core.c +++ b/xen/xsm/xsm_core.c @@ -140,8 +140,7 @@ static int __init xsm_core_init(const void *policy_buff= er, size_t policy_size) } =20 #ifdef CONFIG_MULTIBOOT -int __init xsm_multiboot_init( - unsigned long *module_map, const struct boot_info *bi) +int __init xsm_multiboot_init(const struct boot_info *bi) { int ret =3D 0; void *policy_buffer =3D NULL; @@ -151,8 +150,7 @@ int __init xsm_multiboot_init( =20 if ( XSM_MAGIC ) { - ret =3D xsm_multiboot_policy_init(module_map, bi, &policy_buffer, - &policy_size); + ret =3D xsm_multiboot_policy_init(bi, &policy_buffer, &policy_size= ); if ( ret ) { bootstrap_map(NULL); diff --git a/xen/xsm/xsm_policy.c b/xen/xsm/xsm_policy.c index e4c94afd108d..ac09dd808b27 100644 --- a/xen/xsm/xsm_policy.c +++ b/xen/xsm/xsm_policy.c @@ -32,8 +32,7 @@ =20 #ifdef CONFIG_MULTIBOOT int __init xsm_multiboot_policy_init( - unsigned long *module_map, const struct boot_info *bi, - void **policy_buffer, size_t *policy_size) + const struct boot_info *bi, void **policy_buffer, size_t *policy_size) { int i; int rc =3D 0; @@ -42,7 +41,6 @@ int __init xsm_multiboot_policy_init( =20 /* * Try all modules and see whichever could be the binary policy. - * Adjust module_map for the module that is the binary policy. */ for ( i =3D bi->nr_mods-1; i >=3D 1; i-- ) { @@ -60,7 +58,6 @@ int __init xsm_multiboot_policy_init( printk("Policy len %#lx, start at %p.\n", _policy_len,_policy_start); =20 - __clear_bit(i, module_map); bi->mods[i].type =3D BOOTMOD_XSM_POLICY; break; =20 --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054658; cv=pass; d=zohomail.com; s=zohoarc; b=CDG4xdBxUvCZjcG4fghiYvKNR0Ircreg/3PZqv5yFcDVGP8wl89Tl+55TTtsraa2Kh/rjtruoZvYy7UWW3KodgHvOuQIQ/OG05shE+8229Qf7Gj33/keYupTnW2q431n00EgsCAUMLtRWL4OO6WbNBURkOrgkWAC6EQ8sW9ZeFc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054658; 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=4r8bmG5H6VttNyjMx0aG3Heh83MSlb/U7U7R6jqNGbY=; b=X8sc/BrzM8IIn/QxBBMu9OgthxBGFLELc7feyzly+r/Cj7He6CHNThSaoQYoBIvPutMfK2brxX6aTDe/nY77d+BI7Ff0jFRvd2ukzjgjGoGxb6j4DIb+/9UtEZE+EXc3R/JFGqfaxquoHE6lEvMMREN3MhRTui4q/e3DxNsD+j0= 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 1725054658467362.58337634435566; Fri, 30 Aug 2024 14:50:58 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786709.1196394 (Exim 4.92) (envelope-from ) id 1sk9W4-0003ry-Hp; Fri, 30 Aug 2024 21:50:48 +0000 Received: by outflank-mailman (output) from mailman id 786709.1196394; Fri, 30 Aug 2024 21:50:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9W4-0003rr-Ex; Fri, 30 Aug 2024 21:50:48 +0000 Received: by outflank-mailman (input) for mailman id 786709; Fri, 30 Aug 2024 21:50:47 +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 1sk9W3-0002pb-7I for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:50:47 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e88aa22b-6719-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:50:46 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054486005884.6684138233145; Fri, 30 Aug 2024 14:48:06 -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: e88aa22b-6719-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054488; cv=none; d=zohomail.com; s=zohoarc; b=SNkhcUTb5ljjl2N4k5YOyU3+oI1ILjCxlFunEQS+985K2oo1Yu+xBrLdrDkBJDxLmc2f8rW0DkVOn31d/xaGFBsjtN+u5FJLip4P+ik3GQIxhVbI41HHWntYWnMTBDrw35GjtavGKlfZ8nbhxngiDGjH4VbgJS1m3Yma82oQxLs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054488; 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=4r8bmG5H6VttNyjMx0aG3Heh83MSlb/U7U7R6jqNGbY=; b=VMKWkebmIugSeqsy1YB478K5MVEVqELvz/mT7v+uKnvardBgLfOvaUxAZE4aN0UuqN0tXWortoPkUyoixYwwC94fYrC6CVesl0q5oj68SR9VrU0XdsprkOBSPcGsoXvaF36d0ClD849xYdLug6saTybJXLie4/lQYcSSEllzVco= 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=1725054488; 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=4r8bmG5H6VttNyjMx0aG3Heh83MSlb/U7U7R6jqNGbY=; b=j63f/8kEFjZLnJwXnEwaZ/+r476pw2tLC0WHdxn5Qz5P9y7hHGmfP3qA+hpNyKde nuSZy3mzccLVOIEdnGTaKXemyOWhoJc2r20EWT3fLiceMuUvnhoE9/aZTzcNCQUiCd3 FjUZTGwcsQWeUS2/ou7R3tUVBdmJJxdh+pvDBqlM= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 24/44] x86/boot: remove module_map usage by ramdisk loading Date: Fri, 30 Aug 2024 17:47:09 -0400 Message-Id: <20240830214730.1621-25-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054659083116600 Content-Type: text/plain; charset="utf-8" The ramdisk loading is the last user of module_map, remove its usage and any remaining remnants of module_map. Signed-off-by: Daniel P. Smith --- xen/arch/x86/setup.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 90c2ddb3728a..5f42d1049110 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1053,7 +1053,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) unsigned int initrdidx, num_parked =3D 0; multiboot_info_t *mbi; module_t *mod; - unsigned long nr_pages, raw_max_page, module_map[1]; + unsigned long nr_pages, raw_max_page; int i, j, e820_warn =3D 0, bytes =3D 0; unsigned long eb_start, eb_end; bool acpi_boot_table_init_done =3D false, relocated =3D false; @@ -1203,15 +1203,14 @@ void asmlinkage __init noreturn __start_xen(unsigne= d long mbi_p) panic("dom0 kernel not specified. Check bootloader configuration\n= "); =20 /* Check that we don't have a silly number of modules. */ - if ( boot_info->nr_mods > sizeof(module_map) * 8 ) + if ( boot_info->nr_mods > MAX_NR_BOOTMODS + 1 ) { - boot_info->nr_mods =3D sizeof(module_map) * 8; + boot_info->nr_mods =3D MAX_NR_BOOTMODS + 1; printk("Excessive multiboot modules - using the first %u only\n", boot_info->nr_mods); } =20 - bitmap_fill(module_map, boot_info->nr_mods); - __clear_bit(0, module_map); /* Dom0 kernel is always first */ + /* Dom0 kernel is always first */ boot_info->mods[0].type =3D BOOTMOD_KERNEL; boot_info->mods[0].flags |=3D BOOTMOD_FLAG_X86_CONSUMED; =20 --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054669; cv=pass; d=zohomail.com; s=zohoarc; b=PCr6YP+edn8UhMnZdc6YusJgYJXrwb2OUv3GrWKeW26uG+e3tbHcp6ixtOqxjznf3bwvWPCU0FLM0yJpx51VIh9lzzHs2Mpe6LpNH7S8km9nt9QdW4WVdT/IKhdfJxtU7QKDX0djXGWlCrmpPkvS/X7zUpO/Grz1VrH+Ngc7KBs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054669; 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=ys18ftsSkLmnP3FGqbLMZshx9Vb7hKAbenYbX5oGr+w=; b=lhkmSOXrs5fitW+7VMOnfxAUjV0um+9FOMN9KfDVoVgsC901MVL7vt2nVGSx0JB+w4qVHWFqMNU3NQt+qlIgFqXnNNc7aeHFQh4siKPlBm12rPTpFAT+bpH2h6GjHDR+/7tmFH9qn9Y20p2Sz7dqAfOf/4gDw+SL14etfW2cCOo= 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 1725054669851733.7395097663989; Fri, 30 Aug 2024 14:51:09 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786715.1196405 (Exim 4.92) (envelope-from ) id 1sk9WC-0004QN-Ro; Fri, 30 Aug 2024 21:50:56 +0000 Received: by outflank-mailman (output) from mailman id 786715.1196405; Fri, 30 Aug 2024 21:50:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9WC-0004Q9-MC; Fri, 30 Aug 2024 21:50:56 +0000 Received: by outflank-mailman (input) for mailman id 786715; Fri, 30 Aug 2024 21:50:55 +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 1sk9WB-0002pb-5E for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:50:55 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ed3756ba-6719-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:50:53 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054487065771.3540805061515; Fri, 30 Aug 2024 14:48:07 -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: ed3756ba-6719-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054489; cv=none; d=zohomail.com; s=zohoarc; b=RwM36eY5ndlANJvGlJ0eLycvYhep4L+JHBT2OQ10GwM4BWVcyagKcezER0btgNhQqDCTixPnC90sk7zXQqs1Rl0gKC0vgvB8lMKGEd5M7G+sdFxHm8/7yPsjMc+Pr6uAp+TdkYCMcHFHDzUxJwZsxugaCHIdx7Dz4S09miNu/GI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054489; 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=ys18ftsSkLmnP3FGqbLMZshx9Vb7hKAbenYbX5oGr+w=; b=FrdO7+lXLw8G6ysgq0pzXR020mdz7cIsmcyHkAwq7dfUfTDcMTxNu+6dtIX5W+6TgmlqE0uTmI87IgZOvs2dZv4SMDWcHvLn5Jrr/iV336Fl9KLnP10lBGtuHJkz9Lq7FID/fCW9vZrdfheqefj4QkFrTob2Nw0PBDPcOADgHns= 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=1725054489; 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=ys18ftsSkLmnP3FGqbLMZshx9Vb7hKAbenYbX5oGr+w=; b=DHLyREtRAhlEVRDnPbdhTi+PYXcBI8/qPzw9pewwZ7lTVdEJbGuayFw7jjdPLqB7 eBUUAEdpbCQ8gCHvfZpJnFo3XBeGJqkqfCz7Uoqt5j77z+jj5BbIjttDqb2OJqnDNYv vaRKqhSPaLfFYSCz2GBCMQlV2XZnh43a/i6muMbk= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 25/44] x86/boot: convert create_dom0 to use boot info Date: Fri, 30 Aug 2024 17:47:10 -0400 Message-Id: <20240830214730.1621-26-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054671128116600 Content-Type: text/plain; charset="utf-8" This commit changes create_dom0 to no longer take the individual components= and take struct boot_info instead. Internally, it is changed to locate the kern= el and ramdisk details from struct boot_info. Signed-off-by: Daniel P. Smith --- xen/arch/x86/setup.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 5f42d1049110..6a613c4847b0 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -946,10 +946,8 @@ static unsigned int __init copy_bios_e820(struct e820e= ntry *map, unsigned int li return n; } =20 -static struct domain *__init create_dom0(const module_t *image, - unsigned long headroom, - module_t *initrd, const char *kex= tra, - const char *loader) +static struct domain *__init create_dom0(const struct boot_info *bi, + const char *kextra) { static char __initdata cmdline[MAX_GUEST_CMDLINE]; =20 @@ -964,9 +962,21 @@ static struct domain *__init create_dom0(const module_= t *image, .misc_flags =3D opt_dom0_msr_relaxed ? XEN_X86_MSR_RELAXED : 0, }, }; + int headroom, mod_idx =3D first_boot_module_index(bi, BOOTMOD_RAMDISK); + module_t *image, *initrd; struct domain *d; domid_t domid; =20 + /* Map boot_module to mb1 module for dom0 */ + image =3D bi->mods[0].early_mod; + headroom =3D bi->mods[0].headroom; + + /* Map boot_module to mb1 module for initrd */ + if ( mod_idx < 0 ) + initrd =3D NULL; + else + initrd =3D bi->mods[mod_idx].early_mod; + if ( opt_dom0_pvh ) { dom0_cfg.flags |=3D (XEN_DOMCTL_CDF_hvm | @@ -995,7 +1005,8 @@ static struct domain *__init create_dom0(const module_= t *image, if ( image->string || kextra ) { if ( image->string ) - safe_strcpy(cmdline, cmdline_cook(__va(image->string), loader)= ); + safe_strcpy(cmdline, cmdline_cook(__va(image->string), + bi->boot_loader_name)); =20 if ( kextra ) /* kextra always includes exactly one leading space. */ @@ -2121,10 +2132,7 @@ void asmlinkage __init noreturn __start_xen(unsigned= long mbi_p) * We're going to setup domain0 using the module(s) that we stashed sa= fely * above our heap. The second module, if present, is an initrd ramdisk. */ - dom0 =3D create_dom0(boot_info->mods[0].early_mod, boot_info->mods[0].= headroom, - (initrdidx >=3D 0 && initrdidx < boot_info->nr_mods= ) ? - boot_info->mods[initrdidx].early_mod : NULL, - kextra, boot_info->boot_loader_name); + dom0 =3D create_dom0(boot_info, kextra); if ( !dom0 ) panic("Could not set up DOM0 guest OS\n"); =20 --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725055016; cv=pass; d=zohomail.com; s=zohoarc; b=fpVNG2QoIMVlFq7hYYWM0K5VI7LQ2uu5VppsZHPQzBbyU9pLmUdEX4EBtyRop9nT1xkWnAsg8+eXnXeohm53LIH7h9bEe7zmnubP3NxPdj+bGaq2SOW66W011bGrsNAdmUdK9i5lN9DGpsohCM2Ze1vDY3yTD3vVeL8M4Cg7yWo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725055016; 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=L5tz0lT7C2k6e608u4s5wJilake7jMdmn/z/xN+eCro=; b=gg3dn9n4Ktpj4Ad7LY6IyNW6h/wNuWd5P56l044vPvW9yplbi0RDLXYSXOMwN74oLFDs8L79mcPX98TB5PIm6KRYkVY38PAjXVaxGIc45P393bXCAXvQEWIvps1KMa6R2oJKCXuj0b/UxQpkGBAdwTVY5M0M2ly90TkDACYyAs8= 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 1725055016856656.3059484747735; Fri, 30 Aug 2024 14:56:56 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786798.1196608 (Exim 4.92) (envelope-from ) id 1sk9bl-0007KO-KE; Fri, 30 Aug 2024 21:56:41 +0000 Received: by outflank-mailman (output) from mailman id 786798.1196608; Fri, 30 Aug 2024 21:56: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 1sk9bk-0007Gp-QY; Fri, 30 Aug 2024 21:56:40 +0000 Received: by outflank-mailman (input) for mailman id 786798; Fri, 30 Aug 2024 21:56:38 +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 1sk9WI-0002pb-3U for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:51:02 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f162e06d-6719-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:51:01 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054488141373.37797061577385; Fri, 30 Aug 2024 14:48:08 -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: f162e06d-6719-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054490; cv=none; d=zohomail.com; s=zohoarc; b=S4WCJwe9XVjYfg9SYILGNDE2sLz+Fy8ozFBIUpBe/WlTznKzyhhLGYtS1b3CKgmLNjAKvugxhxjndWMhapjUB5Bb50EmtTMHaPAQwjnDRLmeI/92Cp0Y9UcE/uQkJoMveQzWlpVFAT7xXJPOq9mPOTaoTsfUfUrDzTjVLHQuApM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054490; 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=L5tz0lT7C2k6e608u4s5wJilake7jMdmn/z/xN+eCro=; b=exqOAKBMLEALMZSYZhdyG09tTYe0Ugv/3VBzCdFP4j1oYhvKROwZd3KKWCk7q26nxqVCYQjV928oYzAkwZVJeQpZHNzR6QaZvvz79AEb1PGCodQdgyq3dc4fAkuelA1uX6R1SEYyKNBD1SEXtPGW6uKXcDQzpZE1OIFBW3yblWQ= 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=1725054490; 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=L5tz0lT7C2k6e608u4s5wJilake7jMdmn/z/xN+eCro=; b=nrRFsyM5UInTlstUVsEl0V9mKlmIzQ5GB7oNPvl0tI8pA2iD0DVY1ZkM87bXUrRl qB92yUjPt9ufulSH/3sN+PrzkkTfbUoXzp/bYdXD5eXa5vbgEtgHX1O/DshJ82qL6Ib /ekXHXojlFbeIrRCyHvvDDZdgsspcCyoXrOw+Wa4= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 26/44] x86/boot: convert construct_dom0 to use struct boot_module Date: Fri, 30 Aug 2024 17:47:11 -0400 Message-Id: <20240830214730.1621-27-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725055017170116600 Content-Type: text/plain; charset="utf-8" The construct_dom0 function is converted to consume struct boot_module instances for the kernel and ramdisk. With this change, it is no longer necessary for the internal use of struct mod by create_dom0, so they are changed to struct boot_module. Signed-off-by: Daniel P. Smith --- xen/arch/x86/dom0_build.c | 10 +++++----- xen/arch/x86/include/asm/setup.h | 6 ++---- xen/arch/x86/setup.c | 17 ++++++++--------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index 8d56705a0861..fb1b7e5d11cf 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -13,6 +13,7 @@ #include =20 #include +#include #include #include #include @@ -596,9 +597,8 @@ int __init dom0_setup_permissions(struct domain *d) return rc; } =20 -int __init construct_dom0(struct domain *d, const module_t *image, - unsigned long image_headroom, module_t *initrd, - const char *cmdline) +int __init construct_dom0(struct domain *d, const struct boot_module *imag= e, + struct boot_module *initrd, const char *cmdline) { int rc; =20 @@ -610,9 +610,9 @@ int __init construct_dom0(struct domain *d, const modul= e_t *image, process_pending_softirqs(); =20 if ( is_hvm_domain(d) ) - rc =3D dom0_construct_pvh(d, image, image_headroom, initrd, cmdlin= e); + rc =3D dom0_construct_pvh(d, image->early_mod, image->headroom, in= itrd->early_mod, cmdline); else if ( is_pv_domain(d) ) - rc =3D dom0_construct_pv(d, image, image_headroom, initrd, cmdline= ); + rc =3D dom0_construct_pv(d, image->early_mod, image->headroom, ini= trd->early_mod, cmdline); else panic("Cannot construct Dom0. No guest interface available\n"); =20 diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/se= tup.h index 165ca744ba34..19e2ad95b523 100644 --- a/xen/arch/x86/include/asm/setup.h +++ b/xen/arch/x86/include/asm/setup.h @@ -27,10 +27,8 @@ void subarch_init_memory(void); void init_IRQ(void); =20 int construct_dom0( - struct domain *d, - const module_t *image, unsigned long image_headroom, - module_t *initrd, - const char *cmdline); + struct domain *d, const struct boot_module *image, + struct boot_module *initrd, const char *cmdline); void setup_io_bitmap(struct domain *d); =20 unsigned long initial_images_nrpages(nodeid_t node); diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 6a613c4847b0..f58eb21d00d7 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -962,20 +962,19 @@ static struct domain *__init create_dom0(const struct= boot_info *bi, .misc_flags =3D opt_dom0_msr_relaxed ? XEN_X86_MSR_RELAXED : 0, }, }; - int headroom, mod_idx =3D first_boot_module_index(bi, BOOTMOD_RAMDISK); - module_t *image, *initrd; + int mod_idx =3D first_boot_module_index(bi, BOOTMOD_RAMDISK); + struct boot_module *image, *initrd; struct domain *d; domid_t domid; =20 /* Map boot_module to mb1 module for dom0 */ - image =3D bi->mods[0].early_mod; - headroom =3D bi->mods[0].headroom; + image =3D &bi->mods[0]; =20 /* Map boot_module to mb1 module for initrd */ if ( mod_idx < 0 ) initrd =3D NULL; else - initrd =3D bi->mods[mod_idx].early_mod; + initrd =3D &bi->mods[mod_idx]; =20 if ( opt_dom0_pvh ) { @@ -1002,10 +1001,10 @@ static struct domain *__init create_dom0(const stru= ct boot_info *bi, panic("Error creating d%uv0\n", domid); =20 /* Grab the DOM0 command line. */ - if ( image->string || kextra ) + if ( image->early_mod->string || kextra ) { - if ( image->string ) - safe_strcpy(cmdline, cmdline_cook(__va(image->string), + if ( image->early_mod->string ) + safe_strcpy(cmdline, cmdline_cook(__va(image->early_mod->strin= g), bi->boot_loader_name)); =20 if ( kextra ) @@ -1040,7 +1039,7 @@ static struct domain *__init create_dom0(const struct= boot_info *bi, write_cr4(read_cr4() & ~X86_CR4_SMAP); } =20 - if ( construct_dom0(d, image, headroom, initrd, cmdline) !=3D 0 ) + if ( construct_dom0(d, image, initrd, cmdline) !=3D 0 ) panic("Could not construct domain 0\n"); =20 if ( cpu_has_smap ) --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054997; cv=pass; d=zohomail.com; s=zohoarc; b=AoVCDeZ49xtGDsJtMkkraxdfvAmnR1if5gpEmW0T3W1/sDybGHKukZ6IB07Oc/iNd+jvCke/0qRuPan1IKdAj7dQAuPQBO7s/P+yiYLCVt8P8Toimxwh1jRkSb8JOfQL3XerbzI5akit/f1IVF1lbSIfHaDAbFdryeB+oRlUMwM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054997; 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=1CoQkH+lHv+L/z16JNTEDasfAHp/vM4gE3D+btk1VDg=; b=BKA73gjgoMHtkKCxl9qKTM4UWYfYbg/oHYNxFouFhhNjnolel0YxVOsBP+nqCEOCTY5EQKjhDMWtBj5Y8RPxsz+ow3UTO9h1a+mFNSjaqA+QUpE74m80kyosA9faazfQS05kLFaAXgcFmr4uQ200IFNormiI/80IfFRGGlQMXpM= 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 172505499740270.42928302493317; Fri, 30 Aug 2024 14:56:37 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786758.1196509 (Exim 4.92) (envelope-from ) id 1sk9bS-0002iF-B2; Fri, 30 Aug 2024 21:56:22 +0000 Received: by outflank-mailman (output) from mailman id 786758.1196509; Fri, 30 Aug 2024 21:56:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9bS-0002gq-2C; Fri, 30 Aug 2024 21:56:22 +0000 Received: by outflank-mailman (input) for mailman id 786758; Fri, 30 Aug 2024 21:56:21 +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 1sk9WQ-0000Zf-1T for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:51:10 +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 f5ba0d87-6719-11ef-99a1-01e77a169b0f; Fri, 30 Aug 2024 23:51:08 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054489185157.27284103749457; Fri, 30 Aug 2024 14:48:09 -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: f5ba0d87-6719-11ef-99a1-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1725054491; cv=none; d=zohomail.com; s=zohoarc; b=EuGnOBmt9m/VVYVXJTTFa3ILqf+v+luBtSr/jYRWgoh8BFZkKOBZ0ap57WAC/aNKuOurd30kGqdZ9EuYnseqMH7rKzOzhUeL4idjUxaTYSk3eafIe80ACX1b8QZBIWyjzu28oVLNviDbftLcjVUe1btwkij8OWUhxRFiwYzOAuw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054491; 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=1CoQkH+lHv+L/z16JNTEDasfAHp/vM4gE3D+btk1VDg=; b=ApXX6ZRn8dM9UjlWhKXCgfsNkuikD8zlP76mpYsNvozKvLthiyTMcfz0mNwV/BIhlh0rdCe2rk4WflwHK2xFQYw2gnuEPP2ELZpjxvNEJ4yi9hIvsp5hq1Vy+CWNO5eptrw6z7V+WBuvLFczIUUNUyel6zROCk2eM6ujy3xnBHA= 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=1725054491; 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=1CoQkH+lHv+L/z16JNTEDasfAHp/vM4gE3D+btk1VDg=; b=Qe5pJZwkJOmCZy2ZS+NXw1udAcRDK9I0V59Rpd1tHSvGIgVlTExzNueQMF45/t47 qzV9GFdiVg4+b0tzqP1/yRCL/qtu+x4fr+R4zKASf03pC0KKyk1rWEPwa88KBQyN3Q8 vcDIrEN7oM075KBPt9/0a6/G71m6l3ThlhMTeC/0= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 27/44] x86/boot: relocate kextra into boot info Date: Fri, 30 Aug 2024 17:47:12 -0400 Message-Id: <20240830214730.1621-28-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054999027116600 Content-Type: text/plain; charset="utf-8" Move kextra into struct boot_info, thus no longer needed to be passed as a parameter to create_dom0. Signed-off-by: Daniel P. Smith --- xen/arch/x86/include/asm/bootinfo.h | 2 ++ xen/arch/x86/setup.c | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 1a325f66b3ba..06b3ecaf7bec 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -41,6 +41,8 @@ struct boot_info { const char *boot_loader_name; const char *cmdline; =20 + const char *kextra; + paddr_t mmap_addr; uint32_t mmap_length; }; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index f58eb21d00d7..76f25e9d620c 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -946,8 +946,7 @@ static unsigned int __init copy_bios_e820(struct e820en= try *map, unsigned int li return n; } =20 -static struct domain *__init create_dom0(const struct boot_info *bi, - const char *kextra) +static struct domain *__init create_dom0(const struct boot_info *bi) { static char __initdata cmdline[MAX_GUEST_CMDLINE]; =20 @@ -1001,15 +1000,15 @@ static struct domain *__init create_dom0(const stru= ct boot_info *bi, panic("Error creating d%uv0\n", domid); =20 /* Grab the DOM0 command line. */ - if ( image->early_mod->string || kextra ) + if ( image->early_mod->string || bi->kextra ) { if ( image->early_mod->string ) safe_strcpy(cmdline, cmdline_cook(__va(image->early_mod->strin= g), bi->boot_loader_name)); =20 - if ( kextra ) + if ( bi->kextra ) /* kextra always includes exactly one leading space. */ - safe_strcat(cmdline, kextra); + safe_strcat(cmdline, bi->kextra); =20 /* Append any extra parameters. */ if ( skip_ioapic_setup && !strstr(cmdline, "noapic") ) @@ -1119,6 +1118,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) *kextra =3D '\0'; kextra +=3D 3; while ( kextra[1] =3D=3D ' ' ) kextra++; + boot_info->kextra =3D kextra; } cmdline_parse(boot_info->cmdline); =20 @@ -2131,7 +2131,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) * We're going to setup domain0 using the module(s) that we stashed sa= fely * above our heap. The second module, if present, is an initrd ramdisk. */ - dom0 =3D create_dom0(boot_info, kextra); + dom0 =3D create_dom0(boot_info); if ( !dom0 ) panic("Could not set up DOM0 guest OS\n"); =20 --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725055035; cv=pass; d=zohomail.com; s=zohoarc; b=OFEjq0YznyY0VRjnICqXMks+N/Ntt8aysmgSc2/VNkvPHh8+6Fb1N92nzGydef3qWsKZvCTGWvWpr/Egq7+kafCMaMpATNQMcuUrbjGeQHEmeXh8GfxFfZ0Lnp+X5OmytWy88vJb5LjF/yxCI0bj/XHsWmwDXlxqIDcw+cT31vw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725055035; 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=hWh29eRgG/vTUY/4IatoM48RmM3sftffSEOld+XbhDI=; b=Qv4F5nkdd3RUv8Rm8VDXjEtrTpwr0ZtoWms3biwFMCaLLbaj8a/Sad5n4S8xmb5PKj04vW2wmIJPhQXYPCljwHUiXUQ+5AbKYnw4XALlRfggrOHNoa7Z23U9E++oO5brAZk5BFzCH/DHPz5QqItnu0E7KnFB3COkhmtAORfZdwg= 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 1725055035070534.0403120127404; Fri, 30 Aug 2024 14:57:15 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786848.1196674 (Exim 4.92) (envelope-from ) id 1sk9c4-0003iI-Ak; Fri, 30 Aug 2024 21:57:00 +0000 Received: by outflank-mailman (output) from mailman id 786848.1196674; Fri, 30 Aug 2024 21:57:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9c4-0003g7-4M; Fri, 30 Aug 2024 21:57:00 +0000 Received: by outflank-mailman (input) for mailman id 786848; Fri, 30 Aug 2024 21:56:58 +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 1sk9WX-0000Zf-8B for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:51:17 +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 fa2e6891-6719-11ef-99a1-01e77a169b0f; Fri, 30 Aug 2024 23:51:15 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054490245563.5309767248942; Fri, 30 Aug 2024 14:48:10 -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: fa2e6891-6719-11ef-99a1-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1725054492; cv=none; d=zohomail.com; s=zohoarc; b=ghvdmCfKW1U3wg9sVOKivTQYdsa4a+eHSWZbKhe1gp+AXBzi0edi04NBOH3kYlmAri4dAD5BPM0ldjJ8uripVNYruJja0N/j8dff+YEZ4nPSAj5x5YxvD3Gdeu07RMiRMJkuUIOp6b/RedOvoRDGWOdXRDkwIIuW+6+cS9X6s4k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054492; 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=hWh29eRgG/vTUY/4IatoM48RmM3sftffSEOld+XbhDI=; b=Tr+i9P/YXYznZyn71L/95qgtkaHyFBTrLY5OPGGgqsgCjPWE42b96OHPGF88kO3q0fejsa4/Xep2LeNDBkARAUzTee+22PZ+BawUKpYDCdERtsAP0OH0mqzkqkiQFsfIPthO5Jf1Y+/JfqU/u07zo2sCy2LWgsdoAtOr7Fn90Zo= 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=1725054492; 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=hWh29eRgG/vTUY/4IatoM48RmM3sftffSEOld+XbhDI=; b=Yd1s04nq0GCD9bo1FakYxpkA6AFbm7mrguZ6tktaABvdGIbhO2M/s1BdhdPhy8Jl aFciKfh2G7AQ9SkyDMPbHCvtLxxEwst0oBOIDVSjf39ouV78sQw3BITvniN9iRJ23pL 2Wf6q5yomLNCQlbmtzdoBWP58apA1yxQ+8LS9PIo= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 28/44] x86/boot: add cmdline to struct boot_module Date: Fri, 30 Aug 2024 17:47:13 -0400 Message-Id: <20240830214730.1621-29-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725055037184116600 Content-Type: text/plain; charset="utf-8" Add a char pointer field, cmdline, to struct boot_module to hold the address pointed to by the string field of struct mod. This removes the need to use = the early_mod field to get to the dom0 kernel command line. Signed-off-by: Daniel P. Smith --- xen/arch/x86/include/asm/bootinfo.h | 2 ++ xen/arch/x86/setup.c | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 06b3ecaf7bec..edd5c435d032 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -30,6 +30,8 @@ struct boot_module { #define BOOTMOD_FLAG_X86_RELOCATED (1U << 0) #define BOOTMOD_FLAG_X86_CONSUMED (1U << 1) =20 + const char *cmdline; + paddr_t start; size_t size; }; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 76f25e9d620c..8ba32c6b6bfa 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -314,6 +314,8 @@ static void __init multiboot_to_bootinfo(multiboot_info= _t *mbi, module_t *mods) { boot_mods[i].early_mod =3D &mods[i]; =20 + boot_mods[i].cmdline =3D (char *)(paddr_t)mods[i].string; + boot_mods[i].start =3D (paddr_t)mods[i].mod_start; boot_mods[i].size =3D mods[i].mod_end - mods[i].mod_start; } @@ -1000,10 +1002,11 @@ static struct domain *__init create_dom0(const stru= ct boot_info *bi) panic("Error creating d%uv0\n", domid); =20 /* Grab the DOM0 command line. */ - if ( image->early_mod->string || bi->kextra ) + if ( image->cmdline || bi->kextra ) { - if ( image->early_mod->string ) - safe_strcpy(cmdline, cmdline_cook(__va(image->early_mod->strin= g), + if ( image->cmdline ) + safe_strcpy(cmdline, + cmdline_cook(__va((unsigned long)image->cmdline), bi->boot_loader_name)); =20 if ( bi->kextra ) --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054990; cv=pass; d=zohomail.com; s=zohoarc; b=WLdjS+6b5m1yPFppCNb9bINreyfgc8pk3RoCtCVl0x9f/vRDEMBqPWe7buihqpymI0sS/PTHoCt3PuzMvEx/79FnhSenRba/u7Bax6grQbqccO4QnQJCHc/+xte80dRbIU4nyUlU7g2k8vzOQ+DdiXNEcTSig6uoJwwpykVx84A= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054990; 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=MquSQeaVrCWxsat0mhr5L62hgcjXnVV+6k/kWhQHcXY=; b=OJ2yGbAvjfDky8JJ1f3XlwOeASO9bkiG1qYWOWm87P3Rr5x247vL3x3/0bVt6x03NZ9YHbsTDU+LeDtbqgy5/3Rp52HYQo4wCJfpoijf0YOn2AdBENThRW9o9wPRnFa8Mu/7iH0utMbpHCGvonlPBEBpYhl2+d6qmY4rcUbTkJo= 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 1725054990814367.47470562525825; Fri, 30 Aug 2024 14:56:30 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786748.1196479 (Exim 4.92) (envelope-from ) id 1sk9bJ-0000n1-Az; Fri, 30 Aug 2024 21:56:13 +0000 Received: by outflank-mailman (output) from mailman id 786748.1196479; Fri, 30 Aug 2024 21:56:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9bJ-0000ke-5g; Fri, 30 Aug 2024 21:56:13 +0000 Received: by outflank-mailman (input) for mailman id 786748; Fri, 30 Aug 2024 21:56:12 +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 1sk9We-0000Zf-T1 for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:51:24 +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 fe975f19-6719-11ef-99a1-01e77a169b0f; Fri, 30 Aug 2024 23:51:23 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054491309423.19157704731253; Fri, 30 Aug 2024 14:48:11 -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: fe975f19-6719-11ef-99a1-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1725054493; cv=none; d=zohomail.com; s=zohoarc; b=Em5k1TM7/Bv3Y5RLflF8f0Tgx8xEUzNyQoJtPqZK8r8Xuh9OX4NnuyiVSzUd+2ZyqZuxSiLiC2iNI/mEV8ihfRua029wqL5VrzUrsd8vVSjRIuE3t0tLtqUBV+vKONvQzL6SWHyW1F+Zd6ypTvEI+RhgvPS5WBoek7faJphj+QI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054493; 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=MquSQeaVrCWxsat0mhr5L62hgcjXnVV+6k/kWhQHcXY=; b=ReWpnUmzkfOtjl723Hc4Ke1Xm9ED7AJw3Q1GvRaCZBGRsIdZ1JSEkvHT5NbNI+y9aWKgaMSyTy2ABECAk003a6HLTjmMv6686E9wEnNnXm0YylMsO0IVH+bDo52/+SzabFbv3Ubvaph66VrGVvIdpY11LE3Y6ypyF/B7miH8QMk= 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=1725054493; 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=MquSQeaVrCWxsat0mhr5L62hgcjXnVV+6k/kWhQHcXY=; b=DtYQqFa9eEHPKSuvN8LbUWAdOUrEtAFwYQFxiTFu6R1hfxHjNiwlHKyXjSJNKxPR T3P3KvazzeiZ3dFpJQIdlTqtM4cUXoKno8uYlx0aBFUPn3EHHFMvRckonP7+hK/eeC1 WkjwWUteZiAWE9wteux2wb/T4aCeJr8Qjoo9QVGs= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 29/44] x86/boot: convert dom0_construct_pv image param to struct boot_module Date: Fri, 30 Aug 2024 17:47:14 -0400 Message-Id: <20240830214730.1621-30-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054990960116600 Content-Type: text/plain; charset="utf-8" This changes the type for the image parameter of dom0_construct_pv to be st= ruct boot_module. Removing the usage of early_mod field for kernel module. Signed-off-by: Daniel P. Smith --- xen/arch/x86/dom0_build.c | 2 +- xen/arch/x86/include/asm/dom0_build.h | 7 +++---- xen/arch/x86/pv/dom0_build.c | 9 ++++----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index fb1b7e5d11cf..42043230faff 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -612,7 +612,7 @@ int __init construct_dom0(struct domain *d, const struc= t boot_module *image, if ( is_hvm_domain(d) ) rc =3D dom0_construct_pvh(d, image->early_mod, image->headroom, in= itrd->early_mod, cmdline); else if ( is_pv_domain(d) ) - rc =3D dom0_construct_pv(d, image->early_mod, image->headroom, ini= trd->early_mod, cmdline); + rc =3D dom0_construct_pv(d, image, initrd->early_mod, cmdline); else panic("Cannot construct Dom0. No guest interface available\n"); =20 diff --git a/xen/arch/x86/include/asm/dom0_build.h b/xen/arch/x86/include/a= sm/dom0_build.h index 107c1ff98367..a1f36f7d360d 100644 --- a/xen/arch/x86/include/asm/dom0_build.h +++ b/xen/arch/x86/include/asm/dom0_build.h @@ -13,10 +13,9 @@ unsigned long dom0_compute_nr_pages(struct domain *d, unsigned long initrd_len); int dom0_setup_permissions(struct domain *d); =20 -int dom0_construct_pv(struct domain *d, const module_t *image, - unsigned long image_headroom, - module_t *initrd, - const char *cmdline); +int dom0_construct_pv( + struct domain *d, const struct boot_module *image, + module_t *initrd, const char *cmdline); =20 int dom0_construct_pvh(struct domain *d, const module_t *image, unsigned long image_headroom, diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c index 57e58a02e707..db908ddb78b5 100644 --- a/xen/arch/x86/pv/dom0_build.c +++ b/xen/arch/x86/pv/dom0_build.c @@ -355,8 +355,7 @@ static struct page_info * __init alloc_chunk(struct dom= ain *d, } =20 int __init dom0_construct_pv(struct domain *d, - const module_t *image, - unsigned long image_headroom, + const struct boot_module *image, module_t *initrd, const char *cmdline) { @@ -374,9 +373,9 @@ int __init dom0_construct_pv(struct domain *d, unsigned int flush_flags =3D 0; start_info_t *si; struct vcpu *v =3D d->vcpu[0]; - void *image_base =3D bootstrap_map(image); - unsigned long image_len =3D image->mod_end; - void *image_start =3D image_base + image_headroom; + void *image_base =3D bootstrap_map_bm(image); + unsigned long image_len =3D image->size; + void *image_start =3D image_base + image->headroom; unsigned long initrd_len =3D initrd ? initrd->mod_end : 0; l4_pgentry_t *l4tab =3D NULL, *l4start =3D NULL; l3_pgentry_t *l3tab =3D NULL, *l3start =3D NULL; --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725055035; cv=pass; d=zohomail.com; s=zohoarc; b=HkqxwXoEGlXqM6gTkeZfp5uEpBi5XpAozDlLQOtpOJIviWG98npCZZ0Ks+ImBOr/O74qL3wkyen4VgACAHfO67Sc1YkaQD+Jwh79dgqEW9At+5ByfttFgI9TuskqRpLN5Aeop26p6GZo5z+hDUWHNdAiEk9qJyqxRa4lTHy4fKo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725055035; 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=Uco3P2nZt+b7+Lgo/+TlzWVF3igUfsGLOahtS9BrSXY=; b=TWaxs26cEAdmdnZLlplxjdGe6BbvcpbLxdcOxTGC6v4KvzizDgVEZlGjI3XiVH7sVJRPK3BssyUdXHgZ+SwXy9ojWVpFLDUny9AIf3bjfzdS5AJw9tPY/FpvebjQlsxUVnoVV8veOZtX1jlsd7rI/vSYPPh7UALXesroo2/lRD4= 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 1725055035104512.411180144999; Fri, 30 Aug 2024 14:57:15 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786847.1196658 (Exim 4.92) (envelope-from ) id 1sk9c1-0002uA-Pu; Fri, 30 Aug 2024 21:56:57 +0000 Received: by outflank-mailman (output) from mailman id 786847.1196658; Fri, 30 Aug 2024 21:56:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9c1-0002sW-JU; Fri, 30 Aug 2024 21:56:57 +0000 Received: by outflank-mailman (input) for mailman id 786847; Fri, 30 Aug 2024 21:56:56 +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 1sk9Wm-0000Zf-CF for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:51:32 +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 032ce5b5-671a-11ef-99a1-01e77a169b0f; Fri, 30 Aug 2024 23:51:30 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054492373987.601800935306; Fri, 30 Aug 2024 14:48:12 -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: 032ce5b5-671a-11ef-99a1-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1725054494; cv=none; d=zohomail.com; s=zohoarc; b=JuHcrUfitLx/+Erxf4iWnnj0eub3kVaT0caTtDwSooGvJGSdrl7DdCq8KuCW+Nl8oum3LT10RfhomYGH1UD7iMEW9MO9mmYFaN5RxzgqV6OSVGLMLh3w1uX7JW4gcj1cf2XkcyEoAouyx5E7V9bKgQhYAXwB7HdIwmhJPJWFV6o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054494; 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=Uco3P2nZt+b7+Lgo/+TlzWVF3igUfsGLOahtS9BrSXY=; b=C/4A7iLKTQX1xnrQLTHGlBwd4vTHtIHOSz3isZVxXR09a+sH61okdKgPQUI4AQ8oRZRThtE7KsowLlQG+T7rPvIhVN3g+avuUsbl/+TGD2KlZ28eGT3OlpjTKG/2G78eakoaGvGR72Fm9jfVtwhZCYyAlj5EoScKTSYu2vHJT/A= 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=1725054494; 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=Uco3P2nZt+b7+Lgo/+TlzWVF3igUfsGLOahtS9BrSXY=; b=AD9sgbWVjCjLa0y/0Oa6d5wKkUO6C8X54qDNS/S4/j8bmT42MipbVvTaTgQQHSNL 5mlFsdxRAYabaOJUhKO8XABaqmym0bRVa/y4m86HBEQC8PCNjIN8lBQO9WpRxAFG1gM ws+1Z5mjj2c6r57Y6RVfDad8G4WbHmAWYKE8If+s= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 30/44] x86/boot: convert dom0_construct_pv initrd param to struct boot_module Date: Fri, 30 Aug 2024 17:47:15 -0400 Message-Id: <20240830214730.1621-31-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725055037223116600 Content-Type: text/plain; charset="utf-8" This changes the type for the initrd parameter of dom0_construct_pv to be s= truct boot_module. This conversion requires several adjustments throughout dom0_c= onstruct_pv to account for the type change. Removes the usage of early_mod field for ra= mdisk module. Signed-off-by: Daniel P. Smith --- xen/arch/x86/dom0_build.c | 2 +- xen/arch/x86/include/asm/dom0_build.h | 2 +- xen/arch/x86/pv/dom0_build.c | 19 ++++++++++--------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index 42043230faff..c39588b346b0 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -612,7 +612,7 @@ int __init construct_dom0(struct domain *d, const struc= t boot_module *image, if ( is_hvm_domain(d) ) rc =3D dom0_construct_pvh(d, image->early_mod, image->headroom, in= itrd->early_mod, cmdline); else if ( is_pv_domain(d) ) - rc =3D dom0_construct_pv(d, image, initrd->early_mod, cmdline); + rc =3D dom0_construct_pv(d, image, initrd, cmdline); else panic("Cannot construct Dom0. No guest interface available\n"); =20 diff --git a/xen/arch/x86/include/asm/dom0_build.h b/xen/arch/x86/include/a= sm/dom0_build.h index a1f36f7d360d..2ce5ea3851af 100644 --- a/xen/arch/x86/include/asm/dom0_build.h +++ b/xen/arch/x86/include/asm/dom0_build.h @@ -15,7 +15,7 @@ int dom0_setup_permissions(struct domain *d); =20 int dom0_construct_pv( struct domain *d, const struct boot_module *image, - module_t *initrd, const char *cmdline); + struct boot_module *initrd, const char *cmdline); =20 int dom0_construct_pvh(struct domain *d, const module_t *image, unsigned long image_headroom, diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c index db908ddb78b5..dce62d76e41e 100644 --- a/xen/arch/x86/pv/dom0_build.c +++ b/xen/arch/x86/pv/dom0_build.c @@ -356,7 +356,7 @@ static struct page_info * __init alloc_chunk(struct dom= ain *d, =20 int __init dom0_construct_pv(struct domain *d, const struct boot_module *image, - module_t *initrd, + struct boot_module *initrd, const char *cmdline) { int i, rc, order, machine; @@ -376,7 +376,7 @@ int __init dom0_construct_pv(struct domain *d, void *image_base =3D bootstrap_map_bm(image); unsigned long image_len =3D image->size; void *image_start =3D image_base + image->headroom; - unsigned long initrd_len =3D initrd ? initrd->mod_end : 0; + unsigned long initrd_len =3D initrd ? initrd->size : 0; l4_pgentry_t *l4tab =3D NULL, *l4start =3D NULL; l3_pgentry_t *l3tab =3D NULL, *l3start =3D NULL; l2_pgentry_t *l2tab =3D NULL, *l2start =3D NULL; @@ -612,7 +612,7 @@ int __init dom0_construct_pv(struct domain *d, initrd_pfn =3D vinitrd_start ? (vinitrd_start - v_start) >> PAGE_SHIFT : domain_tot_pages(d); - initrd_mfn =3D mfn =3D initrd->mod_start; + initrd_mfn =3D mfn =3D initrd->start >> PAGE_SHIFT; count =3D PFN_UP(initrd_len); if ( d->arch.physaddr_bitsize && ((mfn + count - 1) >> (d->arch.physaddr_bitsize - PAGE_SHIFT)= ) ) @@ -627,12 +627,13 @@ int __init dom0_construct_pv(struct domain *d, free_domheap_pages(page, order); page +=3D 1UL << order; } - memcpy(page_to_virt(page), mfn_to_virt(initrd->mod_start), + memcpy(page_to_virt(page), maddr_to_virt(initrd->start), initrd_len); - mpt_alloc =3D (paddr_t)initrd->mod_start << PAGE_SHIFT; + mpt_alloc =3D initrd->start; init_domheap_pages(mpt_alloc, mpt_alloc + PAGE_ALIGN(initrd_len)); - initrd->mod_start =3D initrd_mfn =3D mfn_x(page_to_mfn(page)); + initrd_mfn =3D mfn_x(page_to_mfn(page)); + initrd->start =3D initrd_mfn << PAGE_SHIFT; } else { @@ -640,7 +641,7 @@ int __init dom0_construct_pv(struct domain *d, if ( assign_pages(mfn_to_page(_mfn(mfn++)), 1, d, 0) ) BUG(); } - initrd->mod_end =3D 0; + initrd->size =3D initrd->early_mod->mod_end =3D 0; =20 iommu_memory_setup(d, "initrd", mfn_to_page(_mfn(initrd_mfn)), PFN_UP(initrd_len), &flush_flags); @@ -654,7 +655,7 @@ int __init dom0_construct_pv(struct domain *d, nr_pages - domain_tot_pages(d)); if ( initrd ) { - mpt_alloc =3D (paddr_t)initrd->mod_start << PAGE_SHIFT; + mpt_alloc =3D initrd->start; printk("\n Init. ramdisk: %"PRIpaddr"->%"PRIpaddr, mpt_alloc, mpt_alloc + initrd_len); } @@ -882,7 +883,7 @@ int __init dom0_construct_pv(struct domain *d, if ( pfn >=3D initrd_pfn ) { if ( pfn < initrd_pfn + PFN_UP(initrd_len) ) - mfn =3D initrd->mod_start + (pfn - initrd_pfn); + mfn =3D (initrd->start >> PAGE_SHIFT) + (pfn - initrd_pfn); else mfn -=3D PFN_UP(initrd_len); } --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725055036; cv=pass; d=zohomail.com; s=zohoarc; b=GavN958pw8aCb7rKU2GNgcGjK9noCVMfv39IOf/vfUi+ZsQoJsE9cfen5j9bck/eMwbGj3iWnoDsKekB7+9u8qfN2S0SpKNN+GCjtEPkKL0ULNrrC8XjAkQVp1yJUfuw624hJMEGFqBq3+rmiDrElgnEX00SIldEkz5OC7uPLFQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725055036; 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=eI2uOeGg/sx1MKwSvVvpZfm5vXW9RsarhqsgbbBK1us=; b=C91K+RWWs1f9DALMNMV8OMAcGeOip8R/htwJ79mDXyxhV/Ar4dPRPhmjcQNtfjnHDdcM0AW4R5aVkdq6rdkQPb/pfNQC6f2TYh+Wh7bfgXfpzoAgsmfd646hiQ06ruUQ7/VCObWcjTIvhhWNHYyvl7YW1SI4/meBqdIpUlNX2PA= 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 172505503630762.09308561041382; Fri, 30 Aug 2024 14:57:16 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786843.1196654 (Exim 4.92) (envelope-from ) id 1sk9c1-0002ky-8U; Fri, 30 Aug 2024 21:56:57 +0000 Received: by outflank-mailman (output) from mailman id 786843.1196654; Fri, 30 Aug 2024 21:56:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9c1-0002jz-3u; Fri, 30 Aug 2024 21:56:57 +0000 Received: by outflank-mailman (input) for mailman id 786843; Fri, 30 Aug 2024 21:56:55 +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 1sk9Wt-0000Zf-HG for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:51:39 +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 0776c7e4-671a-11ef-99a1-01e77a169b0f; Fri, 30 Aug 2024 23:51:37 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054493481659.7029863364719; Fri, 30 Aug 2024 14:48:13 -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: 0776c7e4-671a-11ef-99a1-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1725054495; cv=none; d=zohomail.com; s=zohoarc; b=BUNATfUWScvd3LlCBz3oxWB4klY/a/ZFb0WrEEDkSF1GeZbYQ4cx7aKlbgUepwKpLrjCafVTI3ekJXbpJ8NMG4L8Aci498e7XlzGhrGpy4vhnpkkMOV4W1zNMwcu+9ApTU2BPuTbieZo3wytTXmmtAt5eP4ndwqAXkM77MEg1vk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054495; 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=eI2uOeGg/sx1MKwSvVvpZfm5vXW9RsarhqsgbbBK1us=; b=SuKImHLz4umEcAcUr/53zbcU+rZYyhC59Ls2qWQlTDMotkWNlUjgsRg2cc43J6+Cr2OtYrl3qBPR6k/NE+7fL/mQax7RhPy7pS7Q3SsI64nioQ4XQbFEq1tkAg900G6jnlyYWlqH3jHvZX4OPrsg5OlbJacurXIZXnC0gNU5Ytw= 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=1725054495; 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=eI2uOeGg/sx1MKwSvVvpZfm5vXW9RsarhqsgbbBK1us=; b=uqc1l1dU+Rth/KAcN0NmNpMZpz42q7mguQYej0hai0CntRWZ1sIUhkcFCLPOgKrN AU+xWY0U7N3P2x9d8iPIWU4WzF5UCe33b7lbt1mNuukzkq6WTsPR9gTKMRa0O9tFnND h5TiCNPIIFMfJgxVBoGpDJYsIVOkVyg+p+ivSwyw= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 31/44] x86/boot: convert dom0_construct_pvh to struct boot_module Date: Fri, 30 Aug 2024 17:47:16 -0400 Message-Id: <20240830214730.1621-32-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725055037200116600 Content-Type: text/plain; charset="utf-8" This changes both the kernel and ramdisk parameters over to struct boot_module. Signed-off-by: Daniel P. Smith --- xen/arch/x86/dom0_build.c | 2 +- xen/arch/x86/hvm/dom0_build.c | 11 +++++------ xen/arch/x86/include/asm/dom0_build.h | 7 +++---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index c39588b346b0..71b2e3afc1a1 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -610,7 +610,7 @@ int __init construct_dom0(struct domain *d, const struc= t boot_module *image, process_pending_softirqs(); =20 if ( is_hvm_domain(d) ) - rc =3D dom0_construct_pvh(d, image->early_mod, image->headroom, in= itrd->early_mod, cmdline); + rc =3D dom0_construct_pvh(d, image, initrd, cmdline); else if ( is_pv_domain(d) ) rc =3D dom0_construct_pv(d, image, initrd, cmdline); else diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c index f3eddb684686..1579034ebfc0 100644 --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -1285,10 +1285,9 @@ static void __hwdom_init pvh_setup_mmcfg(struct doma= in *d) } } =20 -int __init dom0_construct_pvh(struct domain *d, const module_t *image, - unsigned long image_headroom, - module_t *initrd, - const char *cmdline) +int __init dom0_construct_pvh( + struct domain *d, const struct boot_module *image, + struct boot_module *initrd, const char *cmdline) { paddr_t entry, start_info; int rc; @@ -1332,8 +1331,8 @@ int __init dom0_construct_pvh(struct domain *d, const= module_t *image, return rc; } =20 - rc =3D pvh_load_kernel(d, image, image_headroom, initrd, bootstrap_map= (image), - cmdline, &entry, &start_info); + rc =3D pvh_load_kernel(d, image->early_mod, image->headroom, initrd->e= arly_mod, + bootstrap_map_bm(image), cmdline, &entry, &start_= info); if ( rc ) { printk("Failed to load Dom0 kernel\n"); diff --git a/xen/arch/x86/include/asm/dom0_build.h b/xen/arch/x86/include/a= sm/dom0_build.h index 2ce5ea3851af..8f7b37f3d308 100644 --- a/xen/arch/x86/include/asm/dom0_build.h +++ b/xen/arch/x86/include/asm/dom0_build.h @@ -17,10 +17,9 @@ int dom0_construct_pv( struct domain *d, const struct boot_module *image, struct boot_module *initrd, const char *cmdline); =20 -int dom0_construct_pvh(struct domain *d, const module_t *image, - unsigned long image_headroom, - module_t *initrd, - const char *cmdline); +int dom0_construct_pvh( + struct domain *d, const struct boot_module *image, + struct boot_module *initrd, const char *cmdline); =20 unsigned long dom0_paging_pages(const struct domain *d, unsigned long nr_pages); --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054995; cv=pass; d=zohomail.com; s=zohoarc; b=BNvpkevSDNTkUOCeiCqDHG/O3yk7SkJ7TmvmievawSWsfl/nTcEafPXXE3IZzd/k5jilqCMFMuMfwiQEYoybjDmil9h0sutArJL7V3Zrz8FMkoqCwb+7GF8IjDJtBbhGeSZh26TKWPQkOCxuZHWP8CjKlEV1V3ULeEr08E6r/nQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054995; 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=e/jZPWMKnu3Xz391hq0lPvFpid72gh7AyHIhBUi4faY=; b=BgHq1YhdwAhvBT0SmBqnUD9NGYBeJIln5Q5f+kKqEsFpYOzCG6ml2jnlsD0q15AJOZ1sCgozRXyu69Lb0nhePEzvQZPTUzNZUAgb9o1q7I7+pjbzYjNt7Z2tF+TJ7gctexI56ytlGbn51iAbKngU+rDtcEnHrvj5QTY5CrgXRsg= 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 1725054995624503.1068199558365; Fri, 30 Aug 2024 14:56:35 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786756.1196505 (Exim 4.92) (envelope-from ) id 1sk9bR-0002cj-TR; Fri, 30 Aug 2024 21:56:21 +0000 Received: by outflank-mailman (output) from mailman id 786756.1196505; Fri, 30 Aug 2024 21:56:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9bR-0002cX-NJ; Fri, 30 Aug 2024 21:56:21 +0000 Received: by outflank-mailman (input) for mailman id 786756; Fri, 30 Aug 2024 21:56:19 +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 1sk9X0-0000Zf-W1 for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:51:46 +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 0bea60a2-671a-11ef-99a1-01e77a169b0f; Fri, 30 Aug 2024 23:51:45 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 172505449453355.86826546005; Fri, 30 Aug 2024 14:48:14 -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: 0bea60a2-671a-11ef-99a1-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1725054496; cv=none; d=zohomail.com; s=zohoarc; b=kRWghNc2F5sPVQ5+qzb7H8DQVUJNT8NJBljwX7Z9CzrlbUmFyh2Ft/QvGKXqbknxOISJ8sZJg1gJnjO7Qwnh+h1K7VA7T+/3Bp5WCjsDUatXkZsTzgpIP1GatTBH6+wP2NniEcRcOnD0Tis0INikyeG49vQL+IW04EzQjLfTRMc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054496; 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=e/jZPWMKnu3Xz391hq0lPvFpid72gh7AyHIhBUi4faY=; b=OZyFK80p65oqo4Ii7KoSnlpeiyCNDLvCwT9u9C/+ylHjTtpK/oQicRPRJArPOhPIQ+BhXPQ39sw0WlV9JESlqB3k9r6odG+PSk8x84pwgxZH/EvHQ36go5l6JaLyOYkzF3O/bgTKmn5MkBTNcmv5ccRmvB+T4PNNQKqR1sIXN/A= 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=1725054496; 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=e/jZPWMKnu3Xz391hq0lPvFpid72gh7AyHIhBUi4faY=; b=AKjnzuNyRb3yNdo7f2glmUqBQS3oQghijs1A4zbpenqkwz9M8x5GmABZOqvwt5mT Oo7af5neTsiQ3hK9+4kkmVcM1TYto19tNM5ixt2u5rsLgYnfbItVuC8oC+GkKyiW7h2 8FzcAuPbbFcsYr3wD8r/N8YeGYJDM+Ikid6RsYLc= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 32/44] x86/boot: convert pvh_load_kernel to struct boot_module Date: Fri, 30 Aug 2024 17:47:17 -0400 Message-Id: <20240830214730.1621-33-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054996994116600 Content-Type: text/plain; charset="utf-8" This changes both the kernel and ramdisk parameters over to struct boot_mod= ule. Signed-off-by: Daniel P. Smith --- xen/arch/x86/hvm/dom0_build.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c index 1579034ebfc0..b359f3d98376 100644 --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -642,15 +642,14 @@ static bool __init check_and_adjust_load_address( return true; } =20 -static int __init pvh_load_kernel(struct domain *d, const module_t *image, - unsigned long image_headroom, - module_t *initrd, void *image_base, - const char *cmdline, paddr_t *entry, - paddr_t *start_info_addr) +static int __init pvh_load_kernel( + struct domain *d, const struct boot_module *image, + struct boot_module *initrd, void *image_base, + const char *cmdline, paddr_t *entry, paddr_t *start_info_addr) { - void *image_start =3D image_base + image_headroom; - unsigned long image_len =3D image->mod_end; - unsigned long initrd_len =3D initrd ? initrd->mod_end : 0; + void *image_start =3D image_base + image->headroom; + unsigned long image_len =3D image->size; + unsigned long initrd_len =3D initrd ? initrd->size : 0; struct elf_binary elf; struct elf_dom_parms parms; paddr_t last_addr; @@ -725,7 +724,7 @@ static int __init pvh_load_kernel(struct domain *d, con= st module_t *image, =20 if ( initrd !=3D NULL ) { - rc =3D hvm_copy_to_guest_phys(last_addr, mfn_to_virt(initrd->mod_s= tart), + rc =3D hvm_copy_to_guest_phys(last_addr, maddr_to_virt(initrd->sta= rt), initrd_len, v); if ( rc ) { @@ -736,9 +735,9 @@ static int __init pvh_load_kernel(struct domain *d, con= st module_t *image, mod.paddr =3D last_addr; mod.size =3D initrd_len; last_addr +=3D ROUNDUP(initrd_len, elf_64bit(&elf) ? 8 : 4); - if ( initrd->string ) + if ( initrd->cmdline ) { - char *str =3D __va(initrd->string); + char *str =3D __va((unsigned long)initrd->cmdline); size_t len =3D strlen(str) + 1; =20 rc =3D hvm_copy_to_guest_phys(last_addr, str, len, v); @@ -1331,8 +1330,8 @@ int __init dom0_construct_pvh( return rc; } =20 - rc =3D pvh_load_kernel(d, image->early_mod, image->headroom, initrd->e= arly_mod, - bootstrap_map_bm(image), cmdline, &entry, &start_= info); + rc =3D pvh_load_kernel(d, image, initrd, bootstrap_map_bm(image), cmdl= ine, + &entry, &start_info); if ( rc ) { printk("Failed to load Dom0 kernel\n"); --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725055040; cv=pass; d=zohomail.com; s=zohoarc; b=V3Vbs4sG6V2muvhDZXMEL+9iBy1fvtc+hi59zCnUbhO5sWUO/iqTKPdxIWtzGn4klkB+saYALXd9BeJnhDFu5akPHAFR92zvFRrN42nPDjxTcv+Y2VktkQx6i8Gcb5bLfRe34zaPSRQyS6gaf6YaKgfFSu5IRT3nYTibVBc+Lhs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725055040; 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=mt1dRXz36GBmL3hIsTAQ0JnOmkyCwzbvQkCGLSUmMkc=; b=OvU9YAmqGdbrPGk3uEORqSSrH5XppOo9Yu0twXliuby8Ctybs3pXn/Kqbft8UqoACxIH75ridIYMEjL2OARD4XlYFIRuL2phRwMRrdPQvgIgztsRCiehhGcAyobC3nJVOzFT8+A3AbqqWus/a5/5tSVUnizDFLw2CxSKpjQWxDU= 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 1725055040499978.7582392783843; Fri, 30 Aug 2024 14:57:20 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786849.1196680 (Exim 4.92) (envelope-from ) id 1sk9c4-0003n8-RM; Fri, 30 Aug 2024 21:57:00 +0000 Received: by outflank-mailman (output) from mailman id 786849.1196680; Fri, 30 Aug 2024 21:57:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9c4-0003ml-Jz; Fri, 30 Aug 2024 21:57:00 +0000 Received: by outflank-mailman (input) for mailman id 786849; Fri, 30 Aug 2024 21:56:58 +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 1sk9X8-0000Zf-E8 for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:51:54 +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 105c3a69-671a-11ef-99a1-01e77a169b0f; Fri, 30 Aug 2024 23:51:52 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054495605114.11610584368918; Fri, 30 Aug 2024 14:48:15 -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: 105c3a69-671a-11ef-99a1-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1725054497; cv=none; d=zohomail.com; s=zohoarc; b=Gcr2dQXwBERTqwQcwuFqX+lzCerzO8XkQcP00CFR8FHA7WkZsU5OZl/tSbJ6xokX8yIQaqPwbKPnnKSFU3+FDmPYrroMmTT7EIbRSB1hCj1B2F7Dqdp6jIvuHC+d1QeaBg3Wg3PbaQgGy6VBirYlHZG+6LOLWAGblN6I4dvpv+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054497; 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=mt1dRXz36GBmL3hIsTAQ0JnOmkyCwzbvQkCGLSUmMkc=; b=FJ8YmX0BEzPNKHpNrYWufWrkbbnWhojfiAR5cey0btEdiFOHYip0W0ffEuvAY174ypyu2eOCRDns8f6ZAfNj3oLNotBXqL0kwk3GA5ts+k1c4PfDBkejJF2nJSZff5K5FHNqp8fEXbmnhLDygJa+DA0p+3oB4EXKiyQwHbTQzfM= 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=1725054497; 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=mt1dRXz36GBmL3hIsTAQ0JnOmkyCwzbvQkCGLSUmMkc=; b=udtZAvomEEfPM104ld7VCW2/Vcvybqvg17RTZGeXlJUmmEtv78yAg9+YoYmY5I0b nFjPqtKy6uhuyaFQdP8t+XcumC4aBwlLf+vkU9uSeeMaiY7Y7YAGuCN7JJODmzftQRb uRl3pd0TEkpUAx1nw1gvZZVORxrF6uJCXzpTx3qY= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 33/44] x86/boot: convert initial_images to struct boot_module Date: Fri, 30 Aug 2024 17:47:18 -0400 Message-Id: <20240830214730.1621-34-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725055041264116600 Content-Type: text/plain; charset="utf-8" The variable initial_images is used for tracking the boot modules passed in= by the boot loader. Convert to a struct boot_module and adjust the code that u= ses it accordingly. Signed-off-by: Daniel P. Smith --- xen/arch/x86/setup.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 8ba32c6b6bfa..77c0833dd441 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -281,7 +281,7 @@ static const char *cmdline_cook(const char *p, const ch= ar *loader_name); /* Max number of boot modules a bootloader can provide in addition to Xen = */ #define MAX_NR_BOOTMODS 63 =20 -static const module_t *__initdata initial_images; +static const struct boot_module *__initdata initial_images; static struct boot_info __initdata *boot_info; =20 static void __init multiboot_to_bootinfo(multiboot_info_t *mbi, module_t *= mods) @@ -337,8 +337,9 @@ unsigned long __init initial_images_nrpages(nodeid_t no= de) =20 for ( nr =3D i =3D 0; i < boot_info->nr_mods; ++i ) { - unsigned long start =3D initial_images[i].mod_start; - unsigned long end =3D start + PFN_UP(initial_images[i].mod_end); + unsigned long start =3D initial_images[i].early_mod->mod_start; + unsigned long end =3D start + + PFN_UP(initial_images[i].early_mod->mod_end); =20 if ( end > node_start && node_end > start ) nr +=3D min(node_end, end) - max(node_start, start); @@ -353,10 +354,12 @@ void __init discard_initial_images(void) =20 for ( i =3D 0; i < boot_info->nr_mods; ++i ) { - uint64_t start =3D (uint64_t)initial_images[i].mod_start << PAGE_S= HIFT; + uint64_t start =3D + (uint64_t)initial_images[i].early_mod->mod_start << PAGE_SHIFT; =20 init_domheap_pages(start, - start + PAGE_ALIGN(initial_images[i].mod_end)); + start + + PAGE_ALIGN(initial_images[i].early_mod->mod_end= )); } =20 boot_info->nr_mods =3D 0; @@ -1396,7 +1399,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) set_kexec_crash_area_size((u64)nr_pages << PAGE_SHIFT); kexec_reserve_area(); =20 - initial_images =3D boot_info->mods[0].early_mod; + initial_images =3D boot_info->mods; =20 for ( i =3D 0; !efi_enabled(EFI_LOADER) && i < boot_info->nr_mods; i++= ) { --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725055017; cv=pass; d=zohomail.com; s=zohoarc; b=ZN3VpEYyoEjhRVEPY/SpE/a2cFEQvC0d1L99b6nMVG7I7wyPYRsVHF9t8jeiUcnCwexlb2eivH2qbXIygNTrt280Z1A14PBa3Py0paHo9k5wdBdiu0uN5QFioufczWU8HsvQPXTfm8bVCR8sCdyBrp/rJiVWSM0U2WUUwzTxuqw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725055017; 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=p5o3cV7jLCbs9cI7Hw5PLo3huoAejKeUL5qr3Pk5iyM=; b=aYCZdw9YCls1KW1dEprNmMfnyEzlmPCjVTdeJTcixLFPwnbSAox92cuPQ3xvU/qXxMUmaGnu+rRMz3RvIugTvjnRATZdD4wY/phTsKJEHUUVYL7tihrQDe+DK8E2iTeIgzvri0/UVEfV5hgr66sS2heU/16OLf+Icy0pzZsQovQ= 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 1725055017585429.55431025048335; Fri, 30 Aug 2024 14:56:57 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786797.1196601 (Exim 4.92) (envelope-from ) id 1sk9bk-0007E2-KR; Fri, 30 Aug 2024 21:56:40 +0000 Received: by outflank-mailman (output) from mailman id 786797.1196601; Fri, 30 Aug 2024 21:56:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9bk-0007DG-Ad; Fri, 30 Aug 2024 21:56:40 +0000 Received: by outflank-mailman (input) for mailman id 786797; Fri, 30 Aug 2024 21:56:38 +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 1sk9XF-0000Zf-FX for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:52:01 +0000 Received: from sender3-of-o57.zoho.com (sender3-of-o57.zoho.com [136.143.184.57]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 1499de74-671a-11ef-99a1-01e77a169b0f; Fri, 30 Aug 2024 23:51:59 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054496865249.05797085453992; Fri, 30 Aug 2024 14:48:16 -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: 1499de74-671a-11ef-99a1-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1725054498; cv=none; d=zohomail.com; s=zohoarc; b=aGjcaSKDQL6x6+3QXUmV2Efhk+Exo2aZVhqZKyiTLSvnpZoEV1d7orOqC+I/1CHv3YTpdq/AFhRB+xnYdPzoHTUjCLqe7t6bLZ/WGGgY6KSbSrrxUxjiySvnldRwfLvngOGKiFyQxJgj/goM6cVMlWPBjqW26UKsvLgdbHyeABg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054498; 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=p5o3cV7jLCbs9cI7Hw5PLo3huoAejKeUL5qr3Pk5iyM=; b=SHVdUAjdxF3eFlZ44wPBx//nBDmPRuqv3dIURtO5dEgYYIVGTA4e0Zs6Xg5/KfwtqXyXvGWrgZTnBq1fVI44JCeFqHkFrN4T1st/7Y5YCJJ/HPCDYJx6u98d3ykVfVHTdkJZKnKkbzHZ2zVQMkj14VgbDI3VjY1vHR2INhr00Uc= 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=1725054498; 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=p5o3cV7jLCbs9cI7Hw5PLo3huoAejKeUL5qr3Pk5iyM=; b=rT6h3CC64FDRJJ0kWqC7zOjjBZg+0sL5owrewS3VPHxPEazX5lxfySujcSw5+Zzs xi8P1bRN4n+QH+8Kw2Up/BZzdGSqRAoF2G6k/0D684i5BurXgnV19f/jwbaNGDuSuCR NbhBYLJccCfj7AaVYZVLwdqz9ieuDDLM2nHL1cXQ= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 34/44] x86/boot: drop the use of initial_images unit global Date: Fri, 30 Aug 2024 17:47:19 -0400 Message-Id: <20240830214730.1621-35-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725055019068116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel P. Smith --- xen/arch/x86/setup.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 77c0833dd441..977b68098694 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -281,7 +281,6 @@ static const char *cmdline_cook(const char *p, const ch= ar *loader_name); /* Max number of boot modules a bootloader can provide in addition to Xen = */ #define MAX_NR_BOOTMODS 63 =20 -static const struct boot_module *__initdata initial_images; static struct boot_info __initdata *boot_info; =20 static void __init multiboot_to_bootinfo(multiboot_info_t *mbi, module_t *= mods) @@ -337,9 +336,9 @@ unsigned long __init initial_images_nrpages(nodeid_t no= de) =20 for ( nr =3D i =3D 0; i < boot_info->nr_mods; ++i ) { - unsigned long start =3D initial_images[i].early_mod->mod_start; + unsigned long start =3D boot_info->mods[i].early_mod->mod_start; unsigned long end =3D start + - PFN_UP(initial_images[i].early_mod->mod_end); + PFN_UP(boot_info->mods[i].early_mod->mod_end); =20 if ( end > node_start && node_end > start ) nr +=3D min(node_end, end) - max(node_start, start); @@ -355,15 +354,14 @@ void __init discard_initial_images(void) for ( i =3D 0; i < boot_info->nr_mods; ++i ) { uint64_t start =3D - (uint64_t)initial_images[i].early_mod->mod_start << PAGE_SHIFT; + (uint64_t)boot_info->mods[i].early_mod->mod_start << PAGE_SHIF= T; =20 init_domheap_pages(start, start + - PAGE_ALIGN(initial_images[i].early_mod->mod_end= )); + PAGE_ALIGN(boot_info->mods[i].early_mod->mod_en= d)); } =20 boot_info->nr_mods =3D 0; - initial_images =3D NULL; } =20 static void __init init_idle_domain(void) @@ -1399,8 +1397,6 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) set_kexec_crash_area_size((u64)nr_pages << PAGE_SHIFT); kexec_reserve_area(); =20 - initial_images =3D boot_info->mods; - for ( i =3D 0; !efi_enabled(EFI_LOADER) && i < boot_info->nr_mods; i++= ) { if ( boot_info->mods[i].early_mod->mod_start & (PAGE_SIZE - 1) ) --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725055003; cv=pass; d=zohomail.com; s=zohoarc; b=XhGUBanbczFZ4PzoTSjdvm+uUZVfoews6OY95HHDH8fGnpc7RMOvolE+rU53wXXMbqkpjAfPWyQsUtlyfNkwPYN0JFJ3UwdtonYhF9GMAVsfQ+K7US3TmfNeVSA+H3Uqr7itmcjWViByDIo2f8dMRr4wHPGk/04rLsYb92hnJbo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725055003; 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=ngbbLEQwLIwlBq1EHKDN2ggSsuXtMR1Wvlwl95KPSyQ=; b=cRjf46x/U+9UpTa7ndSbqyfRfxJIvnhhvbCYMHG5sttRHUQESGyzM1ArWD2Ww216/qGNww8WkOJyLj4k8q5ddzNitpRZNBq3voFTa2I48Fu0tI9fuilaJrORX00SjMdVpYYZpINrGoRHpSC2oHZrDKgu/suKjRzd6XerA3NUDTY= 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 1725055003465823.7377976842586; Fri, 30 Aug 2024 14:56:43 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786761.1196540 (Exim 4.92) (envelope-from ) id 1sk9bW-0003lO-Ha; Fri, 30 Aug 2024 21:56:26 +0000 Received: by outflank-mailman (output) from mailman id 786761.1196540; Fri, 30 Aug 2024 21:56:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9bW-0003ky-AR; Fri, 30 Aug 2024 21:56:26 +0000 Received: by outflank-mailman (input) for mailman id 786761; Fri, 30 Aug 2024 21:56:24 +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 1sk9XN-0000Zf-48 for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:52:09 +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 18fa953c-671a-11ef-99a1-01e77a169b0f; Fri, 30 Aug 2024 23:52:07 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054497909399.3572608288832; Fri, 30 Aug 2024 14:48:17 -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: 18fa953c-671a-11ef-99a1-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1725054499; cv=none; d=zohomail.com; s=zohoarc; b=m7eOzt8e/yus21ggPibpZzLMVSol6XKNBAqGEyVU1ABNF0K5G9G4lBcnEogjFP14uw0yjxqrzoIihXX0KCh6ANS/wdwQN+2myufcSVASeuwdDTYzFGRN9WsNYSGLgC25XXSKOGFbxMjSuXFkIlvvc+PNCQfu+Cg1Ig4HNWiRubc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054499; 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=ngbbLEQwLIwlBq1EHKDN2ggSsuXtMR1Wvlwl95KPSyQ=; b=XKV/qK1n4YfpLRcHQzZYUkTt5NaWQZcBqEzuZuKQ6WVZOI/c1C2xDrbZRFFa+tga0jnKwSLlDcobePPXggqY0UwWFh2J6swvAeJqQORz7Eb2P87c3qpVphDOAJIf70ZhI50vtibv0N9i8OvurNTc8755ui8oVJiu6X5dr3DNkD8= 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=1725054499; 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=ngbbLEQwLIwlBq1EHKDN2ggSsuXtMR1Wvlwl95KPSyQ=; b=NfDR64LYuwiTPYpAKJN0PClsPjMmpP07k/DIX03CUM/rZHxpk4WobGSqVAmK/dxI U2TruI3vHDcvGmlGo10h0lFlqe2CCb6LlpjAkEEtdPxCLyylnl8qXOiTspmMQ+ZNIrc wfA0C1dpD98odlW4In2Xbod84kEq+SdPk/VwdWUo= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 35/44] x86/boot: remove usage of mod_end by discard_initial_images Date: Fri, 30 Aug 2024 17:47:20 -0400 Message-Id: <20240830214730.1621-36-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725055005031116600 Content-Type: text/plain; charset="utf-8" This eliminates usage of early_mod by discard_initial_images Signed-off-by: Daniel P. Smith --- xen/arch/x86/pv/dom0_build.c | 2 +- xen/arch/x86/setup.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c index dce62d76e41e..a403e23b2f93 100644 --- a/xen/arch/x86/pv/dom0_build.c +++ b/xen/arch/x86/pv/dom0_build.c @@ -641,7 +641,7 @@ int __init dom0_construct_pv(struct domain *d, if ( assign_pages(mfn_to_page(_mfn(mfn++)), 1, d, 0) ) BUG(); } - initrd->size =3D initrd->early_mod->mod_end =3D 0; + initrd->size =3D 0; =20 iommu_memory_setup(d, "initrd", mfn_to_page(_mfn(initrd_mfn)), PFN_UP(initrd_len), &flush_flags); diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 977b68098694..81610405a53c 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -353,12 +353,10 @@ void __init discard_initial_images(void) =20 for ( i =3D 0; i < boot_info->nr_mods; ++i ) { - uint64_t start =3D - (uint64_t)boot_info->mods[i].early_mod->mod_start << PAGE_SHIF= T; + uint64_t start =3D boot_info->mods[i].start; =20 init_domheap_pages(start, - start + - PAGE_ALIGN(boot_info->mods[i].early_mod->mod_en= d)); + start + PAGE_ALIGN(boot_info->mods[i].size)); } =20 boot_info->nr_mods =3D 0; --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725055025; cv=pass; d=zohomail.com; s=zohoarc; b=ebDjZYBJOtMbHAVOokAhpu7rBBCibUp4KDIpuux6qbIEtaCQA382LfW7hQAlIJVbigT8VXu7TIx7c0yKFIc5uvRAfO763MDzkDyB5RHAInwptJGmskpgTnGhEnh24Xqvdg2+rBCmSKMbF0+sCdUJ14o2ORgdn1d6JbYnaY2WMzA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725055025; 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=3IESuTbSEXt1kpS4QxXRhBwnK5tj42QFRgJSLR4gL7g=; b=bcSfTnPQV61ma25ETaXSiJ920DVcjmufDc8td1eYVRrRc4Tu7MiJb8bVs9pc+VXAwKy1W2G1cT+BSPDOWiKaECGPLLY0pfAnJgjjOdN3pgo4Z9YeSOS/xd1z2/eaa/r4gHxlc7gBshpf2cdS2WTHuoz7H2dTpESURPCuiV7+QUw= 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 1725055025301913.8285257612602; Fri, 30 Aug 2024 14:57:05 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786799.1196612 (Exim 4.92) (envelope-from ) id 1sk9bm-0007ZX-Cj; Fri, 30 Aug 2024 21:56:42 +0000 Received: by outflank-mailman (output) from mailman id 786799.1196612; Fri, 30 Aug 2024 21:56:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9bl-0007UK-OU; Fri, 30 Aug 2024 21:56:41 +0000 Received: by outflank-mailman (input) for mailman id 786799; Fri, 30 Aug 2024 21:56: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 1sk9XU-0000Zf-OQ for xen-devel@lists.xenproject.org; Fri, 30 Aug 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 1dadde6a-671a-11ef-99a1-01e77a169b0f; Fri, 30 Aug 2024 23:52:15 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054498973975.9857328919481; Fri, 30 Aug 2024 14:48:18 -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: 1dadde6a-671a-11ef-99a1-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1725054500; cv=none; d=zohomail.com; s=zohoarc; b=GDSKvUqHJ5BLAS627Did2xnWccmZLTtAIspbKcJn4SGe+PXR7jf2bbK4RBHkXgpJyXMoXgbW+AcpY8RE4NjMdMt+h7Z6mVNP8nu7ZQjSfY0883AJlZaXBARkIuxBJSo35yuf7NxczM08AhMjwtPp/bNdbAQG8pK30GuB5Sstszk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054500; 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=3IESuTbSEXt1kpS4QxXRhBwnK5tj42QFRgJSLR4gL7g=; b=AWuOdAeM3rEUAZclJJdARbz6aWQFvv4+gbaGqZ6ZV6q5e3kqzSURm7l6Z175lOkRgYF9U/szQc/TPZ+oKE5jErAV5wLzfpWFF41NtY1pEBiiwZKblJim9nR/keQReqgoqt7OjcFL04XAwaRixaQvHtmW2i80o3ZW0zzbfitd0Dc= 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=1725054500; 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=3IESuTbSEXt1kpS4QxXRhBwnK5tj42QFRgJSLR4gL7g=; b=brTGisH6Dp8rEw9sOTjel49uha73GTWa+U+PshwLRspU68ej6q2ytrr5AMqt2SNZ Hy4OXwg5ZRCE1oPWC9SljIAjBbZ2C1wUTjsTGR3VmwOg7KFP32Ci3swK0uHJzadS7XA orHHrnnbRu4jgznCPGNPv9vWNJzbmk8N3P8wOur8= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 36/44] x86/boot: remove remaining early_mod references Date: Fri, 30 Aug 2024 17:47:21 -0400 Message-Id: <20240830214730.1621-37-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725055027150116600 Content-Type: text/plain; charset="utf-8" Any direct usages of struct mod have been transitioned, remove the remaining references to early_mod fields. Signed-off-by: Daniel P. Smith --- xen/arch/x86/setup.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 81610405a53c..46f6bf82fe63 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -336,9 +336,8 @@ unsigned long __init initial_images_nrpages(nodeid_t no= de) =20 for ( nr =3D i =3D 0; i < boot_info->nr_mods; ++i ) { - unsigned long start =3D boot_info->mods[i].early_mod->mod_start; - unsigned long end =3D start + - PFN_UP(boot_info->mods[i].early_mod->mod_end); + unsigned long start =3D boot_info->mods[i].start; + unsigned long end =3D start + PFN_UP(boot_info->mods[i].size); =20 if ( end > node_start && node_end > start ) nr +=3D min(node_end, end) - max(node_start, start); @@ -665,8 +664,8 @@ static uint64_t __init consider_modules( =20 for ( i =3D 0; i < nr_mods ; ++i ) { - uint64_t start =3D (uint64_t)mods[i].early_mod->mod_start << PAGE_= SHIFT; - uint64_t end =3D start + PAGE_ALIGN(mods[i].early_mod->mod_end); + uint64_t start =3D (uint64_t)mods[i].start; + uint64_t end =3D start + PAGE_ALIGN(mods[i].size); =20 if ( i =3D=3D this_mod ) continue; @@ -1397,10 +1396,8 @@ void asmlinkage __init noreturn __start_xen(unsigned= long mbi_p) =20 for ( i =3D 0; !efi_enabled(EFI_LOADER) && i < boot_info->nr_mods; i++= ) { - if ( boot_info->mods[i].early_mod->mod_start & (PAGE_SIZE - 1) ) + if ( boot_info->mods[i].start & (PAGE_SIZE - 1) ) panic("Bootloader didn't honor module alignment request\n"); - boot_info->mods[i].early_mod->mod_end -=3D boot_info->mods[i].earl= y_mod->mod_start; - boot_info->mods[i].early_mod->mod_start >>=3D PAGE_SHIFT; } =20 /* @@ -1419,15 +1416,13 @@ void asmlinkage __init noreturn __start_xen(unsigne= d long mbi_p) * respective reserve_e820_ram() invocation below. No need to * query efi_boot_mem_unused() here, though. */ - boot_info->mods[idx].start =3D boot_info->mods[idx].early_mod->mod= _start - =3D virt_to_mfn(_stext); - boot_info->mods[idx].size =3D boot_info->mods[idx].early_mod->mod_= end - =3D __2M_rwdata_end - _stext; + boot_info->mods[idx].start =3D virt_to_maddr(_stext); + boot_info->mods[idx].size =3D __2M_rwdata_end - _stext; } =20 boot_info->mods[0].headroom =3D bzimage_headroom( - bootstrap_map(boot_info->mods[0].early_mod), - boot_info->mods[0].early_mod->mod_end); + bootstrap_map_bm(&boot_info->mods[0]), + boot_info->mods[0].size); bootstrap_map(NULL); =20 #ifndef highmem_start @@ -1533,8 +1528,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) { move_memory(end - size + bm->headroom, bm->start, bm->size= ); bm->start =3D (end - size); - bm->early_mod->mod_start =3D paddr_to_pfn(bm->start); - bm->size =3D bm->early_mod->mod_end +=3D bm->headroom; + bm->size +=3D bm->headroom; bm->flags |=3D BOOTMOD_FLAG_X86_RELOCATED; } } @@ -1724,7 +1718,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) { set_pdx_range(paddr_to_pfn(boot_info->mods[i].start), paddr_to_pfn(boot_info->mods[i].start) + - PFN_UP(boot_info->mods[i].early_mod->mod_end)); + PFN_UP(boot_info->mods[i].size)); map_pages_to_xen( (unsigned long)maddr_to_virt(boot_info->mods[i].start), maddr_to_mfn(boot_info->mods[i].start), --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725055005; cv=pass; d=zohomail.com; s=zohoarc; b=QCO58pgyRC0YzgxBTgJ81NL88G9HI9L7T2JPWD2YgQmtWoUdnXuDyFE4DvUM7Ud6jYoHvUMxvwtgmAyFwtiTjHx631avrGvCOzL02RrOU+xTa8LkAG7/hpN0gfjwPb4ATLd10g16XubnwRBRYpopbeZYayqjFKwye/vFM2/kd6c= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725055005; 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=HBxvAb1ltpAXzL9WPBIkhD8Kd9b/CO8vDcvLfbJPxj0=; b=fREokxHtITkNVhFJRYTQdN/aV8ytd8UbMJeKFNZt8r/5qPE+dxxnlONVVHbJnBh85O5ZXpvFc3UlwDcnDc8RDggvgXsYvxU6scRdIopCKuP+baI5dJbYpLUOrg8NqedAJQIRogIsi6LUx+faarPXX7LNb4Y/8y8TehWstyRdnHc= 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 1725055005853880.5581247661906; Fri, 30 Aug 2024 14:56:45 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786771.1196559 (Exim 4.92) (envelope-from ) id 1sk9bZ-0004bZ-L9; Fri, 30 Aug 2024 21:56:29 +0000 Received: by outflank-mailman (output) from mailman id 786771.1196559; Fri, 30 Aug 2024 21:56:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9bZ-0004a5-CK; Fri, 30 Aug 2024 21:56:29 +0000 Received: by outflank-mailman (input) for mailman id 786771; Fri, 30 Aug 2024 21:56: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 1sk9Xe-0000Zf-2K for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:52:26 +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 230e677c-671a-11ef-99a1-01e77a169b0f; Fri, 30 Aug 2024 23:52:24 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054500033634.5246086156144; Fri, 30 Aug 2024 14:48:20 -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: 230e677c-671a-11ef-99a1-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1725054502; cv=none; d=zohomail.com; s=zohoarc; b=Cn+G1qZky79yw/9hC9HKgKVZ45rI70UfgV6bSQszYWRKkXYJS+n7rUyXGKAg2S04DaXfEOBp+vhvvKhuaAp68kajkYA8KdnS9lThNTCR9JgK8q2UyREJ2JhZNeqeTy2URaIuUk34tH/M9n7lnCVB9R/8YHXPTbfqRmA7/7hDLHo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054502; 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=HBxvAb1ltpAXzL9WPBIkhD8Kd9b/CO8vDcvLfbJPxj0=; b=NyK2nyr1cr4+N2IXgM9Yf24qblL/EEcV4TKqcAuRuvryjSY29ISWJsD8GAoSbZt56VUNMyvzBKtdHR8s6H4XW/+RvPbLKKeL/RFlWFfj0pnm9Z+hk6yLvadUhEsc3/sqig33WELaZq5AI9yoUTOXOoFnuoboDQy7VPzAcoUoiPM= 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=1725054502; 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=HBxvAb1ltpAXzL9WPBIkhD8Kd9b/CO8vDcvLfbJPxj0=; b=cvoUht3bbrWsoWvlmhjW+xzwaNFHpd2V3oFWssLldYyD06/GXvJTdPTgHCRLSGhb Ct9SZN5YqudaQCtv31nY7Gad2C7AvK0BuFfCNzchQgqGMsHbtkfOC+dQD6/ECIgQRT5 j5IChvDDZ2ZLRh0bPyJ9nxjzbzpstW/NHNciv9pw= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 37/44] x86/boot: remove early_mod from struct boot_module Date: Fri, 30 Aug 2024 17:47:22 -0400 Message-Id: <20240830214730.1621-38-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725055007268116600 Content-Type: text/plain; charset="utf-8" With all references to early_mod fields removed, remove the early_mod field from struct boot_module. Signed-off-by: Daniel P. Smith --- xen/arch/x86/include/asm/bootinfo.h | 2 -- xen/arch/x86/setup.c | 3 --- 2 files changed, 5 deletions(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index edd5c435d032..59755ef42e53 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -8,7 +8,6 @@ #ifndef __XEN_X86_BOOTINFO_H__ #define __XEN_X86_BOOTINFO_H__ =20 -#include #include =20 /* Boot module binary type / purpose */ @@ -22,7 +21,6 @@ enum bootmod_type { }; =20 struct boot_module { - module_t *early_mod; unsigned long headroom; enum bootmod_type type; =20 diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 46f6bf82fe63..a6fbaecee9ed 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -311,8 +311,6 @@ static void __init multiboot_to_bootinfo(multiboot_info= _t *mbi, module_t *mods) =20 for ( i=3D0; i < info.nr_mods; i++ ) { - boot_mods[i].early_mod =3D &mods[i]; - boot_mods[i].cmdline =3D (char *)(paddr_t)mods[i].string; =20 boot_mods[i].start =3D (paddr_t)mods[i].mod_start; @@ -322,7 +320,6 @@ static void __init multiboot_to_bootinfo(multiboot_info= _t *mbi, module_t *mods) /* map the last mb module for xen entry */ boot_mods[info.nr_mods].type =3D BOOTMOD_XEN; boot_mods[info.nr_mods].flags |=3D BOOTMOD_FLAG_X86_CONSUMED; - boot_mods[info.nr_mods].early_mod =3D &mods[info.nr_mods]; =20 boot_info =3D &info; } --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054985; cv=pass; d=zohomail.com; s=zohoarc; b=Ge8JX+HS7fCa/g82RiPN4gWQV4JGAbdOoSgkknMrnNO5EXk+GC9WGbRVE28lNkbCecsIaneCFI34t2Jdg50p923Z+LwMB2Jm9bVHf7B/UX3+yiG97uVReC8LkDHH0ApIFja2MeG4Gxc9rCqJWG7CG+LTtbeWD1boN85qJgZtbfw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054985; 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=R/MzkWoN4ISAq+3iGJhqemI2sorOj7/J8EPT75xG/08=; b=GSpCYTAtRlhO42ExhY3sjKce0d1SY664zlf7BAdhXsKEJ18Zv+dUOKk3+dge+e7gZcf+0cAPuDl3IbSoBV/VGnIQJUic1V/pM2OOcm7GvSUK48HB4I9QAEKWA0Y8DkYUL602yr3OJIzlsWn1YHdomVYgFVr/9P0JOEP/sUYBcS8= 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 172505498527783.96086139138629; Fri, 30 Aug 2024 14:56:25 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786747.1196475 (Exim 4.92) (envelope-from ) id 1sk9bJ-0000hs-3d; Fri, 30 Aug 2024 21:56:13 +0000 Received: by outflank-mailman (output) from mailman id 786747.1196475; Fri, 30 Aug 2024 21:56:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9bI-0000hE-Uj; Fri, 30 Aug 2024 21:56:12 +0000 Received: by outflank-mailman (input) for mailman id 786747; Fri, 30 Aug 2024 21:56:12 +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 1sk9Xm-0000Zf-Fv for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:52:34 +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 2836cd3a-671a-11ef-99a1-01e77a169b0f; Fri, 30 Aug 2024 23:52:32 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054501101460.90423645474493; Fri, 30 Aug 2024 14:48: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: 2836cd3a-671a-11ef-99a1-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1725054503; cv=none; d=zohomail.com; s=zohoarc; b=lMGZs8SIDtJtI131S+0ymMPmMbm9ZrRmIfMPtzovliVyRoavvu25Qd+y+OFcQ0d2D3/m4cBHKYWobvDQ1UUqSWgDS5S/va6mEdgjq4urQuiSO3BAdXLkyHaWQy26CDvUIfcVS4+wrJ7uxFGH5NQ3VOpLQC9wJA9M+IBJUvXUygQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054503; 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=R/MzkWoN4ISAq+3iGJhqemI2sorOj7/J8EPT75xG/08=; b=JNgYY8qoj7tkrn2MgvM4Qp2r8jm/4q+yUnjOdVb6gTLYpEZ9b9nRs5455sStAqo4AkvwBvxw1yy0yyyR2yzsF6BK5ByL3CSR3lxppX29hzZIIft0JT9jqCdrVn0dcemP1u0Z7VR5+g8kUoHk9B3L7HUuAa9TgzYkJ6t4hcZYmqU= 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=1725054503; 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=R/MzkWoN4ISAq+3iGJhqemI2sorOj7/J8EPT75xG/08=; b=TwTSDY3tQjVwTmmgBSrXGW7hpH82mM7D7QOwNJU3BO2zmz87+6jWWN/bDP0NiZxQ +MCTnu4tbq8KehJzvjegdmtakDUDr/oxw3ux6ugKVTegxKeaRbrdQOfLTCFtD0kGvvM 88mHGE1ZkNxFWHxDAiEvBxDOMb3kHgICmFO1QRic= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 38/44] x86/boot: introduce boot domain Date: Fri, 30 Aug 2024 17:47:23 -0400 Message-Id: <20240830214730.1621-39-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054987064116600 Content-Type: text/plain; charset="utf-8" To begin moving toward allowing the hypervisor to construct more than one domain at boot, a container is needed for a domain's build information. Introduce a new header, , that contains the initial struct boot_domain that encapsulate the build information for a domain. No functional change intended. Signed-off-by: Daniel P. Smith --- xen/arch/x86/include/asm/bootdomain.h | 28 +++++++++++++++++++++++++++ xen/arch/x86/include/asm/bootinfo.h | 7 +++++++ xen/arch/x86/setup.c | 27 +++++++++++--------------- 3 files changed, 46 insertions(+), 16 deletions(-) create mode 100644 xen/arch/x86/include/asm/bootdomain.h diff --git a/xen/arch/x86/include/asm/bootdomain.h b/xen/arch/x86/include/a= sm/bootdomain.h new file mode 100644 index 000000000000..4285223ac5ab --- /dev/null +++ b/xen/arch/x86/include/asm/bootdomain.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2024 Apertus Solutions, LLC + * Author: Daniel P. Smith + * Copyright (c) 2024 Christopher Clark + */ + +#ifndef __XEN_X86_BOOTDOMAIN_H__ +#define __XEN_X86_BOOTDOMAIN_H__ + +struct boot_module; + +struct boot_domain { + struct boot_module *kernel; + struct boot_module *ramdisk; +}; + +#endif + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 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 59755ef42e53..b135aaebd25e 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -10,6 +10,11 @@ =20 #include =20 +#include + +/* Max number of boot domains that Xen can construct */ +#define MAX_NR_BOOTDOMS 1 + /* Boot module binary type / purpose */ enum bootmod_type { BOOTMOD_UNKNOWN, @@ -45,6 +50,8 @@ struct boot_info { =20 paddr_t mmap_addr; uint32_t mmap_length; + + struct boot_domain *domains; }; =20 static inline int __init next_boot_module_index( diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index a6fbaecee9ed..77abed637ff2 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -287,6 +287,7 @@ static void __init multiboot_to_bootinfo(multiboot_info= _t *mbi, module_t *mods) { static struct boot_info __initdata info; static struct boot_module __initdata boot_mods[MAX_NR_BOOTMODS + 1]; + static struct boot_domain __initdata boot_doms[MAX_NR_BOOTDOMS]; unsigned int i; =20 info.nr_mods =3D mbi->mods_count; @@ -321,6 +322,8 @@ static void __init multiboot_to_bootinfo(multiboot_info= _t *mbi, module_t *mods) boot_mods[info.nr_mods].type =3D BOOTMOD_XEN; boot_mods[info.nr_mods].flags |=3D BOOTMOD_FLAG_X86_CONSUMED; =20 + info.domains =3D boot_doms; + boot_info =3D &info; } =20 @@ -958,20 +961,10 @@ static struct domain *__init create_dom0(const struct= boot_info *bi) .misc_flags =3D opt_dom0_msr_relaxed ? XEN_X86_MSR_RELAXED : 0, }, }; - int mod_idx =3D first_boot_module_index(bi, BOOTMOD_RAMDISK); - struct boot_module *image, *initrd; + struct boot_domain *bd =3D &bi->domains[0]; struct domain *d; domid_t domid; =20 - /* Map boot_module to mb1 module for dom0 */ - image =3D &bi->mods[0]; - - /* Map boot_module to mb1 module for initrd */ - if ( mod_idx < 0 ) - initrd =3D NULL; - else - initrd =3D &bi->mods[mod_idx]; - if ( opt_dom0_pvh ) { dom0_cfg.flags |=3D (XEN_DOMCTL_CDF_hvm | @@ -997,11 +990,11 @@ static struct domain *__init create_dom0(const struct= boot_info *bi) panic("Error creating d%uv0\n", domid); =20 /* Grab the DOM0 command line. */ - if ( image->cmdline || bi->kextra ) + if ( bd->kernel->cmdline || bi->kextra ) { - if ( image->cmdline ) - safe_strcpy(cmdline, - cmdline_cook(__va((unsigned long)image->cmdline), + if ( bd->kernel->cmdline ) + safe_strcpy(cmdline, cmdline_cook( + __va((unsigned long)bd->kernel->cmdline), bi->boot_loader_name)); =20 if ( bi->kextra ) @@ -1036,7 +1029,7 @@ static struct domain *__init create_dom0(const struct= boot_info *bi) write_cr4(read_cr4() & ~X86_CR4_SMAP); } =20 - if ( construct_dom0(d, image, initrd, cmdline) !=3D 0 ) + if ( construct_dom0(d, bd->kernel, bd->ramdisk, cmdline) !=3D 0 ) panic("Could not construct domain 0\n"); =20 if ( cpu_has_smap ) @@ -1221,6 +1214,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) /* Dom0 kernel is always first */ boot_info->mods[0].type =3D BOOTMOD_KERNEL; boot_info->mods[0].flags |=3D BOOTMOD_FLAG_X86_CONSUMED; + boot_info->domains[0].kernel =3D &boot_info->mods[0]; =20 if ( pvh_boot ) { @@ -2112,6 +2106,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) { boot_info->mods[initrdidx].type =3D BOOTMOD_RAMDISK; boot_info->mods[initrdidx].flags |=3D BOOTMOD_FLAG_X86_CONSUMED; + boot_info->domains[0].ramdisk =3D &boot_info->mods[initrdidx]; if ( first_boot_module_index(boot_info, BOOTMOD_UNKNOWN) >=3D 0 ) printk(XENLOG_WARNING "Multiple initrd candidates, picking module #%u\n", --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054776; cv=pass; d=zohomail.com; s=zohoarc; b=WN1Rg8BQ9iyqqGmHzAOl92ER7J0FpspxFC7ctELKlNFKRqThMr4CgZxkFT/U8xNYUIcpv6tql0BxS/s2DlL4iXSC6enR48xf5tqdcFzWJZLhOPBM8DTcItk/Nq/RxH6STUKGuLcfhaUZ83iOj79z6/8ndmxXNI2OAirUboFflc8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054776; 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=feqDlwU7EGLLtvhfulZ1x0mRALgPHN///oYnW4IFKWA=; b=ggP5bG9mCpUAvV+kIOx/as7ArzNAn8uHb3hoaE5kCZ6FJjqvuwk7YMEOnwlkfd6BCoAsEH4tTx2S0F7TcIo1akQPvqNAGG0HUWOLRFlYLEJh05kAHnCDRlAJ9txeTZWQV3em57y6PQRiuIGIkI2k7vaxYTvMgtTukWMaLYIDrVI= 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 1725054776496268.18816889420043; Fri, 30 Aug 2024 14:52:56 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786723.1196414 (Exim 4.92) (envelope-from ) id 1sk9Xw-0005ab-4P; Fri, 30 Aug 2024 21:52:44 +0000 Received: by outflank-mailman (output) from mailman id 786723.1196414; Fri, 30 Aug 2024 21:52:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9Xw-0005aU-1Z; Fri, 30 Aug 2024 21:52:44 +0000 Received: by outflank-mailman (input) for mailman id 786723; Fri, 30 Aug 2024 21:52:42 +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 1sk9Xu-0005aM-So for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:52:42 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 2d0ecb87-671a-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:52:41 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054502153808.9241274770283; Fri, 30 Aug 2024 14:48:22 -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: 2d0ecb87-671a-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054504; cv=none; d=zohomail.com; s=zohoarc; b=HQc/8Mpes7nky1IqTnmc7WcSNsdXEdetXZNaGZMrV3ObGjL9HzhgtIDvnmOp0jZqs55UI4JZf4dO/NSgiLBX2P0CIWRYauWHowYmeNO6rXIBBPrwoCUivc5qBxeEYb6j9uW3nL+q9ct3+pqm8LZVA5fyB0EFIFA10NGe09Rw0as= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054504; 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=feqDlwU7EGLLtvhfulZ1x0mRALgPHN///oYnW4IFKWA=; b=a2pxoqUMt5aHGMs71XhzBzZq7qxLsNQYRpN8qfLkTQ4fy6OqBeJ1kItKz/3oP2fx5pz/HL8Xtmq3EspRq0t38yLYlqrDbCO1d8ICw/V0/P/uzKFbpZNXSxKzEswcoAThQJw4885YODAYop6k8RhAXQvG5hiz7dEsTkfBiu4PWEs= 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=1725054504; 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=feqDlwU7EGLLtvhfulZ1x0mRALgPHN///oYnW4IFKWA=; b=P7jsgqlg6tmxb9gsrZXaupZa0AdgOxCLm/Cmg3KqyoABo6g2PbcZyShtGec57SSr ZtO5rJLvQi1ZXd4nesUHE/lhkUzJ6vELNpBoEqd1vLRugqzBZ9wRyyMTsCx4gKdz3Tw UfHQ2WTWo5VHV9UySk4SRuZMmnVZcoCl1Bxim+Jo= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 39/44] x86/boot: introduce domid field to struct boot_domain Date: Fri, 30 Aug 2024 17:47:24 -0400 Message-Id: <20240830214730.1621-40-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054778029116600 Content-Type: text/plain; charset="utf-8" Add a domid field to struct boot_domain to hold the assigned domain id for = the domain. During initialization, ensure all instances of struct boot_domain h= ave the invalid domid to ensure that the domid must be set either by convention= or configuration. Signed-off-by: Daniel P. Smith --- xen/arch/x86/include/asm/bootdomain.h | 2 ++ xen/arch/x86/setup.c | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/include/asm/bootdomain.h b/xen/arch/x86/include/a= sm/bootdomain.h index 4285223ac5ab..d6264d554dba 100644 --- a/xen/arch/x86/include/asm/bootdomain.h +++ b/xen/arch/x86/include/asm/bootdomain.h @@ -11,6 +11,8 @@ struct boot_module; =20 struct boot_domain { + domid_t domid; + struct boot_module *kernel; struct boot_module *ramdisk; }; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 77abed637ff2..43b588d4d105 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -322,6 +322,9 @@ static void __init multiboot_to_bootinfo(multiboot_info= _t *mbi, module_t *mods) boot_mods[info.nr_mods].type =3D BOOTMOD_XEN; boot_mods[info.nr_mods].flags |=3D BOOTMOD_FLAG_X86_CONSUMED; =20 + for ( i=3D0; i < MAX_NR_BOOTDOMS; i++ ) + boot_doms[i].domid =3D DOMID_INVALID; + info.domains =3D boot_doms; =20 boot_info =3D &info; @@ -963,7 +966,6 @@ static struct domain *__init create_dom0(const struct b= oot_info *bi) }; struct boot_domain *bd =3D &bi->domains[0]; struct domain *d; - domid_t domid; =20 if ( opt_dom0_pvh ) { @@ -979,15 +981,15 @@ static struct domain *__init create_dom0(const struct= boot_info *bi) dom0_cfg.flags |=3D XEN_DOMCTL_CDF_iommu; =20 /* Create initial domain. Not d0 for pvshim. */ - domid =3D get_initial_domain_id(); - d =3D domain_create(domid, &dom0_cfg, pv_shim ? 0 : CDF_privileged); + bd->domid =3D get_initial_domain_id(); + d =3D domain_create(bd->domid, &dom0_cfg, pv_shim ? 0 : CDF_privileged= ); if ( IS_ERR(d) ) - panic("Error creating d%u: %ld\n", domid, PTR_ERR(d)); + panic("Error creating d%u: %ld\n", bd->domid, PTR_ERR(d)); =20 init_dom0_cpuid_policy(d); =20 if ( alloc_dom0_vcpu0(d) =3D=3D NULL ) - panic("Error creating d%uv0\n", domid); + panic("Error creating d%uv0\n", bd->domid); =20 /* Grab the DOM0 command line. */ if ( bd->kernel->cmdline || bi->kextra ) --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054785; cv=pass; d=zohomail.com; s=zohoarc; b=MsA4v+PFUFLCGrTzuk2HIETpiio9FpUQJHFFr1P81g6l8JWilmSYtaAhZRxCR+aTA2ewcT+HfkZgjex0JgbC3FXe1+2Gs+dr9swAtgFUQY2OyG60WCFO9Tl1ZPhV3d8m7FTeTIZ+cfQmDQGaOeRSzJSuKc2iUdhDLvSvlb+Tsuc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054785; 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=Sd7QQyOHQcpE3M4m4u6Ct3Fw13iRggCCs6j9qnmZOMk=; b=hbixdu4TMzkIhINz19ssH+eKpHofd+a6xARQncrcbDZGoneMOwf7NWbDGUv272km4zmqAiZapRJJNq5rqsuN/JWhfQBQJ0yiPdshiKKy5sK79mWGUgqWOnZeG2Lplgyg2nspWFDl0uja6yaRutwGecm0v6q3U7mZEXefdQKx/EI= 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 1725054785907838.3150440945847; Fri, 30 Aug 2024 14:53:05 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786725.1196424 (Exim 4.92) (envelope-from ) id 1sk9Y5-0005sr-Ab; Fri, 30 Aug 2024 21:52:53 +0000 Received: by outflank-mailman (output) from mailman id 786725.1196424; Fri, 30 Aug 2024 21:52:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9Y5-0005sk-7O; Fri, 30 Aug 2024 21:52:53 +0000 Received: by outflank-mailman (input) for mailman id 786725; Fri, 30 Aug 2024 21:52:52 +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 1sk9Y4-0005aM-45 for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:52:52 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 329b11bb-671a-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:52:50 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 17250545032331016.3890116274274; Fri, 30 Aug 2024 14:48:23 -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: 329b11bb-671a-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054505; cv=none; d=zohomail.com; s=zohoarc; b=GA7Yp4LFWXcUTCQ+tcxx7puOdH0pa01EM+OSB1scExt/54hyvetQ5OqApsaTg5bhieRGq8CZ0TEH2EqR42b/fkKU4deFvS7a8D7/kKY0YDcnGpp5QWB1fqAwaVrGvyJPwbEbdNOYu0gx1caNmkUjh31mqbfTmMJDnmcTeuYqy5E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054505; 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=Sd7QQyOHQcpE3M4m4u6Ct3Fw13iRggCCs6j9qnmZOMk=; b=f3kuXxbWhnh9K89+FrbWk50c5gQwEw+vXn0kUXi/q5VA2cOUs548oAm7or7+iH6nl+hxLwKQWmVFVWU87+uhxnvKh399OkS/oA7B7aAx0AQsfYZTGGDdXDchqyGILSWZonIb42lnDXEZvGjhpsdRkbmqiwzyw6B1sXkeIEQ4Cc8= 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=1725054505; 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=Sd7QQyOHQcpE3M4m4u6Ct3Fw13iRggCCs6j9qnmZOMk=; b=bbvsH87qot8P5OwLFLsH9YynUee1DpqXrTjvDagCWBZuBKHREwoSy3evHF+Fehwm WcdP0l7LFQzr4f1EX1TA4q/YRh8tW0TQkg4voUpF/6vIBTmNrk8NMKENe8A9HXPVPCY p7KZgRCe+XHpDWOXzG/OfJhzNA4hWDhLl/vgqFZ8= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 40/44] x86/boot: add cmdline to struct boot_domain Date: Fri, 30 Aug 2024 17:47:25 -0400 Message-Id: <20240830214730.1621-41-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054788076116600 Content-Type: text/plain; charset="utf-8" Add a container for the "cooked" command line for a domain. Signed-off-by: Daniel P. Smith --- xen/arch/x86/include/asm/bootdomain.h | 4 ++++ xen/arch/x86/setup.c | 18 ++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/xen/arch/x86/include/asm/bootdomain.h b/xen/arch/x86/include/a= sm/bootdomain.h index d6264d554dba..00f7d9267965 100644 --- a/xen/arch/x86/include/asm/bootdomain.h +++ b/xen/arch/x86/include/asm/bootdomain.h @@ -8,9 +8,13 @@ #ifndef __XEN_X86_BOOTDOMAIN_H__ #define __XEN_X86_BOOTDOMAIN_H__ =20 +#include + struct boot_module; =20 struct boot_domain { + char cmdline[MAX_GUEST_CMDLINE]; + domid_t domid; =20 struct boot_module *kernel; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 43b588d4d105..2c1aa1475c4e 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -951,8 +951,6 @@ static unsigned int __init copy_bios_e820(struct e820en= try *map, unsigned int li =20 static struct domain *__init create_dom0(const struct boot_info *bi) { - static char __initdata cmdline[MAX_GUEST_CMDLINE]; - struct xen_domctl_createdomain dom0_cfg =3D { .flags =3D IS_ENABLED(CONFIG_TBOOT) ? XEN_DOMCTL_CDF_s3_integrity = : 0, .max_evtchn_port =3D -1, @@ -995,17 +993,17 @@ static struct domain *__init create_dom0(const struct= boot_info *bi) if ( bd->kernel->cmdline || bi->kextra ) { if ( bd->kernel->cmdline ) - safe_strcpy(cmdline, cmdline_cook( + safe_strcpy(bd->cmdline, cmdline_cook( __va((unsigned long)bd->kernel->cmdline), bi->boot_loader_name)); =20 if ( bi->kextra ) /* kextra always includes exactly one leading space. */ - safe_strcat(cmdline, bi->kextra); + safe_strcat(bd->cmdline, bi->kextra); =20 /* Append any extra parameters. */ - if ( skip_ioapic_setup && !strstr(cmdline, "noapic") ) - safe_strcat(cmdline, " noapic"); + if ( skip_ioapic_setup && !strstr(bd->cmdline, "noapic") ) + safe_strcat(bd->cmdline, " noapic"); =20 if ( (strlen(acpi_param) =3D=3D 0) && acpi_disabled ) { @@ -1013,10 +1011,10 @@ static struct domain *__init create_dom0(const stru= ct boot_info *bi) safe_strcpy(acpi_param, "off"); } =20 - if ( (strlen(acpi_param) !=3D 0) && !strstr(cmdline, "acpi=3D") ) + if ( (strlen(acpi_param) !=3D 0) && !strstr(bd->cmdline, "acpi=3D"= ) ) { - safe_strcat(cmdline, " acpi=3D"); - safe_strcat(cmdline, acpi_param); + safe_strcat(bd->cmdline, " acpi=3D"); + safe_strcat(bd->cmdline, acpi_param); } } =20 @@ -1031,7 +1029,7 @@ static struct domain *__init create_dom0(const struct= boot_info *bi) write_cr4(read_cr4() & ~X86_CR4_SMAP); } =20 - if ( construct_dom0(d, bd->kernel, bd->ramdisk, cmdline) !=3D 0 ) + if ( construct_dom0(d, bd->kernel, bd->ramdisk, bd->cmdline) !=3D 0 ) panic("Could not construct domain 0\n"); =20 if ( cpu_has_smap ) --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054789; cv=pass; d=zohomail.com; s=zohoarc; b=WBj2F4lNSHJWvGMCUhmaWFK2dIrJq5+ngL3OS2x/R+TTLq3LCYPdU8iahQNQmOz5oNHAGfdz6P0vCvNdTuBYKEiINUsJMeHEykwpYUJYS6qKq9q8RQ4/MJ4ZL7rOQy66umJX6/TGzjzTW9ywp38ebbfYdbg/O/BScyfPJ1FTAOk= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054789; 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=FMMyV/u+IcJlzna8xPedLWbpzcFdbye2wRnqCcAWCr4=; b=d0h1U+1roGt6zIry2fWHepUK2JrBmwlKlsOSQLaTFBWTXyz5MVZxYAp3t0Ddu0VpzNW8I4gUrI2yVypi1yKInJg0759AfBjWFMT+y3oGsgpyI+j98tU9MxeTnNcg9+oJ1eUcymobwx7AqAFqRNxBMWftXbUlJp3XtWxeGOq8ZOY= 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 1725054789919782.0222733398646; Fri, 30 Aug 2024 14:53:09 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786726.1196434 (Exim 4.92) (envelope-from ) id 1sk9YB-0006D6-Lq; Fri, 30 Aug 2024 21:52:59 +0000 Received: by outflank-mailman (output) from mailman id 786726.1196434; Fri, 30 Aug 2024 21:52:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9YB-0006Ct-IV; Fri, 30 Aug 2024 21:52:59 +0000 Received: by outflank-mailman (input) for mailman id 786726; Fri, 30 Aug 2024 21:52:58 +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 1sk9YA-0005aM-PN for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:52:58 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 36efc773-671a-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:52:57 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054505001907.1045928467133; Fri, 30 Aug 2024 14:48:25 -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: 36efc773-671a-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054506; cv=none; d=zohomail.com; s=zohoarc; b=XomcCrLeVpW08ad/3v70oAvP5emB5KRDdrW2/JPT5js1srnSkvp5X6aWhc50ZSnK+Dgd9WlAs1rfoIQv4ZcARJCh4HbdQA1TXcmUiSifX8m1+A0u40XkCkqtoR2AaDrWX1T5DcxTor1bB+seMX5fZuVqhQEvJXv1/NXM/G5Nr+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054506; 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=FMMyV/u+IcJlzna8xPedLWbpzcFdbye2wRnqCcAWCr4=; b=dhIu1CJp6gv0Pj5rDEeAgXcnLINWMqbKLQRH/zJRnMBT+AZVgLlseL1+Xt76s8ZLO+4hq9mIzDsFpLD+B8EOD8cBMx9XlECxWJ0mM/C6aG0Oic/a5HxAS0Oj2K2iXzlTqrBlhL8fM6TmAYWjuOZPxnOKnCQCtfyPxot7mwilYJY= 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=1725054506; 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=FMMyV/u+IcJlzna8xPedLWbpzcFdbye2wRnqCcAWCr4=; b=Q9ecpxi+qWrHVcOUKwjYqwtCFh7Q4MQWgNZ2569OoDPGnO24NUa3yN2MWX7hktiJ RF1atkVKx107UYLFz36EdEebw7DZdb148q24qP/aamrV1AoNJw9q61mnv56N3FBixyw aS8IEBLtWN/3JHJmU8D1NLRTKBbxp4+cZUbLckPQ= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 41/44] x86/boot: add struct domain to struct boot_domain Date: Fri, 30 Aug 2024 17:47:26 -0400 Message-Id: <20240830214730.1621-42-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054792082116600 Content-Type: text/plain; charset="utf-8" Store a reference to the created domain in struct boot_domain. Signed-off-by: Daniel P. Smith --- xen/arch/x86/include/asm/bootdomain.h | 3 +++ xen/arch/x86/setup.c | 15 +++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/include/asm/bootdomain.h b/xen/arch/x86/include/a= sm/bootdomain.h index 00f7d9267965..2322c459e36a 100644 --- a/xen/arch/x86/include/asm/bootdomain.h +++ b/xen/arch/x86/include/asm/bootdomain.h @@ -10,6 +10,7 @@ =20 #include =20 +struct domain; struct boot_module; =20 struct boot_domain { @@ -19,6 +20,8 @@ struct boot_domain { =20 struct boot_module *kernel; struct boot_module *ramdisk; + + struct domain *d; }; =20 #endif diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 2c1aa1475c4e..872d51310628 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -963,7 +963,6 @@ static struct domain *__init create_dom0(const struct b= oot_info *bi) }, }; struct boot_domain *bd =3D &bi->domains[0]; - struct domain *d; =20 if ( opt_dom0_pvh ) { @@ -980,13 +979,13 @@ static struct domain *__init create_dom0(const struct= boot_info *bi) =20 /* Create initial domain. Not d0 for pvshim. */ bd->domid =3D get_initial_domain_id(); - d =3D domain_create(bd->domid, &dom0_cfg, pv_shim ? 0 : CDF_privileged= ); - if ( IS_ERR(d) ) - panic("Error creating d%u: %ld\n", bd->domid, PTR_ERR(d)); + bd->d =3D domain_create(bd->domid, &dom0_cfg, pv_shim ? 0 : CDF_privil= eged); + if ( IS_ERR(bd->d) ) + panic("Error creating d%u: %ld\n", bd->domid, PTR_ERR(bd->d)); =20 - init_dom0_cpuid_policy(d); + init_dom0_cpuid_policy(bd->d); =20 - if ( alloc_dom0_vcpu0(d) =3D=3D NULL ) + if ( alloc_dom0_vcpu0(bd->d) =3D=3D NULL ) panic("Error creating d%uv0\n", bd->domid); =20 /* Grab the DOM0 command line. */ @@ -1029,7 +1028,7 @@ static struct domain *__init create_dom0(const struct= boot_info *bi) write_cr4(read_cr4() & ~X86_CR4_SMAP); } =20 - if ( construct_dom0(d, bd->kernel, bd->ramdisk, bd->cmdline) !=3D 0 ) + if ( construct_dom0(bd->d, bd->kernel, bd->ramdisk, bd->cmdline) !=3D = 0 ) panic("Could not construct domain 0\n"); =20 if ( cpu_has_smap ) @@ -1038,7 +1037,7 @@ static struct domain *__init create_dom0(const struct= boot_info *bi) cr4_pv32_mask |=3D X86_CR4_SMAP; } =20 - return d; + return bd->d; } =20 /* How much of the directmap is prebuilt at compile time. */ --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054802; cv=pass; d=zohomail.com; s=zohoarc; b=difQeg/DKVCGmw5o8Yu9vsZDDRKrhWeXMfjMoGtxGaNv/n6L64BwawlR2gc6ISyGn3EkO53ZV/bnwgBH24Uv7ZxkRETreTC8u5e2OfYcl6mY+FKMurwCKVAp9VOgJwKWTCNzwxsAZwJImPhRMv4sVPsTVfTotYC0moV7PJcN17g= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054802; 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=CRDjJu35KX6V+P191+8yBK+MBAuPjEumeiizl3mdu7o=; b=KRs+wRRaeiJeyTCzgOqywZANSswIQxrDALEYBT4UXsOofOKZyzbVEhjOykVaD2ecuqNaNxHI70HJKHMbWXsRUWjPMPN27IGVtA/2CVoihNarGcMfW19YZilt295tKl/D+LqWuqLnVPBMscOXgBJUeCLe439yUdP/3JeA7B7wlK4= 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 1725054802689837.9258027141466; Fri, 30 Aug 2024 14:53:22 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786728.1196445 (Exim 4.92) (envelope-from ) id 1sk9YJ-0006hW-V2; Fri, 30 Aug 2024 21:53:07 +0000 Received: by outflank-mailman (output) from mailman id 786728.1196445; Fri, 30 Aug 2024 21:53:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9YJ-0006hP-PX; Fri, 30 Aug 2024 21:53:07 +0000 Received: by outflank-mailman (input) for mailman id 786728; Fri, 30 Aug 2024 21:53:07 +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 1sk9YJ-0005aM-6M for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:53:07 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 3bea8550-671a-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:53:06 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054506125987.9398819733996; Fri, 30 Aug 2024 14:48:26 -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: 3bea8550-671a-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054508; cv=none; d=zohomail.com; s=zohoarc; b=O8TRKyhf8CV/yw/RfoC5zy4TtPHUtc8LB3MP+K0p/PkWrMwUrePhHVrH/IYTbujWy/+m9lNOYC2n4/z6q7hCrRRhGXwu+BKcqcNBhLaWde10CTgCPniDi3loDLtduY+9kQql5mWtMSJcIxlRLcy+0acfMIlTuUhMcSJ5VXdAxV8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054508; 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=CRDjJu35KX6V+P191+8yBK+MBAuPjEumeiizl3mdu7o=; b=QFYXEIHnY1ez+yY/vX+3OTTkR5DKVe46LUbPe3xcjyUNthHTXSHNz2Ju3vkekhvFklCLoPF5ddBV2qjUNbH5ft3SjBqNGrkHsLgYHPQg4LL+vMkxTP4ZILXAryhlO6sVW3Pq9vEl7WXnO5EGHpf0D/CQTzUYxNAqPUG6hcRxUlg= 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=1725054508; 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=CRDjJu35KX6V+P191+8yBK+MBAuPjEumeiizl3mdu7o=; b=ANHjI/3uMXWw5dgDKD0wrBI5ouad1BHyIwR0ocGzQEwsaFGPxDaGuD2RSj6M/1F7 g60NIYcLWlnbJTPhI+rQY9lSEiOj5B3oVZLOsdkdCkXdpfwkco3nrhMaEyc68WKQtBg 6herQMuzvN2pR68iFQTvhNMKqtQQ4w6Wmkzkoop8= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 42/44] x86/boot: convert construct_dom0 to struct boot_domain Date: Fri, 30 Aug 2024 17:47:27 -0400 Message-Id: <20240830214730.1621-43-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054804128116600 Content-Type: text/plain; charset="utf-8" A struct boot_domain now encapsulates the domain reference, kernel, ramdisk, and command line for the domain being constructed. As a result of this encapsulation, construct_dom0 can now take a single struct boot_domain inst= ead of these four parameters. Signed-off-by: Daniel P. Smith --- xen/arch/x86/dom0_build.c | 19 +++++++++---------- xen/arch/x86/include/asm/setup.h | 4 +--- xen/arch/x86/setup.c | 2 +- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index 71b2e3afc1a1..e552f2e9abef 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -597,22 +597,21 @@ int __init dom0_setup_permissions(struct domain *d) return rc; } =20 -int __init construct_dom0(struct domain *d, const struct boot_module *imag= e, - struct boot_module *initrd, const char *cmdline) +int __init construct_dom0(struct boot_domain *bd) { int rc; =20 /* Sanity! */ - BUG_ON(!pv_shim && d->domain_id !=3D 0); - BUG_ON(d->vcpu[0] =3D=3D NULL); - BUG_ON(d->vcpu[0]->is_initialised); + BUG_ON(!pv_shim && bd->d->domain_id !=3D 0); + BUG_ON(bd->d->vcpu[0] =3D=3D NULL); + BUG_ON(bd->d->vcpu[0]->is_initialised); =20 process_pending_softirqs(); =20 - if ( is_hvm_domain(d) ) - rc =3D dom0_construct_pvh(d, image, initrd, cmdline); - else if ( is_pv_domain(d) ) - rc =3D dom0_construct_pv(d, image, initrd, cmdline); + if ( is_hvm_domain(bd->d) ) + rc =3D dom0_construct_pvh(bd->d, bd->kernel, bd->ramdisk, bd->cmdl= ine); + else if ( is_pv_domain(bd->d) ) + rc =3D dom0_construct_pv(bd->d, bd->kernel, bd->ramdisk, bd->cmdli= ne); else panic("Cannot construct Dom0. No guest interface available\n"); =20 @@ -620,7 +619,7 @@ int __init construct_dom0(struct domain *d, const struc= t boot_module *image, return rc; =20 /* Sanity! */ - BUG_ON(!d->vcpu[0]->is_initialised); + BUG_ON(!bd->d->vcpu[0]->is_initialised); =20 return 0; } diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/se= tup.h index 19e2ad95b523..8f54b429b954 100644 --- a/xen/arch/x86/include/asm/setup.h +++ b/xen/arch/x86/include/asm/setup.h @@ -26,9 +26,7 @@ void subarch_init_memory(void); =20 void init_IRQ(void); =20 -int construct_dom0( - struct domain *d, const struct boot_module *image, - struct boot_module *initrd, const char *cmdline); +int construct_dom0(struct boot_domain *d); void setup_io_bitmap(struct domain *d); =20 unsigned long initial_images_nrpages(nodeid_t node); diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 872d51310628..5d48ebea51d5 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1028,7 +1028,7 @@ static struct domain *__init create_dom0(const struct= boot_info *bi) write_cr4(read_cr4() & ~X86_CR4_SMAP); } =20 - if ( construct_dom0(bd->d, bd->kernel, bd->ramdisk, bd->cmdline) !=3D = 0 ) + if ( construct_dom0(bd) !=3D 0 ) panic("Could not construct domain 0\n"); =20 if ( cpu_has_smap ) --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054805; cv=pass; d=zohomail.com; s=zohoarc; b=XQe7QypGUgaIOBm8t8ZrHDyE9k8wjRPH9cy5qVrNsFn92UXQRgEFJoqUL+s/m8/rgTmj4REX4igT036ihgf5VAmnJJK5PYmA8vG3bCemr2anF16DJTo/mQ5jMYLaGo6hy3KzOf6IAy7GEr4DczIBt6I7EhLZk6BnaxB1KZSPo14= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054805; 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=om7y5y0WMnQkQrCTabtNb0cenhPENJfwq9EcVkz9EkM=; b=aj904byqNoqpUwUjygL0uZ3OE5DDpty+IavH/cbVIZPuaxez24LaOjptWmGvmwHKCokkrIYuSTKpyZ9G9NHJVxcrqfTi6fyrL64c9HS3KGFHKEG3RRsv/HpLVuQl5rX7BDsicwB+ZsJSiZODI5MTDlblNVYa/3ng+TfEaSpwFCk= 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 1725054805140758.3440289846761; Fri, 30 Aug 2024 14:53:25 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786734.1196454 (Exim 4.92) (envelope-from ) id 1sk9YR-0007EF-5H; Fri, 30 Aug 2024 21:53:15 +0000 Received: by outflank-mailman (output) from mailman id 786734.1196454; Fri, 30 Aug 2024 21:53:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9YR-0007E6-1n; Fri, 30 Aug 2024 21:53:15 +0000 Received: by outflank-mailman (input) for mailman id 786734; Fri, 30 Aug 2024 21:53:14 +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 1sk9YQ-0005aM-5r for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:53:14 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 402f402e-671a-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:53:13 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054507201417.3403256954641; Fri, 30 Aug 2024 14:48:27 -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: 402f402e-671a-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054509; cv=none; d=zohomail.com; s=zohoarc; b=nYIvBOw7bKH/+LTjSG8e20u+CSkjctNMf9HleaCaqR6l2qNThdczixIpcUgA/XfkJ3GuEIAyCqdi/KODOQZ3aIe1jS7/FbKRIADjLdNH49Nwo8ezRIaEWLjsl69pmVsLeMI1tUmLLe6TxVDYuRZip3cihISNHkQa24UAeMX5c70= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054509; 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=om7y5y0WMnQkQrCTabtNb0cenhPENJfwq9EcVkz9EkM=; b=koMQ8ITrLNawDlvka1CS5H4GERurOgdHGfKt0qJCmkR2uBoC7e3Z2Nz5T6K3EDgbQN9BgSQHJOhidJGM0+OyNVthBIGnBwywVUwe7dbkY968H0NIUAOMPy2aYxAOm3b4braEt//Ea2R7n/+E9qpfDbQ9Msq01o+xC+XrlkujOvA= 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=1725054509; 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=om7y5y0WMnQkQrCTabtNb0cenhPENJfwq9EcVkz9EkM=; b=rUJdJuo9pANssvynRbE4/1h9ESWuAPhuE46FQPQzjN5tiwXjHgUalWu0LOgaWODW uqtZfApEHBqMIl5ceBXVbDGLCiCR5IixqUYLZEwmy3/CEyQ2XOjeMHmmGaYEpJ5DlOO qZ178oei70C03G1GS86eIboiIHi/YUAmtWDs5L+s= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 43/44] x86/boot: convert dom0_construct_pv to struct boot_domain Date: Fri, 30 Aug 2024 17:47:28 -0400 Message-Id: <20240830214730.1621-44-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054806175116600 Content-Type: text/plain; charset="utf-8" With construct_dom0 consuming struct boot_domain, continue passing the structure down to dom0_construct_pv. Signed-off-by: Daniel P. Smith --- xen/arch/x86/dom0_build.c | 2 +- xen/arch/x86/include/asm/dom0_build.h | 5 ++-- xen/arch/x86/pv/dom0_build.c | 36 +++++++++++++-------------- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index e552f2e9abef..8beb33032940 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -611,7 +611,7 @@ int __init construct_dom0(struct boot_domain *bd) if ( is_hvm_domain(bd->d) ) rc =3D dom0_construct_pvh(bd->d, bd->kernel, bd->ramdisk, bd->cmdl= ine); else if ( is_pv_domain(bd->d) ) - rc =3D dom0_construct_pv(bd->d, bd->kernel, bd->ramdisk, bd->cmdli= ne); + rc =3D dom0_construct_pv(bd); else panic("Cannot construct Dom0. No guest interface available\n"); =20 diff --git a/xen/arch/x86/include/asm/dom0_build.h b/xen/arch/x86/include/a= sm/dom0_build.h index 8f7b37f3d308..60e9cb21f14d 100644 --- a/xen/arch/x86/include/asm/dom0_build.h +++ b/xen/arch/x86/include/asm/dom0_build.h @@ -4,6 +4,7 @@ #include #include =20 +#include #include =20 extern unsigned int dom0_memflags; @@ -13,9 +14,7 @@ unsigned long dom0_compute_nr_pages(struct domain *d, unsigned long initrd_len); int dom0_setup_permissions(struct domain *d); =20 -int dom0_construct_pv( - struct domain *d, const struct boot_module *image, - struct boot_module *initrd, const char *cmdline); +int dom0_construct_pv(struct boot_domain *bd); =20 int dom0_construct_pvh( struct domain *d, const struct boot_module *image, diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c index a403e23b2f93..82dc0c379f27 100644 --- a/xen/arch/x86/pv/dom0_build.c +++ b/xen/arch/x86/pv/dom0_build.c @@ -354,10 +354,7 @@ static struct page_info * __init alloc_chunk(struct do= main *d, return page; } =20 -int __init dom0_construct_pv(struct domain *d, - const struct boot_module *image, - struct boot_module *initrd, - const char *cmdline) +int __init dom0_construct_pv(struct boot_domain *bd) { int i, rc, order, machine; bool compatible, compat; @@ -372,11 +369,12 @@ int __init dom0_construct_pv(struct domain *d, struct page_info *page =3D NULL; unsigned int flush_flags =3D 0; start_info_t *si; - struct vcpu *v =3D d->vcpu[0]; - void *image_base =3D bootstrap_map_bm(image); - unsigned long image_len =3D image->size; - void *image_start =3D image_base + image->headroom; - unsigned long initrd_len =3D initrd ? initrd->size : 0; + struct domain *d =3D bd->d; + struct vcpu *v =3D bd->d->vcpu[0]; + void *image_base =3D bootstrap_map_bm(bd->kernel); + unsigned long image_len =3D bd->kernel->size; + void *image_start =3D image_base + bd->kernel->headroom; + unsigned long initrd_len =3D bd->ramdisk ? bd->ramdisk->size : 0; l4_pgentry_t *l4tab =3D NULL, *l4start =3D NULL; l3_pgentry_t *l3tab =3D NULL, *l3start =3D NULL; l2_pgentry_t *l2tab =3D NULL, *l2start =3D NULL; @@ -612,7 +610,7 @@ int __init dom0_construct_pv(struct domain *d, initrd_pfn =3D vinitrd_start ? (vinitrd_start - v_start) >> PAGE_SHIFT : domain_tot_pages(d); - initrd_mfn =3D mfn =3D initrd->start >> PAGE_SHIFT; + initrd_mfn =3D mfn =3D bd->ramdisk->start >> PAGE_SHIFT; count =3D PFN_UP(initrd_len); if ( d->arch.physaddr_bitsize && ((mfn + count - 1) >> (d->arch.physaddr_bitsize - PAGE_SHIFT)= ) ) @@ -627,13 +625,13 @@ int __init dom0_construct_pv(struct domain *d, free_domheap_pages(page, order); page +=3D 1UL << order; } - memcpy(page_to_virt(page), maddr_to_virt(initrd->start), + memcpy(page_to_virt(page), maddr_to_virt(bd->ramdisk->start), initrd_len); - mpt_alloc =3D initrd->start; + mpt_alloc =3D bd->ramdisk->start; init_domheap_pages(mpt_alloc, mpt_alloc + PAGE_ALIGN(initrd_len)); initrd_mfn =3D mfn_x(page_to_mfn(page)); - initrd->start =3D initrd_mfn << PAGE_SHIFT; + bd->ramdisk->start =3D initrd_mfn << PAGE_SHIFT; } else { @@ -641,7 +639,7 @@ int __init dom0_construct_pv(struct domain *d, if ( assign_pages(mfn_to_page(_mfn(mfn++)), 1, d, 0) ) BUG(); } - initrd->size =3D 0; + bd->ramdisk->size =3D 0; =20 iommu_memory_setup(d, "initrd", mfn_to_page(_mfn(initrd_mfn)), PFN_UP(initrd_len), &flush_flags); @@ -653,9 +651,9 @@ int __init dom0_construct_pv(struct domain *d, if ( domain_tot_pages(d) < nr_pages ) printk(" (%lu pages to be allocated)", nr_pages - domain_tot_pages(d)); - if ( initrd ) + if ( bd->ramdisk ) { - mpt_alloc =3D initrd->start; + mpt_alloc =3D bd->ramdisk->start; printk("\n Init. ramdisk: %"PRIpaddr"->%"PRIpaddr, mpt_alloc, mpt_alloc + initrd_len); } @@ -883,7 +881,7 @@ int __init dom0_construct_pv(struct domain *d, if ( pfn >=3D initrd_pfn ) { if ( pfn < initrd_pfn + PFN_UP(initrd_len) ) - mfn =3D (initrd->start >> PAGE_SHIFT) + (pfn - initrd_pfn); + mfn =3D (bd->ramdisk->start >> PAGE_SHIFT) + (pfn - initrd= _pfn); else mfn -=3D PFN_UP(initrd_len); } @@ -953,8 +951,8 @@ int __init dom0_construct_pv(struct domain *d, } =20 memset(si->cmd_line, 0, sizeof(si->cmd_line)); - if ( cmdline !=3D NULL ) - strlcpy((char *)si->cmd_line, cmdline, sizeof(si->cmd_line)); + if ( bd->cmdline[0] !=3D '\0' ) + strlcpy((char *)si->cmd_line, bd->cmdline, sizeof(si->cmd_line)); =20 #ifdef CONFIG_VIDEO if ( !pv_shim && fill_console_start_info((void *)(si + 1)) ) --=20 2.30.2 From nobody Wed Dec 4 08:19:00 2024 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=1725054815; cv=pass; d=zohomail.com; s=zohoarc; b=CAsIsir1DQO1jxdMgoQiVY5MRQggOkm62krUL3YjQP9O55r0DBCeTsfPni/Ul/qyfvsJDUUS/t8urcd4EGYzzyEPY0XT0Fk+l8Tru33I/Z7+W/3cgSjGmptNm7zLn6bZRxMFIYg+x/C77SsBIHjxOAZneobrcO+uLCe4tM8P50U= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054815; 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=KS82AUYRZGk7W9Pk3CIfd4vp+4qfK/g7l4LYGblZ46w=; b=Nik+aI7ur3z39zXWc0+A4a9UmTOCPwzW3EK8RnfZyre6ybxPyfFVZhlhxLW+6Hu/YoLjRXxOIiGNSo+T1i2I0WuSGR3QtVogGvKuPqhPdbOceRY5aZeJxRslKbQK/o98dVWFGMRdcFpgh1LZxLQdp8XWNKhgaQHjUAREZVJGx7E= 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 1725054815491990.9739655030471; Fri, 30 Aug 2024 14:53:35 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.786736.1196463 (Exim 4.92) (envelope-from ) id 1sk9YY-0007gy-DA; Fri, 30 Aug 2024 21:53:22 +0000 Received: by outflank-mailman (output) from mailman id 786736.1196463; Fri, 30 Aug 2024 21:53:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sk9YY-0007gn-AL; Fri, 30 Aug 2024 21:53:22 +0000 Received: by outflank-mailman (input) for mailman id 786736; Fri, 30 Aug 2024 21:53:20 +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 1sk9YW-0005aM-N4 for xen-devel@lists.xenproject.org; Fri, 30 Aug 2024 21:53:20 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 43f67f7e-671a-11ef-a0b1-8be0dac302b0; Fri, 30 Aug 2024 23:53:19 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1725054508269777.6559146284596; Fri, 30 Aug 2024 14:48:28 -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: 43f67f7e-671a-11ef-a0b1-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1725054510; cv=none; d=zohomail.com; s=zohoarc; b=F8GDSqvtfe8sJGYcYxWphnjze9dEx9bE/zadr8JX5NVSXkAQhinY0XWCWka4Ek15zQDVUuMX6EUN9/HQqtDyfomKjBeGlFQJt4oE+IYPNqDfaT+5ObFh7MRoDtvjARGEA46ihAa31MELBPSzOl3c9TD+/pIzFaD/0tCU1RInw94= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054510; 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=KS82AUYRZGk7W9Pk3CIfd4vp+4qfK/g7l4LYGblZ46w=; b=N0RFq2bGoZ/6Tp7lh2CY6T6WanyroSB87ZR1BvHqh5PcluVV5ZgIiGvWp9jfmAWa35mNXyVLiCLfvk8j4pjZB04YmopVUB1xheHGlcT3YSYmQCzMrvrroytJUd34EEuGbMCHpQapW1ufx22t58AiWWNLg59lHeVj+Y1QBvUm1Mk= 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=1725054510; 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=KS82AUYRZGk7W9Pk3CIfd4vp+4qfK/g7l4LYGblZ46w=; b=ei25+HbYtoU4V9y9fHjO2Jal2Ep9aNv4ViQcn5+wcA9OrxyDi/LplUmi16AjAN+E TNV6bNnFASva7Ak/4eC6BxaCLNRYT8H9wRekpIn2VSSkAwknPVfgtbR1NjY77Ds9dU7 ImpxIBcpsghkPP7WYjwIfj4VTfx9HbbAXiD4sF/Y= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 44/44] x86/boot: convert dom0_construct_pvh to struct boot_domain Date: Fri, 30 Aug 2024 17:47:29 -0400 Message-Id: <20240830214730.1621-45-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240830214730.1621-1-dpsmith@apertussolutions.com> References: <20240830214730.1621-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: 1725054816210116600 Content-Type: text/plain; charset="utf-8" With construct_dom0 consuming struct boot_domain, continue passing the structure down to dom0_construct_pvh. Signed-off-by: Daniel P. Smith --- xen/arch/x86/dom0_build.c | 2 +- xen/arch/x86/hvm/dom0_build.c | 31 +++++++++++++-------------- xen/arch/x86/include/asm/dom0_build.h | 4 +--- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index 8beb33032940..6a21fd46d5a3 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -609,7 +609,7 @@ int __init construct_dom0(struct boot_domain *bd) process_pending_softirqs(); =20 if ( is_hvm_domain(bd->d) ) - rc =3D dom0_construct_pvh(bd->d, bd->kernel, bd->ramdisk, bd->cmdl= ine); + rc =3D dom0_construct_pvh(bd); else if ( is_pv_domain(bd->d) ) rc =3D dom0_construct_pv(bd); else diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c index b359f3d98376..13e17550efa5 100644 --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -1284,25 +1284,23 @@ static void __hwdom_init pvh_setup_mmcfg(struct dom= ain *d) } } =20 -int __init dom0_construct_pvh( - struct domain *d, const struct boot_module *image, - struct boot_module *initrd, const char *cmdline) +int __init dom0_construct_pvh(const struct boot_domain *bd) { paddr_t entry, start_info; int rc; =20 - printk(XENLOG_INFO "*** Building a PVH Dom%d ***\n", d->domain_id); + printk(XENLOG_INFO "*** Building a PVH Dom%d ***\n", bd->domid); =20 - if ( is_hardware_domain(d) ) + if ( is_hardware_domain(bd->d) ) { /* * Setup permissions early so that calls to add MMIO regions to the * p2m as part of vPCI setup don't fail due to permission checks. */ - rc =3D dom0_setup_permissions(d); + rc =3D dom0_setup_permissions(bd->d); if ( rc ) { - printk("%pd unable to setup permissions: %d\n", d, rc); + printk("%pd unable to setup permissions: %d\n", bd->d, rc); return rc; } } @@ -1312,25 +1310,26 @@ int __init dom0_construct_pvh( * initialization so the iommu code can fetch the MMCFG regions used b= y the * domain. */ - pvh_setup_mmcfg(d); + pvh_setup_mmcfg(bd->d); =20 /* * Craft dom0 physical memory map and set the paging allocation. This = must * be done before the iommu initializion, since iommu initialization c= ode * will likely add mappings required by devices to the p2m (ie: RMRRs). */ - pvh_init_p2m(d); + pvh_init_p2m(bd->d); =20 - iommu_hwdom_init(d); + iommu_hwdom_init(bd->d); =20 - rc =3D pvh_populate_p2m(d); + rc =3D pvh_populate_p2m(bd->d); if ( rc ) { printk("Failed to setup Dom0 physical memory map\n"); return rc; } =20 - rc =3D pvh_load_kernel(d, image, initrd, bootstrap_map_bm(image), cmdl= ine, + rc =3D pvh_load_kernel(bd->d, bd->kernel, bd->ramdisk, + bootstrap_map_bm(bd->kernel), bd->cmdline, &entry, &start_info); if ( rc ) { @@ -1338,14 +1337,14 @@ int __init dom0_construct_pvh( return rc; } =20 - rc =3D pvh_setup_cpus(d, entry, start_info); + rc =3D pvh_setup_cpus(bd->d, entry, start_info); if ( rc ) { printk("Failed to setup Dom0 CPUs: %d\n", rc); return rc; } =20 - rc =3D pvh_setup_acpi(d, start_info); + rc =3D pvh_setup_acpi(bd->d, start_info); if ( rc ) { printk("Failed to setup Dom0 ACPI tables: %d\n", rc); @@ -1354,8 +1353,8 @@ int __init dom0_construct_pvh( =20 if ( opt_dom0_verbose ) { - printk("Dom%u memory map:\n", d->domain_id); - print_e820_memory_map(d->arch.e820, d->arch.nr_e820); + printk("Dom%u memory map:\n", bd->domid); + print_e820_memory_map(bd->d->arch.e820, bd->d->arch.nr_e820); } =20 return 0; diff --git a/xen/arch/x86/include/asm/dom0_build.h b/xen/arch/x86/include/a= sm/dom0_build.h index 60e9cb21f14d..adbe90bfd034 100644 --- a/xen/arch/x86/include/asm/dom0_build.h +++ b/xen/arch/x86/include/asm/dom0_build.h @@ -16,9 +16,7 @@ int dom0_setup_permissions(struct domain *d); =20 int dom0_construct_pv(struct boot_domain *bd); =20 -int dom0_construct_pvh( - struct domain *d, const struct boot_module *image, - struct boot_module *initrd, const char *cmdline); +int dom0_construct_pvh(const struct boot_domain *bd); =20 unsigned long dom0_paging_pages(const struct domain *d, unsigned long nr_pages); --=20 2.30.2