From nobody Thu Nov 21 21:35:13 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=1729184653; cv=pass; d=zohomail.com; s=zohoarc; b=lm5p0zho8MRtxaKSHKEOfxRMn59UNEoAFJ/DuEzugwMTKwDjm2+cVuiQqdxo404t3xQKNupVTUsC3/4Ad8eTlOrKz40RpUf9e6Dh+G1x+VOacGuJ0GhXfDviQQJmTa8L+rTMOOgBB7a6M+iE2nXOPsIq1B++fw2fgd6pBE/Y6DU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184653; 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=/GTvBBrsBVsR7hgeazYsrIdIraxYMSG35yaHz9LsVpk=; b=X2EkcfjMm6b0Bjvenpcv8MzidC1YmI9AiuS15rj29PuRdkNGULPqqqYFDT8bFdPa+z6RRkWlOFl8uvgHHhgbQqRN3BC046AbSie4uoiNDzAFQ/ZGfsyhT2DPWDeS9Eenvz15zxPJML6wRH47XHdRZcL20zsTQWtY8mBXEDIjLFo= 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 1729184653465128.8363830052424; Thu, 17 Oct 2024 10:04:13 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820830.1234459 (Exim 4.92) (envelope-from ) id 1t1Tuf-000700-Ts; Thu, 17 Oct 2024 17:03:49 +0000 Received: by outflank-mailman (output) from mailman id 820830.1234459; Thu, 17 Oct 2024 17:03:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t1Tuf-0006zr-QP; Thu, 17 Oct 2024 17:03:49 +0000 Received: by outflank-mailman (input) for mailman id 820830; Thu, 17 Oct 2024 17:03:48 +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 1t1Tue-0006TN-KO for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:03:48 +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 c4ed82b6-8ca9-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:03:46 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 172918461568161.967850809187325; Thu, 17 Oct 2024 10:03:35 -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: c4ed82b6-8ca9-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184617; cv=none; d=zohomail.com; s=zohoarc; b=V7DmMI0IyY1SvQ+dFhr99YoBFyumoEMS2iLrzrNhtS3FHIr0cEuASvy2ks3PKgeWt3NXJom3SFZl0bqUhN98Bj+kinurVkzaS5vw5JrsQF1TydMtBoGsABfPFxGNyNn/zFnszV+lW+h6AiWL2JfPELUzCo7/MU8E3NtIkL7+dOU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184617; 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=/GTvBBrsBVsR7hgeazYsrIdIraxYMSG35yaHz9LsVpk=; b=LyzdqAvv1fvhdMI7fB2kuoJZwF59XEDEI6wtjnhlH7TNhiSQqv0jUmfDQlZJiYN+MNsNg6svWGtQkJsSzBpNgbceClQTJl6Oz04PmJLjrmq6YdV1Hq5fHOeb1uwznZ0wS+83EGXnM+MKs1lxQ/cze4QjeIoOHNzEmHL+PtQb0eY= 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=1729184617; 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=/GTvBBrsBVsR7hgeazYsrIdIraxYMSG35yaHz9LsVpk=; b=a5WpW5m87PCRe8fcXRRPRUAcmDl4s0/AfLgGUIgwdMgY8X5sBxuPWqp1ZSmYVNLr 7z5BxbPhGX7cJ0bvMdEn8d0cix3bAHFutEAepwmxWBy5i1IZZOpDseAroEGK1O1TMtT iKQ/QbSl0mZFdj7W0iAi7lRR+jUCmWtD657JeSqE= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: Christopher Clark , jason.andryuk@amd.com, stefano.stabellini@amd.com, "Daniel P . Smith" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 01/44] x86/boot: move x86 boot module counting into a new boot_info struct Date: Thu, 17 Oct 2024 13:02:41 -0400 Message-Id: <20241017170325.3842-2-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729184731670116600 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_i= nfo 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 Reviewed-by: Jason Andryuk --- Changes since v5: - moved __init from being in middle of type declaration --- xen/arch/x86/include/asm/bootinfo.h | 29 +++++++++++++ xen/arch/x86/include/asm/setup.h | 2 + xen/arch/x86/setup.c | 64 ++++++++++++++++++----------- 3 files changed, 71 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..a649500ee3a2 --- /dev/null +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -0,0 +1,29 @@ +/* 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__ + +/* + * Xen internal representation of information provided by the + * bootloader/environment, or derived from the information. + */ +struct boot_info { + unsigned int nr_modules; +}; + +#endif /* __XEN_X86_BOOTINFO_H__ */ + +/* + * 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/setup.h b/xen/arch/x86/include/asm/se= tup.h index d75589178b91..3d189521189d 100644 --- a/xen/arch/x86/include/asm/setup.h +++ b/xen/arch/x86/include/asm/setup.h @@ -32,6 +32,8 @@ int construct_dom0( const char *cmdline); void setup_io_bitmap(struct domain *d); =20 +extern struct boot_info xen_boot_info; + unsigned long initial_images_nrpages(nodeid_t node); void discard_initial_images(void); void *bootstrap_map(const module_t *mod); diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index a6e77c9ed9fc..6201ca0fad19 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -32,6 +32,7 @@ #include #endif #include +#include #include #include #include @@ -274,16 +275,28 @@ static int __init cf_check parse_acpi_param(const cha= r *s) custom_param("acpi", parse_acpi_param); =20 static const module_t *__initdata initial_images; -static unsigned int __initdata nr_initial_images; + +struct boot_info __initdata xen_boot_info; + +static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi= _p) +{ + struct boot_info *bi =3D &xen_boot_info; + const multiboot_info_t *mbi =3D __va(mbi_p); + + bi->nr_modules =3D (mbi->flags & MBI_MODULES) ? mbi->mods_count : 0; + + return bi; +} =20 unsigned long __init initial_images_nrpages(nodeid_t node) { + struct boot_info *bi =3D &xen_boot_info; unsigned long node_start =3D node_start_pfn(node); unsigned long node_end =3D node_end_pfn(node); 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 < bi->nr_modules; ++i ) { unsigned long start =3D initial_images[i].mod_start; unsigned long end =3D start + PFN_UP(initial_images[i].mod_end); @@ -297,9 +310,10 @@ unsigned long __init initial_images_nrpages(nodeid_t n= ode) =20 void __init discard_initial_images(void) { + struct boot_info *bi =3D &xen_boot_info; unsigned int i; =20 - for ( i =3D 0; i < nr_initial_images; ++i ) + for ( i =3D 0; i < bi->nr_modules; ++i ) { uint64_t start =3D (uint64_t)initial_images[i].mod_start << PAGE_S= HIFT; =20 @@ -307,7 +321,7 @@ void __init discard_initial_images(void) start + PAGE_ALIGN(initial_images[i].mod_end)); } =20 - nr_initial_images =3D 0; + bi->nr_modules =3D 0; initial_images =3D NULL; } =20 @@ -969,6 +983,7 @@ void asmlinkage __init noreturn __start_xen(unsigned lo= ng mbi_p) void *bsp_stack; struct cpu_info *info =3D get_cpu_info(), *bsp_info; unsigned int initrdidx, num_parked =3D 0; + struct boot_info *bi; multiboot_info_t *mbi; module_t *mod; unsigned long nr_pages, raw_max_page, modules_headroom, module_map[1]; @@ -1015,6 +1030,8 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) mod =3D __va(mbi->mods_addr); } =20 + bi =3D multiboot_fill_boot_info(mbi_p); + loader =3D (mbi->flags & MBI_LOADERNAME) ? __va(mbi->boot_loader_name) : "unknown"; =20 @@ -1122,18 +1139,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 ( !bi->nr_modules ) 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 ( bi->nr_modules > sizeof(module_map) * 8 ) { - mbi->mods_count =3D sizeof(module_map) * 8; - printk("Excessive multiboot modules - using the first %u only\n", - mbi->mods_count); + bi->nr_modules =3D sizeof(module_map) * 8; + printk("Excessive boot modules - using the first %u only\n", + bi->nr_modules); } =20 - bitmap_fill(module_map, mbi->mods_count); + bitmap_fill(module_map, bi->nr_modules); __clear_bit(0, module_map); /* Dom0 kernel is always first */ =20 if ( pvh_boot ) @@ -1306,9 +1323,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 < bi->nr_modules; i++ ) { if ( mod[i].mod_start & (PAGE_SIZE - 1) ) panic("Bootloader didn't honor module alignment request\n"); @@ -1332,8 +1348,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[bi->nr_modules].mod_start =3D virt_to_mfn(_stext); + mod[bi->nr_modules].mod_end =3D __2M_rwdata_end - _stext; } =20 modules_headroom =3D bzimage_headroom(bootstrap_map(mod), mod->mod_end= ); @@ -1393,7 +1409,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, bi->nr_modules, -1); end &=3D ~mask; } else @@ -1414,7 +1430,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 bi->nr_modules - 1; j >=3D 0; j-- ) { /* * 'headroom' is a guess for the decompressed size and @@ -1429,7 +1445,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); + bi->nr_modules + relocated, j); =20 if ( highmem_start && end > highmem_start ) continue; @@ -1456,7 +1472,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); + bi->nr_modules + relocated, -1); if ( s >=3D e ) break; if ( e > kexec_crash_area_limit ) @@ -1471,7 +1487,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 < bi->nr_modules; ++i ) { uint64_t s =3D (uint64_t)mod[i].mod_start << PAGE_SHIFT; =20 @@ -1551,7 +1567,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 < bi->nr_modules; ++j ) { uint64_t end =3D pfn_to_paddr(mod[j].mod_start) + mod[j].mod_end; @@ -1626,7 +1642,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 < bi->nr_modules; ++i ) { set_pdx_range(mod[i].mod_start, mod[i].mod_start + PFN_UP(mod[i].mod_end)); @@ -2011,8 +2027,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, bi->nr_modules); + if ( bitmap_weight(module_map, bi->nr_modules) > 1 ) printk(XENLOG_WARNING "Multiple initrd candidates, picking module #%u\n", initrdidx); @@ -2022,7 +2038,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 < bi->nr_modules ? mod + initrdidx : NULL, kextra, loader); if ( !dom0 ) panic("Could not set up DOM0 guest OS\n"); --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729184660; cv=pass; d=zohomail.com; s=zohoarc; b=CBEXCigIvpipBPi2+Odz/XqpKIsAX7GVKpCl5xZApFewk55Q+owpIRf6fWLvytI5MMb95/hH/GNMYMJcW8vt4wmkG2JgqF1RuvzOfnbf+xvWGd+2vHHOW+6NqhLfcD2XkWY+eNCLWJ/Xeo8zT6qq57S6U8dBt2SiY/M2FG2MLsI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184660; 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=ioXQiGftZuaa2y3+MlFiiL8tR31atQ3yfwKB0el8GZ8=; b=md+8zK3KyL6WBSxckmwOyfZJkaWy8N/z1EpEKORnEqETi92oCUn3hqKDfpMElnhoDbhti9HJsvRQH2pORplST/4+ut8zyqKWDuwl8rU7vUbw8SUI/ts6g1GVUcGIUf9SuRmL8zD4JgyYZ7bp3pJJT4Rptj3A/PLJ9PoexUwL6UY= 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 1729184659992222.36054572889168; Thu, 17 Oct 2024 10:04:19 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820832.1234469 (Exim 4.92) (envelope-from ) id 1t1Tup-0007Om-5j; Thu, 17 Oct 2024 17:03:59 +0000 Received: by outflank-mailman (output) from mailman id 820832.1234469; Thu, 17 Oct 2024 17:03: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 1t1Tup-0007Of-1f; Thu, 17 Oct 2024 17:03:59 +0000 Received: by outflank-mailman (input) for mailman id 820832; Thu, 17 Oct 2024 17:03:57 +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 1t1Tun-0006TN-0H for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:03:57 +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 c9f0b45f-8ca9-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:03:55 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184617025693.5091672796183; Thu, 17 Oct 2024 10:03:37 -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: c9f0b45f-8ca9-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184619; cv=none; d=zohomail.com; s=zohoarc; b=Gmtj6AN39W5taH+ZtDAgTM9cSAB3DsnuX0gmnoywqsFxdXHlLJ5cJsU3GtKhgZ3rc3wK+WFzOblQXuIHhbGRJnCQEIKhvTV49Nareno5T4bncVyOiOS67dDZX66glaBvQ3/pcTgT2FRFRr4XvRH4Smo61hPApzcAG5jE4V9jIs8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184619; 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=ioXQiGftZuaa2y3+MlFiiL8tR31atQ3yfwKB0el8GZ8=; b=VaJcEyEJjFdnj/N4MA3zPIYriY3qvUdSJQRZxarLxrJx4T1H5Uroq8obavFfiXf5maVkuwqQQ7IsVEogrxsB3zFwfZfMuV1VeTackddCBjmxxcbmOi4tyVzV12kBR+caetQJ5i7YxuBRZm47HenEJ4iio1AZ7Ng2vbIDRZ8k44Q= 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=1729184619; 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=ioXQiGftZuaa2y3+MlFiiL8tR31atQ3yfwKB0el8GZ8=; b=YGE1uQkAKaI6cNbuiw4DONdSlNhrnrPRcDhutefcGVvqF/us9MxGP8PD2Xerv1V4 /eZCmxBWPa2Hi9Fv8+BqxxHtszqNRxDe9xeFfSBeiQUXa1aOhvKAeqWWd6TfUy753mw iKQrqN1W9yqhMz8KKCXKzMZpvTZ2FHTrwjHreD+c= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 02/44] x86/boot: move boot loader name to boot info Date: Thu, 17 Oct 2024 13:02:42 -0400 Message-Id: <20241017170325.3842-3-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729184742273116600 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 Reviewed-by: Jason Andryuk --- Changes since v5: - reorder struct boot_module fields - code style changes --- xen/arch/x86/include/asm/bootinfo.h | 2 ++ xen/arch/x86/setup.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index a649500ee3a2..bec35e7c2f23 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -13,6 +13,8 @@ * bootloader/environment, or derived from the information. */ struct boot_info { + const char *loader; + unsigned int nr_modules; }; =20 diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 6201ca0fad19..eac0954f42b8 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -285,6 +285,9 @@ static struct boot_info *__init multiboot_fill_boot_inf= o(unsigned long mbi_p) =20 bi->nr_modules =3D (mbi->flags & MBI_MODULES) ? mbi->mods_count : 0; =20 + bi->loader =3D (mbi->flags & MBI_LOADERNAME) ? __va(mbi->boot_loader_n= ame) + : "unknown"; + return bi; } =20 @@ -978,7 +981,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; @@ -1032,12 +1035,9 @@ void asmlinkage __init noreturn __start_xen(unsigned= long mbi_p) =20 bi =3D multiboot_fill_boot_info(mbi_p); =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), bi->loader); =20 if ( (kextra =3D strstr(cmdline, " -- ")) !=3D NULL ) { @@ -1078,7 +1078,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", bi->loader); =20 printk("Command line: %s\n", cmdline); =20 @@ -1171,7 +1171,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 bi->loader; } else if ( efi_enabled(EFI_BOOT) ) memmap_type =3D "EFI"; @@ -2039,7 +2039,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) */ dom0 =3D create_dom0(mod, modules_headroom, initrdidx < bi->nr_modules ? mod + initrdidx : NULL, - kextra, loader); + kextra, bi->loader); if ( !dom0 ) panic("Could not set up DOM0 guest OS\n"); =20 --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729184924; cv=pass; d=zohomail.com; s=zohoarc; b=IZNFCCVvTCXirRkYo8YjYZlXs01Hc0zBsco4TxIpUvcaC8E34cU56qcG1g95NADkpI0FdL4boqxxEdf4NIdwFE4iHlvqPGzxdDGUUZEXnpMf+QBH9HLKRh4GAbyc1UgRPHnxpAs8qZ8AJZti0bgSsLlvbE7SUGnWX95R/Sw0p1M= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184924; 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=Dr1jKzgUHAaiQbYekBVD6PQo4dQeZnEBKNdNITplfLE=; b=jocsKjQpTjXJhXm5Kdpq2BWbVYinChbEaxd8GzIAvCGS7eJ1aer55kwK4Sy4iKb62GYQBuoZtuswT6SbFijmBiTT6B5vmkuExYXPkhyCQPJu+3D6JxAO2jln6LXUb9sEqZid5IYyK+rjqJKc2ryN8bMWn44Pibqv35rMcVeu3JE= 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 1729184924458327.46248798836325; Thu, 17 Oct 2024 10:08:44 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820894.1234599 (Exim 4.92) (envelope-from ) id 1t1Tyz-00070D-NG; Thu, 17 Oct 2024 17:08:17 +0000 Received: by outflank-mailman (output) from mailman id 820894.1234599; Thu, 17 Oct 2024 17:08: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 1t1Tyz-0006zY-JL; Thu, 17 Oct 2024 17:08:17 +0000 Received: by outflank-mailman (input) for mailman id 820894; Thu, 17 Oct 2024 17:08: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 1t1Tuv-0006TN-3d for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:04:05 +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 cebfa7dd-8ca9-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:04:03 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184618449299.4483272125001; Thu, 17 Oct 2024 10:03:38 -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: cebfa7dd-8ca9-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184621; cv=none; d=zohomail.com; s=zohoarc; b=Jj69mog7FESSW+fvVP3+RCzMBMmqWmc3v0uPKmHRi8b263x7K6eX/88EhvivAybvDSZJa+Kwk8WgtHtneYbmvzcvenJNbaglQ/syLwxfUkCi3W2iddyWxMHn1+sEsDXlWJUSk0SoyD4hhDJzR/HlBk+1feG0SIXWvd/XQGZDPUE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184621; 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=Dr1jKzgUHAaiQbYekBVD6PQo4dQeZnEBKNdNITplfLE=; b=TZkx8ohR4MO2a4uoshPcehr5lwl0XBEyWwM/xabNwAFb84nam0gObY5GPqStjoLYH/j9lxq21KdeAFDSCWsL2OkbdbuVDCwMf9E39nDkKiGpS93UmXu+6tblwaS4WhuSZg939o5wxD4Xv8W6y/hdsLAQuOfbocr2asoZ4AlAdRU= 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=1729184621; 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=Dr1jKzgUHAaiQbYekBVD6PQo4dQeZnEBKNdNITplfLE=; b=GR6WiaXfoG7f/aZ+nKcXzYLlpEwLqBIDprZYcMvRlxkOu42PG34CwqjDnJScBtBX m7yW0hLY5gPRPTLFjrFfE8nsR/dALcfiMNM7IyHCxtM6k2K8yhPsIhyA1NMENl3QY0S ejNWVze6O2NbaMBbZMtJjPcKYoLU3t22/oaw9PUQ= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 03/44] x86/boot: move cmdline to boot info Date: Thu, 17 Oct 2024 13:02:43 -0400 Message-Id: <20241017170325.3842-4-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729184948669116600 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 --- Changes since v5: - reorder struct boot_module fields --- xen/arch/x86/include/asm/bootinfo.h | 1 + xen/arch/x86/setup.c | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index bec35e7c2f23..efbbd30cc514 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -14,6 +14,7 @@ */ struct boot_info { const char *loader; + const char *cmdline; =20 unsigned int nr_modules; }; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index eac0954f42b8..037cdd17386c 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -274,6 +274,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; =20 struct boot_info __initdata xen_boot_info; @@ -288,6 +290,12 @@ static struct boot_info *__init multiboot_fill_boot_in= fo(unsigned long mbi_p) bi->loader =3D (mbi->flags & MBI_LOADERNAME) ? __va(mbi->boot_loader_n= ame) : "unknown"; =20 + /* Parse the command-line options. */ + if ( mbi->flags & MBI_CMDLINE ) + bi->cmdline =3D cmdline_cook(__va(mbi->cmdline), bi->loader); + else + bi->cmdline =3D ""; + return bi; } =20 @@ -981,7 +989,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; @@ -1035,11 +1043,7 @@ void asmlinkage __init noreturn __start_xen(unsigned= long mbi_p) =20 bi =3D multiboot_fill_boot_info(mbi_p); =20 - /* Parse the command-line options. */ - if ( mbi->flags & MBI_CMDLINE ) - cmdline =3D cmdline_cook(__va(mbi->cmdline), bi->loader); - - if ( (kextra =3D strstr(cmdline, " -- ")) !=3D NULL ) + if ( (kextra =3D strstr(bi->cmdline, " -- ")) !=3D NULL ) { /* * Options after ' -- ' separator belong to dom0. @@ -1050,7 +1054,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(bi->cmdline); =20 /* Must be after command line argument parsing and before * allocing any xenheap structures wanted in lower memory. */ @@ -1080,7 +1084,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) =20 printk("Bootloader: %s\n", bi->loader); =20 - printk("Command line: %s\n", cmdline); + printk("Command line: %s\n", bi->cmdline); =20 printk("Xen image load base address: %#lx\n", xen_phys_start); if ( hypervisor_name ) --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729184895; cv=pass; d=zohomail.com; s=zohoarc; b=KG1bpY+RWyWPkvbAq8Ni51ItlEcwE8myOTP1V8PRfV8xaK0v+M2G7K+sx2pAjl2EFVom2f6L7D7JV6HbEOPhBKi9QXxMSetZMR1Q2t3dXgTB6OtR5B7osW6OE3fd97MBOL3uBhFpr93coFM9UVnWr3RMBN6zaHWUJ+7riPuuAkw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184895; 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=3fsfruenGzMW022TyDqthGbN65HLKdpAAZMOHPTj6cg=; b=MwQDdw86/7Vfzd1fa+cJrTuJUv27FqolpI+XFVXclvSxCyH1rFJYMD8Cu4Gy34DZIYClCJQlxmyStLsD2htSdWVfMGxTaQzGWoXA5XVtl/5Y+ErhXsKXkyhpj8tSG0S9DhNNkMp4aD8DaFOUB/tskPKdMdn6sf7BGPnuNzoi5Xo= 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 1729184895739761.9901340030736; Thu, 17 Oct 2024 10:08:15 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820889.1234589 (Exim 4.92) (envelope-from ) id 1t1Tyd-0005tJ-BW; Thu, 17 Oct 2024 17:07:55 +0000 Received: by outflank-mailman (output) from mailman id 820889.1234589; Thu, 17 Oct 2024 17:07: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 1t1Tyd-0005tC-8L; Thu, 17 Oct 2024 17:07:55 +0000 Received: by outflank-mailman (input) for mailman id 820889; Thu, 17 Oct 2024 17:07: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 1t1Tv4-0006TN-7w for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:04:14 +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 d412f094-8ca9-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:04:12 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184619793164.3023967873388; Thu, 17 Oct 2024 10:03:39 -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: d412f094-8ca9-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184622; cv=none; d=zohomail.com; s=zohoarc; b=cQk1zZ7TwRBci2G9oF6og8rdWMqi3KtNbdnlRxViRtcKnaW9xnnpQ/QW2lVfu8AwXmcFWi74fDK7H0oMV48tBLgP7v8IBm34qYjbivmNZEe6PCTqpNHR63Y5MvMRKyItrPtP2iKenrS+X9wU19nWur/IVZ0u4bP+IB8qenIU2Bo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184622; 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=3fsfruenGzMW022TyDqthGbN65HLKdpAAZMOHPTj6cg=; b=Zay2ybEtCrHNIWi/jHt36aQFMMY3HOPjUeNSYbYWMGpZ0bne9jjuinavfDPcoPaxFsVSnfBhSGJh9Ocicflwz2MXMF5NNth755MzJxJNYKDK3rNgCXe0XWycjc9ZbBuxviryB9RJdVbJQWyycCccELdOqBe5kRcWYfqTw1gvWQE= 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=1729184622; 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=3fsfruenGzMW022TyDqthGbN65HLKdpAAZMOHPTj6cg=; b=p1dnh5wu2HChCm67ww/Dz9smgUzf0jbdB+ZDPt61AWymLWVp7LS1BZa1mdg74Sc1 b0LPdA8UMQRKksuGZ29LmKYpTl0kZ7Gc2TMObaLpDcpqTrIiBpkStXNzaIY/YQmAXNX kyHQ5nMZJhwIoPYk4G6Vf8EACMWJlkxDXUeajnhE= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 04/44] x86/boot: move mmap info to boot info Date: Thu, 17 Oct 2024 13:02:44 -0400 Message-Id: <20241017170325.3842-5-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729184917370116600 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 Reviewed-by: Jason Andryuk --- Changes since v5: - reorder of struct boot_module fields - changed to memmap_length check for memmap detection --- 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 efbbd30cc514..f75a7e72a700 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -8,6 +8,8 @@ #ifndef __XEN_X86_BOOTINFO_H__ #define __XEN_X86_BOOTINFO_H__ =20 +#include + /* * Xen internal representation of information provided by the * bootloader/environment, or derived from the information. @@ -16,6 +18,9 @@ struct boot_info { const char *loader; const char *cmdline; =20 + paddr_t memmap_addr; + size_t memmap_length; + unsigned int nr_modules; }; =20 diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 037cdd17386c..f7ea482920ef 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -296,6 +296,12 @@ static struct boot_info *__init multiboot_fill_boot_in= fo(unsigned long mbi_p) else bi->cmdline =3D ""; =20 + if ( mbi->flags & MBI_MEMMAP ) + { + bi->memmap_addr =3D mbi->mmap_addr; + bi->memmap_length =3D mbi->mmap_length; + } + return bi; } =20 @@ -1185,13 +1191,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 ( bi->memmap_length ) { memmap_type =3D "Multiboot-e820"; - while ( bytes < mbi->mmap_length && + while ( bytes < bi->memmap_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(bi->memmap_addr + bytes); =20 /* * This is a gross workaround for a BIOS bug. Some bootloaders= do --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729184887; cv=pass; d=zohomail.com; s=zohoarc; b=B2kCATsXE7Fo/Jk1GW5/vcB5ao1fgqg65MgxEVmKTqIzfc/vd2X39vPBb3guKtN2+Dl0SS/YymiBhDg/SPxI5NeSNvIiA+nubImXV7YBHJl7Lal1LzN6g4jQOiqlm0ZEYNC/QCu5aKGUClSp7oys8RjyNDFmhiy10rGkJRYhXoI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184887; 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=8Nn0zA/RVfT8SY13G0Olhb8w8UWUndxx4zU/53Bq7j4=; b=gm31eRwrJlbZhts9cEM4PKz8SDJNZUpWKY8aHJToldxSH/AszTO8nUAAfUbzkI3UsjIScmU05d0P5q3/sHtH3Q5qR5YKxmMVFltxEnpCaA8Rg8Z4/NvMKvB6UMVSnVaWJ5u0RTOdBQljIeRbbjgxq07MTXoBWsS+b3P3Q+kGHBA= 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 1729184887773542.666559027482; Thu, 17 Oct 2024 10:08:07 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820885.1234579 (Exim 4.92) (envelope-from ) id 1t1TyU-0005Lz-3K; Thu, 17 Oct 2024 17:07:46 +0000 Received: by outflank-mailman (output) from mailman id 820885.1234579; Thu, 17 Oct 2024 17:07:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t1TyU-0005Ln-0h; Thu, 17 Oct 2024 17:07:46 +0000 Received: by outflank-mailman (input) for mailman id 820885; Thu, 17 Oct 2024 17:07:44 +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 1t1TvD-0006TN-4t for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:04:23 +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 d968c908-8ca9-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:04:21 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184621129703.1852929433529; Thu, 17 Oct 2024 10:03: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: d968c908-8ca9-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184623; cv=none; d=zohomail.com; s=zohoarc; b=SEAYWKE7xL9UY82MEuvzA+0SxasmSBKqYzgwbNc4g+lHlj6PMoU7SXxUHjRtw51ROIuh8WlqoChZK7Jkw2+yZyCzgbK4Be3uYG2+0htFRojgMzbGfK8zMkqf36nsd05QpQ5NAGS4JEfYnFmdT8agqiBBuwpL97B4+gmveO3Ctzs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184623; 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=8Nn0zA/RVfT8SY13G0Olhb8w8UWUndxx4zU/53Bq7j4=; b=g32lLWqhURhiuSQlrlAiS++0ytl8QPj1Bi/OBsolv/ARRyFCfT2Yt1YY8EspgvwyjdBoNhhS+CgqocxCrsqyBkF6XQVKokkNMcViZCPyxkbsbMujR5xEJg2603tX5oaUnYHgQok21ZpmzAXBuBHKMR82XDy7KQbarykCg8+vb3Y= 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=1729184623; 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=8Nn0zA/RVfT8SY13G0Olhb8w8UWUndxx4zU/53Bq7j4=; b=cS8x22pegiJZg6bepZsRpT6NPWts2WLIAgAEFSXUS569tIWPsS28dRaepcjcvri4 cEghTfCdame0vVv/i0DaV477S/SsegqiftYncKJuIwbw1VrEVQ3ANQOzQgthGdyUUfl ZM5sqHkdwS8hfUzy214zQcZuIr6nvSZqM+TCReKg= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 05/44] x86/boot: introduce struct boot_module Date: Thu, 17 Oct 2024 13:02:45 -0400 Message-Id: <20241017170325.3842-6-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729184908003116600 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 `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 Reviewed-by: Jason Andryuk --- Changes since v5: - reword comment --- xen/arch/x86/include/asm/bootinfo.h | 10 ++++++++++ xen/arch/x86/setup.c | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index f75a7e72a700..d19473d8941e 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -8,8 +8,17 @@ #ifndef __XEN_X86_BOOTINFO_H__ #define __XEN_X86_BOOTINFO_H__ =20 +#include #include =20 +/* Max number of boot modules a bootloader can provide in addition to Xen = */ +#define MAX_NR_BOOTMODS 63 + +struct boot_module { + /* Transitionary only */ + module_t *mod; +}; + /* * Xen internal representation of information provided by the * bootloader/environment, or derived from the information. @@ -22,6 +31,7 @@ struct boot_info { size_t memmap_length; =20 unsigned int nr_modules; + struct boot_module mods[MAX_NR_BOOTMODS + 1]; }; =20 #endif /* __XEN_X86_BOOTINFO_H__ */ diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index f7ea482920ef..d8ee5741740a 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -284,6 +284,8 @@ static struct boot_info *__init multiboot_fill_boot_inf= o(unsigned long mbi_p) { struct boot_info *bi =3D &xen_boot_info; const multiboot_info_t *mbi =3D __va(mbi_p); + module_t *mods =3D __va(mbi->mods_addr); + unsigned int i; =20 bi->nr_modules =3D (mbi->flags & MBI_MODULES) ? mbi->mods_count : 0; =20 @@ -302,6 +304,13 @@ static struct boot_info *__init multiboot_fill_boot_in= fo(unsigned long mbi_p) bi->memmap_length =3D mbi->mmap_length; } =20 + /* + * Iterate over all modules, including the extra one which should have= been + * reserved for Xen itself + */ + for ( i =3D 0; i <=3D bi->nr_modules; i++ ) + bi->mods[i].mod =3D &mods[i]; + return bi; } =20 --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729184924; cv=pass; d=zohomail.com; s=zohoarc; b=lISxQAOqPMdCecnbAoZMu9L/4nX+bYpArHlyThY1WWR+tlcW/YCO6PnxJ1rWSJHD1vjHSKF7RqdfXndPnVG3Ia7U4GrL84Inr5duFbXDgiMIrZy8RqAwi36tB9IEFtye3CzmpH61ARrrcEh8YhtngRn/RjxUrA7ARX1+juz8dl0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184924; 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=i/MwelbIDlLsytRqJnx56gOPNpJbq/sBz2YfvwIYl4c=; b=EXkxLNrv1tq5HZYsHGx4n3Jc0wiyHHAx6K72OYlUmE1+xkHikMa4xYCNHns4B03XtRJynHj6pMXb4ulY3kZQiynsBPjSomC9w0sX07GS/Pggq/vgNHWTZ22Je0cCFGMPgzbyDfhz3a5+Y3ruXcFpLiPHggXl52DOfro2pyquako= 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 172918492407887.99967349010785; Thu, 17 Oct 2024 10:08:44 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820895.1234609 (Exim 4.92) (envelope-from ) id 1t1Tz5-0007OE-Tt; Thu, 17 Oct 2024 17:08:23 +0000 Received: by outflank-mailman (output) from mailman id 820895.1234609; Thu, 17 Oct 2024 17:08:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t1Tz5-0007O0-R3; Thu, 17 Oct 2024 17:08:23 +0000 Received: by outflank-mailman (input) for mailman id 820895; Thu, 17 Oct 2024 17:08:22 +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 1t1TvL-0006TN-Cm for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:04:31 +0000 Received: from sender3-of-o59.zoho.com (sender3-of-o59.zoho.com [136.143.184.59]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id de6aa70a-8ca9-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:04:29 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184622569551.9933736684571; Thu, 17 Oct 2024 10:03:42 -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: de6aa70a-8ca9-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184625; cv=none; d=zohomail.com; s=zohoarc; b=JxOPe9KK7rni9b8F2K6sb0JpTMEgtu2VDdjARWYd1Kp30tslpPEQm8P3yMuvFyqO3ovQSvaZ1L5/Ler/EpO49VKusqWouUM1iMZNUO7Dw5arx1yPimgprRJnyxZZRiFGiD7YdkUHpf8NTmKV9D6TajoPMLeBeVdfwpqtjQRU9Hw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184625; 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=i/MwelbIDlLsytRqJnx56gOPNpJbq/sBz2YfvwIYl4c=; b=GAQSAHJxfulU7UVno+fvmUbI8jcisFo6uaampi1BTROFbdzvYVFVKUAiN6nOl2ATaH1VE+KYxb1Zxg/rACDZZ/ts0MuCOCZ1nzSjZdTf0By70/W4bNGfsbFc8Yi/SkO6GBnDWpR6gdD/bYy591F0n8xqIPaHronuRevRF9OMSJk= 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=1729184625; 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=i/MwelbIDlLsytRqJnx56gOPNpJbq/sBz2YfvwIYl4c=; b=qcLTaouKMVsM2G/AnEtCSkWyGecFRTR9kUX8ygvq8O1JsNJjln0u/54rOtKTThsA 0HEMECXMh0x2+Or1JUYSpuzdI1VnqWw1dd1kDieGylfsDdE5ZOtWcTbsjeW+s59OW7W AXcjDtgJ8VmYRh6xpS4M3AlU7IpNZ/JtRPQI0X+A= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 06/44] x86/boot: convert consider_modules to struct boot_module Date: Thu, 17 Oct 2024 13:02:46 -0400 Message-Id: <20241017170325.3842-7-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729184944276116600 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 mod. No functional change intended. Signed-off-by: Daniel P. Smith Reviewed-by: Jason Andryuk --- Changes since v5: - drop unnecessary type cast --- 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 d8ee5741740a..10934bf31d7f 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -629,7 +629,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; @@ -639,20 +639,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 pfn_to_paddr(mods[i].mod->mod_start); + uint64_t end =3D start + PAGE_ALIGN(mods[i].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); } } @@ -1428,7 +1428,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, bi->nr_modules, -1); + bi->mods, bi->nr_modules, -1); end &=3D ~mask; } else @@ -1463,7 +1463,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, bi->mods, bi->nr_modules + relocated, j); =20 if ( highmem_start && end > highmem_start ) @@ -1490,7 +1490,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)= , bi->mods, bi->nr_modules + relocated, -1); if ( s >=3D e ) break; --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729184875; cv=pass; d=zohomail.com; s=zohoarc; b=CO8fCkQrTMINlfE6gdY6VdiEsS+aAi3mioWNOSEU93k0KYtcom2qTh2Yi3T0Mu2mfgBudzyiQhC7TyGEUmyJwnphxs/4UbDRALZlN8Bfw/GqEhdjsi9g+CzMDXTmnb4xl8SH5aHrTUNpszMSn7bw7TPOUQhbmDLUJr7UXzE9138= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184875; 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=H7+H2K1xx8lIY92L5+m10RhDN9p6bY+Wrz/xIahDxoc=; b=VwDr4+2+f3BrE7dzYxX0BoV4XHvsbC4KGwNlhbZIFrTQK3JzCYFMLEn6aUp+Ww6vVGsh+UF5xgwZtjpZ56eXL9lpJhP07xwqtswwFjKoe3dr5oWz8TTqjTzH8aYdZYXP2RjYHVrkxc4kfGHKWRdmHIuSJdP/lJ+HA/TPqxXwPc4= 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 172918487521695.55244705803864; Thu, 17 Oct 2024 10:07:55 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820882.1234569 (Exim 4.92) (envelope-from ) id 1t1TyM-0004rW-SP; Thu, 17 Oct 2024 17:07:38 +0000 Received: by outflank-mailman (output) from mailman id 820882.1234569; Thu, 17 Oct 2024 17:07:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t1TyM-0004rN-Om; Thu, 17 Oct 2024 17:07:38 +0000 Received: by outflank-mailman (input) for mailman id 820882; Thu, 17 Oct 2024 17:07: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 1t1TvU-0006TN-4f for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:04:40 +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 e382022c-8ca9-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:04:38 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184623813332.0053578314786; Thu, 17 Oct 2024 10:03: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: e382022c-8ca9-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184626; cv=none; d=zohomail.com; s=zohoarc; b=bosGKq7O4GCzRI4fX0jqTRkaseg7RuA6hZrxT1cfZgkyUMfmeh15/QP1CBZfVrpIOztoM28vf92y/HY90CVXoKLU70epYOy5d+pSV+rEB/Qu2H+So9y5jCiL8HTXtaRiQtJlgsk/LF9JQssaRjHvtHbqVd6DNOzhglKLZyRiYCo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184626; 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=H7+H2K1xx8lIY92L5+m10RhDN9p6bY+Wrz/xIahDxoc=; b=CZDOVR2sT/N5kYCYadGbQgv7rlUjSFtwQIEleQV5X2jczsVYEUnAY/d2qz+tij+Dx25bVcnjn5JowllPVK1XR0d5zuvg7mSbC7eLMCgNXfR+7gwUusCToPBmo08zS/yRRz/k1M3X+XKkY2Sgdrhmf6sg5qldL0KYMcL0v1m93T4= 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=1729184626; 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=H7+H2K1xx8lIY92L5+m10RhDN9p6bY+Wrz/xIahDxoc=; b=Zr+oNKk3rc/45DjoWREHaupFr7RYaQSsjF4bgSyExxxKzb8XPG6rxwNaA5yCQG2u bEifx013yw++oO58VT46KWzwVotzdCGLdBcJbYiJrzBHdJtAmxEwy1JHe2GNWTUQpdV E8R6eK1YOo6XrYcGEF9Y2c/u94YP6Zo2fduzqrSs= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 07/44] x86/boot: move headroom to boot modules Date: Thu, 17 Oct 2024 13:02:47 -0400 Message-Id: <20241017170325.3842-8-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729184898503116600 Content-Type: text/plain; charset="utf-8" The purpose of struct boot_module is to encapsulate the state of boot modul= e as it is processed by Xen. Locating boot module state struct boot_module reduc= es the number of global variables as well as the number of state variables that must be passed around. It also lays the groundwork for hyperlaunch mult-dom= ain construction, where multiple instances of state variables like headroom wil= l be needed. Signed-off-by: Daniel P. Smith Reviewed-by: Jason Andryuk --- Changes since v5: - reword and expand comment on headroom - consolidated declaration and assignment --- xen/arch/x86/include/asm/bootinfo.h | 13 +++++++++++++ xen/arch/x86/setup.c | 21 ++++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index d19473d8941e..5fe4f1387d03 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -17,6 +17,19 @@ struct boot_module { /* Transitionary only */ module_t *mod; + /* + * A boot module may contain a compressed kernel that will require + * additional space, before the module data, into which the kernel wil= l be + * decompressed. + * + * Memory layout at boot: + * [ compressed kernel ] + * After boot module relocation: + * [ estimated headroom + PAGE_SIZE rounding ][ compressed kernel ] + * After kernel decompression: + * [ decompressed kernel ][ unused rounding ] + */ + unsigned long headroom; }; =20 /* diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 10934bf31d7f..11e1027d72dd 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1012,7 +1012,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) struct boot_info *bi; 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; @@ -1371,7 +1371,10 @@ void asmlinkage __init noreturn __start_xen(unsigned= long mbi_p) mod[bi->nr_modules].mod_end =3D __2M_rwdata_end - _stext; } =20 - modules_headroom =3D bzimage_headroom(bootstrap_map(mod), mod->mod_end= ); + bi->mods[0].headroom =3D + bzimage_headroom(bootstrap_map(bi->mods[0].mod), + bi->mods[0].mod->mod_end); + bootstrap_map(NULL); =20 #ifndef highmem_start @@ -1456,8 +1459,8 @@ 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 &bi->mods[j]; + unsigned long size =3D PAGE_ALIGN(bm->headroom + mod[j].mod_en= d); =20 if ( mod[j].reserved ) continue; @@ -1470,14 +1473,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; } } @@ -1504,7 +1507,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) #endif } =20 - if ( modules_headroom && !mod->reserved ) + if ( bi->mods[0].headroom && !mod->reserved ) panic("Not enough memory to relocate the dom0 kernel image\n"); for ( i =3D 0; i < bi->nr_modules; ++i ) { @@ -2056,7 +2059,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, bi->mods[0].headroom, initrdidx < bi->nr_modules ? mod + initrdidx : NULL, kextra, bi->loader); if ( !dom0 ) --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729184934; cv=pass; d=zohomail.com; s=zohoarc; b=fplfaeGn81xqRGRy+UJkWd8kr6jN7QtcGraqVRJylAFqDz6aY0ALyhPm4TwQwR3ZAoD/IZJyf/K1rs32xn2sQX/f3SOHReX6GLFH3q6SedlW+/tXKlGy2R+RqtHEQXnQJ4E1LVt2c8RNO3V3yTuzbcWOHen9mUPx+MOsocnekdk= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184934; 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=a1nvXWrB1CLe8R744GeUpJxtCMGjQBOguC52kxhYdIY=; b=kQdCGSO6T8EU6ybEP0ZdvWhYMik4Pk/oDj/dM6wf17tKBJGmdhRJBquxxdcruwAe1HflQRzG6awQjFSXog6Ofz3dXuOc+P6/9YduFhLxZzn9XaS5ikeLZtEEVj7BXM0CvlsK1Ne68tm3bJ+kEusD0gROediwmZVh6hRlS8cv8qA= 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 1729184934069383.95740767672316; Thu, 17 Oct 2024 10:08:54 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820897.1234619 (Exim 4.92) (envelope-from ) id 1t1TzE-0007n7-5T; Thu, 17 Oct 2024 17:08:32 +0000 Received: by outflank-mailman (output) from mailman id 820897.1234619; Thu, 17 Oct 2024 17:08: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 1t1TzE-0007my-2J; Thu, 17 Oct 2024 17:08:32 +0000 Received: by outflank-mailman (input) for mailman id 820897; Thu, 17 Oct 2024 17:08:31 +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 1t1Tve-0006TN-UP for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:04:50 +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 e9f9d9f1-8ca9-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:04:48 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 172918462501326.25612647323169; Thu, 17 Oct 2024 10:03: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: e9f9d9f1-8ca9-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184627; cv=none; d=zohomail.com; s=zohoarc; b=FUkpM/OCEcp5/uIZbCKalpSYRPxBkMgIREkMD/F/4arWA+FeVEOTkGRJbIY56GbOvFgyrLBSbBDASLoTzUbPwN4MhnLujKQDNiMEafS1P0IO+FVr2W8+MMY+3q/K/MJjfnRcf0WIpSMFAIyXHiPvMcluVrr5+LI+zhpqpizOIZM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184627; 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=a1nvXWrB1CLe8R744GeUpJxtCMGjQBOguC52kxhYdIY=; b=CC1W1WtLl1uhPlm47ARFUPNOCPHt/0MqUQOqpo8Hau8V4fIFywMPDQ5q/StNVL7x3t2RwSW3b8UIGtD+1AUCS5dXaF8tKe3VUe6LUXsNMo0yRRPPmt+DUhLhTVZ0PBJaSO5Gj2Nvz3dzgx0Zpz28wV0F1Xmy+kc1N9CSMfU7H/M= 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=1729184627; 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=a1nvXWrB1CLe8R744GeUpJxtCMGjQBOguC52kxhYdIY=; b=NUiiCmVMwLCgLnyONPDG29nW6SCnACEvQQ4OlChClf1q7omdhESPdexQlngzuw6X vDZVxjsZvUZLEqmTufx9ZifwviXQuiXMq/jVTmD8gSZjmo6EIXihCLBHo1UdB7fmsoR BjdWm8JtIM/F2MaPn2cHnzwew1KqhNUWA1C5uP58= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 08/44] x86/boot: convert mod refs to boot_module mod Date: Thu, 17 Oct 2024 13:02:48 -0400 Message-Id: <20241017170325.3842-9-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729184955505116600 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 module_t mod, only in setup.c, to the mod eleme= nt of struct boot_module. These serves twofold, first to allow the incremental transition from module_t fields to struct boot_module fields. The second is= to allow the conversion of function definitions from taking module_t parameter= s to accepting struct boot_module as needed when a transitioned field will be accessed. Signed-off-by: Daniel P. Smith --- Changes since v5: - rewrote commit message - coding style changes - added comment for initial_images assignment --- xen/arch/x86/setup.c | 64 +++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 11e1027d72dd..1b56eaf26efe 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1341,15 +1341,19 @@ 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; + /* + * The field bi->mods[0].mod points to the first element of the module= _t + * array. + */ + initial_images =3D bi->mods[0].mod; =20 for ( i =3D 0; !efi_enabled(EFI_LOADER) && i < bi->nr_modules; i++ ) { - if ( mod[i].mod_start & (PAGE_SIZE - 1) ) + if ( bi->mods[i].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; + bi->mods[i].mod->mod_end -=3D bi->mods[i].mod->mod_start; + bi->mods[i].mod->mod_start >>=3D PAGE_SHIFT; + bi->mods[i].mod->reserved =3D 0; } =20 /* @@ -1360,6 +1364,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) =20 if ( xen_phys_start ) { + unsigned int xen =3D bi->nr_modules; relocated =3D true; =20 /* @@ -1367,8 +1372,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[bi->nr_modules].mod_start =3D virt_to_mfn(_stext); - mod[bi->nr_modules].mod_end =3D __2M_rwdata_end - _stext; + bi->mods[xen].mod->mod_start =3D virt_to_mfn(_stext); + bi->mods[xen].mod->mod_end =3D __2M_rwdata_end - _stext; } =20 bi->mods[0].headroom =3D @@ -1460,9 +1465,9 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) * move mod[0], we incorporate this as extra space at the star= t. */ struct boot_module *bm =3D &bi->mods[j]; - unsigned long size =3D PAGE_ALIGN(bm->headroom + mod[j].mod_en= d); + unsigned long size =3D PAGE_ALIGN(bm->headroom + bm->mod->mod_= end); =20 - if ( mod[j].reserved ) + if ( bi->mods[j].mod->reserved ) continue; =20 /* Don't overlap with other modules (or Xen itself). */ @@ -1474,14 +1479,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->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->mod->mod_start << PAGE_SHIFT, + bm->mod->mod_end); + bm->mod->mod_start =3D (end - size) >> PAGE_SHIFT; + bm->mod->mod_end +=3D bm->headroom; + bm->mod->reserved =3D 1; } } =20 @@ -1507,13 +1512,15 @@ void asmlinkage __init noreturn __start_xen(unsigne= d long mbi_p) #endif } =20 - if ( bi->mods[0].headroom && !mod->reserved ) + if ( bi->mods[0].headroom && !bi->mods[0].mod->reserved ) panic("Not enough memory to relocate the dom0 kernel image\n"); for ( i =3D 0; i < bi->nr_modules; ++i ) { - uint64_t s =3D (uint64_t)mod[i].mod_start << PAGE_SHIFT; + uint64_t s =3D (uint64_t)bi->mods[i].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(bi->mods[i].mod->mod_end)); } =20 if ( !xen_phys_start ) @@ -1591,8 +1598,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 < bi->nr_modules; ++j ) { - uint64_t end =3D pfn_to_paddr(mod[j].mod_start) + - mod[j].mod_end; + uint64_t end =3D pfn_to_paddr( + bi->mods[j].mod->mod_start) + + bi->mods[j].mod->mod_end; =20 if ( map_e < end ) map_e =3D end; @@ -1666,11 +1674,12 @@ void asmlinkage __init noreturn __start_xen(unsigne= d long mbi_p) =20 for ( i =3D 0; i < bi->nr_modules; ++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(bi->mods[i].mod->mod_start, + bi->mods[i].mod->mod_start + + PFN_UP(bi->mods[i].mod->mod_end)); + map_pages_to_xen((unsigned long)mfn_to_virt(bi->mods[i].mod->mod_s= tart), + _mfn(bi->mods[i].mod->mod_start), + PFN_UP(bi->mods[i].mod->mod_end), PAGE_HYPERVISOR); } =20 #ifdef CONFIG_KEXEC @@ -2059,8 +2068,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, bi->mods[0].headroom, - initrdidx < bi->nr_modules ? mod + initrdidx : NULL, + dom0 =3D create_dom0(bi->mods[0].mod, bi->mods[0].headroom, + initrdidx < bi->nr_modules ? bi->mods[initrdidx].mod + : NULL, kextra, bi->loader); if ( !dom0 ) panic("Could not set up DOM0 guest OS\n"); --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729184868; cv=pass; d=zohomail.com; s=zohoarc; b=NDJI+7LZiFP7cs5FHdALbmb0t8ybdQ1f2jVu4sbggvPZ6nKjLAJCRgg9teuX2GdbFkhhBqNfdIN/KG39za0yB8hEjDKAxVDfoM4Wagcdrpw9ozXmqPcDsnJBLSkfYOM0nb9alymvJWneVfS16y5a6CnKJaaoGGxAUtTGNWqLEHg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184868; 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=Gn+NgukrSZNmUBqbS3h19LnxMuHuw+P3qAI40MVL2NA=; b=DO3FL1lzgKZNZuPwQtUXw4oLfsMMyA0JCYCJR9aYVuht5yO8CL7maLMyCrqdGQGZsPh6VKk+IZhkvUHzflufHiYqpgfkkxWuy6A7aK4UAl7GIj+KTt42xMBKuQeYIMKbBNwlZcb//u6YfZfK/G9UA0RUK9MHTh6LssPcQqJ3qho= 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 1729184868667694.2931769833298; Thu, 17 Oct 2024 10:07:48 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820879.1234549 (Exim 4.92) (envelope-from ) id 1t1TyF-0004Dy-EW; Thu, 17 Oct 2024 17:07:31 +0000 Received: by outflank-mailman (output) from mailman id 820879.1234549; Thu, 17 Oct 2024 17:07:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t1TyF-0004Dr-Bb; Thu, 17 Oct 2024 17:07:31 +0000 Received: by outflank-mailman (input) for mailman id 820879; Thu, 17 Oct 2024 17:07:30 +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 1t1Tvn-0006TN-8i for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:04:59 +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 eefa78a0-8ca9-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:04:57 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184626209754.6375868347845; Thu, 17 Oct 2024 10:03: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: eefa78a0-8ca9-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184628; cv=none; d=zohomail.com; s=zohoarc; b=EhQ00uV5KWcXLb7ZAuzSAi6b9ej2Wl3tJ3B+8kjvf7b6mDzZoeQ8pJaEMRYmYY6CsusInTHpK0D1ZgGhP8ctXlBTjve44IwhZbRqEQl/wxY3ZA7KZFmHpSt35Gv1LKxhvGsKpLU0XDtsjooMe2BgYaWS5cZ32LdogXvHPBHDXMs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184628; 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=Gn+NgukrSZNmUBqbS3h19LnxMuHuw+P3qAI40MVL2NA=; b=WeBY9Xq/Qo1W/Abt/lIT3RCAH5yPe01/M3J5tk3+bX0ZzZtyrvtUMuJTV6Crw0R6j3o9YZ+8+Z/8FQI23XOQITWat55/aPT2qmZl4q//5ylQYEu65DPRjQpK2BEo+R0orN3A76XbTBHa41vV4JiGMXYD8Qv/Upfnr1rZZ6MOytU= 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=1729184628; 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=Gn+NgukrSZNmUBqbS3h19LnxMuHuw+P3qAI40MVL2NA=; b=mwJ7JW/xMrsbow9/Z7dd+HrZF1KFwGE7GS2qLwrof2NHO4zBojx07XP5HLcuq7Ay WF+W6hJM6aE5JLNTmmgQswClDlGbC6S9NyPNntm/Tabn3km51o/EM/8uFcrxvRQp1Az yO78/fPqEKa4UH739OfXByt0xtybdiFXJDNU1yf4= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 09/44] x86/boot: introduce boot module types Date: Thu, 17 Oct 2024 13:02:49 -0400 Message-Id: <20241017170325.3842-10-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729184887750116600 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 Reviewed-by: Jason Andryuk --- Changes since v5: - added guard around initrd type assignment - removed a missed rebase artifact --- xen/arch/x86/include/asm/bootinfo.h | 9 +++++++++ xen/arch/x86/setup.c | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 5fe4f1387d03..18281d80fa97 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -14,6 +14,14 @@ /* Max number of boot modules a bootloader can provide in addition to Xen = */ #define MAX_NR_BOOTMODS 63 =20 +/* Boot module binary type / purpose */ +enum bootmod_type { + BOOTMOD_UNKNOWN, + BOOTMOD_XEN, + BOOTMOD_KERNEL, + BOOTMOD_RAMDISK, +}; + struct boot_module { /* Transitionary only */ module_t *mod; @@ -30,6 +38,7 @@ struct boot_module { * [ decompressed kernel ][ unused rounding ] */ unsigned long headroom; + enum bootmod_type type; }; =20 /* diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 1b56eaf26efe..fed9bef16305 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -311,6 +311,9 @@ static struct boot_info *__init multiboot_fill_boot_inf= o(unsigned long mbi_p) for ( i =3D 0; i <=3D bi->nr_modules; i++ ) bi->mods[i].mod =3D &mods[i]; =20 + /* map the last mb module for xen entry */ + bi->mods[bi->nr_modules].type =3D BOOTMOD_XEN; + return bi; } =20 @@ -1171,6 +1174,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) =20 bitmap_fill(module_map, bi->nr_modules); __clear_bit(0, module_map); /* Dom0 kernel is always first */ + bi->mods[0].type =3D BOOTMOD_KERNEL; =20 if ( pvh_boot ) { @@ -2059,6 +2063,8 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) cpu_has_nx ? "" : "not "); =20 initrdidx =3D find_first_bit(module_map, bi->nr_modules); + if ( initrdidx < bi->nr_modules ) + bi->mods[initrdidx].type =3D BOOTMOD_RAMDISK; if ( bitmap_weight(module_map, bi->nr_modules) > 1 ) printk(XENLOG_WARNING "Multiple initrd candidates, picking module #%u\n", --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729184928; cv=pass; d=zohomail.com; s=zohoarc; b=ebgGLnyKGUKMiGSYf5s561yxfyKik/a5LHBvgfxnyUD6UlJC4dNCmlGlmrOVlSNqgLjKY5tbu/DHOQRnvi0wVZOEtiMQP7pbmNRW7cQu/+4DhUJiy2aapsB437xSsvxCvs6Ro9T/VomExCJ0tVskQjl4iDzJVXFNet3760Karkc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184928; 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=Dgh7JemAIAyELVZo1MtAbdLIy6CYiHIimrr6e9LjQD8=; b=CieOUsJtcBASsPgQRrGp35tBwPkc0+I4VDQzkON8BBvpTBvKZfzkAyKYcllC4spOtR233A489dyufdhOfr6PXepE76KtdwCXjjaE3Ezt5uVldfe48ze1G/XirI9KnvTs7m2uk+9Vb7yEYRE3kUaMR2xIGl43bRrVO9rgE+n0vJo= 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 1729184928638239.98468919316701; Thu, 17 Oct 2024 10:08:48 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820898.1234629 (Exim 4.92) (envelope-from ) id 1t1TzF-000849-CC; Thu, 17 Oct 2024 17:08:33 +0000 Received: by outflank-mailman (output) from mailman id 820898.1234629; Thu, 17 Oct 2024 17:08:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t1TzF-00083w-8k; Thu, 17 Oct 2024 17:08:33 +0000 Received: by outflank-mailman (input) for mailman id 820898; Thu, 17 Oct 2024 17:08:32 +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 1t1Tvv-0006TN-ST for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:05:07 +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 f42e10c9-8ca9-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:05:06 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184627400845.0097301540941; Thu, 17 Oct 2024 10:03: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: f42e10c9-8ca9-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184629; cv=none; d=zohomail.com; s=zohoarc; b=SeayuwoQT0saTqC6G096y+49K1bclg5Ivg81bteWsoDLt/adFhxnFW3tKKpe/IWKuCK2jaI8RMq4NqZ3w5Hit3zXBubjRzMX+B0N8cy4mAOfWPTcJf/wEUf4YLj12lfiJYWtazTvbLq8IoUOlC37CmR00icW70Q4sFG8mfbUbXo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184629; 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=Dgh7JemAIAyELVZo1MtAbdLIy6CYiHIimrr6e9LjQD8=; b=TS19wJUP0AMUiHWHp2eIISwQGpgs2CJKJCRwnlx1rDwNRQwoqOWgZqqwCnXyLHBMQRtRuIO4V/X70VsAZvI6r8AhW49kWAwEttsFIPPDcFm4ZhOW1cd2yWnnDYQzZ5DZcOnwS3zRwDpAaJgBy/PA+ibqDTqhGQo3/0OG+L8IhTQ= 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=1729184629; 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=Dgh7JemAIAyELVZo1MtAbdLIy6CYiHIimrr6e9LjQD8=; b=K4K1/ZiQiOWJ4pIQWR8kcK25hcKKNHMCIIV0jXCjd2149ZUXycVc3sYYaeqwrsyM 1sfKSVqt1NlVpU6FcdjYIInTnfaoX/QRYLCSXzdsuoMKKGXIy1JGrCnL9EoeLYbioUH rRXqtzfuNVbC3KFj5rGn2C969yTTnhPCXPclm8Xg= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 10/44] x86/boot: introduce boot module flags Date: Thu, 17 Oct 2024 13:02:50 -0400 Message-Id: <20241017170325.3842-11-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729184950673116600 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 Reviewed-by: Jason Andryuk Acked-by: Jan Beulich --- Changes since v5: - removed trailing blank line. --- xen/arch/x86/include/asm/bootinfo.h | 3 +++ xen/arch/x86/setup.c | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 18281d80fa97..e8ba9390a51f 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -39,6 +39,9 @@ struct boot_module { */ unsigned long headroom; enum bootmod_type type; + + uint32_t flags; +#define BOOTMOD_FLAG_X86_RELOCATED (1U << 0) }; =20 /* diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index fed9bef16305..f87faa31a2cf 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1357,7 +1357,6 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) panic("Bootloader didn't honor module alignment request\n"); bi->mods[i].mod->mod_end -=3D bi->mods[i].mod->mod_start; bi->mods[i].mod->mod_start >>=3D PAGE_SHIFT; - bi->mods[i].mod->reserved =3D 0; } =20 /* @@ -1471,7 +1470,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) struct boot_module *bm =3D &bi->mods[j]; unsigned long size =3D PAGE_ALIGN(bm->headroom + bm->mod->mod_= end); =20 - if ( bi->mods[j].mod->reserved ) + if ( bi->mods[j].flags & BOOTMOD_FLAG_X86_RELOCATED ) continue; =20 /* Don't overlap with other modules (or Xen itself). */ @@ -1490,7 +1489,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) bm->mod->mod_end); bm->mod->mod_start =3D (end - size) >> PAGE_SHIFT; bm->mod->mod_end +=3D bm->headroom; - bm->mod->reserved =3D 1; + bm->flags |=3D BOOTMOD_FLAG_X86_RELOCATED; } } =20 @@ -1516,7 +1515,8 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) #endif } =20 - if ( bi->mods[0].headroom && !bi->mods[0].mod->reserved ) + if ( bi->mods[0].headroom && + !(bi->mods[0].flags & BOOTMOD_FLAG_X86_RELOCATED) ) panic("Not enough memory to relocate the dom0 kernel image\n"); for ( i =3D 0; i < bi->nr_modules; ++i ) { --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729184802; cv=pass; d=zohomail.com; s=zohoarc; b=k+xOz6AEx3M0JetAvsCKe0J0aYpxdLSQM7q97SQ7xWGultB/CsfGVvF8ofm8d0zhH6EmJAXRT7/L12h6GBcMvwfZaam/SbFk9yBlWtwj+EsXwEBqcaqm1DwA368rg36XPgQ9qxrkrZqSJ1X1b+ziYOWM923G6rF06ct/3t5hj2Q= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184802; 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=jMznZ4/Qnb47L6uS5Mep6oH/AOXeu1gaoH+gJ/apC6A=; b=dBdROmFAB1snCKVfPyqi+L3YJ/6LnS1F8og3CIOLe0iSqyLASdKIroxaYy8B4TDnz2Yp9NIsAwMqoZnMZhzF79Z8uWrl/j4xYkcwLuQKSHCqyX+je8OZkSDOftJf5Q53tm4Fzi2sQlhtkKzWsJ3uU9r5XgWmgR4H9ByLPObcIag= 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 1729184802857845.8461682869371; Thu, 17 Oct 2024 10:06:42 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820874.1234539 (Exim 4.92) (envelope-from ) id 1t1TxD-0002vE-2u; Thu, 17 Oct 2024 17:06:27 +0000 Received: by outflank-mailman (output) from mailman id 820874.1234539; Thu, 17 Oct 2024 17:06: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 1t1TxC-0002v7-W3; Thu, 17 Oct 2024 17:06:26 +0000 Received: by outflank-mailman (input) for mailman id 820874; Thu, 17 Oct 2024 17:06: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 1t1Tw4-0006TN-Dx for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:05: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 f9430893-8ca9-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:05:14 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184628693714.7111287097858; Thu, 17 Oct 2024 10:03: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: f9430893-8ca9-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184631; cv=none; d=zohomail.com; s=zohoarc; b=PqX/pyk6X/pI9ldvPH5cVFcVKKcRotmmkSVyyRetCm6EY+W+GXe6GedXJqODel6E9ZT8IDERd6OGwVB5khKFsmUCJdcfzHUU5J4vO0PK2f/LHOIZmn7utQmGiXHmN9DlrhxNOXViMoaIhNb8zpEYX2YsIHr5oos83ioy7rL1YD4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184631; 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=jMznZ4/Qnb47L6uS5Mep6oH/AOXeu1gaoH+gJ/apC6A=; b=Q7XLJYKaSTBdJ9nU9OIJaOLc3CZ3xZDIQHHUK1kfIM0nJeKEwWWJUThvg14rZ8r9j8MkwN5xPdPz+UfBZsPUV7E1xPZ2/kviJ116leNKlWNCwZ9W3kFMAKju+ssNUq3R9QeFZyY2e/p0ouTmmYFf3y+iBejLwMWVNp/9MnIAz1k= 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=1729184631; 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=jMznZ4/Qnb47L6uS5Mep6oH/AOXeu1gaoH+gJ/apC6A=; b=oqszHDl5zgvb+fvQ1+Ix9i1lHgNhHIGLAdOVfg+SmLYzC9AKX6dssJ9UAeXeL2fX 08zzCNWIm4+p5swcAYigZJ5ZdxN2Bs+KyRKNgcA9aBnfa9LkuxcTRAuKFTk4I1X7OR4 9MiXrP+4fcXYknOl5YFxo2fKGJGavMpZBraj76Vw= From: "Daniel P. Smith" To: Jan Beulich , xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 11/44] x86/boot: add start and size fields to struct boot_module Date: Thu, 17 Oct 2024 13:02:51 -0400 Message-Id: <20241017170325.3842-12-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729184820087116600 Content-Type: text/plain; charset="utf-8" This commit introduces the start and size fields to struct boot_module and assigns their value during boot_info construction. The EFI entry point special cased itself, and pre-converted mod_start and mod_end to mfn and size respectively. This required an additional test in the coversion loop to not convert mod_start and mod_end when the convers= ion was done for both the multiboot and PVH boot entry points. To simplify the logic populating the start and size fields, the EFI module population logic was coverted to using start and end addresses. Signed-off-by: Daniel P. Smith Reviewed-by: Jason Andryuk --- Changes since v5: - switched EFI population of mod_start/mod_end to addresses --- xen/arch/x86/efi/efi-boot.h | 4 ++-- xen/arch/x86/include/asm/bootinfo.h | 3 +++ xen/arch/x86/setup.c | 7 ++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index 94f34433640f..779f101c3de7 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -732,8 +732,8 @@ static void __init efi_arch_handle_module(const struct = file *file, if ( options ) place_string(&mb_modules[mbi.mods_count].string, options); place_string(&mb_modules[mbi.mods_count].string, local_name.s); - mb_modules[mbi.mods_count].mod_start =3D file->addr >> PAGE_SHIFT; - mb_modules[mbi.mods_count].mod_end =3D file->size; + mb_modules[mbi.mods_count].mod_start =3D file->addr; + mb_modules[mbi.mods_count].mod_end =3D file->addr + file->size; ++mbi.mods_count; efi_bs->FreePool(ptr); } diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index e8ba9390a51f..5862054b8cef 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -42,6 +42,9 @@ struct boot_module { =20 uint32_t flags; #define BOOTMOD_FLAG_X86_RELOCATED (1U << 0) + + paddr_t start; + size_t size; }; =20 /* diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index f87faa31a2cf..6ee352fc0cde 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -309,8 +309,13 @@ static struct boot_info *__init multiboot_fill_boot_in= fo(unsigned long mbi_p) * reserved for Xen itself */ for ( i =3D 0; i <=3D bi->nr_modules; i++ ) + { bi->mods[i].mod =3D &mods[i]; =20 + bi->mods[i].start =3D (paddr_t)mods[i].mod_start; + bi->mods[i].size =3D mods[i].mod_end - mods[i].mod_start; + } + /* map the last mb module for xen entry */ bi->mods[bi->nr_modules].type =3D BOOTMOD_XEN; =20 @@ -1351,7 +1356,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) */ initial_images =3D bi->mods[0].mod; =20 - for ( i =3D 0; !efi_enabled(EFI_LOADER) && i < bi->nr_modules; i++ ) + for ( i =3D 0; i < bi->nr_modules; i++ ) { if ( bi->mods[i].mod->mod_start & (PAGE_SIZE - 1) ) panic("Bootloader didn't honor module alignment request\n"); --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729184745; cv=pass; d=zohomail.com; s=zohoarc; b=YbTG1fogh+u7aDwvmPuA2dIF+4Xt2BZo1C9anBmAYqsN6TMdInezlYcWFkANVld3nctP2Mh5AOBt3lFhKv25eM1oVYZhyN4BZlnvIa34SpT68sFXkcfrzAZRSGdNhf2ugvVlGSrb9yTqFLyEzUst1kgTo5m5osg38FUZ8BMsShk= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184745; 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=zL/cFqK5qkXy9lJ8lYgSqek6O1BwEfk0id77UI0IvV0=; b=WdqpiTxBTW0jr87YB7047MHuKv3EXX59+rXdOMBox7rFOIZuKXfPe9qfdizJ5/6sxdi/ZvQEhztqIIsfuFzSq6BRL3K7i08+iKJnWvQw5bY4x9ivTAAn4xbxORBin3zrzIq1JUJBUryBQ4RNk59QKA7sYBLJq63M3xmQxP3KHgM= 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 1729184745973915.9211858304974; Thu, 17 Oct 2024 10:05:45 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820846.1234479 (Exim 4.92) (envelope-from ) id 1t1TwG-0008Tb-GP; Thu, 17 Oct 2024 17:05:28 +0000 Received: by outflank-mailman (output) from mailman id 820846.1234479; Thu, 17 Oct 2024 17:05:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t1TwG-0008TU-Dg; Thu, 17 Oct 2024 17:05:28 +0000 Received: by outflank-mailman (input) for mailman id 820846; Thu, 17 Oct 2024 17:05: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 1t1TwF-0008TH-HT for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:05:27 +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 ffe5de37-8ca9-11ef-a0be-8be0dac302b0; Thu, 17 Oct 2024 19:05:25 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184629973825.0331942335803; Thu, 17 Oct 2024 10:03: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: ffe5de37-8ca9-11ef-a0be-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1729184632; cv=none; d=zohomail.com; s=zohoarc; b=lCkBpR3oksT79NRryhLIHUU6Pgz5aNGTPZNaqKRRRGlpH6oI4Yl5/uEaaTROBETeHCePCJHySyAEoucZCHmNmaX/QpYVp91xrrxEgApuPIuvaSee2kfonPFxto4N66hoj3jG4YFYNFkOyVF9zOWItXs/mz9ZMC8Avlu+vO1mSOI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184632; 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=zL/cFqK5qkXy9lJ8lYgSqek6O1BwEfk0id77UI0IvV0=; b=W3XtYF+xk2SmhMqBSGTUGpX35JwqsvxKdeUfTLWBd4o55YQNtPrzt16yyNRHIKsbks+OFojA7vVmaVnOwzHXp9un/mj+k66tNkUn7nKKJrKkMK+2ZBOMD8cJiV2rpwer/mSWvR7FX5aEM4kzWJDOTXroyjQH2cDxh4oeKTmaeOY= 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=1729184632; 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=zL/cFqK5qkXy9lJ8lYgSqek6O1BwEfk0id77UI0IvV0=; b=qIvG04TZ4Khikl1EDCNAoiu7IwFFeh6YdcxcvUQxFBRgyBezX++uUNEXhkWXKWbr JA71ZQDdn1qsozaR2ozKwT5CmIUxg93VSlp2ILghflZtx4WgpWjsl2kHAdPz/JFU5nx PWH9JkIVtAeU6mAMwWWZczdeTsam6WmJ0l27vHYQ= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 12/44] x86/boot: update struct boot_module on module relocation Date: Thu, 17 Oct 2024 13:02:52 -0400 Message-Id: <20241017170325.3842-13-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729184772781116600 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 --- Changes since v5: - corrected conversion function for a missed switch from mfn to maddr/paddr --- xen/arch/x86/setup.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 6ee352fc0cde..d51b0b03bc97 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1380,8 +1380,11 @@ 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. */ - bi->mods[xen].mod->mod_start =3D virt_to_mfn(_stext); - bi->mods[xen].mod->mod_end =3D __2M_rwdata_end - _stext; + bi->mods[xen].start =3D virt_to_maddr(_stext); + bi->mods[xen].size =3D __2M_rwdata_end - _stext; + + bi->mods[xen].mod->mod_start =3D bi->mods[xen].start; + bi->mods[xen].mod->mod_end =3D bi->mods[xen].size; } =20 bi->mods[0].headroom =3D --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729184770; cv=pass; d=zohomail.com; s=zohoarc; b=XxFxAxbT4onrbW7bG5QPj+akugx/hIcBkvDw262N9TBIuWoCjv/zeBfjQYvYTa7WBvmF4cRgkk9D7MdHMahL+kRb66y23GPDFul2dWlIihEqnD4UWXntI0cfDbVeERB5RMuolvSFqSnBS/r8mk9D08HdlT3k0WJr0oFwjI5Vk0M= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184770; 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=buUYqo46akp40axyhMLTCjGqzGXlUDMWgwiiv0Mju9Y=; b=b3Gpfltb+P4upJiQgzJGPGhED/dgE6vq6xmawQXCoQMr/lSQkzxYhxLc4JKS86Lhfls0t2GNGpBwhHfHmbjA1WImEnan/LOSZ1Nk5b9z0qfTFHQ9InIZ6ukbTNTYy1WiJq/ApFdfyHLtmlqE7TcHig5z/jtE6Hkz392JouoEW5U= 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 1729184770227989.8598547674162; Thu, 17 Oct 2024 10:06:10 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820847.1234489 (Exim 4.92) (envelope-from ) id 1t1TwO-0000KL-NB; Thu, 17 Oct 2024 17:05:36 +0000 Received: by outflank-mailman (output) from mailman id 820847.1234489; Thu, 17 Oct 2024 17:05:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t1TwO-0000KC-KM; Thu, 17 Oct 2024 17:05:36 +0000 Received: by outflank-mailman (input) for mailman id 820847; Thu, 17 Oct 2024 17:05:35 +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 1t1TwN-0008TH-PG for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:05:35 +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 055c323c-8caa-11ef-a0be-8be0dac302b0; Thu, 17 Oct 2024 19:05:34 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184631161835.9593205812029; Thu, 17 Oct 2024 10:03: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: 055c323c-8caa-11ef-a0be-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1729184633; cv=none; d=zohomail.com; s=zohoarc; b=G9DjefLvn7Ru+/zbJhgbQf/oWEtG6w9X3bIJZ96hSFmnck49GVckqDLnmuA3682IGUaWsbYegHLO+bfkKQC90YUP+ymIi9P9qqKsgffrTSru886SSD3PbNPYH0LRCIqXT99Mz5lIz4wDwI6XJzRJe7imGhmwrVYtnCVmlzYKs08= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184633; 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=buUYqo46akp40axyhMLTCjGqzGXlUDMWgwiiv0Mju9Y=; b=nxMv2aHM6AytCLReXGvPa1qf+Ko0xf7uCwjHEE7Gd75DErgmdUhimnLuA8e9ioYg3R3Eh3X7YK7VMfWlDRWJemXU5fkb2YVpkwlPP5xNGbhMF0vGxjiEhT1/vyhGJcGsj+9653j70KD9ZQsjEaqtC3TkKHTniCK+4xm3HTeU2QY= 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=1729184633; 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=buUYqo46akp40axyhMLTCjGqzGXlUDMWgwiiv0Mju9Y=; b=Rt4/mpQfEreseFJGJfA1K+wlAgU0prYIMvig84X4FrsQCFL5W336te2DOKwrS1cD n+Gg9EzFSzlzi7s5uLYaJlzCIK5E/VlSKw0YGekg2RAO97mkMxcHIorDzJsDq+TB4K/ 6fOrqw0tCTQhTmKYY4VUZcyEzYJ79B/kC6zErDo8= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 13/44] x86/boot: transition relocation calculations to struct boot_module Date: Thu, 17 Oct 2024 13:02:53 -0400 Message-Id: <20241017170325.3842-14-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729184792254116600 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 Reviewed-by: Jason Andryuk --- Changes since v5: - removed unnecessary paddr_to_pfn, allowing condition to collapse to one l= ine - correct a missed conversion from .mod->mod_start to .start --- xen/arch/x86/setup.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index d51b0b03bc97..44cec48fc877 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1476,7 +1476,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) * move mod[0], we incorporate this as extra space at the star= t. */ struct boot_module *bm =3D &bi->mods[j]; - unsigned long size =3D PAGE_ALIGN(bm->headroom + bm->mod->mod_= end); + unsigned long size =3D PAGE_ALIGN(bm->headroom + bm->size); =20 if ( bi->mods[j].flags & BOOTMOD_FLAG_X86_RELOCATED ) continue; @@ -1488,15 +1488,13 @@ void asmlinkage __init noreturn __start_xen(unsigne= d long mbi_p) if ( highmem_start && end > highmem_start ) continue; =20 - if ( s < end && - (bm->headroom || - ((end - size) >> PAGE_SHIFT) > bm->mod->mod_start) ) + if ( s < end && (bm->headroom || (end - size) > bm->start) ) { - move_memory(end - size + bm->headroom, - (uint64_t)bm->mod->mod_start << PAGE_SHIFT, - bm->mod->mod_end); - bm->mod->mod_start =3D (end - size) >> PAGE_SHIFT; - bm->mod->mod_end +=3D bm->headroom; + move_memory(end - size + bm->headroom, bm->start, bm->size= ); + bm->start =3D (end - size); + bm->mod->mod_start =3D paddr_to_pfn(bm->start); + bm->size +=3D bm->headroom; + bm->mod->mod_end =3D bm->size; bm->flags |=3D BOOTMOD_FLAG_X86_RELOCATED; } } @@ -1528,11 +1526,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 < bi->nr_modules; ++i ) { - uint64_t s =3D (uint64_t)bi->mods[i].mod->mod_start - << PAGE_SHIFT; + uint64_t s =3D (uint64_t)bi->mods[i].start; =20 reserve_e820_ram(&boot_e820, s, - s + PAGE_ALIGN(bi->mods[i].mod->mod_end)); + s + PAGE_ALIGN(bi->mods[i].size)); } =20 if ( !xen_phys_start ) @@ -1610,9 +1607,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 < bi->nr_modules; ++j ) { - uint64_t end =3D pfn_to_paddr( - bi->mods[j].mod->mod_start) + - bi->mods[j].mod->mod_end; + uint64_t end =3D bi->mods[j].start + + bi->mods[j].size; =20 if ( map_e < end ) map_e =3D end; @@ -1686,12 +1682,12 @@ void asmlinkage __init noreturn __start_xen(unsigne= d long mbi_p) =20 for ( i =3D 0; i < bi->nr_modules; ++i ) { - set_pdx_range(bi->mods[i].mod->mod_start, - bi->mods[i].mod->mod_start + - PFN_UP(bi->mods[i].mod->mod_end)); - map_pages_to_xen((unsigned long)mfn_to_virt(bi->mods[i].mod->mod_s= tart), - _mfn(bi->mods[i].mod->mod_start), - PFN_UP(bi->mods[i].mod->mod_end), PAGE_HYPERVISOR); + set_pdx_range(paddr_to_pfn(bi->mods[i].start), + paddr_to_pfn(bi->mods[i].start) + + PFN_UP(bi->mods[i].size)); + map_pages_to_xen((unsigned long)maddr_to_virt(bi->mods[i].start), + maddr_to_mfn(bi->mods[i].start), + PFN_UP(bi->mods[i].size), PAGE_HYPERVISOR); } =20 #ifdef CONFIG_KEXEC --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729184776; cv=pass; d=zohomail.com; s=zohoarc; b=U2eQqMzkvUUEK6Bm09g5PgY/Gp9TV9zDQZ6vD3awLilEAFQTClP+I2TkonqvfQHVqULTZUqJyVb3rxi66Vlu5hv45A203I8V+VflWpxTZedA9tZ49wDO3+zFv8JJyjlnn41LjClumGZpnlUXlV6XKGz9+5KmVmU/R/8ll5RfhoA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184776; 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=3lVlOCpdm5TzR4Ue4fgJ/C+2B6QVGR3l2Wwg3ehYe0k=; b=cGt0J25rhirK+RlJ/OeTGQRRaDv1dHFkxcepLjW3tcU7Zio/raHYPyxHx1+O3qGdIPtg07UtwdTCnsw3ERJJTvkRYKMURrwpWqQA0RHUKPRiWQqNGyTpReyvxzh39OrOIu1A7Za1e1PpwVzAdwoYcMuq1pop94Cv/8Vvu4sqpk8= 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 1729184776340365.2846801395966; Thu, 17 Oct 2024 10:06:16 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820849.1234499 (Exim 4.92) (envelope-from ) id 1t1TwW-0000ge-3e; Thu, 17 Oct 2024 17:05:44 +0000 Received: by outflank-mailman (output) from mailman id 820849.1234499; Thu, 17 Oct 2024 17:05: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 1t1TwW-0000gX-0G; Thu, 17 Oct 2024 17:05:44 +0000 Received: by outflank-mailman (input) for mailman id 820849; Thu, 17 Oct 2024 17:05:43 +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 1t1TwV-0008TH-2v for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:05:43 +0000 Received: from sender3-of-o58.zoho.com (sender3-of-o58.zoho.com [136.143.184.58]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 09cb3731-8caa-11ef-a0be-8be0dac302b0; Thu, 17 Oct 2024 19:05:42 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184632344879.4637074312935; Thu, 17 Oct 2024 10:03: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: 09cb3731-8caa-11ef-a0be-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1729184634; cv=none; d=zohomail.com; s=zohoarc; b=hs0ya0EXGgdii09hB6B50gKi/B5NEM9YlQSpSJmaU5jX0HcI/s+qVQCuK1jh+/5Lp87oKIKItjCU0QEy8bIbX4oLRIHfFqdmSz6/StD7Gda1cLq+llyTEETZ++FfnUErq6a321XvNYhz9Uxx3Vj/BZ9dUakoMTMOMTdXJqZqJ60= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184634; 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=3lVlOCpdm5TzR4Ue4fgJ/C+2B6QVGR3l2Wwg3ehYe0k=; b=ZaQoxosUFrBxAC0LF+Oa4INnWTJ90CLG4siiB8Lcw3C9HbKuGQNRs0SOHOyrP9FsgGoXSZNhYNpzpsYiS1QIrO/voamWl53ifnqhd0HIcBnnJzn/S17vP6TEi5/0mJRARLljMA0AjxK3jgW/52Cx+92ImyN2+K91UOi+3lgrq/0= 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=1729184634; 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=3lVlOCpdm5TzR4Ue4fgJ/C+2B6QVGR3l2Wwg3ehYe0k=; b=qQ+jZvZju1WjCYDEgDCHPNCvO7bJ+4EtMAfCSVkHkBCgh5t7VcN+eOL6WhxYHyS3 GDKzV1gffCJoqcHp3ym7MxO+O6AXOGx4rhHgvSovRUXajCMwTCumeXn4z7w0CUZXcgv 0GvL5harq6b90/DfPMPsss9mffo4i4SrhJfonhV0= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 14/44] x86/boot: introduce boot module interator Date: Thu, 17 Oct 2024 13:02:54 -0400 Message-Id: <20241017170325.3842-15-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729184798563116600 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 --- Changes since v5: - documented help next_boot_module_index - switch to unsigned int for next_boot_module_index - changes identified that BOOTMOD_XEN was not supported, so added support --- xen/arch/x86/include/asm/bootinfo.h | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 5862054b8cef..3010e6f4af9c 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -62,8 +62,35 @@ struct boot_info { struct boot_module mods[MAX_NR_BOOTMODS + 1]; }; =20 -#endif /* __XEN_X86_BOOTINFO_H__ */ +/* + * next_boot_module_index: + * Finds the next boot module of type t, starting at array index start. + * + * Returns: + * Success - index in boot_module array + * Failure - a value greater than MAX_NR_BOOTMODS + */ +static inline unsigned int __init next_boot_module_index( + const struct boot_info *bi, enum bootmod_type t, unsigned int start) +{ + unsigned int i; + + if ( t =3D=3D BOOTMOD_XEN ) + return MAX_NR_BOOTMODS; =20 + for ( i =3D start; i < bi->nr_modules; i++ ) + { + if ( bi->mods[i].type =3D=3D t ) + return i; + } + + return MAX_NR_BOOTMODS + 1; +} + +#define first_boot_module_index(bi, t) \ + next_boot_module_index(bi, t, 0) + +#endif /* __XEN_X86_BOOTINFO_H__ */ /* * Local variables: * mode: C --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729184769; cv=pass; d=zohomail.com; s=zohoarc; b=SJIU3rP8bVfUSpdcZwrS2qGSQ7rLs9u1ooq1WTGMtQ2JcqpdospQLY0Zns0HfJJKYPryAV/yKJ9MWWL8jmLlC9MkCtiY8uF5QWPCZiTDpzouIBEjDrumBgjWbo7FsK31TQSKezmx7cfMFOToD3/R/v445k2y4jV+rgLApbGmcGA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184769; 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=UOSq2CQ+avjz4TDy8H9wvkgSNIMCssGHhL5g606izH0=; b=EaoUHRqLdY/U3efRh8nRvKCeW9LTlNV/38dUI2RbdNEwYC0GTxFe7ZZ9vVYDgUfTcRkM2vxNukgPCs59WnDoyaMiP52rxhgeGdGCOm/m1ZlmQ8UDXmPWc58F4QOt7bYp5eqnmp5ytYtV/x2hKzM1Kzv+6EwstzwIxw17Evsqj88= 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 1729184769152293.33883050175655; Thu, 17 Oct 2024 10:06:09 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820852.1234509 (Exim 4.92) (envelope-from ) id 1t1Twe-00019z-Bw; Thu, 17 Oct 2024 17:05:52 +0000 Received: by outflank-mailman (output) from mailman id 820852.1234509; Thu, 17 Oct 2024 17:05:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t1Twe-00019s-8S; Thu, 17 Oct 2024 17:05:52 +0000 Received: by outflank-mailman (input) for mailman id 820852; Thu, 17 Oct 2024 17:05:50 +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 1t1Twc-0008TH-BQ for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:05:50 +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 0dfb6901-8caa-11ef-a0be-8be0dac302b0; Thu, 17 Oct 2024 19:05:49 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184633549591.1849705803486; Thu, 17 Oct 2024 10:03:53 -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: 0dfb6901-8caa-11ef-a0be-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1729184635; cv=none; d=zohomail.com; s=zohoarc; b=bRqieGlVFZ/N04xtoYCV2/nB4oT+9dzFbm7jPyI55EBmij42qn6zfrhUYqdYSKj5G+Kph8LV2DNPhq974/BktseYSjAMIjna9UAq+639P74dxcBYtBpvZpiA6Np7iAUnscBnHkKBg/P8pVBeOqH+VMXRE8pqA/6EgPARw4H1e4E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184635; 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=UOSq2CQ+avjz4TDy8H9wvkgSNIMCssGHhL5g606izH0=; b=hNwIchschivOXSjMOrWOSXEpKNE9jrHA0ljfizKfslueb5CoLKnhYQ1xRuMFKosmI1SrGnI59m8QmvPnNBKKoCG5C6tcp7MAfT4peG7Dra2kLX6ptRSmqZfq54xZZ4JwuV87g1/jfuhobFivE+yn8w/UrSMaT+e3JcX3HH+04bs= 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=1729184635; 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=UOSq2CQ+avjz4TDy8H9wvkgSNIMCssGHhL5g606izH0=; b=tbfOUxOwC2qw65HyPaOR/AOqCwFrs30Hb+N6c49ws9ZGmdtizFGP1T/ykjx8UE0F MeVyqtcSe8rWG7wsdF31zxBnjVGhhIqwTJ/MRARWIO5raN5kouLAdhDtLVlxXqdfe7C hcxcnmRKE5xYkivyMh14JsrS56RUMMvODZoLfmFk= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 15/44] x86/boot: introduce consumed flag for struct boot_module Date: Thu, 17 Oct 2024 13:02:55 -0400 Message-Id: <20241017170325.3842-16-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729184791664116600 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 --- Changes since v5: - first flag assignment can be =3D instead of |=3D --- xen/arch/x86/include/asm/bootinfo.h | 1 + xen/arch/x86/setup.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 3010e6f4af9c..6903ab00ec90 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -42,6 +42,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 44cec48fc877..8261a87d9fb4 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -318,6 +318,7 @@ static struct boot_info *__init multiboot_fill_boot_inf= o(unsigned long mbi_p) =20 /* map the last mb module for xen entry */ bi->mods[bi->nr_modules].type =3D BOOTMOD_XEN; + bi->mods[bi->nr_modules].flags =3D BOOTMOD_FLAG_X86_CONSUMED; =20 return bi; } @@ -1180,6 +1181,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) bitmap_fill(module_map, bi->nr_modules); __clear_bit(0, module_map); /* Dom0 kernel is always first */ bi->mods[0].type =3D BOOTMOD_KERNEL; + bi->mods[0].flags =3D BOOTMOD_FLAG_X86_CONSUMED; =20 if ( pvh_boot ) { @@ -2068,7 +2070,10 @@ void asmlinkage __init noreturn __start_xen(unsigned= long mbi_p) =20 initrdidx =3D find_first_bit(module_map, bi->nr_modules); if ( initrdidx < bi->nr_modules ) + { bi->mods[initrdidx].type =3D BOOTMOD_RAMDISK; + bi->mods[initrdidx].flags |=3D BOOTMOD_FLAG_X86_CONSUMED; + } if ( bitmap_weight(module_map, bi->nr_modules) > 1 ) printk(XENLOG_WARNING "Multiple initrd candidates, picking module #%u\n", --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729184792; cv=pass; d=zohomail.com; s=zohoarc; b=ODn70C+RTVvya6vdCiUZdQHn/cJ6YsxL+LqtcsYAFGm0Jbd7DIXkiDcYl3jM0FrljVUdJRRpu4Yae5ZByBcxCW8JcvTO7feTK/Q+RgoSOE8ywkf4kJZ0JghCypuLj6Ot+EvB08XwIxUl+vzATyFbwyrxoEXCwDUyUhELu/aOM2I= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184792; 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=HqxZ6XJiXLCqmaSWp0mzQral5RGgZ8p3yBsfBpkK9gk=; b=FmPz1iGV71mFCHmfuAAUK342qlPXNcgeHKB19ZltIhvlbh/RRZLq0jrOOPY5qbIBYSs/PtAAeBEoPjF4xhNdiw2CUddsrWHSGN5ARlChOq6QcChRrgv7OLASVozpP9vjqfZW0NYBV5AG+uWuN/exJ0zgOfykQ5WHIQtb5dMORb0= 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 1729184792356528.3832737695536; Thu, 17 Oct 2024 10:06:32 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820862.1234519 (Exim 4.92) (envelope-from ) id 1t1Twm-0001gj-Ih; Thu, 17 Oct 2024 17:06:00 +0000 Received: by outflank-mailman (output) from mailman id 820862.1234519; Thu, 17 Oct 2024 17:06: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 1t1Twm-0001ga-Fc; Thu, 17 Oct 2024 17:06:00 +0000 Received: by outflank-mailman (input) for mailman id 820862; Thu, 17 Oct 2024 17:05:59 +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 1t1Twl-00014B-B8 for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:05:59 +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 12ce7763-8caa-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:05:57 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184634817591.1928959407942; Thu, 17 Oct 2024 10:03: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: 12ce7763-8caa-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184637; cv=none; d=zohomail.com; s=zohoarc; b=M4y3G8O6JKAiI5vqQXyZGSBHMpOQi9SRILP7EUkG1d3qbOcyyr9bqBStZmMSgHXr+Sl1WcFMnPm77pucsYelTNZijkaCMS22LXuvuUyJkxIqDHKfh6wi01dOQxsU+9s+TKJ6QmjQdEFtgN6Qd3mDFae47FYP0M5FwjOGjEW6j38= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184637; 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=HqxZ6XJiXLCqmaSWp0mzQral5RGgZ8p3yBsfBpkK9gk=; b=cFj3x4xlFQcRAzC8mUlTRHqwKRuPW4aHFMd2J93PkCwYdzr+h+hC9KUb+l+m/QKV95M9/kuf9XywA5gL/M1YTMatPJsNugJLHFg4tq/i+KMDpA2sUnTgue/+jxCCLooFscao35yCbfPjXSQ5CIYcxANcSfRoEno27Fc6sX0l530= 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=1729184637; 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=HqxZ6XJiXLCqmaSWp0mzQral5RGgZ8p3yBsfBpkK9gk=; b=kUz/DnUCHxdAWmKwQhTk8VJzXlt+TZeZsF59yAWSNZrgdDOcr/uqbP5629PRiXo7 8rRPhKm1ck39Dy9T1R9FHqh4aO1hC9ZVcn651oBaxCA0gH7gg3gRic89kMWTWvtWwyy ZEfrwcjmHlTUPawNquEWUUkB/4IZdaQ8Rf78Q9gk= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: Andrew Cooper , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, "Daniel P . Smith" , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 16/44] x86/boot: split bootstrap_map_addr() out of bootstrap_map() Date: Thu, 17 Oct 2024 13:02:56 -0400 Message-Id: <20241017170325.3842-17-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729184809763116600 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 Reviewed-by: Jason Andryuk --- Changes since v5: - moved bootstrap_map_addr() to being static to setup.c --- xen/arch/x86/setup.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 8261a87d9fb4..852454c161ee 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -442,24 +442,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) +static void *__init bootstrap_map_addr(paddr_t start, paddr_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 @@ -475,6 +473,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 Thu Nov 21 21:35:13 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=1729184799; cv=pass; d=zohomail.com; s=zohoarc; b=Za+u6RVb4+ZIB7PyZ4oCHxl4lScMX4++sXtvlwXKd10/QsPNUvs5I4OZrDSRfi5OQGrgAfi2/fB18W7YzYEv+Ih6iHMlrqZKasQUtDlFxjAGSJzEDgJG8rzRkSSUkyl2ZLMrvQto+6OgJ6EEcy/tHeoz7vjtSXoC8u5tQbXgsJQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184799; 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=mEfInqFkYxY5RZVtNiKPHgUhdYnWLo2IuwYz96mD0y4=; b=FSKokxo+Y9a4CQ1nCe8mHSn4BGOdtcwAxWHL45jBNuOt6mmpDBUV7VGAHAc11jZnlJJWCOpYDcowWDaJEyxJ2Yihl2ePWQYcIPfybcDmzclt6dM5jVsEWMWHzsaFb/jOur1eVOslQIfE9Cp4kkem6Yog/omZkX2P/bQGhkT66Wo= 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 1729184799625864.4076582410911; Thu, 17 Oct 2024 10:06:39 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820865.1234528 (Exim 4.92) (envelope-from ) id 1t1Twu-0002Af-QN; Thu, 17 Oct 2024 17:06:08 +0000 Received: by outflank-mailman (output) from mailman id 820865.1234528; Thu, 17 Oct 2024 17:06:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t1Twu-0002AY-Na; Thu, 17 Oct 2024 17:06:08 +0000 Received: by outflank-mailman (input) for mailman id 820865; Thu, 17 Oct 2024 17:06: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 1t1Twt-00014B-Ui for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:06:07 +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 1804ce12-8caa-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:06:06 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184636285638.5734527381169; Thu, 17 Oct 2024 10:03: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: 1804ce12-8caa-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184638; cv=none; d=zohomail.com; s=zohoarc; b=Q7r4nHSVDq5gQXeVmJvZns0msN1qkLbRSMFtRD5dm70aFF+PWpFc9HhCBHNHiwhcrnnrVJU5z0T11OUvA7SbRwyS8bBP96XEq725q8PBS3K1ydYyKq0p02JMgxLo06WS1dk0yvRgFdGlM530DJaZDSaGgEVjkzm5KLo0kvlQ9b8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184638; 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=mEfInqFkYxY5RZVtNiKPHgUhdYnWLo2IuwYz96mD0y4=; b=OH1WOhblMEbskTZ5gd+jMxSUbyekb8sDrrjgoZQnFHiPmoNYPa67XBnVOC0AxJdVSv2JR+uWr4KY9I00adDOzWa9rWFbqaydd5wRH59kt92xWbxAZrJlmu5lsH9a83Yh8QEzpVS69p89p8CZ5mfCQj/eG3H7IwaE5hgpK9L21MM= 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=1729184638; 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=mEfInqFkYxY5RZVtNiKPHgUhdYnWLo2IuwYz96mD0y4=; b=MjxdYnmfmkS1pCZB/lpCPSatWm43UxUnNJX+nozJAGKBP0cslJgLTjHS3LJrSHvW 2T87ZTKb7c9Aeds2mQX+kEef9L/3CK8NtlJ2zryo/GEWYvycGDYOCViiBu8s/nNw2Ku VpIdn5Yy5AmnFbTtbgGhfaqCn9M5vw2p9VH1GurE= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 17/44] x86/boot: convert microcode loading to consume struct boot_info Date: Thu, 17 Oct 2024 13:02:57 -0400 Message-Id: <20241017170325.3842-18-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729184815242116600 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. To support loading the microcode boot module in to the bootstrap map, intro= duce bootstrap_map_bm() for mapping struct boot_module. Signed-off-by: Daniel P. Smith --- Changes since v5: - moved bootstrap_map_bm definition to this commit --- 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/include/asm/setup.h | 2 ++ xen/arch/x86/setup.c | 12 +++++++-- 5 files changed, 38 insertions(+), 28 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode= /core.c index 8564e4d2c94c..22fea80bc97e 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 @@ -153,10 +154,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; @@ -178,16 +177,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_modules; 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; } @@ -205,20 +204,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, 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_modules; + if ( ucode_mod_idx <=3D 0 || ucode_mod_idx >=3D bi->nr_modules || !__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].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; @@ -822,8 +819,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 @@ -832,7 +829,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), @@ -879,7 +876,7 @@ static int __init early_microcode_update_cpu(void) } =20 int __init early_microcode_init(unsigned long *module_map, - const struct multiboot_info *mbi) + struct boot_info *bi) { const struct cpuinfo_x86 *c =3D &boot_cpu_data; int rc =3D 0; @@ -922,7 +919,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 6903ab00ec90..19a0ed16ab27 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -20,6 +20,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..495c8f7a7cc5 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, 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/include/asm/setup.h b/xen/arch/x86/include/asm/se= tup.h index 3d189521189d..729f68ca23b8 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[]; @@ -37,6 +38,7 @@ extern struct boot_info xen_boot_info; unsigned long initial_images_nrpages(nodeid_t node); void discard_initial_images(void); 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 852454c161ee..04de06ba1400 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -482,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) { @@ -1377,7 +1385,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, bi); =20 if ( xen_phys_start ) { @@ -1929,7 +1937,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, bi); /* Needs xmalloc() */ =20 tsx_init(); /* Needs microcode. May change HLE/RTM feature bits. */ =20 --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729184874; cv=pass; d=zohomail.com; s=zohoarc; b=DIAk6ot0OiByGy61AFxVuHyE9ZqASDrjFPj7L1Hs9UnN6FoK844vJzXMVsf7aRKjIuS1zHnQ7pjPhKKX+4HJyTR+dGjl53oP8UJysDHcHSbWCyvy5P2gS3oZ8ExTnAxMGSMbSQ4ESBiYtfhBC25BmOJxntz56INf7aICdQoOKzY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184874; 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=IYHnqAORfDi1eC8Y7S7zVhUJU72K5GjJXVS7llgVqYI=; b=TI8iI6AzEVuXAbI3ngvSMBKkkxF5Uk2fkXZrghL2S9y2Q6YAB+7d/tc+eJyhGj7jq5uFVOtwpK43mlNOXSC7WQk/RSo1MmflzKhTW1S4U2jDg9JT2toR2mKEn8cRwDqI5iZVjqNRm8JDfRXrmPwbdWRbmG2ReSx3s5r2WhyQg5w= 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 1729184874861783.1914772380082; Thu, 17 Oct 2024 10:07:54 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820881.1234558 (Exim 4.92) (envelope-from ) id 1t1TyG-0004Sf-Kk; Thu, 17 Oct 2024 17:07:32 +0000 Received: by outflank-mailman (output) from mailman id 820881.1234558; Thu, 17 Oct 2024 17:07: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 1t1TyG-0004SW-Hs; Thu, 17 Oct 2024 17:07:32 +0000 Received: by outflank-mailman (input) for mailman id 820881; Thu, 17 Oct 2024 17:07:30 +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 1t1Tx1-00014B-Fz for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:06:15 +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 1c96bce4-8caa-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:06:13 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184637493451.84421739071854; Thu, 17 Oct 2024 10:03: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: 1c96bce4-8caa-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184639; cv=none; d=zohomail.com; s=zohoarc; b=ER0ju3p2fPTCk6jegIRIWVHZCZiFqjUM0aihbhLMWQK0hQ2/Ur+sM9Yv/gJYYEHALYcOCVQDNwI0xZFjFXXHiIlb/rzwQpER173Y4eslYDMawLfmG157QePXP6Ux8bWtt/KXW0VajU5bDbhXZFkvRLlFXgbDSRcP2ld/p8sZhl8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184639; 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=IYHnqAORfDi1eC8Y7S7zVhUJU72K5GjJXVS7llgVqYI=; b=DctUKoEGuoA8Rdr9m63PNBizaKu5a4n2j/hCYDvddsc3z2F56vCUjzRlsxvgAlp1rLozQMSWC7D9zReEToZpdlbJOeOzJUjVTQA+YWcM3hJGxWGbnyW4bGq9xC4ZFGvHa6ZtNCnFyANbeLEu1+JcCdwE5+AWKIpiDjepXmISV88= 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=1729184639; 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=IYHnqAORfDi1eC8Y7S7zVhUJU72K5GjJXVS7llgVqYI=; b=Gky6augRufFxhCCGQoCHMsQCCvAVH1Ed2IHZ2UOnHu95P5BAUqqfPDkplBb0OqZl usAn+3rUYty4DhUMfO2ScdDvbuekt2MBsOe+i1DDUloVskaIJRMo4pY5g+qhbgUJPyh 4zlbbZviL6xtvzyOXglv3VQPHV8DCPeKo2opNFmk= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 18/44] x86/boot: convert late microcode loading to struct boot_module Date: Thu, 17 Oct 2024 13:02:58 -0400 Message-Id: <20241017170325.3842-19-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729184895676116600 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 Reviewed-by: Jason Andryuk --- 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 22fea80bc97e..7bcc17e0ab2f 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; @@ -98,7 +97,7 @@ struct patch_with_flags { =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; @@ -199,7 +198,7 @@ static void __init microcode_scan_module( ucode_blob.data =3D cd.data; break; } - bootstrap_map(NULL); + bootstrap_map_bm(NULL); } } =20 @@ -212,7 +211,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].mod; + ucode_mod =3D bi->mods[ucode_mod_idx]; scan: if ( ucode_scan ) microcode_scan_module(module_map, bi); @@ -766,14 +765,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; @@ -831,9 +830,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 @@ -852,10 +851,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 ) @@ -921,7 +920,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 Thu Nov 21 21:35:13 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=1729184937; cv=pass; d=zohomail.com; s=zohoarc; b=enSNHslbUV34e8e5oT/lEHLNn+Gs8dn8p4U4rlcwdnZ3RWIAFoxG/S0eLjAbvIRbFRsY55zXGz+LcAv4Tbs0Ec7SDGhPHJ9EA2ObAsu/TmlXGmzH5v/+YRSXaGS0mO09KBw7h48KZLEw3HHGl8IWXEJButKtdG4eDqwBegmKEFc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184937; 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=VF4eHm6uxrTpSrtxk8vxbuolB5VgBKHNdcHv6nx9QeQ=; b=izjbpze6q/x7t02ci9I7rgLi/u75P/QwMSEhPaEuz1dg9bhsiR/TO9zyqt/La7quSssPktekRd6wc520qola2rvJtUMC46NbQnJBHsKQgEteAl+WINru1xoBFx8EkJf7Ro+I8Umffd6xptXJn4asICJg+QNW6nT4PKHpA3d8g64= 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 1729184937586703.0394590394538; Thu, 17 Oct 2024 10:08:57 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820901.1234639 (Exim 4.92) (envelope-from ) id 1t1TzL-00006x-Qd; Thu, 17 Oct 2024 17:08:39 +0000 Received: by outflank-mailman (output) from mailman id 820901.1234639; Thu, 17 Oct 2024 17:08: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 1t1TzL-00006n-MI; Thu, 17 Oct 2024 17:08:39 +0000 Received: by outflank-mailman (input) for mailman id 820901; Thu, 17 Oct 2024 17:08: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 1t1Tx8-00014B-N8 for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:06:22 +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 20cfa8ef-8caa-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:06:21 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184639096561.6358775710053; Thu, 17 Oct 2024 10:03: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: 20cfa8ef-8caa-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184641; cv=none; d=zohomail.com; s=zohoarc; b=MV3u8BzJ/LpTzbG91Beu7DO1aL2ciVRH+ZszcL8ha8+8/ddu+5Cp+Bx/E2yGoNU91+9mSLTWkcHExtp5JVOZed8Mch5pGIbPTBto1VR8JYmu3DCi5zUymDklg20v4U/6g8FhusjEyC2gukZp++b9lRsDH2wthVAp4abM60NbNhM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184641; 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=VF4eHm6uxrTpSrtxk8vxbuolB5VgBKHNdcHv6nx9QeQ=; b=YOeAlAQ8UqXDMkHJh4D/3cXI9R/bnPhlQYpeQYXz+XQJ6KkzKSlWwgFMRDjcicLHlBrwS/1Z1pJsWxdgNcMNaS9WFiNyLRZkWEbeCH6uZszHRXyDooGz/+eqs22ld6G8S+SUwxMBBYRJ2dFOOudnu/hh7v1DzM7XawbdkUc0LxE= 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=1729184641; 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=VF4eHm6uxrTpSrtxk8vxbuolB5VgBKHNdcHv6nx9QeQ=; b=aMxZe0CvWweY1pZjHQuHKYRrnyTiYEOiQvK/qww0sZ+x7duhNG7OzwTz//8iS3l8 eHx0u0Xp53vGNZ+my0Ewiu/HSN0l0BWACQVRShO7vPGiQnhJkK+Njl3PRLSFwSwxWa2 PhDaeRIDkoSDo6l+xtSOlKQ6ed3C2wBaaSKGb03k= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 19/44] x86/boot: use consumed boot module flag for microcode Date: Thu, 17 Oct 2024 13:02:59 -0400 Message-Id: <20241017170325.3842-20-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729184957631116600 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 7bcc17e0ab2f..5b42aad2fdd0 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; @@ -211,7 +211,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); @@ -769,10 +769,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; @@ -826,14 +826,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; @@ -851,10 +851,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 ) @@ -920,7 +920,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 Thu Nov 21 21:35:13 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=1729185584; cv=pass; d=zohomail.com; s=zohoarc; b=JOY1JMzOyU+PvreSgeaIc57QhT7FZgq3eiwELYFiFMFzPiBjpAwveSnrbb5dMpcYBWqrOsiCM7hGkUYpTGvzkW4vZSVJ203P49hC62jiYw1h4MvVPo6GRxOZJNJTH3/lieJJA1IVdtyqj66CeP0AR58qT2q5YfRXWpSp3d7Wtyo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185584; 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=GjWn8P4/iAki6mlp0w0Xm+yUTIZ9w1BAGBcnDQ6vMwM=; b=ISY2/RmaqqkriKjWAbvLzNBSHFE6dv5/6hHKiadjVAH6egEZdtpTFAJgft2nLawL1clj308ItAZq314mzDkkWma9+mJXtZ+Jp+19cUIjnf5UATm/i0opEQM/ZU1k6ACEak+uroJTK0AVb0aZsYKvr0Vx6W75WipbvodoO9I7VbA= 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 1729185584917117.83957898386029; Thu, 17 Oct 2024 10:19:44 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820992.1234782 (Exim 4.92) (envelope-from ) id 1t1U9i-0000jv-85; Thu, 17 Oct 2024 17:19:22 +0000 Received: by outflank-mailman (output) from mailman id 820992.1234782; Thu, 17 Oct 2024 17:19: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 1t1U9i-0000jm-4M; Thu, 17 Oct 2024 17:19:22 +0000 Received: by outflank-mailman (input) for mailman id 820992; Thu, 17 Oct 2024 17:19: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 1t1TxG-0008TH-Pu for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:06:30 +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 2621499d-8caa-11ef-a0be-8be0dac302b0; Thu, 17 Oct 2024 19:06:29 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184640324617.7081638090145; Thu, 17 Oct 2024 10:04: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: 2621499d-8caa-11ef-a0be-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1729184643; cv=none; d=zohomail.com; s=zohoarc; b=GudBkxNB4uk1sueWWl+b+OP6jTJXLFAeyzYM8YUWdxnyr+bK/gVchS0QTLyxsKoFxE7DdP5s3e08ZWH7fb6uUN7S12N8Hh8PgvTUXlEqmKLBmJ+K/BUMQD46W5ct7jdJCl/aIzotiZELXhjFVH+YWESa4B/KhlhzXLkyZ1mDrxI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184643; 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=GjWn8P4/iAki6mlp0w0Xm+yUTIZ9w1BAGBcnDQ6vMwM=; b=LpYrwgK9bfZueJBU+SAUDU1e3bU5wodF29i6gi1+jPXnXoZE9ow843hw6Yc9ovQYURESv9FJZig+f94DZ/daVKxVlntlBzTGIYtN6yc4tJRiCTy8GwX+7faLJNoy3xy1ITWMGysEwE6I7qjep+nArvqkLA1wz5yE203zmPzJVLw= 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=1729184643; 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=GjWn8P4/iAki6mlp0w0Xm+yUTIZ9w1BAGBcnDQ6vMwM=; b=TkoQ29bQlwlOP19lG7oy5Zjm46vD9LKMur7RO34njb2dqGPpF02cR1T43nSTDWSP c3Q+bGHEPk7vTw70gM5qvW6JCt4KYx6X8Pbl2ZpM54BfMqc2M0uOGjbv3JUZF67V2ez 9mPBEwPVrlWQPZz8o/kGuKb3nFAhrBKtVsp1Fulg= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 20/44] x86/boot: convert xsm policy loading to struct boot_module Date: Thu, 17 Oct 2024 13:03:00 -0400 Message-Id: <20241017170325.3842-21-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185585246116600 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 Reviewed-by: Jason Andryuk --- Changes since v5: - replaced bootstrap_map with bootstrap_map_bm - make init function definitions consistent in dropping const on *bi --- 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 | 17 +++++++++++++---- xen/xsm/xsm_policy.c | 15 ++++++++------- 5 files changed, 30 insertions(+), 16 deletions(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 19a0ed16ab27..8b63eb27d6dd 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -21,6 +21,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 04de06ba1400..a4ddcb908626 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1863,7 +1863,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, bi); =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..f155d10e718c 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, struct boot_info *bi); int xsm_multiboot_policy_init( - unsigned long *module_map, const multiboot_info_t *mbi, + unsigned long *module_map, 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, struct boot_info *bi) { return 0; } diff --git a/xen/xsm/xsm_core.c b/xen/xsm/xsm_core.c index eaa028109bde..6f034f70428d 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, struct boot_info *bi) { int ret =3D 0; void *policy_buffer =3D NULL; @@ -150,18 +151,26 @@ 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 ) { - bootstrap_map(NULL); + bootstrap_map_bm(NULL); printk(XENLOG_ERR "Error %d initializing XSM policy\n", ret); return -EINVAL; } } =20 ret =3D xsm_core_init(policy_buffer, policy_size); - bootstrap_map(NULL); + 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_bm(NULL); =20 return 0; } diff --git a/xen/xsm/xsm_policy.c b/xen/xsm/xsm_policy.c index 8dafbc93810f..921bb254b9d1 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, 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_modules-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 Thu Nov 21 21:35:13 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=1729185447; cv=pass; d=zohomail.com; s=zohoarc; b=nJyDwwS4P6GdCU1xQGuYxRbPjjdXcM+zfo/UcISA2cHANrlc6myw4oTVJ+gkwxNuINGpk6l1pXJ3SBC9yfVWRPLVtPjtlj+9QFfDSdwoCTYJn0l2QG3Euxwd4e0sVTIZITfgqXZQiBXeaHISd0n3M4jJoB+lhV+vxD5pOeP62K8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185447; 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=a9E8yTqYav2aI/xh1POt8XbQvYtTU40bLqsYbWj2y9s=; b=fsi3tfrkiXDPH+UMrMbIsj50nuS4Zn0z2okBPrlz01VTcUSh7O3DDMZWI3Nxc6IoEhLfVgYBpX8tSI9cwLtBJ920ZsTuRrrVUmnHygX1k+NtwLRazzSU71iPPvhdQs3em40hqBbmbtzQ5V/WPtcLw6l8csfUEy/1uqciJilte7Y= 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 1729185447456377.83317041586645; Thu, 17 Oct 2024 10:17:27 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820939.1234682 (Exim 4.92) (envelope-from ) id 1t1U7V-00049g-El; Thu, 17 Oct 2024 17:17:05 +0000 Received: by outflank-mailman (output) from mailman id 820939.1234682; Thu, 17 Oct 2024 17:17:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t1U7V-00049Z-B1; Thu, 17 Oct 2024 17:17:05 +0000 Received: by outflank-mailman (input) for mailman id 820939; Thu, 17 Oct 2024 17:17:04 +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 1t1TxO-0008TH-ST for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:06:38 +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 2b0226f4-8caa-11ef-a0be-8be0dac302b0; Thu, 17 Oct 2024 19:06:38 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184642001935.7928067426468; Thu, 17 Oct 2024 10:04: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: 2b0226f4-8caa-11ef-a0be-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1729184644; cv=none; d=zohomail.com; s=zohoarc; b=VThMhDqlfyEbcCaSZ4XQ//QSDbd2FvoW9cNkyRyOmoBaUzboZAO8jIZQ684Sea4w4Jet6lIYaVAMgXg+iMB2ti8L/iYyXv+VsFB2P1E9HK4xwlnukuQjgUL2Nx1i+WXxDhFDbXLMBlZqCuvu92q538ubRWRT7gc77rCnhBuQl+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184644; 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=a9E8yTqYav2aI/xh1POt8XbQvYtTU40bLqsYbWj2y9s=; b=aIkOl1TcwtmHYXqTQ8rMRfsLaKTijG8zrJvjstr2pTH8AKcEH8seC4pOwmBO+hB7FxMV1Z10c8qWWx8KbEscCD2eyetxKyewZTuCvj1Cf90Hzc0tZRxBXIjff7ykRGOT9B6omFkllzJfiwq6wI706TeSM9dZ3gYgaawPk+03wa0= 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=1729184644; 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=a9E8yTqYav2aI/xh1POt8XbQvYtTU40bLqsYbWj2y9s=; b=NCkCTvtSUm3XGj5CqdsH7YFc300BedFexRbHOP785xaw2+Ixc7K2d9ljI/IjUh5L ny7r0a6y9ONM8g7ygDWHHIQnP0M1FX1HUP2uMY/8KL/dXoqY8F/P86c2RrRo/IPgUh1 AweAdVo2Fvm4nar/s4oJFrUCIx7nmnfINi7tRNpw= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 21/44] x86/boot: convert ramdisk locating to struct boot_module Date: Thu, 17 Oct 2024 13:03:01 -0400 Message-Id: <20241017170325.3842-22-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185448232116600 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. In the change, the new boot module iterator is used to find the initrd index, which returns a signed int. Switch initrdidx from unsigned to signed. Signed-off-by: Daniel P. Smith Reviewed-by: Jason Andryuk --- Changes since v5: - adjusted initrdidx check for prior changes to boot module search function --- xen/arch/x86/setup.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index a4ddcb908626..6ba8a893daf0 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -2083,16 +2083,23 @@ 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, bi->nr_modules); - if ( initrdidx < bi->nr_modules ) + /* + * 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(bi, BOOTMOD_UNKNOWN); + if ( initrdidx < MAX_NR_BOOTMODS ) { bi->mods[initrdidx].type =3D BOOTMOD_RAMDISK; bi->mods[initrdidx].flags |=3D BOOTMOD_FLAG_X86_CONSUMED; + if ( first_boot_module_index(bi, BOOTMOD_UNKNOWN) < MAX_NR_BOOTMOD= S ) + printk(XENLOG_WARNING + "Multiple initrd candidates, picking module #%u\n", + initrdidx); } - if ( bitmap_weight(module_map, bi->nr_modules) > 1 ) - 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 --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729185599; cv=pass; d=zohomail.com; s=zohoarc; b=YLEKnnZJ4XH83KdKTFi7Q37RY7IAlfGzjPdV1D1D+Qq2MJ92uIQxYAOxFdoLVEGBjfMY8DJqBmSEriRR+0mY6ngRbnNlr1oDgYzmkvO5TifcrMriub1oRdNIcNbluQtTRx2LH7kxHW9YegnI9idCSuyrRBE8XdfeaAVoPIO2KvI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185599; 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=fMkGfujHPoOjChPMwwzqPao8q0VWxzzsdGo5pHHHDFY=; b=jbEMqs1jzLj5wsSieswbIvnM7dSaaMJ/hSP5uhPdgP0OXaAkFBSh2NdKPsWUDadOTv8NgJ1cRv9cvIpdm1yRI7CYVJQtDPXvpjdori0ulFht0cEMbuG6lYelJPRc396/j3p8M7U89SXVZoZzgjxlfpwrrqPT+G/8XpAmdAe/B4s= 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 1729185599252399.2566397871077; Thu, 17 Oct 2024 10:19:59 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820991.1234772 (Exim 4.92) (envelope-from ) id 1t1U9g-0000P8-0S; Thu, 17 Oct 2024 17:19:20 +0000 Received: by outflank-mailman (output) from mailman id 820991.1234772; Thu, 17 Oct 2024 17:19:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t1U9f-0000Ox-Sc; Thu, 17 Oct 2024 17:19:19 +0000 Received: by outflank-mailman (input) for mailman id 820991; Thu, 17 Oct 2024 17:19:18 +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 1t1TxW-0008TH-Pd for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:06:46 +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 2fb3dcb7-8caa-11ef-a0be-8be0dac302b0; Thu, 17 Oct 2024 19:06:45 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184643193190.33025190860144; Thu, 17 Oct 2024 10:04: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: 2fb3dcb7-8caa-11ef-a0be-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1729184645; cv=none; d=zohomail.com; s=zohoarc; b=aZe4itBBnJA2y9TxgpuNou8I7xD39engfcpAbjXrG+C8EqbJ4vl+doeSIXfiKjkQvwbgPuXe+VRACv/us7s/sY1L1GrnaNwweIdHdfJPKNs3SvF8KiR5PGqYoATKgVEonxNhQ1kvPwWNFT/uJuH+gqAdAH5vzNi6QMYMOJlkTYU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184645; 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=fMkGfujHPoOjChPMwwzqPao8q0VWxzzsdGo5pHHHDFY=; b=kCNym6KselYtzkaoiRE54OKnmGVijOgHVABlUOxI5KU2yWgieDHQqzMv/jrig45TyTpTTBA/wcJlB+KbpHxCnfrw/r9w5JFW6ne0jD3MB641n7JmHdToOiAvBEHXGvHEMEqqy012Jyloh3Sw0+P/5Iq57TC7ZcIm0HQR+H+IzmI= 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=1729184645; 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=fMkGfujHPoOjChPMwwzqPao8q0VWxzzsdGo5pHHHDFY=; b=noYIythe3ulKS3B18DOV2DkKiCX8BtzIW/ZfL3MVh6Sk918EvpHtk2ZE9s+XESi6 piRf3NFbfZi+01nPJGk1gJukqCh8jwU8KUSRStPWZkj3jzaRuY9dm47ZCBHzWVEXacm RuSybzs+4hntfMgvXISl/uNbDs45acJ9Bx3F8zCc= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 22/44] x86/boot: remove module_map usage from microcode loading Date: Thu, 17 Oct 2024 13:03:02 -0400 Message-Id: <20241017170325.3842-23-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185601302116600 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 Reviewed-by: Jason Andryuk --- Changes since v5: - dropped unnecessary parens --- 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 5b42aad2fdd0..23984c69bce7 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -152,8 +152,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; @@ -178,7 +177,7 @@ static void __init microcode_scan_module( */ for ( i =3D 1 /* Ignore dom0 kernel */; i < bi->nr_modules; 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]); @@ -202,19 +201,18 @@ static void __init microcode_scan_module( } } =20 -static void __init microcode_grab_module( - unsigned long *module_map, struct boot_info *bi) +static void __init microcode_grab_module(struct boot_info *bi) { if ( ucode_mod_idx < 0 ) ucode_mod_idx +=3D bi->nr_modules; if ( ucode_mod_idx <=3D 0 || ucode_mod_idx >=3D bi->nr_modules || - !__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; @@ -818,8 +816,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 @@ -828,7 +825,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), @@ -874,8 +871,7 @@ static int __init early_microcode_update_cpu(void) return microcode_update_cpu(patch, 0); } =20 -int __init early_microcode_init(unsigned long *module_map, - struct boot_info *bi) +int __init early_microcode_init(struct boot_info *bi) { const struct cpuinfo_x86 *c =3D &boot_cpu_data; int rc =3D 0; @@ -918,7 +914,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 495c8f7a7cc5..84e0eb487244 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, struct boot_info *bi); -int microcode_init_cache( - unsigned long *module_map, const struct boot_info *bi); +int early_microcode_init(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 6ba8a893daf0..e1763d7e6548 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1385,7 +1385,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, bi); + early_microcode_init(bi); =20 if ( xen_phys_start ) { @@ -1937,7 +1937,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) =20 timer_init(); =20 - microcode_init_cache(module_map, bi); /* Needs xmalloc() */ + microcode_init_cache(bi); /* Needs xmalloc() */ =20 tsx_init(); /* Needs microcode. May change HLE/RTM feature bits. */ =20 --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729185498; cv=pass; d=zohomail.com; s=zohoarc; b=GAv01RKbnKtgHLaHv/9LIQOtj3/X88g0J8QTpBNqXoShe7+e6wr5KtElGISde74CSapx3Q16Uw47HUV4Ms1y/1N//BPyILzVN/Xreh/RkbSHA2MO74UFMvvTn0KujvdKpApsmIeoSOFbN1lnXVmK1Ot62Jj4Jmm4CEvpv0d1Gqk= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185498; 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=INdU8Vy7H1JFe+GjwDiltbnyksHVP3i84VMPvIn3WAY=; b=i8m4Nz15whKEqj/u0Pqy/XYu/srZ76tsCRLE9i7TpaJMkzi7OyACQObzXBeWk9rpj440h06DY8FGKXubV58xAohXUGzC1yIg8rXE3En8trkrBlvrMb/ThO3Bw1Il48FpjJ2z//P1DvGHsUwbidvibq0d69rFsvTJoKPMPbpHho4= 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 1729185498751835.2463680915754; Thu, 17 Oct 2024 10:18:18 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820968.1234711 (Exim 4.92) (envelope-from ) id 1t1U8O-0006Ec-2e; Thu, 17 Oct 2024 17:18:00 +0000 Received: by outflank-mailman (output) from mailman id 820968.1234711; Thu, 17 Oct 2024 17:18: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 1t1U8O-0006ET-09; Thu, 17 Oct 2024 17:18:00 +0000 Received: by outflank-mailman (input) for mailman id 820968; Thu, 17 Oct 2024 17:17:59 +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 1t1Txe-0008TH-Dk for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:06: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 3453d31c-8caa-11ef-a0be-8be0dac302b0; Thu, 17 Oct 2024 19:06:53 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184644453447.45974491621405; Thu, 17 Oct 2024 10:04: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: 3453d31c-8caa-11ef-a0be-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1729184646; cv=none; d=zohomail.com; s=zohoarc; b=n+mu8ezXWcs5uab9RtWpeEcNuIZz3J4tj/l91FTvYbwJ5O3gPGdos+RdqiEBiO4+AAz5Um26RWduIIRTMlGlzxSMqd/H+6HEfGUgM9pGc5FpxxHQbtdy70IF6LRi/FtOLcKyCuj3lAQPtTNT3jQp5/eJLJ5bHvu80OLijnnQYWA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184646; 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=INdU8Vy7H1JFe+GjwDiltbnyksHVP3i84VMPvIn3WAY=; b=IM5m2bZpAHgXSJckzMrAzCyhZWgH94E41bX95fRmC1Nh/rFlgOkfiFKqMhbNMYmTayRi6tYLsTxx6F92p5lrHYyrqN2foBzpUrx70z8xUJyAG9IYG50HoxEaxOxo4NZ3b50zaRMCVk+07NCPvEyFg2QvweEoZ5jUNwOxen9KvuM= 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=1729184646; 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=INdU8Vy7H1JFe+GjwDiltbnyksHVP3i84VMPvIn3WAY=; b=QkiSudRVf/AxMqRDYQidDSOMYr8nhOeZb8TFC7qKG464V2iRvWqCaW/XQKvPGnyz PJKp78zHMrtgPjIfktdSC9X5jy/ZGptWpLFV6094lX+sA4Uh89W+wUbC2MAlu8oLnzJ 4gLy8aB2swQ/A8SUN+vBw4kT+jqcACMg7aeIRT9s= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 23/44] x86/boot: remove module_map usage from xsm policy loading Date: Thu, 17 Oct 2024 13:03:03 -0400 Message-Id: <20241017170325.3842-24-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185500868116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel P. Smith Reviewed-by: Jason Andryuk --- Changes since v5: - adjust comment to coding style --- xen/arch/x86/setup.c | 2 +- xen/include/xsm/xsm.h | 9 +++------ xen/xsm/xsm_core.c | 6 ++---- xen/xsm/xsm_policy.c | 9 ++------- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index e1763d7e6548..91110ba96f73 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1863,7 +1863,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, bi); + xsm_multiboot_init(bi); =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 f155d10e718c..791936e5285b 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, struct boot_info *bi); +int xsm_multiboot_init(struct boot_info *bi); int xsm_multiboot_policy_init( - unsigned long *module_map, struct boot_info *bi, - void **policy_buffer, size_t *policy_size); + 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, struct boot_info *bi) +static inline int xsm_multiboot_init(struct boot_info *bi) { return 0; } diff --git a/xen/xsm/xsm_core.c b/xen/xsm/xsm_core.c index 6f034f70428d..50b665759aad 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, struct boot_info *bi) +int __init xsm_multiboot_init(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_bm(NULL); diff --git a/xen/xsm/xsm_policy.c b/xen/xsm/xsm_policy.c index 921bb254b9d1..453c81df4a2d 100644 --- a/xen/xsm/xsm_policy.c +++ b/xen/xsm/xsm_policy.c @@ -32,18 +32,14 @@ =20 #ifdef CONFIG_MULTIBOOT int __init xsm_multiboot_policy_init( - unsigned long *module_map, struct boot_info *bi, - void **policy_buffer, size_t *policy_size) + struct boot_info *bi, void **policy_buffer, size_t *policy_size) { int i; int rc =3D 0; u32 *_policy_start; unsigned long _policy_len; =20 - /* - * Try all modules and see whichever could be the binary policy. - * Adjust module_map for the module that is the binary policy. - */ + /* Try all modules and see whichever could be the binary policy. */ for ( i =3D bi->nr_modules-1; i >=3D 1; i-- ) { if ( bi->mods[i].type !=3D BOOTMOD_UNKNOWN ) @@ -60,7 +56,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 Thu Nov 21 21:35:13 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=1729185685; cv=pass; d=zohomail.com; s=zohoarc; b=Of6R6irU+IZm69fT32wqD2wutooMfuxibMNTYUyvXc56uVUa+aJ4pqas5mxMvmewyns4i68R+rxZwRUSgokYVUDhFJ7ldYPTYY9WwnnhSS8wFg/VoESuungu+paDVxZU/UrqrNJ9xe7dW/fNWmcjgmun8GkrsqxYWq+5gvuvCOs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185685; 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=AlPw4EAVQKE/AEdlatH3NgpfKfcwbCqOnaIcZsRcFfU=; b=PO++S4mcmUxMioYXu/Gi3/g8A22Ep5FyHFqJ0JITelM8I8ZyeubsjmoWNEQ3aMqPX/1Er5F2c1wvgfgnNpm0ZwuytIKt9OQLbGKybNnDeChc1YDgAz/sv30cALyt7lZk1f0wyOLpwT8a4YWnSBMyaQhCNP0N8YLBfZmLbzSrP8E= 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 1729185685536276.7225167584685; Thu, 17 Oct 2024 10:21:25 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.821053.1234862 (Exim 4.92) (envelope-from ) id 1t1UBI-00079m-TO; Thu, 17 Oct 2024 17:21:00 +0000 Received: by outflank-mailman (output) from mailman id 821053.1234862; Thu, 17 Oct 2024 17:21: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 1t1UBI-00079f-Q8; Thu, 17 Oct 2024 17:21:00 +0000 Received: by outflank-mailman (input) for mailman id 821053; Thu, 17 Oct 2024 17:21: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 1t1Txm-00014B-Tg for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:07:02 +0000 Received: from sender3-of-o59.zoho.com (sender3-of-o59.zoho.com [136.143.184.59]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 38cd6bc6-8caa-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:07:01 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184645708207.7226848723384; Thu, 17 Oct 2024 10:04:05 -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: 38cd6bc6-8caa-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184648; cv=none; d=zohomail.com; s=zohoarc; b=SJYiZ1sUG49vabG9vcQXWN55T3uHptNU1UAWTTCUhGuzX4sb0NITpr7LUck7C36p+VnZutGul0pYr3k/mi5VufsxCfhs707nEBT40jWiundcnHOgJ2dgZHbd8o1vQ5VAE6CWUzBYCfQlxElg3z536OpmW8X9hj97UtbtQZgL3FE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184648; 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=AlPw4EAVQKE/AEdlatH3NgpfKfcwbCqOnaIcZsRcFfU=; b=NkkOhsKT9bH/kMaNOkR4KvOxRRnXWpggDWemdGITiY/O8ZMlsVUT6hXAxhjRJNW2DFTk7zpcwIGEqO0wdD0QjNcYDzV82phiDs18mZkNrMIrbEZJzxRj48e6ZMio4mo+95N0fxCKNFQmQNAbrzVfCCnyKZY3x65vToK2GAxFqFE= 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=1729184648; 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=AlPw4EAVQKE/AEdlatH3NgpfKfcwbCqOnaIcZsRcFfU=; b=ncTHZpOwvInORTU5zOa2lR3cK3RNc3VWl35npYLPcApdMoUXNO9cukYWWx/o0ETh niJYbKYIKLrtbv/yQDByfZDl9hjQMNvKBjsxQud9flWzSIK7bwiOcseBGMZfefcFKYs c8oP/zx5pmKlNkMQLFICiZxommBIEArKPW2js30g= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 24/44] x86/boot: remove module_map usage by ramdisk loading Date: Thu, 17 Oct 2024 13:03:04 -0400 Message-Id: <20241017170325.3842-25-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185685727116600 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 --- Changes since v5: - set excessive module check down to MAX_NR_BOOTMODS --- xen/arch/x86/setup.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 91110ba96f73..08319f871a5d 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1036,7 +1036,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) struct boot_info *bi; 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; @@ -1186,15 +1186,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 ( bi->nr_modules > sizeof(module_map) * 8 ) + if ( bi->nr_modules > MAX_NR_BOOTMODS ) { - bi->nr_modules =3D sizeof(module_map) * 8; - printk("Excessive boot modules - using the first %u only\n", + bi->nr_modules =3D MAX_NR_BOOTMODS; + printk("Excessive multiboot modules - using the first %u only\n", bi->nr_modules); } =20 - bitmap_fill(module_map, bi->nr_modules); - __clear_bit(0, module_map); /* Dom0 kernel is always first */ + /* Dom0 kernel is always first */ bi->mods[0].type =3D BOOTMOD_KERNEL; bi->mods[0].flags =3D BOOTMOD_FLAG_X86_CONSUMED; =20 --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729185803; cv=pass; d=zohomail.com; s=zohoarc; b=BHQkR5aJecMGiBJduRklFkaXXecC6+Gz/uJZKpgbwYIYOT6LR7lqBMrzNSWUbns7ugyWKNbcQBhcxkbqsXhHuUiGxHwV+cW1KfWvb1VfB+kts2x/UVo6bRqakwS+wK49qFvfj20i6vHf+9zQgxxnJlbmjRrSSD0LrjOLEQmBix8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185803; 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=aspkH3LwBaiSwnG3lvyv34jbI4VkIKf8lSHUsreXCUg=; b=mZYrehWMiwnkMtRWWLWvFA2Bgh002ijOaDpbNdx4PcW9ote0ZqV4rkPudlD9mNh893SRq0lwDdWAKoFMUhjjjTqrlgXYL/4aYfhCkRr1HpIrinEzhVqVtQBqfjQcP/kAU1BrQcv8EfRcZfyLqqz/3hDkKU2gfpdLbVzsmKMwI2E= 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 1729185803428696.079818046143; Thu, 17 Oct 2024 10:23:23 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.821087.1234932 (Exim 4.92) (envelope-from ) id 1t1UD3-0002w1-2G; Thu, 17 Oct 2024 17:22:49 +0000 Received: by outflank-mailman (output) from mailman id 821087.1234932; Thu, 17 Oct 2024 17:22:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t1UD2-0002vs-Uz; Thu, 17 Oct 2024 17:22:48 +0000 Received: by outflank-mailman (input) for mailman id 821087; Thu, 17 Oct 2024 17:22:47 +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 1t1Txw-00014B-BO for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:07:12 +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 3e59ac53-8caa-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:07:10 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184646961494.5555495958281; Thu, 17 Oct 2024 10:04: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: 3e59ac53-8caa-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184649; cv=none; d=zohomail.com; s=zohoarc; b=VB+bghv1DBQjUSk6ujnGUFjyWy7/8DtSUjB1NYK7UJdnn/0ZN/KOflLsCNqflpF1P4VZ+xydvKkSUnQPoK0Ybxu5XiJ6j5QcBvUblWAip2UJfHctY4BUX1Pv8+oGs1pfEpzrXtetcy0x8JuMgHoEazs4VtrAvU5b3NEd5NfQNzo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184649; 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=aspkH3LwBaiSwnG3lvyv34jbI4VkIKf8lSHUsreXCUg=; b=m2lyBFLaShauw3nSRXIaG7+9vbEsLffItwmRIGGKsZva3hr5iNUAb+hitv+mW+Gdz2g3Gdv2SaIAFN2SVesusRWIPVVoQSTmsC6Ids1bgAnbd9buBzf8WCgcfrhin+ERIFC96/YV9xss8bgI1qPBggp+lCzdXRYNKkKL4awEbZw= 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=1729184649; 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=aspkH3LwBaiSwnG3lvyv34jbI4VkIKf8lSHUsreXCUg=; b=QPCRMfutIMbiye7CYv0bzR8+gm7BqarP4IB0ntvYD+sjukUu/SthYCBCIlO3mRiM d0JEyPs7Qwr5Mh1NVR1FiZE5Lj4txUdSs1TpTzMtAwTlwx8VN2g6M9gFvcMvqPJI7MF 3MNhBYPPa9vCx3FFXr6MU9EXLb75t+ZCvptM7kT4= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 25/44] x86/boot: convert create_dom0 to use boot info Date: Thu, 17 Oct 2024 13:03:05 -0400 Message-Id: <20241017170325.3842-26-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185804265116600 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 Reviewed-by: Jason Andryuk --- Changes since v5: - change headroom back to unsigned long - make mod_idx unsigned int --- 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 08319f871a5d..5bc667b8b4d4 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -945,10 +945,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 @@ -963,9 +961,22 @@ static struct domain *__init create_dom0(const module_= t *image, .misc_flags =3D opt_dom0_msr_relaxed ? XEN_X86_MSR_RELAXED : 0, }, }; + unsigned long headroom; + unsigned int 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].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].mod; + if ( opt_dom0_pvh ) { dom0_cfg.flags |=3D (XEN_DOMCTL_CDF_hvm | @@ -994,7 +1005,7 @@ 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->loa= der)); =20 if ( kextra ) /* kextra always includes exactly one leading space. */ @@ -2104,10 +2115,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(bi->mods[0].mod, bi->mods[0].headroom, - initrdidx < bi->nr_modules ? bi->mods[initrdidx].mod - : NULL, - kextra, bi->loader); + dom0 =3D create_dom0(bi, kextra); if ( !dom0 ) panic("Could not set up DOM0 guest OS\n"); =20 --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729185792; cv=pass; d=zohomail.com; s=zohoarc; b=L+acWA3SuSLXBXawTLkSGV9wLjSWWPQHDiHpEB6SDQm/VJ8kdQoghKBvU7LbWMo+eyowIWkhtF9g6JodkYyBw5dMDE4ZlpfOYqBLsTsChbJEa966r52H8hiVhwlbfaV0hxEX/1vRg3vOTuLNCtXQ0zAWrfUILg6XRgOty9smURc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185792; 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=8tl89rB/YSG6P4YyPJkHaSNB7c9SwgIpSdiGSHM6J/8=; b=eyW7Pnr8dlDyT53iTr5hBGbZZYE3fyGiGfBX25+xsiJqikQUanSnnpUUXOVAl6wQZOJPPyfgsGGO8E3P85Tv7EQw94fxDK/HQq5dQ1BiRbzlRIxyHtpjtiOEmxWhiQmFloBoWrgqWNaxTuGFjp8IM7m+8O02sMSDSunYQQf4QGQ= 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 1729185792922726.9939311397442; Thu, 17 Oct 2024 10:23:12 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.821077.1234901 (Exim 4.92) (envelope-from ) id 1t1UCq-0001yy-Bv; Thu, 17 Oct 2024 17:22:36 +0000 Received: by outflank-mailman (output) from mailman id 821077.1234901; Thu, 17 Oct 2024 17:22:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t1UCq-0001yr-92; Thu, 17 Oct 2024 17:22:36 +0000 Received: by outflank-mailman (input) for mailman id 821077; Thu, 17 Oct 2024 17:22:35 +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 1t1Ty5-00014B-CW for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:07:21 +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 439ef11c-8caa-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:07:19 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184648189955.1156774966953; Thu, 17 Oct 2024 10:04: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: 439ef11c-8caa-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184650; cv=none; d=zohomail.com; s=zohoarc; b=Jx5FWTUJn7kqf8t8QVVpiHAbOaUuY0KYLLS8PjdImFLSDBSgmcb5CqgW2eQ7YO1J8rMna7coslGxDAHaORRg8OJafEAxmupT2+fNsf2RfBdd+d0f77TZO0ovPMZngNT7ilEYSUewhSLcjFa9EjQ86hyktlC40hAFgzkoAjyf6ug= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184650; 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=8tl89rB/YSG6P4YyPJkHaSNB7c9SwgIpSdiGSHM6J/8=; b=RExN4TJGaQZLLvhfmGSAGdXm1MPg3LiS4f09hJdFqB+EPckERAXHpALFhdhGNhPMYgQrrRoXNEyT91lIdvS54LtkxXJSM5vFU5XtUuR7rrQ/G/Tr68DEm/gCsDe3VV2RBHNoHDevdkhJWTdtI3d+5wleQsL+b7vA8heh01CNHYI= 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=1729184650; 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=8tl89rB/YSG6P4YyPJkHaSNB7c9SwgIpSdiGSHM6J/8=; b=tF0OR6hy1R8IyNULd+7NLrpKf2Ht0ZsIq+rTNtMMoLueOPEEykIyyABOReFP8eqB aa1zVpW58kq/qdZOO+O1tnNtzl0JkQjzs50PbFAH2JEDX+FzMbxUMkbZsu3AGb0OR2n 00MTduYm3x8HgOtCjKBVOj0RjGr6hv0QIIH1vM4g= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 26/44] x86/boot: convert construct_dom0 to use struct boot_module Date: Thu, 17 Oct 2024 13:03:06 -0400 Message-Id: <20241017170325.3842-27-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185794204116600 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 Reviewed-by: Jason Andryuk --- xen/arch/x86/dom0_build.c | 12 +++++++----- xen/arch/x86/include/asm/setup.h | 6 ++---- xen/arch/x86/setup.c | 19 +++++++++---------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index 8d56705a0861..1eff3192f72d 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,11 @@ int __init construct_dom0(struct domain *d, const modu= le_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->mod, image->headroom, initrd->= 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->mod, image->headroom, initrd->m= od, + 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 729f68ca23b8..72d183e8a4de 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 extern struct boot_info xen_boot_info; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 5bc667b8b4d4..e7573bc3f40b 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -945,7 +945,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, +static struct domain *__init create_dom0(struct boot_info *bi, const char *kextra) { static char __initdata cmdline[MAX_GUEST_CMDLINE]; @@ -961,21 +961,19 @@ static struct domain *__init create_dom0(const struct= boot_info *bi, .misc_flags =3D opt_dom0_msr_relaxed ? XEN_X86_MSR_RELAXED : 0, }, }; - unsigned long headroom; unsigned int mod_idx =3D first_boot_module_index(bi, BOOTMOD_RAMDISK); - module_t *image, *initrd; + 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].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].mod; + initrd =3D &bi->mods[mod_idx]; =20 if ( opt_dom0_pvh ) { @@ -1002,10 +1000,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->string || kextra ) + if ( image->mod->string || kextra ) { - if ( image->string ) - safe_strcpy(cmdline, cmdline_cook(__va(image->string), bi->loa= der)); + if ( image->mod->string ) + safe_strcpy(cmdline, cmdline_cook(__va(image->mod->string), + bi->loader)); =20 if ( kextra ) /* kextra always includes exactly one leading space. */ @@ -1028,7 +1027,7 @@ static struct domain *__init create_dom0(const struct= boot_info *bi, } } =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 return d; --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729185650; cv=pass; d=zohomail.com; s=zohoarc; b=VyP3/cYVYLd3mLcMmFhKPOAEKWcsUZn6PTvI8eqF2ESNTcglK8PZrgYiyDRnvSL0un/iQgRU0et4fqsHmK9l+qevuLwyYS6nCsPW6oyG+wSet1IbZyXUePur3bKHj46/Vd7Fp6F48woc25RMC3TjM/tCLFNv88BapcUzxroWBtw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185650; 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=m7ZLsFa0scaQr3iKRnGjSr9xOOYoJU1g28IpOugO1dA=; b=jKpNGo4AxOo0H+6PTlmA/m0jr1rmUf9UVJe6L24kWCqU8U4igJBcii1zWOpnXDLY6mFE125F+V87WlUTLHcBkmabxv6vim9gboGb4UCMIUrt+bNLHPmZhqdg9fTaTOh22gEZK5C/U/YMsGxiAoF8YwJ3Rli9+jMaH9stCvFxbCY= 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 1729185650709301.7432835670344; Thu, 17 Oct 2024 10:20:50 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.821038.1234842 (Exim 4.92) (envelope-from ) id 1t1UAu-0005f0-3o; Thu, 17 Oct 2024 17:20:36 +0000 Received: by outflank-mailman (output) from mailman id 821038.1234842; Thu, 17 Oct 2024 17:20:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t1UAt-0005en-Vx; Thu, 17 Oct 2024 17:20:35 +0000 Received: by outflank-mailman (input) for mailman id 821038; Thu, 17 Oct 2024 17:20:34 +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 1t1TyG-00014B-Ow for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:07: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 4a73a28b-8caa-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:07:30 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184649380155.40519092477825; Thu, 17 Oct 2024 10:04: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: 4a73a28b-8caa-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184651; cv=none; d=zohomail.com; s=zohoarc; b=Wpe+oEVSbYV3IhV6IBjYPlx3kNNAazLZxGPKXgbAFTVtxCHAg/uvodXXUT/rWOCuD19nIC5W8lVQmZx5Ts1f+Bv5N1XqfQ2gsBsvjMIhyKab5SJRbseFJZO/rILifvLmjtEQhi+tY7xpgyaH+1f8J/KXnG4AHUdZYzxOT57/V5I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184651; 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=m7ZLsFa0scaQr3iKRnGjSr9xOOYoJU1g28IpOugO1dA=; b=fKe7VX5oXbm9z9WyEMvAegXBpNfFZ2Hse/EWr6Ch9WPR84VWTOHGyApauOUNWW39+4VAo1j0hgIELO/vScTBytZJQd5Lhv2W4dYORyFTz6kB31RO5leLk0hsJHKTOsAACHFZFRDBtIUGY/ixRxiasV7ZoRfgVkkq5DGapym7r7w= 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=1729184651; 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=m7ZLsFa0scaQr3iKRnGjSr9xOOYoJU1g28IpOugO1dA=; b=hPMDsb+3XYBveCTZ/4OUIthAHB6gh8TRBAWsQR+H7lvmIEYMvuFTlIg+5krCZaHr atgYbglbip2cXpVnKto59kHe+ApwYH80LZ8NjvUuMe0dQhDf5Ub9WL4ehXnOIRPALE1 Wh47WspqpHO/viBaxPtIhxshp6Zi3YbkLbwK8qNE= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 27/44] x86/boot: relocate kextra into boot info Date: Thu, 17 Oct 2024 13:03:07 -0400 Message-Id: <20241017170325.3842-28-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185651524116600 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 Reviewed-by: Jason Andryuk --- xen/arch/x86/include/asm/bootinfo.h | 1 + xen/arch/x86/setup.c | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 8b63eb27d6dd..8dcda42b3400 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -57,6 +57,7 @@ struct boot_module { struct boot_info { const char *loader; const char *cmdline; + const char *kextra; =20 paddr_t memmap_addr; size_t memmap_length; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index e7573bc3f40b..2574d2f1fdb4 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -945,8 +945,7 @@ static unsigned int __init copy_bios_e820(struct e820en= try *map, unsigned int li return n; } =20 -static struct domain *__init create_dom0(struct boot_info *bi, - const char *kextra) +static struct domain *__init create_dom0(struct boot_info *bi) { static char __initdata cmdline[MAX_GUEST_CMDLINE]; =20 @@ -1000,15 +999,15 @@ static struct domain *__init create_dom0(struct boot= _info *bi, panic("Error creating d%uv0\n", domid); =20 /* Grab the DOM0 command line. */ - if ( image->mod->string || kextra ) + if ( image->mod->string || bi->kextra ) { if ( image->mod->string ) safe_strcpy(cmdline, cmdline_cook(__va(image->mod->string), bi->loader)); =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") ) @@ -1102,6 +1101,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) *kextra =3D '\0'; kextra +=3D 3; while ( kextra[1] =3D=3D ' ' ) kextra++; + bi->kextra =3D kextra; } cmdline_parse(bi->cmdline); =20 @@ -2114,7 +2114,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(bi, kextra); + dom0 =3D create_dom0(bi); if ( !dom0 ) panic("Could not set up DOM0 guest OS\n"); =20 --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729185561; cv=pass; d=zohomail.com; s=zohoarc; b=cq6YCnWLA2wc4UCaWQ8IFs2LX1eHWojow9UWNmUyF2VhmA72zaypQ7KDGwiYbIvMfegf5B/TH9JS3wwFqq5wSU0khPCchGSLQXVspPOErscgHJQHyd9wdc1WyQLTNdlfjlJXShRt3TMpwhJYZes1+oBOR5wACV+Fo7MlThI65lk= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185561; 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=5pWxQAdhYkQ5A/U/o5fJjyYZh8d6vSIlQX+nrYdkAwQ=; b=ZSvKtViu4HeZgVGpiKIqzDj3AbFJdtvcc1heTp+ZBXzqYF5cMGI7YlkeV4T4AIX1Df7X2WEicmtln1LfK+qE78Nx4RCqXW8bcdNjI7HCBI1bpgUNXaaNhB4QanoOAkaEzQRVqItTnUqi5LK099hlglXx5bXyBFas+YidZERZAvs= 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 1729185561397460.94184509200693; Thu, 17 Oct 2024 10:19:21 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820975.1234722 (Exim 4.92) (envelope-from ) id 1t1U9L-000744-Be; Thu, 17 Oct 2024 17:18:59 +0000 Received: by outflank-mailman (output) from mailman id 820975.1234722; Thu, 17 Oct 2024 17:18: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 1t1U9L-00073x-8j; Thu, 17 Oct 2024 17:18:59 +0000 Received: by outflank-mailman (input) for mailman id 820975; Thu, 17 Oct 2024 17:18:57 +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 1t1TyO-00014B-9e for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:07:40 +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 4f0770c6-8caa-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:07:38 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184650633546.6576643682486; Thu, 17 Oct 2024 10:04: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: 4f0770c6-8caa-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184653; cv=none; d=zohomail.com; s=zohoarc; b=dfCM84MZcmAEPtFX2MhQRtWyFJmLgrRmDcsXJW7/voj/A8DRPp9Jr7bH5fJI1n2JFiKvk7SABUVFF5nPpQ/ud7Gus5mQvzU5Eplt2TI8FAhcEphOHWb8wGTAx0Vtw8JpWXLrugCxcPjgatw5yv+f0dJUWS4VSCHiWv8EA8i3uzA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184653; 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=5pWxQAdhYkQ5A/U/o5fJjyYZh8d6vSIlQX+nrYdkAwQ=; b=BCGY6vLiLdLQldxTLDRyFmUUkcwXutAgzSsstAlv7rguLd4UAv/99whuY8LtUxiUcZFCOh65vKYNnKkYFXp0KgW+0+w5SPw868pec30nmedDuRxi39awWVK7yYxrVU5gZ8p9Izz5kESnH94Y+hoRTF1vaQdKtCPXGwub6HtyYTw= 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=1729184653; 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=5pWxQAdhYkQ5A/U/o5fJjyYZh8d6vSIlQX+nrYdkAwQ=; b=JgKwDM9SC3x8mlCYgwlqEfMC5cbLdkCtwVyGT20FtHidBVMkHTc1Fowme5/FIsIk 6lTWhRRaeMMM9SpgkuLVdSBxfVrokP+x6+2O6g19HHrHjWqEtUQIfRfEk/0L6KP9bAi Hye9m7NzKfzdndWb/N3UqjjgzqhVKeNblTsAZQN8= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 28/44] x86/boot: add cmdline to struct boot_module Date: Thu, 17 Oct 2024 13:03:08 -0400 Message-Id: <20241017170325.3842-29-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185563024116600 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 --- Changes since v5: - changed boot_module element cmdline to paddr_t --- 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 8dcda42b3400..24c2f37c7b11 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -46,6 +46,8 @@ struct boot_module { #define BOOTMOD_FLAG_X86_RELOCATED (1U << 0) #define BOOTMOD_FLAG_X86_CONSUMED (1U << 1) =20 + paddr_t cmdline; + paddr_t start; size_t size; }; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 2574d2f1fdb4..e6f1208d5807 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -312,6 +312,8 @@ static struct boot_info *__init multiboot_fill_boot_inf= o(unsigned long mbi_p) { bi->mods[i].mod =3D &mods[i]; =20 + bi->mods[i].cmdline =3D (paddr_t)mods[i].string; + bi->mods[i].start =3D (paddr_t)mods[i].mod_start; bi->mods[i].size =3D mods[i].mod_end - mods[i].mod_start; } @@ -999,10 +1001,11 @@ static struct domain *__init create_dom0(struct boot= _info *bi) panic("Error creating d%uv0\n", domid); =20 /* Grab the DOM0 command line. */ - if ( image->mod->string || bi->kextra ) + if ( image->cmdline || bi->kextra ) { - if ( image->mod->string ) - safe_strcpy(cmdline, cmdline_cook(__va(image->mod->string), + if ( image->cmdline ) + safe_strcpy(cmdline, + cmdline_cook(__va(image->cmdline), bi->loader)); =20 if ( bi->kextra ) --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729185655; cv=pass; d=zohomail.com; s=zohoarc; b=cSX/ImPNn9KpMJ/m46YUkPEOlYZmkinnfvD0GPtyJwMB7/rWnu4OgHDB1qILuYmQge6Rt+QbRruwFUZsDPHa7+N2MpCBIcxWlA9rmnmkE6gwJwE7tWCmww6GoxMCzH7DCvmRnyKGSiNYf1p5DEJIFtdF6Vdz328z6kgfcIuR9ws= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185655; 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=cvWn5Yqu/hyHibZNnNCf1iWRt37Pr6iw0261tw9I/1o=; b=g/2BZw+vFJUKEIV7jGY1LpHBN/W6gQQrY4qTYy3OlMGCSaBrVLrrpDdrwSC50glIzDhr9GzBRO+zCmpv/84lTY4sDdnjntQsMuELcs7jpXBm/uzKkDFPvIEvT047pm329V1Xb1z7YyT+T3QKfnIgyjSkhvy6V8zObKicgoxAi3g= 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 1729185655114778.7225291453177; Thu, 17 Oct 2024 10:20:55 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.821019.1234802 (Exim 4.92) (envelope-from ) id 1t1UAb-00042s-1O; Thu, 17 Oct 2024 17:20:17 +0000 Received: by outflank-mailman (output) from mailman id 821019.1234802; Thu, 17 Oct 2024 17:20: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 1t1UAa-00042l-UO; Thu, 17 Oct 2024 17:20:16 +0000 Received: by outflank-mailman (input) for mailman id 821019; Thu, 17 Oct 2024 17:20: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 1t1TyW-00014B-0C for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:07:48 +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 539bd735-8caa-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:07:46 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184651885979.0690248848649; Thu, 17 Oct 2024 10:04: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: 539bd735-8caa-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184654; cv=none; d=zohomail.com; s=zohoarc; b=HRGzO+0jOKUR/Meq44FRnVuwdp1uY7NXVVZifN8wuadlwVVxglBTFTCIXNOMEB8rFU0Cn23CGQAH8fS9dSLmSFCTH1d6yGrwoYAATRmAnrYE6secvf2XOSYFVcNJo7LjRPhGziCSf9co7ZcIuzcO87Bq5p8e9gtRbnPLhLiriMk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184654; 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=cvWn5Yqu/hyHibZNnNCf1iWRt37Pr6iw0261tw9I/1o=; b=EyN6YhRwhAIouOy4xuxaqLrgtitgsZssr8DVFkozYUmzorXPJYJOFamAt2THm7Jrte3xKEmQtoPsCR4lmvbixRAb3rRQIhzcdNxG+PfoXh6OF0p0/SzBfdFa/BGvCLx6PCpC8oVw8IdIgKxiAWfLv9/AuF94uJVewwyQvBh2+Xo= 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=1729184654; 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=cvWn5Yqu/hyHibZNnNCf1iWRt37Pr6iw0261tw9I/1o=; b=TRxOmHrFkMtsK4fC14yETXVYeGzzRVW+9ez0BTMeFHumoA0qnlqc2BDZXyeVWjas 9aTmOPSvcY6ECR6hWek0Pysc2Vf6JgYRgWMuIp+D9UZI7TI/ds04UiThOcC2CjmnL6L WRTXqFpTlEbcBCf5LEOXbS08992Y2zOsx3gLtdN4= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 29/44] x86/boot: convert dom0_construct_pv image param to struct boot_module Date: Thu, 17 Oct 2024 13:03:09 -0400 Message-Id: <20241017170325.3842-30-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185655541116600 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 Reviewed-by: Jason Andryuk --- Changes since v5: - replaced bootstrap_map(NULL) with bootstrap_map_bm --- xen/arch/x86/dom0_build.c | 3 +-- xen/arch/x86/include/asm/dom0_build.h | 7 +++---- xen/arch/x86/pv/dom0_build.c | 16 +++++++--------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index 1eff3192f72d..54db578dd29f 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -613,8 +613,7 @@ int __init construct_dom0(struct domain *d, const struc= t boot_module *image, rc =3D dom0_construct_pvh(d, image->mod, image->headroom, initrd->= mod, cmdline); else if ( is_pv_domain(d) ) - rc =3D dom0_construct_pv(d, image->mod, image->headroom, initrd->m= od, - cmdline); + rc =3D dom0_construct_pv(d, image, initrd->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 262edb6bf2f0..f59597e50a11 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 static int __init dom0_construct(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 @@ static int __init dom0_construct(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; @@ -830,7 +829,7 @@ static int __init dom0_construct(struct domain *d, printk("Failed to load the kernel binary\n"); goto out; } - bootstrap_map(NULL); + bootstrap_map_bm(NULL); =20 if ( UNSET_ADDR !=3D parms.virt_hypercall ) { @@ -1052,8 +1051,7 @@ out: } =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) { @@ -1072,7 +1070,7 @@ int __init dom0_construct_pv(struct domain *d, write_cr4(read_cr4() & ~X86_CR4_SMAP); } =20 - rc =3D dom0_construct(d, image, image_headroom, initrd, cmdline); + rc =3D dom0_construct(d, image, initrd, cmdline); =20 if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) ) { --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729185801; cv=pass; d=zohomail.com; s=zohoarc; b=F0id0jOux8UseeeT5ASKRJEgoGVSsi9sqYyy94hOF+fE/4OqXXDc3/Cj0VaR20fD4FXYSQaHmImSMUm6VRzzZhOq8HMbO0I0wajqutmaOUm+CVELYxdhkHSmfMG2Gn2myOleJli8ef/O4wyZSqlW+83HeCeJVu/1Z0OiSg3S0HM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185801; 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=/WocqNvqWMovNBKSHYsx06yhaw6uzqBVu1livQAQNWE=; b=Ip8qkAJnlG7i5ywmCE5Kery9tt+ZODxM3qYSJbQ+2T7RFC94Db7qVhLaoWiwZdbIqXa02I3B9ZA/RsjNNgce7vCJHzm9fzBZXc9JspJMlDYhq5nKx1hBwJSL+P99O93S7BCsD6kvHLZx3cp2S+s1wALoTeIOukS/t4ydBus3u18= 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 172918580164688.58325738326334; Thu, 17 Oct 2024 10:23:21 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.821084.1234922 (Exim 4.92) (envelope-from ) id 1t1UD1-0002gi-S0; Thu, 17 Oct 2024 17:22:47 +0000 Received: by outflank-mailman (output) from mailman id 821084.1234922; Thu, 17 Oct 2024 17:22: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 1t1UD1-0002gY-Oi; Thu, 17 Oct 2024 17:22:47 +0000 Received: by outflank-mailman (input) for mailman id 821084; Thu, 17 Oct 2024 17:22:46 +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 1t1Tyd-00014B-Kw for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:07:55 +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 58218783-8caa-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:07:53 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184653228647.9822276705668; Thu, 17 Oct 2024 10:04: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: 58218783-8caa-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184655; cv=none; d=zohomail.com; s=zohoarc; b=Jld2HDSz4LYuX9nEW6HUuGh4+nl1b+M4vtjnzZJX6kqQvNPTjxuJPrjUw3/bC4nuF8SiiEjOB72ejNwFlwp+qc40eeadiuImnIAOtTwGO86x46ORGtbsWWjn0YyQVK/pT2pZNkuYu/Jp6Cw5MwqMZtPODq9Ai5SONtrfomgssJs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184655; 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=/WocqNvqWMovNBKSHYsx06yhaw6uzqBVu1livQAQNWE=; b=GtY7Fy0eheiLwmG68C3oilhZ/IrCfd5rZ2SC+9E3QmxsHEvZrJntySo/8BN4Zy/bfGuM5nLJc2QocODobdHomG0aA7FWh+mgkG6vowaSfrbG416+s0ukE/bTHtihXLvV1A/i22ED5t/TV0x/gq+u5Z8m5OP2F8jR8QrblRlIlgg= 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=1729184655; 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=/WocqNvqWMovNBKSHYsx06yhaw6uzqBVu1livQAQNWE=; b=TftWHWDt5PjjLKEvUeJw+DLFHVsXNW7/WDUktKsLLJ1QiLmExiQ3RgXqSJnK4y4J 64z7HcX5gmoMdbw5ALEiKCM3WuB/+20jOAsSWjQP1pKlUS6VxkDTOBzSayeS+6SZy4R BQRjJDBJfmw2s1CGNwNYCZ7Q2WSrDQrOlbfPiI2U= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 30/44] x86/boot: convert dom0_construct_pv initrd param to struct boot_module Date: Thu, 17 Oct 2024 13:03:10 -0400 Message-Id: <20241017170325.3842-31-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185802302116600 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 Reviewed-by: Jason Andryuk --- Changes since v5: - changed initrd_mfn initialization to _mfn(0) --- xen/arch/x86/dom0_build.c | 2 +- xen/arch/x86/include/asm/dom0_build.h | 2 +- xen/arch/x86/pv/dom0_build.c | 29 +++++++++++++++------------ 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index 54db578dd29f..1d05ee53a6d8 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -613,7 +613,7 @@ int __init construct_dom0(struct domain *d, const struc= t boot_module *image, rc =3D dom0_construct_pvh(d, image->mod, image->headroom, initrd->= mod, cmdline); else if ( is_pv_domain(d) ) - rc =3D dom0_construct_pv(d, image, initrd->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 f59597e50a11..5e7b543d0cbe 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 static int __init dom0_construct(struct domain *d, const struct boot_module *image, - module_t *initrd, + struct boot_module *initrd, const char *cmdline) { int i, rc, order, machine; @@ -367,7 +367,8 @@ static int __init dom0_construct(struct domain *d, unsigned long nr_pt_pages; unsigned long alloc_spfn; unsigned long alloc_epfn; - unsigned long initrd_pfn =3D -1, initrd_mfn =3D 0; + unsigned long initrd_pfn =3D -1; + mfn_t initrd_mfn =3D _mfn(0); unsigned long count; struct page_info *page =3D NULL; unsigned int flush_flags =3D 0; @@ -376,7 +377,7 @@ static int __init dom0_construct(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 +613,8 @@ static int __init dom0_construct(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 maddr_to_mfn(initrd->start); + mfn =3D mfn_x(initrd_mfn); count =3D PFN_UP(initrd_len); if ( d->arch.physaddr_bitsize && ((mfn + count - 1) >> (d->arch.physaddr_bitsize - PAGE_SHIFT)= ) ) @@ -627,12 +629,13 @@ static int __init dom0_construct(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 page_to_mfn(page); + initrd->start =3D mfn_to_maddr(initrd_mfn); } else { @@ -640,9 +643,9 @@ static int __init dom0_construct(struct domain *d, if ( assign_pages(mfn_to_page(_mfn(mfn++)), 1, d, 0) ) BUG(); } - initrd->mod_end =3D 0; + initrd->size =3D 0; =20 - iommu_memory_setup(d, "initrd", mfn_to_page(_mfn(initrd_mfn)), + iommu_memory_setup(d, "initrd", mfn_to_page(initrd_mfn), PFN_UP(initrd_len), &flush_flags); } =20 @@ -654,7 +657,7 @@ static int __init dom0_construct(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); } @@ -763,7 +766,7 @@ static int __init dom0_construct(struct domain *d, if ( count < initrd_pfn || count >=3D initrd_pfn + PFN_UP(initrd_l= en) ) mfn =3D pfn++; else - mfn =3D initrd_mfn++; + mfn =3D mfn_x(initrd_mfn) + 1; *l1tab =3D l1e_from_pfn(mfn, compat ? COMPAT_L1_PROT : L1_PROT); l1tab++; =20 @@ -882,7 +885,7 @@ static int __init dom0_construct(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 paddr_to_pfn(initrd->start) + (pfn - initrd_pfn); else mfn -=3D PFN_UP(initrd_len); } @@ -1052,7 +1055,7 @@ out: =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 rc; --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729185679; cv=pass; d=zohomail.com; s=zohoarc; b=VssqBRuud8U2nkyYoasx2pZ7F59QO5MTBjgY7It0CTGUOsgDjmsmwWx6Q8sZWdfuSX6DiuweJji6g7Kkrs7Zi9DW1iqkS7FDwGO2jng5xmuqcM2kgsTlzpraebokiW4HAa7I6XQb79LCUT0u4QFq+M9fEvXHy1oc7C94jZqOm3I= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185679; 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=F4Lz7sqO+ktRyIvGIcZPYbApzi/uegkQRLWv0yMSK6A=; b=PaeO/ZFPqoONR5zr+L6thKVrK76PhmssCeq16EwMSVQcfzadAgDbUAKvksbnzRoPJuqggGT55e5xZQLk4mPRuH0c84Ii+55Ru38BPTlyk/xQxrz8zfzvarCDlT6rESYOwYDxNkpEnD/WFFCMxMnpU7pgLNwPo4kypl+He92Uuuc= 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 1729185679240526.6894177457112; Thu, 17 Oct 2024 10:21:19 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.821049.1234852 (Exim 4.92) (envelope-from ) id 1t1UBE-0006nF-Ju; Thu, 17 Oct 2024 17:20:56 +0000 Received: by outflank-mailman (output) from mailman id 821049.1234852; Thu, 17 Oct 2024 17:20: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 1t1UBE-0006n6-FK; Thu, 17 Oct 2024 17:20:56 +0000 Received: by outflank-mailman (input) for mailman id 821049; Thu, 17 Oct 2024 17:20:54 +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 1t1Tym-00014B-Dl for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:08:04 +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 5cce03bf-8caa-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:08:01 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184654449478.7806231697002; Thu, 17 Oct 2024 10:04: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: 5cce03bf-8caa-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184656; cv=none; d=zohomail.com; s=zohoarc; b=BlgBeqvn+5njIBvSNaCrFnXfqcjRi9m0UBXa6PxjfXpvZzE0QwNpMivSL8ZtGGpLd38Xry+JuznYGJ4Ns18e8nif6bTgUCzlbp2pooTphmbOqBrZlsUHf2dCVxkZpAbhGlxcfEpgXczcQcR2dbjzGRsElEE6qHgqZQzNQHz+nYM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184656; 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=F4Lz7sqO+ktRyIvGIcZPYbApzi/uegkQRLWv0yMSK6A=; b=i1cQlB2zdS+kuEpuagXx7vqCgMt2tUD0HHdNwjMdZ5IzSWteDP7CpMl1tTLo67j27blkl4EfmBkJIgQMKVE9G5Uvt4RBkkepJIumO+TmmIy2SOEQ/Je2FAGk5EkLR1krxTpsfhyM1Vxr09ktOg4Tc9KCQ8MdFk0EZ9yIpiO4cQE= 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=1729184656; 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=F4Lz7sqO+ktRyIvGIcZPYbApzi/uegkQRLWv0yMSK6A=; b=SWjNeTJDj4gjiqiwKRVV+QEHiABcJX5F7SYtw8CGejLsHocWv8fGgt+nbdPVaOLw 5sN38TetRvO1d87E+6R56E6cnSllqkElbnrWU28tYq5E2uwaYjJT79y+DOcV1QnNSKj jEtIr/V/xUPFKYaBB8JKDQ2317HCBZMH3P4Nyx4I= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 31/44] x86/boot: convert dom0_construct_pvh to struct boot_module Date: Thu, 17 Oct 2024 13:03:11 -0400 Message-Id: <20241017170325.3842-32-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185679693116600 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 Reviewed-by: Jason Andryuk --- xen/arch/x86/dom0_build.c | 3 +-- xen/arch/x86/hvm/dom0_build.c | 11 +++++------ xen/arch/x86/include/asm/dom0_build.h | 7 +++---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index 1d05ee53a6d8..71b2e3afc1a1 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -610,8 +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->mod, image->headroom, initrd->= 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 3dd913bdb029..beaa1d492077 100644 --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -1300,10 +1300,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; @@ -1347,8 +1346,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->mod, image->headroom, initrd->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 Thu Nov 21 21:35:13 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=1729185643; cv=pass; d=zohomail.com; s=zohoarc; b=LHynNQff11numJMdMCAN0aQ2GTkZkSRmURI8dWKOgImyYp0YjknTedmTt8g9I9eoUmR5rK2jZjIA2OzrGSkkeYjWqgZTf5jQMLiRajugVkjSdbPCkUM7xYabPNZoj7i4yayIMsRSGNtDB14Mg6CZIa7kWdN5TrSiSUU2v8i5oEA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185643; 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=NBDtInGp9YJQJOeasJO8noI67YJSFGQINY+XLRHfqCo=; b=ltCX+/NUvb3V64gtxylZPpyloRMHVcCBgUWvhg8/A1P31Oo2y8aem/DcqsKxdS3pHOru5xjWmlPCPAN7/JedCOe20l4lIybgee+427DWkHL3rjVcQlHLPgZI4DdiUsYFG4SBuN5euTfu8LG8SRfnUJZt8wgOGDhuNf+5ET5rOP0= 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 1729185643092285.84101018432455; Thu, 17 Oct 2024 10:20:43 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.821027.1234822 (Exim 4.92) (envelope-from ) id 1t1UAf-0004jW-Gv; Thu, 17 Oct 2024 17:20:21 +0000 Received: by outflank-mailman (output) from mailman id 821027.1234822; Thu, 17 Oct 2024 17:20: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 1t1UAf-0004jN-De; Thu, 17 Oct 2024 17:20:21 +0000 Received: by outflank-mailman (input) for mailman id 821027; Thu, 17 Oct 2024 17:20: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 1t1Tyu-00014B-LM for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:08:12 +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 61c44785-8caa-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:08:09 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184655620990.0465556999607; Thu, 17 Oct 2024 10:04: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: 61c44785-8caa-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184657; cv=none; d=zohomail.com; s=zohoarc; b=dbwr3om9PZ4En8gFJd9v1mNrb/XPwezxwWfc4fiSUCNZ8f7LvijJJRsUkzu1WDfgERsE+TCBvensIXC+4wAiIZDUNkpuU756buzHgDNmR5CudHfWLT/cnkDLoiRaC9/yHIDsgNEgmwx4RWMhX4CCjWmowULHFILKHa07fasUFAs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184657; 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=NBDtInGp9YJQJOeasJO8noI67YJSFGQINY+XLRHfqCo=; b=J2aljjfyPDne7TpLJ9XyqIZQjXyWhLlE4XRZmWShk+k/98iBec89enAqplSBsyedkKaFS7/yKtdbO+mB9KunSLURI08q7xPuTsaB0l6N7Y6pPcaaA4WlqT1+eDe4W11Da92ROCCD21TKhEkDD8BFCsZknuZH2bDyQkI3gDu4YbQ= 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=1729184657; 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=NBDtInGp9YJQJOeasJO8noI67YJSFGQINY+XLRHfqCo=; b=Y1txQgXlBFhJcdfypqPQmk4164USOHXRiQqzkaLVEZDVogw2V51hQK7iqt9qrOoA 7Yp6hD1vkM874W9+A4ZVxch2iKrEgBuwbVOmRxDgvaFDec3m0QreqXeqn8yzb/bkX7D 6rRNexlNk1iI2Bl8hnaYQ1VoSLNLSn01btDvQI2E= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 32/44] x86/boot: convert pvh_load_kernel to struct boot_module Date: Thu, 17 Oct 2024 13:03:12 -0400 Message-Id: <20241017170325.3842-33-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185643478116600 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 Reviewed-by: Jason Andryuk --- 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 beaa1d492077..a3fd5e762dc4 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); @@ -1346,8 +1345,8 @@ int __init dom0_construct_pvh( return rc; } =20 - rc =3D pvh_load_kernel(d, image->mod, image->headroom, initrd->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 Thu Nov 21 21:35:13 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=1729185685; cv=pass; d=zohomail.com; s=zohoarc; b=e4MitNd0KrGPu7mQzxWRg/KUsHKDxSyew4VLZldfaRUutKMpUKP7ri+p973KrY6hxdkJP4yK8Boo3UMN4wkGMFIs37N1Kslk+GFZ4D25xaNxvNn76cAsWamxQ86EUXou3RnpRzSeZ9CGdYLk4wVDsyiyPYsOofi+eCDPxQe7WlA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185685; 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=Rp7RzI1QNTY5hwhage3xG8298106lOX2KeM4idRZunk=; b=njPcn78RMX/rO1V1D2Rulqw5w0Urhf+wf1RtOg/5DE4AqMT7F1HBbdm9zPYb4D4OaNfswFAZwXKsyT+aCOEQ38a7CMXlSNYNz0ZALnYMjWmP1Mi+GKHdUJ+q7Xzj7LbK7IWUJ96YdoZmbSnkJHFe1rGzYi2I8ack0iNgr2/Uca4= 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 1729185685510128.95472882320053; Thu, 17 Oct 2024 10:21:25 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.821055.1234867 (Exim 4.92) (envelope-from ) id 1t1UBJ-0007Cm-6c; Thu, 17 Oct 2024 17:21:01 +0000 Received: by outflank-mailman (output) from mailman id 821055.1234867; Thu, 17 Oct 2024 17:21: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 1t1UBJ-0007Bv-28; Thu, 17 Oct 2024 17:21:01 +0000 Received: by outflank-mailman (input) for mailman id 821055; Thu, 17 Oct 2024 17:21: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 1t1Tz2-00014B-6A for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:08:20 +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 66b991cd-8caa-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:08:18 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 172918465678522.81224609932019; Thu, 17 Oct 2024 10:04: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: 66b991cd-8caa-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184659; cv=none; d=zohomail.com; s=zohoarc; b=eJQfjQzV3ePGKVDU/vX+th6KQbjrtVB9sjDQeUGVsjDIFi4di3rClsfJgPbehrTqzz9ebdpK4KpyaUmr1fxVUwwT53IeHcIzP9AfeeqXeGoQC9etWyJ/KMd+ltjqPJmP24qSO9dNJl9y1S2f/TQvoEMcMgqtdOcHF/PwNw0Iu54= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184659; 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=Rp7RzI1QNTY5hwhage3xG8298106lOX2KeM4idRZunk=; b=Dk6/hSvBUPh+Pertq86eqcZvACCkSta0TQLCxH7pCwLRVLo5HtlrwUM0KSWTe0dk4frrIxb/EonAhgaQ++trEEmrGNGB7OKkhEAfenwdA1z/HKEvLlawEEczn21KAwg8QFmexu7mxKl6rX2/ELwF/j6kPW3FYCaizrrzBCg4HW4= 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=1729184659; 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=Rp7RzI1QNTY5hwhage3xG8298106lOX2KeM4idRZunk=; b=ai0q7Ip3Elh0GwZq/CZicDNx8l6vfbr4f8leXo+qnk7k+1Ip5MdyjE2yPZ83Qu9B +Wy4X8S/7Re51tzqVgcJ+7HujdkFot0pszNkEZ9j9N5mJeDocyqbaKVXHS6Zu2vbwUA H2RWSvZATWvk3q9dQy7+HhMg9/NpQ5w5NaTw+3lo= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 33/44] x86/boot: convert initial_images to struct boot_module Date: Thu, 17 Oct 2024 13:03:13 -0400 Message-Id: <20241017170325.3842-34-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185685732116600 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 Reviewed-by: Jason Andryuk --- Changes since v5: - coding style changes --- xen/arch/x86/setup.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index e6f1208d5807..f5cd7eeb157c 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -276,7 +276,7 @@ custom_param("acpi", parse_acpi_param); =20 static const char *cmdline_cook(const char *p, const char *loader_name); =20 -static const module_t *__initdata initial_images; +static const struct boot_module *__initdata initial_images; =20 struct boot_info __initdata xen_boot_info; =20 @@ -335,8 +335,8 @@ unsigned long __init initial_images_nrpages(nodeid_t no= de) =20 for ( nr =3D i =3D 0; i < bi->nr_modules; ++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].mod->mod_start; + unsigned long end =3D start + PFN_UP(initial_images[i].mod->mod_en= d); =20 if ( end > node_start && node_end > start ) nr +=3D min(node_end, end) - max(node_start, start); @@ -352,10 +352,11 @@ void __init discard_initial_images(void) =20 for ( i =3D 0; i < bi->nr_modules; ++i ) { - uint64_t start =3D (uint64_t)initial_images[i].mod_start << PAGE_S= HIFT; + uint64_t start =3D + (uint64_t)initial_images[i].mod->mod_start << PAGE_SHIFT; =20 init_domheap_pages(start, - start + PAGE_ALIGN(initial_images[i].mod_end)); + start + PAGE_ALIGN(initial_images[i].mod->mod_e= nd)); } =20 bi->nr_modules =3D 0; @@ -1379,11 +1380,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 - /* - * The field bi->mods[0].mod points to the first element of the module= _t - * array. - */ - initial_images =3D bi->mods[0].mod; + initial_images =3D bi->mods; =20 for ( i =3D 0; i < bi->nr_modules; i++ ) { --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729185440; cv=pass; d=zohomail.com; s=zohoarc; b=FIcGE9HRzvjO2i6ixX79Tt0Is4Q81r+wMymyWIxh3PJI9d5HZ34h00wqKxCLPN4yrT8x3Zp2745R8Np8BDRFDVmRgazGUR/omidfRlRiYUfTqNAPczBd38F2+7tMgjPkh1NDdsU8rdQ7Oct89wGaLCTq9iUIq0VArjdndQWNd2E= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185440; 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=JraRp4qDaDWJ2lj1CcSCRxF+QAMscl93p41Cp6mewpw=; b=CQTVIsEFQ4qfSTrR/tXvSUc/OHWcbC0LyoEmPmneZRBD+tgMBLCrL6Sb0PJ05enwHA2Sc7PAxtrlx5WNLscbDSCBFEhmajh1PVcHd9JnzaTxuMeddsks1qHA8BpsURjDOwZAlXG/Wj606zZWg/9d9A5KGmAE4jk52IE6suDMxfc= 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 1729185439991288.7626069207985; Thu, 17 Oct 2024 10:17:19 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820935.1234672 (Exim 4.92) (envelope-from ) id 1t1U7M-0003gZ-37; Thu, 17 Oct 2024 17:16:56 +0000 Received: by outflank-mailman (output) from mailman id 820935.1234672; Thu, 17 Oct 2024 17:16: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 1t1U7M-0003gS-0I; Thu, 17 Oct 2024 17:16:56 +0000 Received: by outflank-mailman (input) for mailman id 820935; Thu, 17 Oct 2024 17:16: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 1t1TzA-00014B-HW for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:08:28 +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 6bd16e38-8caa-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:08:26 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184658005873.5613662896585; Thu, 17 Oct 2024 10:04: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: 6bd16e38-8caa-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184660; cv=none; d=zohomail.com; s=zohoarc; b=n7ZYi8u/rh/V7Dw9U4AhWRO/mKjxsLHcvk2bf9fVBZUnfCUuCkptJ9yzyu1VdzWzgU44ApHNdSUeLMwndFoWF4w8STrNUXNP5tIgUjpRsPUV5h3xqLf7X0jjv8vy1GjLGC2d5g4Z4C0NZ+6WC8MWDXNk+suElVcTu707am/nnd4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184660; 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=JraRp4qDaDWJ2lj1CcSCRxF+QAMscl93p41Cp6mewpw=; b=anJC8yyyrOqRlOC/1FBaHJ6rqFhMr1m84qT2Jy/1vpZuBt5VrI9PqrKei0hXvy+VfxwPyiPtHnig1FlH7IgX7/+ET44C+QkOZWQYQt0pgH3wmFNBruUsAiZ/oxJtc8YOiX8HroIu6z8Z9MjAOE860kQnWTEQVT07+gl04TKXitM= 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=1729184660; 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=JraRp4qDaDWJ2lj1CcSCRxF+QAMscl93p41Cp6mewpw=; b=Ap1tYajcF/sRYx7/Ua6dS2DfhYOwNh/9hyXa3+gMfIPBDe0A9HWtIDb4f9TuVY8/ D4a0iHviwHMpz3h4Wd56ZcB1FpYjQiin12xmSV3itQ1W5v0GxNoWfo1zX6lzD3Xsj98 +YeheXOzZd6g2Ahif2l3CIrhgUw1TsriaOH0bT1w= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 34/44] x86/boot: drop the use of initial_images unit global Date: Thu, 17 Oct 2024 13:03:14 -0400 Message-Id: <20241017170325.3842-35-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185442249116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel P. Smith Reviewed-by: Jason Andryuk --- Changes since v5: - coding style changes --- xen/arch/x86/setup.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index f5cd7eeb157c..f8b9c164c1cb 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -276,8 +276,6 @@ custom_param("acpi", parse_acpi_param); =20 static const char *cmdline_cook(const char *p, const char *loader_name); =20 -static const struct boot_module *__initdata initial_images; - struct boot_info __initdata xen_boot_info; =20 static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi= _p) @@ -335,8 +333,8 @@ unsigned long __init initial_images_nrpages(nodeid_t no= de) =20 for ( nr =3D i =3D 0; i < bi->nr_modules; ++i ) { - unsigned long start =3D initial_images[i].mod->mod_start; - unsigned long end =3D start + PFN_UP(initial_images[i].mod->mod_en= d); + unsigned long start =3D bi->mods[i].mod->mod_start; + unsigned long end =3D start + PFN_UP(bi->mods[i].mod->mod_end); =20 if ( end > node_start && node_end > start ) nr +=3D min(node_end, end) - max(node_start, start); @@ -353,14 +351,12 @@ void __init discard_initial_images(void) for ( i =3D 0; i < bi->nr_modules; ++i ) { uint64_t start =3D - (uint64_t)initial_images[i].mod->mod_start << PAGE_SHIFT; + (uint64_t)bi->mods[i].mod->mod_start << PAGE_SHIFT; =20 - init_domheap_pages(start, - start + PAGE_ALIGN(initial_images[i].mod->mod_e= nd)); + init_domheap_pages(start, start + PAGE_ALIGN(bi->mods[i].mod->mod_= end)); } =20 bi->nr_modules =3D 0; - initial_images =3D NULL; } =20 static void __init init_idle_domain(void) @@ -1380,8 +1376,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 bi->mods; - for ( i =3D 0; i < bi->nr_modules; i++ ) { if ( bi->mods[i].mod->mod_start & (PAGE_SIZE - 1) ) --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729185776; cv=pass; d=zohomail.com; s=zohoarc; b=XktRYOhB8iRbDwJ/oubW1DeDUr+LkloZL97fj2Uzwo8C9f+oMyJdslH5pWeu7Ifji0RKUQ32gO9dHQCXqhL5sN+FOKPS69Yh59x6EVbAbIxdtjIVwxaeKakY7FszCQHaQ53X29GNI+yDZsgxUsfp4Z6OAqy5yD94KKVbAKV3OyU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185776; 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=0gjJz5LNIJtqKeHWTU5DRHYNSoNLJ9iVjYbe2ie5Je8=; b=RvyHfq1RcznMS8l8oku2z+txbsmPwgSjs/P5LhCmOoLVQGPQVZNBqfNEn56gRZ95ZoAvJlBG3uSFS1cFWVyRVeAzK8JMCsA2Gt5GWifIjMFCoI7TVCirnkBXzDNfKfEhMa6gJFyeVaTtg/+GaUno+cl1cS4X/eDloNQBhFtp/DE= 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 1729185776856365.0352290996334; Thu, 17 Oct 2024 10:22:56 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.821079.1234913 (Exim 4.92) (envelope-from ) id 1t1UCs-0002Fb-LZ; Thu, 17 Oct 2024 17:22:38 +0000 Received: by outflank-mailman (output) from mailman id 821079.1234913; Thu, 17 Oct 2024 17:22:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t1UCs-0002FS-G7; Thu, 17 Oct 2024 17:22:38 +0000 Received: by outflank-mailman (input) for mailman id 821079; Thu, 17 Oct 2024 17:22:36 +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 1t1TzI-00014B-Ru for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:08:36 +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 70cf6943-8caa-11ef-99a3-01e77a169b0f; Thu, 17 Oct 2024 19:08:35 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184659192935.1571835611051; Thu, 17 Oct 2024 10:04:19 -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: 70cf6943-8caa-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; t=1729184661; cv=none; d=zohomail.com; s=zohoarc; b=cLxxMYz4+nyr7jfi+Ep3ytFff8XZcen7miLa1T8mjFeYdfPvpAohjPHA18fZGV7CwfGx2kYxTRpjiygaILG0fMG+7NsOxVGofa8eurTy/btluC2cESCL1BWJsLsS+2nbA9tHAni7FW3jnK9vbKBqZ3N2ZLqpNWcNY0CpbdbgdSg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184661; 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=0gjJz5LNIJtqKeHWTU5DRHYNSoNLJ9iVjYbe2ie5Je8=; b=LXu/AVLme8Hl12MVfGEEhOFM4w+wD3MIYbn9A2rKMcaO22wZzkDN7AOMmtxTg4htOmiiU9TLrNPUSdfP5Fwh0r5GXhZfTttuU7T163/6NactU37BfI7HgxRRsc7a4KTyb/z12Qsb7jd397ejSO9r2Vz64rUlf/Unz7MO2MBEyDY= 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=1729184661; 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=0gjJz5LNIJtqKeHWTU5DRHYNSoNLJ9iVjYbe2ie5Je8=; b=RTC1S6GK7APnbt9YKRdB5S/2iypzfyIc9IJMFjUFLIIMpN9R4tfbcogvXrRTsZye LkRtSdNC5/MznK8MNY5fOVEo5ifLJh0OUK+9SeV8rJ3OlbEhUV+xoMnCW+Ca7OrQSZL d1auH6xRqFx8kJEkgyOfDTD1QnTMEVt4I7lkOwZA= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 35/44] x86/boot: remove usage of mod_end by discard_initial_images Date: Thu, 17 Oct 2024 13:03:15 -0400 Message-Id: <20241017170325.3842-36-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185778096116600 Content-Type: text/plain; charset="utf-8" This eliminates usage of early_mod by discard_initial_images Signed-off-by: Daniel P. Smith Reviewed-by: Jason Andryuk --- xen/arch/x86/setup.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index f8b9c164c1cb..4d53292aa444 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -350,10 +350,9 @@ void __init discard_initial_images(void) =20 for ( i =3D 0; i < bi->nr_modules; ++i ) { - uint64_t start =3D - (uint64_t)bi->mods[i].mod->mod_start << PAGE_SHIFT; + uint64_t start =3D bi->mods[i].start; =20 - init_domheap_pages(start, start + PAGE_ALIGN(bi->mods[i].mod->mod_= end)); + init_domheap_pages(start, start + PAGE_ALIGN(bi->mods[i].size)); } =20 bi->nr_modules =3D 0; --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729185422; cv=pass; d=zohomail.com; s=zohoarc; b=RBERGbit8RYXRRSaa6VLUbZegLhsJVIL0+c27W33UOIj5TyF3FqP7snrIIPw6Zy3W7CnAgOpJv/qInMvquio75Xpl1WDjLQKblnIlOa0juKJkFj8zsNfy7R04/pGM6ROMTyMJEaafLY6kikfzTxwy0Ecm9+f5PF3n+dTHS/r1f4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185422; 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=yCWAwbuasnt6b9Yd1Y7i2kLi7iLwBuIBFqAlz4Zq4CE=; b=QYe6Vv17IkFgiAazxTpeEkwUM157fPRgEFdWgloh5+ptmacuq94PJ55ljaoBgrjtPo1BABzKoI7NIaFhuGGqta475+0SHhh64wPIJ88r1GWqnb4ydNGkvt7xoHo0GSFeSxq9zstf20MpPtt9UzBTEP65ZBLbVgZE/7eHhD0Gqpo= 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 1729185422375959.629145699753; Thu, 17 Oct 2024 10:17:02 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820931.1234662 (Exim 4.92) (envelope-from ) id 1t1U76-0003Es-SU; Thu, 17 Oct 2024 17:16:40 +0000 Received: by outflank-mailman (output) from mailman id 820931.1234662; Thu, 17 Oct 2024 17:16: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 1t1U76-0003El-Ot; Thu, 17 Oct 2024 17:16:40 +0000 Received: by outflank-mailman (input) for mailman id 820931; Thu, 17 Oct 2024 17:16: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 1t1TzR-0008TH-14 for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:08: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 764fdd61-8caa-11ef-a0be-8be0dac302b0; Thu, 17 Oct 2024 19:08:44 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184660412458.4759663546213; Thu, 17 Oct 2024 10:04: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: 764fdd61-8caa-11ef-a0be-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1729184662; cv=none; d=zohomail.com; s=zohoarc; b=ICoRWKfFh0fwzoJ4RKp+H6tPLezHb7U0FjEexjHQMGfl5abUMQGUcC2HY+M4Q2ZryiXBOQ/I4e8k9uzcgPYvAMW4hQhE9etbli1uZFqUvZrqla/wstbhT74RhD6lJuV9wPSwSwdq2q8GndMFJtt7EQSEcnDnxw0Qrk5gmrcx7JM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184662; 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=yCWAwbuasnt6b9Yd1Y7i2kLi7iLwBuIBFqAlz4Zq4CE=; b=GyZCqXV2sEq9lDb9hy7MIOC+4ClfXxIZZ6HuY54xuuYiOVx8f7hhFIyX0utvAYLP7XXhaAqpqTqzDxyoa50OCsZGX1xz4i1+gKf/8UGg0jnoP5ByyAgI6nrg1cQnDSMw1kFUNZpdL9HOdz4Lxna33FtBemHT6Ilb9tHeXKQRVBQ= 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=1729184662; 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=yCWAwbuasnt6b9Yd1Y7i2kLi7iLwBuIBFqAlz4Zq4CE=; b=GuqVYQ57RFIx63UqbWBa/o9oOsSAbZ3TtsQyhYI50nlocZZwUneOZG4BQfpLe5d+ DTvEIN/YFqdhwENjpg4xc1cDS+qWtm9pyLrpln/Gg+6R6vV3WL394bU3anRMfcN8xEh F9iKhXuErl9N27B0l025V6K0W+Fceu8sOrjPhlMw= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 36/44] x86/boot: remove remaining module_t references Date: Thu, 17 Oct 2024 13:03:16 -0400 Message-Id: <20241017170325.3842-37-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185424208116600 Content-Type: text/plain; charset="utf-8" Any direct usages of module_t have been transitioned, remove the remaining references to the mod field. This also removes any external use of bootstrap_map(), dropping from setup.h and making it static. Signed-off-by: Daniel P. Smith --- Changes since v5: - commit message rewrite - coding style change - remove export of bootstrap_map() --- xen/arch/x86/include/asm/setup.h | 1 - xen/arch/x86/setup.c | 27 +++++++++------------------ 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/se= tup.h index 72d183e8a4de..f7958b56eab6 100644 --- a/xen/arch/x86/include/asm/setup.h +++ b/xen/arch/x86/include/asm/setup.h @@ -35,7 +35,6 @@ extern struct boot_info xen_boot_info; =20 unsigned long initial_images_nrpages(nodeid_t node); void discard_initial_images(void); -void *bootstrap_map(const module_t *mod); void *bootstrap_map_bm(const struct boot_module *bm); =20 int remove_xen_ranges(struct rangeset *r); diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 4d53292aa444..5ae82f3abcb5 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -333,8 +333,8 @@ unsigned long __init initial_images_nrpages(nodeid_t no= de) =20 for ( nr =3D i =3D 0; i < bi->nr_modules; ++i ) { - unsigned long start =3D bi->mods[i].mod->mod_start; - unsigned long end =3D start + PFN_UP(bi->mods[i].mod->mod_end); + unsigned long start =3D bi->mods[i].start; + unsigned long end =3D start + PFN_UP(bi->mods[i].size); =20 if ( end > node_start && node_end > start ) nr +=3D min(node_end, end) - max(node_start, start); @@ -471,7 +471,7 @@ static void *__init bootstrap_map_addr(paddr_t start, p= addr_t end) return ret; } =20 -void *__init bootstrap_map(const module_t *mod) +static void *__init bootstrap_map(const module_t *mod) { if ( !mod ) return bootstrap_map_addr(0, 0); @@ -661,8 +661,8 @@ static uint64_t __init consider_modules( =20 for ( i =3D 0; i < nr_mods ; ++i ) { - uint64_t start =3D pfn_to_paddr(mods[i].mod->mod_start); - uint64_t end =3D start + PAGE_ALIGN(mods[i].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; @@ -1377,10 +1377,8 @@ void asmlinkage __init noreturn __start_xen(unsigned= long mbi_p) =20 for ( i =3D 0; i < bi->nr_modules; i++ ) { - if ( bi->mods[i].mod->mod_start & (PAGE_SIZE - 1) ) + if ( bi->mods[i].start & (PAGE_SIZE - 1) ) panic("Bootloader didn't honor module alignment request\n"); - bi->mods[i].mod->mod_end -=3D bi->mods[i].mod->mod_start; - bi->mods[i].mod->mod_start >>=3D PAGE_SHIFT; } =20 /* @@ -1401,16 +1399,11 @@ void asmlinkage __init noreturn __start_xen(unsigne= d long mbi_p) */ bi->mods[xen].start =3D virt_to_maddr(_stext); bi->mods[xen].size =3D __2M_rwdata_end - _stext; - - bi->mods[xen].mod->mod_start =3D bi->mods[xen].start; - bi->mods[xen].mod->mod_end =3D bi->mods[xen].size; } =20 - bi->mods[0].headroom =3D - bzimage_headroom(bootstrap_map(bi->mods[0].mod), - bi->mods[0].mod->mod_end); - - bootstrap_map(NULL); + bi->mods[0].headroom =3D bzimage_headroom( + bootstrap_map_bm(&bi->mods[0]), bi->mods[0].size); + bootstrap_map_bm(NULL); =20 #ifndef highmem_start /* Don't allow split below 4Gb. */ @@ -1511,9 +1504,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->mod->mod_start =3D paddr_to_pfn(bm->start); bm->size +=3D bm->headroom; - bm->mod->mod_end =3D bm->size; bm->flags |=3D BOOTMOD_FLAG_X86_RELOCATED; } } --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729185449; cv=pass; d=zohomail.com; s=zohoarc; b=i5/21BKWVfEto3pDlJ4q7EBiFDeNJpV9VNOpPkoDJ6pY+ImdcQ1AnxmFBOvRNqn/LmZVBzh7VqhIegHU8OwIS17qDEiy+olI3q5c70ZszB2faGqUoo2JvEruIE4h5rmrY6oR8XOaLWclZDJ6Gzl2D62ygg9GGTpuLSR9Fdg/45s= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185449; 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=t8mwfgj0+AG9djRszVKShE80Ero/zF+/yhs316UwKJo=; b=magQuZnIktWeF0dgDiGgbUMr3G/+n3kP9DF7e4fuqTJB2YWaduJvSXWG/KVrXQ7ryWda93E5kaE/JzzbNC4NC2d+CURlKrkcyMu/zA/PtG20wZJFdxQDmwtYSagGP6k08XEC8iHQDeHvpCghxWQ4WSJQt2ARVRUsanvRGF4wkCU= 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 1729185449878679.6898000133941; Thu, 17 Oct 2024 10:17:29 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820943.1234692 (Exim 4.92) (envelope-from ) id 1t1U7f-0004gO-KP; Thu, 17 Oct 2024 17:17:15 +0000 Received: by outflank-mailman (output) from mailman id 820943.1234692; Thu, 17 Oct 2024 17:17: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 1t1U7f-0004gH-Hq; Thu, 17 Oct 2024 17:17:15 +0000 Received: by outflank-mailman (input) for mailman id 820943; Thu, 17 Oct 2024 17:17:13 +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 1t1TzY-0008TH-14 for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:08: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 7a61aa24-8caa-11ef-a0be-8be0dac302b0; Thu, 17 Oct 2024 19:08:51 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184661673704.2726553863293; Thu, 17 Oct 2024 10:04: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: 7a61aa24-8caa-11ef-a0be-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1729184664; cv=none; d=zohomail.com; s=zohoarc; b=FGaplFOEg0rWI0UwXkCA+tRto+W1AeKjKp/IK1sImY8OaZ0tt2Hwb3CBRrNcwNVSewTgRHEPOPlRZFPQOswlI+1dYOfuxLrEw6PMzvJZsYhV3TDfsOIEq9pxwprgNN2P8NLChp7FSWcHs0+bdZ6xyEd9Ljm+asRWKTH/Eqmo2A8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184664; 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=t8mwfgj0+AG9djRszVKShE80Ero/zF+/yhs316UwKJo=; b=WauNIwkoJRLSMZUi9LAolyhJZfXfdMN1GuLam2sWYVV4151l5t33HuKcCNqIdgohaiwEJ6OEW6DjjJZUBclRbNC6ucxcH7u7HQZsGU3rdmgBWuHT8X9/Ebo4m9EBG2uoto6W06+FLiZOuFcv51LblVaYTNfyCV0CKiFDt6klqrc= 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=1729184664; 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=t8mwfgj0+AG9djRszVKShE80Ero/zF+/yhs316UwKJo=; b=V/XPjZlOPZgdAHyA7bfz3i0WTSD1qZbB+lW7Mi6BUdIyPL8JTejU6Ixn8DiCqQxW Nq6v5VZ8gQZfDhceAcmaSmSaq8g6yIMr+YkjrA820OeUKHtaWugOxLvPXze+TRJHhHP y3d1OCR2oN89UagNAVviywYA7jmq0z/iwLBWphB4= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 37/44] x86/boot: remove mod from struct boot_module Date: Thu, 17 Oct 2024 13:03:17 -0400 Message-Id: <20241017170325.3842-38-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185450219116600 Content-Type: text/plain; charset="utf-8" With all references to mod field removed, remove the mod field from struct boot_module. Signed-off-by: Daniel P. Smith Reviewed-by: Jason Andryuk --- xen/arch/x86/include/asm/bootinfo.h | 3 --- xen/arch/x86/setup.c | 2 -- 2 files changed, 5 deletions(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 24c2f37c7b11..b65b55c0a2c2 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 /* Max number of boot modules a bootloader can provide in addition to Xen = */ @@ -25,8 +24,6 @@ enum bootmod_type { }; =20 struct boot_module { - /* Transitionary only */ - module_t *mod; /* * A boot module may contain a compressed kernel that will require * additional space, before the module data, into which the kernel wil= l be diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 5ae82f3abcb5..ae027667eb82 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -308,8 +308,6 @@ static struct boot_info *__init multiboot_fill_boot_inf= o(unsigned long mbi_p) */ for ( i =3D 0; i <=3D bi->nr_modules; i++ ) { - bi->mods[i].mod =3D &mods[i]; - bi->mods[i].cmdline =3D (paddr_t)mods[i].string; =20 bi->mods[i].start =3D (paddr_t)mods[i].mod_start; --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729185477; cv=pass; d=zohomail.com; s=zohoarc; b=RYA8J6cWxide9oaqnrv6h0sAYoZFYZgxciG8GVfaWzNIAx1juKd4fimASP+WpdtDhIIVSzktJX+OmXY5Ix/3ac9P+3bQStQ4BJJvZ+aF6v9nQQX7IrpiwP1HExMuiRBzALX8T24hbuv53UKcRa8LFGIF9Q4vaqQnkc/IjZSahio= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185477; 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=S1LW22pFbnxH5JGQ8//MfzLwShQxKtqrPZfaGz84Hgg=; b=i+Yn665CvERSY3sZu6b4drxUQ1wadetg6lGyn+bYVgOiVP28aAwd7Tgr5qpWgJaxPn4CnLAS97bjDrr5/jOuOo1pbAM1GulXEsMajNQARywV41JrI5AM0yRE2FwpTnkBhXIrIAk2g2MEOTlQfhngv6r8TarhkjLc0gMzZN4fBWU= 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 1729185477904576.7435014133803; Thu, 17 Oct 2024 10:17:57 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820960.1234701 (Exim 4.92) (envelope-from ) id 1t1U7y-0005Vu-RQ; Thu, 17 Oct 2024 17:17:34 +0000 Received: by outflank-mailman (output) from mailman id 820960.1234701; Thu, 17 Oct 2024 17:17: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 1t1U7y-0005Vn-Os; Thu, 17 Oct 2024 17:17:34 +0000 Received: by outflank-mailman (input) for mailman id 820960; Thu, 17 Oct 2024 17:17: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 1t1Tze-0008TH-L2 for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:08: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 7e4aa548-8caa-11ef-a0be-8be0dac302b0; Thu, 17 Oct 2024 19:08:57 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184662893105.18560154820727; Thu, 17 Oct 2024 10:04: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: 7e4aa548-8caa-11ef-a0be-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1729184665; cv=none; d=zohomail.com; s=zohoarc; b=fBe4WLb7EHSW3PylVLEICC3qQRDDiKHL+H0c+uF7mjXUy5PcrmKf+qG1f+lFY1FaTEm+rJdYCMxDPGRJVX/zTJsxy+pLukTSOLLDgnmyVLq5xFzEX6up4Uope85qacc6qakYc9V2YNGofkbqt+JkPuydUFfn31tClzqBDC92t9E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184665; 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=S1LW22pFbnxH5JGQ8//MfzLwShQxKtqrPZfaGz84Hgg=; b=Osbbkoh/MPisEEZO+D7hShf3v40EoYGbEGjI6M3dRnpeoX55IQeNvxjd9Jx4ydAjCk71cBZd0stqBiPJ0WZBxqqFDvRnjiNbzWoyF262aBb579DcVinw+ZX1OykfpqBjGwWONu6eZkKHIzC91ulhOJoBpvnSNjip6pLwrN7OD1w= 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=1729184665; 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=S1LW22pFbnxH5JGQ8//MfzLwShQxKtqrPZfaGz84Hgg=; b=is4MgpcB2Qw7lJR60I4biW7RtZlThCKyy2HlGdCtygnA1/Dnl/VtyJOQ5nQ3qnIo x0O/4vni9MAKVmUNEGCWt8jMAhmfvQ8W86OUoQKWUDLaINyE/BzXyvbgI95CPlYSDDY ip+F2EqrX5YhPQ68F5dW77QqzYrrfLoRphOVPLiY= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 38/44] x86/boot: introduce boot domain Date: Thu, 17 Oct 2024 13:03:18 -0400 Message-Id: <20241017170325.3842-39-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185478416116600 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 | 5 +++++ xen/arch/x86/setup.c | 23 +++++++--------------- 3 files changed, 40 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 b65b55c0a2c2..476f71a7633b 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -9,10 +9,14 @@ #define __XEN_X86_BOOTINFO_H__ =20 #include +#include =20 /* Max number of boot modules a bootloader can provide in addition to Xen = */ #define MAX_NR_BOOTMODS 63 =20 +/* Max number of boot domains that Xen can construct */ +#define MAX_NR_BOOTDOMS 1 + /* Boot module binary type / purpose */ enum bootmod_type { BOOTMOD_UNKNOWN, @@ -63,6 +67,7 @@ struct boot_info { =20 unsigned int nr_modules; struct boot_module mods[MAX_NR_BOOTMODS + 1]; + struct boot_domain domains[MAX_NR_BOOTDOMS]; }; =20 /* diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index ae027667eb82..ccb5052e18be 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -956,20 +956,10 @@ static struct domain *__init create_dom0(struct boot_= info *bi) .misc_flags =3D opt_dom0_msr_relaxed ? XEN_X86_MSR_RELAXED : 0, }, }; - unsigned 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 | @@ -995,11 +985,10 @@ static struct domain *__init create_dom0(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(image->cmdline), + if ( bd->kernel->cmdline ) + safe_strcpy(cmdline, cmdline_cook(__va(bd->kernel->cmdline), bi->loader)); =20 if ( bi->kextra ) @@ -1023,7 +1012,7 @@ static struct domain *__init create_dom0(struct boot_= info *bi) } } =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 return d; @@ -1203,6 +1192,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) /* Dom0 kernel is always first */ bi->mods[0].type =3D BOOTMOD_KERNEL; bi->mods[0].flags =3D BOOTMOD_FLAG_X86_CONSUMED; + bi->domains[0].kernel =3D &bi->mods[0]; =20 if ( pvh_boot ) { @@ -2086,6 +2076,7 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) { bi->mods[initrdidx].type =3D BOOTMOD_RAMDISK; bi->mods[initrdidx].flags |=3D BOOTMOD_FLAG_X86_CONSUMED; + bi->domains[0].ramdisk =3D &bi->mods[initrdidx]; if ( first_boot_module_index(bi, BOOTMOD_UNKNOWN) < MAX_NR_BOOTMOD= S ) printk(XENLOG_WARNING "Multiple initrd candidates, picking module #%u\n", --=20 2.30.2 From nobody Thu Nov 21 21:35:13 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=1729185571; cv=pass; d=zohomail.com; s=zohoarc; b=iOqMecDRgRiu+Xb9+BdJJpsgAYx2Zp0CjRXS4QjWPRA2s6AH1zopL7yhAFOgJ3CYnStvYXW4JaK/pw44Aa466ZlukJ9mkTrvnf7Bd2XTdBUT/aY/w0bSXu3kkSuLGLBg3gxZ8pgpBVp2108kMLdwotQkzNj/mEc6vc7rs80vYn0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185571; 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=BJ5VYIncE7+0Abn8b+L/cjX/uv1rXkaBhM0DRTxUuNQ=; b=hRCVZ9WO6IW2+Z5RB75dixwo2/yqnisw0X2A2VX4L7twtR6VI+lelQvnESMzFmkTS8TJU5Y+lDXjBXQSKf8U6No3DfdxOo8pspea17aJH0yvEb+/16rK8DsnFnCymt6040HW0IS1eIhKCI9apMaMNzH2qVYyFLyShbz50+Gi+fQ= 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 1729185571774725.3295498863945; Thu, 17 Oct 2024 10:19:31 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.820978.1234732 (Exim 4.92) (envelope-from ) id 1t1U9W-0007R6-Mv; Thu, 17 Oct 2024 17:19:10 +0000 Received: by outflank-mailman (output) from mailman id 820978.1234732; Thu, 17 Oct 2024 17:19: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 1t1U9W-0007Qx-Je; Thu, 17 Oct 2024 17:19:10 +0000 Received: by outflank-mailman (input) for mailman id 820978; Thu, 17 Oct 2024 17:19:09 +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 1t1Tzm-0008TH-Lk for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:09:06 +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 823c5b74-8caa-11ef-a0be-8be0dac302b0; Thu, 17 Oct 2024 19:09:04 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 17291846641131020.5415294818473; Thu, 17 Oct 2024 10:04:24 -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: 823c5b74-8caa-11ef-a0be-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1729184666; cv=none; d=zohomail.com; s=zohoarc; b=G9sG10XUydhECPLFpPpP4Gj5/KgVJVQcXfRjaOC5oWlrL8zFzWaAKfK73gv8k9j2jB3VDy+Nu9C2t6YdRKkUX0h5zMc7s+Ytqgp/7KOQjjjW+XAVR2unke/Z4+ucXODc71ln7P+KH8v/02qJNBj7HtvFh8Xc1SAuya0TqqBhcX4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184666; 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=BJ5VYIncE7+0Abn8b+L/cjX/uv1rXkaBhM0DRTxUuNQ=; b=OEDj4ZGTx7P0jgg7gqEkpX71lswsW2r7WLNGdghPKfLb+dwez9x0cc5YaEUnA8it8pjzUdylnM+UzdsSL/dlURZB1BoF4cjRfOvzuUtnOJPmz46LCgaeNVBjRlx3BMJuGroGj7pUNuyEpN9pKindfkcMydSUbNHs48Phhw7WM3k= 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=1729184666; 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=BJ5VYIncE7+0Abn8b+L/cjX/uv1rXkaBhM0DRTxUuNQ=; b=IXRNGp/QEirmwMm1/AiJDtxtQJ802FfZ9h8qYsp9jINm9o7ywTzn36Mg3zvorEXe 0YnSOm1w+xfCCh9bf1Pa1YtAc5TDnW8KbXRa2ztLVfUTBeNGZ/r2hlZR+qdfxPtrmLb WikeVFtcw3/ErWtTF8l5Jd/a66LwvC+LTCoM87sw= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 39/44] x86/boot: introduce domid field to struct boot_domain Date: Thu, 17 Oct 2024 13:03:19 -0400 Message-Id: <20241017170325.3842-40-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185573209116600 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 Reviewed-by: Jason Andryuk --- 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 ccb5052e18be..e74526e20b5b 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -318,6 +318,9 @@ static struct boot_info *__init multiboot_fill_boot_inf= o(unsigned long mbi_p) bi->mods[bi->nr_modules].type =3D BOOTMOD_XEN; bi->mods[bi->nr_modules].flags =3D BOOTMOD_FLAG_X86_CONSUMED; =20 + for ( i =3D 0; i < MAX_NR_BOOTDOMS; i++ ) + bi->domains[i].domid =3D DOMID_INVALID; + return bi; } =20 @@ -958,7 +961,6 @@ static struct domain *__init create_dom0(struct boot_in= fo *bi) }; struct boot_domain *bd =3D &bi->domains[0]; struct domain *d; - domid_t domid; =20 if ( opt_dom0_pvh ) { @@ -974,15 +976,15 @@ static struct domain *__init create_dom0(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 Thu Nov 21 21:35:13 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=1729185683; cv=pass; d=zohomail.com; s=zohoarc; b=nYNh0V/KYt9w9xDyRfy+XObWzvCoLmEsPgOQnqsI5/txsLfFJkSAphU6nOvandjv0Eh15rIf4/mz5KupS9aQWl0pBfIFkOIlS4o7cn5l1EXzz2ImY5SMcvDnQGaIrGxhHVfuQSqGAQxCcsKgh1vv1FPSy3h2DUIpm2UZDdQNrhw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185683; 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=M5ZqTV3hdrjp9T+eS9L5DEYe6kUmW2KTxCnzOajAfpE=; b=nbwReJEnSjwtkNaQj+rLQ6VmdbKWvrULNc+WfUJqCMmcIOIsiiocU6a+LqWLY+vl2X43lvyqkVpdlBBFIMJ9G0hBgl82Ytuu6be/wK58PnNlkbgzMPFIXSs7JygzNruW8JLmihpq/ChFpLDTyE9BJ9DV8KMfMt4HUtecEETg/js= 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 1729185683253230.3654300993037; Thu, 17 Oct 2024 10:21:23 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.821058.1234882 (Exim 4.92) (envelope-from ) id 1t1UBN-0007s1-Fr; Thu, 17 Oct 2024 17:21:05 +0000 Received: by outflank-mailman (output) from mailman id 821058.1234882; Thu, 17 Oct 2024 17:21:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t1UBN-0007rs-Bs; Thu, 17 Oct 2024 17:21:05 +0000 Received: by outflank-mailman (input) for mailman id 821058; Thu, 17 Oct 2024 17:21:03 +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 1t1Tzs-0008TH-3K for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:09:12 +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 86559b7f-8caa-11ef-a0be-8be0dac302b0; Thu, 17 Oct 2024 19:09:11 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184665301732.0723237960185; Thu, 17 Oct 2024 10:04: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: 86559b7f-8caa-11ef-a0be-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1729184668; cv=none; d=zohomail.com; s=zohoarc; b=VMQ+bGVq9sllLGMYOT9NujBbHIYd1PyHiSqvZcsqfSqi3fbdcyF8uCB4UffqLq+rttutct2vQuff8Cm68oMs2A0PiIKPgh63dCK6kg8db51xA2lfu2XXsImLkSSQZUayMnKGYaNfUqE2bXaPNI9KAh9O4ClgvAQSnduUy9mX2TQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184668; 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=M5ZqTV3hdrjp9T+eS9L5DEYe6kUmW2KTxCnzOajAfpE=; b=cJV/c4hN5XBjioZluQlAfs8pcUWameU1dIIU+vfl/bPdsrP5ouvEGQnbprqmny4isWbTZuxsAxP9OO4G/ZbP+HUkEiFZDR/N4zGq/bURDX51P6zE04PQYZ3TuVG7x2sQeWtjeRyvWa1xorLgGh59638FvzA8aowzkzml9NciV+4= 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=1729184668; 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=M5ZqTV3hdrjp9T+eS9L5DEYe6kUmW2KTxCnzOajAfpE=; b=vWM3I32nrj0Q9VLOHMOj77lAL0+AxCLKzgAmv40s/POtYaQXn7hPJOkvfEVDnFci ZXLo4KHTW97dvYUxoRO+gbdemQMHe8hA47+yxzwOn+xJOYDYZwTPqRsEcPD+1Zk2yJN 4iqmuf1VrDGhJKkZ8qq/WeBp/1Ut2e5a0U0qiMdc= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 40/44] x86/boot: add cmdline to struct boot_domain Date: Thu, 17 Oct 2024 13:03:20 -0400 Message-Id: <20241017170325.3842-41-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185683815116600 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 e74526e20b5b..1aa063facfce 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -946,8 +946,6 @@ static unsigned int __init copy_bios_e820(struct e820en= try *map, unsigned int li =20 static struct domain *__init create_dom0(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, @@ -990,16 +988,16 @@ static struct domain *__init create_dom0(struct boot_= info *bi) if ( bd->kernel->cmdline || bi->kextra ) { if ( bd->kernel->cmdline ) - safe_strcpy(cmdline, cmdline_cook(__va(bd->kernel->cmdline), + safe_strcpy(bd->cmdline, cmdline_cook(__va(bd->kernel->cmdline= ), bi->loader)); =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 ) { @@ -1007,14 +1005,14 @@ static struct domain *__init create_dom0(struct boo= t_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 - 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 return d; --=20 2.30.2 From nobody Thu Nov 21 21:35:14 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=1729185646; cv=pass; d=zohomail.com; s=zohoarc; b=U2B+S0rnqtR2bXevrkW1VeEi4qZuR5eGWhah1VtwKqVq/gujwC/x0gbFy5lUq4yQBlq6Qm3fsC0JsPDe1zbxesivf6spzxcck7376humUGCyBVoFDxCPCb5hwX2iRrejSQGdLymlG3KfMYQEncgbn6ybi3MpT4dpQ5llyrRnZtY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185646; 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=MA3/IH4VWLQ7jN2aVHhTtAIX9q+RjxglxLS16ZJ3JG4=; b=iWvwzPH/tgAmcwXDJB5eiY/zJO1WcN6M4/YagLj1Ztbp84LJqxas1cT2gnTZZQtXjdO7N5HPzWZNBoQvhEk68TNQ7nmRNB6DRbyjO8YqGVJFFhb1VdMBDrmlxQjTCB4IMpfR+AuiERCTFD66bY99dGeeI5uNmDXMNqO684QaYDg= 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 1729185646044995.4390536849671; Thu, 17 Oct 2024 10:20:46 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.821022.1234811 (Exim 4.92) (envelope-from ) id 1t1UAc-0004Iv-8R; Thu, 17 Oct 2024 17:20:18 +0000 Received: by outflank-mailman (output) from mailman id 821022.1234811; Thu, 17 Oct 2024 17:20: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 1t1UAc-0004Io-5X; Thu, 17 Oct 2024 17:20:18 +0000 Received: by outflank-mailman (input) for mailman id 821022; Thu, 17 Oct 2024 17:20:16 +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 1t1Tzy-0008TH-MW for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:09:18 +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 8a49ec72-8caa-11ef-a0be-8be0dac302b0; Thu, 17 Oct 2024 19:09:17 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184666649537.2838599744491; Thu, 17 Oct 2024 10:04: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: 8a49ec72-8caa-11ef-a0be-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1729184669; cv=none; d=zohomail.com; s=zohoarc; b=oHHB7tPYQvisRi3u0iB+bVrCD7dg6zYEq0nvVKIrcPfKLE6HlQR99F591gzujjraocIn3pHreKtEqb1Z2hEvUeJelryz/P9EyOZaHA+mu4jszJlsFngQ8jE0Dsmvgb08JC/3R2OP6wZv1a4YY/EQJAOd4pMkMdZaPH5Oc9zaT2M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184669; 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=MA3/IH4VWLQ7jN2aVHhTtAIX9q+RjxglxLS16ZJ3JG4=; b=feHejNNneXvg0zFTeejqjJHLTk+QyLaan0JN1LntEzApZjcwT8oGwJbZK5rlfOvItEHR9gkdDzQVQqHfOfvsUKi/VWdls7Lsc1tDGrJCu2GObsvPstykww8GwOBZSzlKizprAYosZpG5TOv1Twhav/5Kt7kAKIFc9MAK/nXu3Kk= 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=1729184669; 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=MA3/IH4VWLQ7jN2aVHhTtAIX9q+RjxglxLS16ZJ3JG4=; b=jTUtbPFRVzBOQciezzn28jKMB9WTosJ6B1wF4vOpIqx1+QNUdhh2/8QYjT7uSC3N UZAw61ekFunYgRyi+DDns8rVmsxZCnBOhAbGIV2AToRE+I/rQ6H4A4kbn5ARUnY2LRX XE0r8lH/bdeWhR++Qe/N/7kunbGXOuyTfcj2gQWw= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 41/44] x86/boot: add struct domain to struct boot_domain Date: Thu, 17 Oct 2024 13:03:21 -0400 Message-Id: <20241017170325.3842-42-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185647516116600 Content-Type: text/plain; charset="utf-8" Store a reference to the created domain in struct boot_domain. Signed-off-by: Daniel P. Smith --- Changes since v5: - moved back to using variable *d to hold domain reference locally --- xen/arch/x86/include/asm/bootdomain.h | 3 +++ xen/arch/x86/setup.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) 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 1aa063facfce..494e48a7c836 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1012,10 +1012,12 @@ static struct domain *__init create_dom0(struct boo= t_info *bi) } } =20 + bd->d =3D d; + if ( construct_dom0(d, bd->kernel, bd->ramdisk, bd->cmdline) !=3D 0 ) panic("Could not construct domain 0\n"); =20 - return d; + return bd->d; } =20 /* How much of the directmap is prebuilt at compile time. */ --=20 2.30.2 From nobody Thu Nov 21 21:35:14 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=1729185710; cv=pass; d=zohomail.com; s=zohoarc; b=b3Uxa80hQiTeRzHMMA85xmtSkMqvl2gl5dJHRUx15AUC3rSMKYNL4G0WdARrhywInPZFpUWqsPV9mQWCbKN24ngTt5ev/SndfTB2Lf+Ripnor+M6R+uRyizJTIfmFpnUnt8rQ+7zFVK17xG4IBvwMrBs2yhAhwLVStahzKdEcoE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185710; 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=+1GsfAAD9TH3Wlh8fsiZ1qgiG1+d1IF1Bk8zaWFZI9U=; b=KWZu9GZT3uC0V91DqCRCleiOJJKW+frT2/+CgwmCK5hPJZ+IAe0S7316bTl2+v8bQo38oGFsQuUDctsnFW6cBLkRyXtfwMPedI3TblMVq6DpU70LVtW2JjQIP/7pfRpn3ninaKi72uuG/6ro+wPKh2VVdKka8KVsguVScbcTnwU= 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 1729185710568525.428213685229; Thu, 17 Oct 2024 10:21:50 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.821059.1234887 (Exim 4.92) (envelope-from ) id 1t1UBN-0007uu-Rm; Thu, 17 Oct 2024 17:21:05 +0000 Received: by outflank-mailman (output) from mailman id 821059.1234887; Thu, 17 Oct 2024 17:21:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t1UBN-0007tz-KL; Thu, 17 Oct 2024 17:21:05 +0000 Received: by outflank-mailman (input) for mailman id 821059; Thu, 17 Oct 2024 17:21:04 +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 1t1U04-0008TH-IH for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:09:24 +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 8dc2d6f9-8caa-11ef-a0be-8be0dac302b0; Thu, 17 Oct 2024 19:09:23 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184667892741.9331042535918; Thu, 17 Oct 2024 10:04: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: 8dc2d6f9-8caa-11ef-a0be-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1729184670; cv=none; d=zohomail.com; s=zohoarc; b=WVR/lDK+04iVOVW/0H/mHVl9L6kUHWCNJWWyghZxCuhKlHc4yQfq8WpNiXnkMQugs8k+RIccLmVyDuEDFkMARnlnSPqKZPEAl64FEOlraHKZDogGGgAEF6HzAU9IxcfVwSUHYV8ZJ/A4jhv4/cONHMBDlcbNF156qAXxTUhe268= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184670; 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=+1GsfAAD9TH3Wlh8fsiZ1qgiG1+d1IF1Bk8zaWFZI9U=; b=ebrqyv3CKounmHSUNcjhbQviXOLghOgMdrTbkGE8+YK5rCsdZgkVnYdXASMvjl+x0Nh5ONlzRWzExGSyV2L60T4JDofJbdFIG+bdw4YLtZom81jdKrm0JJekFdYCO9TqHWZ60EcsMVNfIn44RY1Yyi9nSuSh1gDrfB6KVq6TuIk= 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=1729184670; 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=+1GsfAAD9TH3Wlh8fsiZ1qgiG1+d1IF1Bk8zaWFZI9U=; b=l53SLPqO/UvAc2AhBCNFOElQLLyAgDloPG62jPyUtOMKRBeTGvV5kg6bPyC6K/19 ap1KP+Q7nlw1wpt/H1/w+HUzBw2YdaKixh25040M4VyxfJFQG5/Wktq63PkIp/dm4AT tpq7/5t2Uh90tGiSRMfz3G3gCVBEIxKvvW2yHvpg= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 42/44] x86/boot: convert construct_dom0 to struct boot_domain Date: Thu, 17 Oct 2024 13:03:22 -0400 Message-Id: <20241017170325.3842-43-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185711874116600 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 --- Changes since v5: - moved back to using variable *d to hold domain reference locally --- xen/arch/x86/dom0_build.c | 8 ++++---- xen/arch/x86/include/asm/setup.h | 4 +--- xen/arch/x86/setup.c | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index 71b2e3afc1a1..34b4943de3b1 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -597,10 +597,10 @@ 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; + struct domain *d =3D bd->d; =20 /* Sanity! */ BUG_ON(!pv_shim && d->domain_id !=3D 0); @@ -610,9 +610,9 @@ 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, initrd, cmdline); + rc =3D dom0_construct_pvh(bd->d, bd->kernel, bd->ramdisk, bd->cmdl= ine); else if ( is_pv_domain(d) ) - rc =3D dom0_construct_pv(d, image, initrd, cmdline); + 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 diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/se= tup.h index f7958b56eab6..b049dc5ee17e 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 extern struct boot_info xen_boot_info; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 494e48a7c836..d9ad27093611 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1014,7 +1014,7 @@ static struct domain *__init create_dom0(struct boot_= info *bi) =20 bd->d =3D d; =20 - if ( construct_dom0(d, bd->kernel, bd->ramdisk, bd->cmdline) !=3D 0 ) + if ( construct_dom0(bd) !=3D 0 ) panic("Could not construct domain 0\n"); =20 return bd->d; --=20 2.30.2 From nobody Thu Nov 21 21:35:14 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=1729185666; cv=pass; d=zohomail.com; s=zohoarc; b=GBUr/n+B+yw/h9wamb+K771Hr++4sF7BugKbreDAH0wMy/hh9tutXbOepyzKIMwsEkVsd2KElTFJqjfNZdegBKKkX/A8Cm3fRQImpSmNRWQVeDMK6szGaLrLSIY09YLPuZ4JbLnbJ/U8iuu4iXgqYp8yWKJ79Pj/QGVM8iNGBQ8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185666; 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=9+B4OzBQ7rw57Cecbw8dku0IeEJ1zavf5a/aaymJkgU=; b=QB46Q9bF1To+H1XXVo9mkW/pUBpkP9ij1j0MUlO3LYZMMGSq3CXm3SStNrx9CTEn678IjPfa1YCwFeno6cUUUXOfEwTTWmnsmg0ODxsS7hlxgf2mlPsMYIsZ5XZzKWlJGsw54GzQfcZHhQcNFx7mc9ZYLVsSuUkdPgb1L8G+ysg= 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 1729185666672816.2481313945085; Thu, 17 Oct 2024 10:21:06 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.821036.1234831 (Exim 4.92) (envelope-from ) id 1t1UAs-0005Mx-Qs; Thu, 17 Oct 2024 17:20:34 +0000 Received: by outflank-mailman (output) from mailman id 821036.1234831; Thu, 17 Oct 2024 17:20: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 1t1UAs-0005Mk-N8; Thu, 17 Oct 2024 17:20:34 +0000 Received: by outflank-mailman (input) for mailman id 821036; Thu, 17 Oct 2024 17:20:34 +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 1t1U0E-0008TH-Mg for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:09:34 +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 93ddd747-8caa-11ef-a0be-8be0dac302b0; Thu, 17 Oct 2024 19:09:34 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184669125634.2300346641034; Thu, 17 Oct 2024 10:04:29 -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: 93ddd747-8caa-11ef-a0be-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1729184672; cv=none; d=zohomail.com; s=zohoarc; b=WEKpKvDtClHHQBu0BzpCfBAD/yVFbIu4CI12tll1MvaPJ8DbqPizvrdLlArqNVtruizHVLfyQUaBL2/hn/D0mMnD/6yRx75Sv7VxQYtuVxjCsTaQ3nyEmjmR5jAAIn3uR1+xbIVNGkbH9LF6nml7RqU+/N1cDEQ+/FYjgvh+kc8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184672; 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=9+B4OzBQ7rw57Cecbw8dku0IeEJ1zavf5a/aaymJkgU=; b=bAQQDiTx4fZoQDKLiUIW212k+LBPbbQQ4d/2n4gKHKyz7WmT29Lf01/ItbAvk2JkQvYkXUORGuLZ+996sJgHjbSTzsulyZEZg/rktdvt/xjMLPXmpgb/pP5WNir0qCNih2MGS3fIJtdBg05VY39FnqpGCR5en1fVEh8+oAbp04M= 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=1729184672; 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=9+B4OzBQ7rw57Cecbw8dku0IeEJ1zavf5a/aaymJkgU=; b=qjgxSDaDZaunxPeasAy4mEYRX7fljKd0+/lWyCl/lSYWT1T77eG47a998ine8WsD gHt+mqRDzkZV2gJ4aoivpI4W//04DWBCkSHRa4uNwspWAa81t09IAeqBAK89g6CyFmr wF4wWc8uc7vbhtwBlEZ01/h44sOpEAmuwqtwL9+A= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 43/44] x86/boot: convert dom0_construct_pv to struct boot_domain Date: Thu, 17 Oct 2024 13:03:23 -0400 Message-Id: <20241017170325.3842-44-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185667687116600 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 Reviewed-by: Jason Andryuk --- Changes since v5: - reverted back *v d->vcpu[0] --- xen/arch/x86/dom0_build.c | 2 +- xen/arch/x86/include/asm/dom0_build.h | 5 ++-- xen/arch/x86/pv/dom0_build.c | 41 ++++++++++++--------------- 3 files changed, 21 insertions(+), 27 deletions(-) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index 34b4943de3b1..96cd1154b037 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -612,7 +612,7 @@ int __init construct_dom0(struct boot_domain *bd) if ( is_hvm_domain(d) ) rc =3D dom0_construct_pvh(bd->d, bd->kernel, bd->ramdisk, bd->cmdl= ine); else if ( is_pv_domain(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 5e7b543d0cbe..53c34b7cf358 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 -static int __init dom0_construct(struct domain *d, - const struct boot_module *image, - struct boot_module *initrd, - const char *cmdline) +static int __init dom0_construct(struct boot_domain *bd) { int i, rc, order, machine; bool compatible, compat; @@ -373,11 +370,12 @@ static int __init dom0_construct(struct domain *d, struct page_info *page =3D NULL; unsigned int flush_flags =3D 0; start_info_t *si; + struct domain *d =3D bd->d; 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; + 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; @@ -613,7 +611,7 @@ static int __init dom0_construct(struct domain *d, initrd_pfn =3D vinitrd_start ? (vinitrd_start - v_start) >> PAGE_SHIFT : domain_tot_pages(d); - initrd_mfn =3D maddr_to_mfn(initrd->start); + initrd_mfn =3D maddr_to_mfn(bd->ramdisk->start); mfn =3D mfn_x(initrd_mfn); count =3D PFN_UP(initrd_len); if ( d->arch.physaddr_bitsize && @@ -629,13 +627,13 @@ static int __init dom0_construct(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 page_to_mfn(page); - initrd->start =3D mfn_to_maddr(initrd_mfn); + bd->ramdisk->start =3D mfn_to_maddr(initrd_mfn); } else { @@ -643,7 +641,7 @@ static int __init dom0_construct(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(initrd_mfn), PFN_UP(initrd_len), &flush_flags); @@ -655,9 +653,9 @@ static int __init dom0_construct(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); } @@ -885,7 +883,7 @@ static int __init dom0_construct(struct domain *d, if ( pfn >=3D initrd_pfn ) { if ( pfn < initrd_pfn + PFN_UP(initrd_len) ) - mfn =3D paddr_to_pfn(initrd->start) + (pfn - initrd_pfn); + mfn =3D paddr_to_pfn(bd->ramdisk->start) + (pfn - initrd_p= fn); else mfn -=3D PFN_UP(initrd_len); } @@ -955,8 +953,8 @@ static int __init dom0_construct(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)) ) @@ -1053,10 +1051,7 @@ out: return rc; } =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 rc; =20 @@ -1073,7 +1068,7 @@ int __init dom0_construct_pv(struct domain *d, write_cr4(read_cr4() & ~X86_CR4_SMAP); } =20 - rc =3D dom0_construct(d, image, initrd, cmdline); + rc =3D dom0_construct(bd); =20 if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) ) { --=20 2.30.2 From nobody Thu Nov 21 21:35:14 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=1729185803; cv=pass; d=zohomail.com; s=zohoarc; b=OTf9Y5j9xktkNbToyfp4pH8xq30cnytMUEhWoCRvy6MVPJT7H3AJn7DWmQ+2NWJ3B+mnMQ+fpTC/rDAhViAiChXndEgU+/xPfpwzh+vDXKswaVm64BVbeyGv9czNXy4JT8aTvhZ+Uoh0+2+vHmvnTr6H/rddQdXDm5Q1sgMXENQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729185803; 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=q6fEPJY/wmWNpsEBUPTBtfhYBFq0uC8xsS/EzPvmcH0=; b=SFkKxxMLSTQL7xVQH049ww8TTKmRNXmack0CLnKzsHrpFcd44SWWSBqmIVR9vRfsIlYBkCrxdOp1LHeVH39Gm+5cJoE7Cn8Mh4Sp+fJfEzaX6aHDHNSH/65v+QK+rSZ3fTYt6ZhLjjnA42JlG3F7BgrUIoZrzNFLn6GOuJxO5q0= 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 1729185803197811.6148444727496; Thu, 17 Oct 2024 10:23:23 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.821098.1234942 (Exim 4.92) (envelope-from ) id 1t1UDN-0003mF-A4; Thu, 17 Oct 2024 17:23:09 +0000 Received: by outflank-mailman (output) from mailman id 821098.1234942; Thu, 17 Oct 2024 17:23: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 1t1UDN-0003m6-7A; Thu, 17 Oct 2024 17:23:09 +0000 Received: by outflank-mailman (input) for mailman id 821098; Thu, 17 Oct 2024 17:23:08 +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 1t1U0L-0008TH-Ha for xen-devel@lists.xenproject.org; Thu, 17 Oct 2024 17:09:41 +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 97e63093-8caa-11ef-a0be-8be0dac302b0; Thu, 17 Oct 2024 19:09:40 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1729184670345139.97769028146377; Thu, 17 Oct 2024 10:04:30 -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: 97e63093-8caa-11ef-a0be-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; t=1729184675; cv=none; d=zohomail.com; s=zohoarc; b=h8JXQBZOZrM2p6qZgH3hMcCxqAAhiixQy6xbyCWesNaNXQN80/EoWjREk/VI4hDsVigYxkD2cQ8AWqduewxCD5jRc9TkAdrcKSEashepCRAb/m0Ym8UNCKuq0qL9f8Adqf//U+mfFAaCanF/YULp/tRvrQhhC14nOL69QDayGJE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729184675; 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=q6fEPJY/wmWNpsEBUPTBtfhYBFq0uC8xsS/EzPvmcH0=; b=MFL9pWy5djDH5+3K4yX5AHL7Q7OgPzSp/eaJU1VyVEbpNOY4B/4AY8Um7E1ThcNAkIDYWElCNv20YHe5BHMbXH4xccMFbfayUVtPMXBDdGjuNX5yVMei+qNLYwbSFl4DS95C/xcMqt1tUn/VLaLhP6zPQpILQh8remgPbrH9COc= 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=1729184675; 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=q6fEPJY/wmWNpsEBUPTBtfhYBFq0uC8xsS/EzPvmcH0=; b=mm2pa+tS7CPFYPUsuJOT7JtnoBisxyxfn+6/rrXOOFhjav1oHkM9jdlazrPhrwVU l3NR4r2XV5Erynnui2pZUWfWUXUjx1e3Dya2JJHWqw5R9w3uj9YWEO8MpHdy1CJgAmb kliwcbxi327WlCD1HjcWBwygDmSDfjTURYVwAKjc= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v6 44/44] x86/boot: convert dom0_construct_pvh to struct boot_domain Date: Thu, 17 Oct 2024 13:03:24 -0400 Message-Id: <20241017170325.3842-45-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241017170325.3842-1-dpsmith@apertussolutions.com> References: <20241017170325.3842-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: 1729185804254116600 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 --- Changes since v5: - revert back to using *d as local reference for struct domain --- xen/arch/x86/dom0_build.c | 2 +- xen/arch/x86/hvm/dom0_build.c | 8 ++++---- xen/arch/x86/include/asm/dom0_build.h | 4 +--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index 96cd1154b037..f0d2c349095b 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -610,7 +610,7 @@ int __init construct_dom0(struct boot_domain *bd) process_pending_softirqs(); =20 if ( is_hvm_domain(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(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 a3fd5e762dc4..720e08f9346f 100644 --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -1299,10 +1299,9 @@ static void __hwdom_init pvh_setup_mmcfg(struct doma= in *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) { + struct domain *d =3D bd->d; paddr_t entry, start_info; int rc; =20 @@ -1345,7 +1344,8 @@ int __init dom0_construct_pvh( return rc; } =20 - rc =3D pvh_load_kernel(d, image, initrd, bootstrap_map_bm(image), cmdl= ine, + rc =3D pvh_load_kernel(d, bd->kernel, bd->ramdisk, + bootstrap_map_bm(bd->kernel), bd->cmdline, &entry, &start_info); if ( rc ) { 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