From nobody Sat Nov 23 10:16:16 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; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1729780045; cv=none; d=zohomail.com; s=zohoarc; b=X5D4+dL7YGddOUtiPSNTSvBGjymqzYXUcV2k6TN4M7DvbSZrph4dhYosVj7TMbjbSaixdr3uTsh/mYgddUxgbU8rE/fM/iZHVQK8swYjLN8mhCMBDcyPN62mxRQJGQBxxGX0fBV0mHInlBI6uBV+0aafPY1Ay22vN5mcmpysrds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729780045; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=dVXd7SoQfi1YRwuP/bchb8oFe7nMu7FPsr69BeMQRRM=; b=Kmuxzg7rNKrlmzajEZgCZjI4LF4naKVS1FsN9JczyMb4DxorqiVEbdJJR6BuIyGVABjc7+lOM6geiOh2sTwvEuiGWL9Z61bqu6fvyG6C4WLdPd1PE/MN8Hpy1nf5ib+3ClURMvLKbCyeM9WW7A8Z5bfQGsCzua0RURv5bT2gGZk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1729780045948874.7778041173261; Thu, 24 Oct 2024 07:27:25 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.825346.1239545 (Exim 4.92) (envelope-from ) id 1t3ynm-00048t-H6; Thu, 24 Oct 2024 14:27:02 +0000 Received: by outflank-mailman (output) from mailman id 825346.1239545; Thu, 24 Oct 2024 14:27:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t3ynm-00048m-EX; Thu, 24 Oct 2024 14:27:02 +0000 Received: by outflank-mailman (input) for mailman id 825346; Thu, 24 Oct 2024 14:27:01 +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 1t3ynl-00048L-6M for xen-devel@lists.xenproject.org; Thu, 24 Oct 2024 14:27:01 +0000 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [2a00:1450:4864:20::535]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 07b73ecc-9214-11ef-a0bf-8be0dac302b0; Thu, 24 Oct 2024 16:27:00 +0200 (CEST) Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5c9362c26d8so3732613a12.1 for ; Thu, 24 Oct 2024 07:27:00 -0700 (PDT) Received: from andrewcoop.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cb66c6b4e4sm5707409a12.61.2024.10.24.07.26.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 07:26:58 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 07b73ecc-9214-11ef-a0bf-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1729780019; x=1730384819; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dVXd7SoQfi1YRwuP/bchb8oFe7nMu7FPsr69BeMQRRM=; b=h/zWW9hfot0jC6bq1GDu4wIZadz8TduqHvPgF9xie0DvIp+FPMlG1oh9qJfmRkqNkx NG2znVzaCjZpfLy5QUysl2SPcp0pJ9QnN4mH4U+SAVNys3mtYmt41X9BAs1znEvQmjYj wAcfDIHmR7ItKlNeX75M50WCBeoWJsyAvGIsk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729780019; x=1730384819; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dVXd7SoQfi1YRwuP/bchb8oFe7nMu7FPsr69BeMQRRM=; b=ho+VXHkrhCsD0JE+40wtqz+gDAEAqGAI4zSU/aT/qaNUIrWSB4piCro2kndT2kf7jf N5TOJenNubGKhhXxRAx61R7LZ5jtYQHWqx7lqRNZUhtnxuf4gdkR6fTsnmmbFCtoeSJy q/SrzT50sVsBvWtNiHgcPCOS8ZxYFv36qWIrXa2Jgjb7nfsfb9N3RCHXGNFx23qpE/Yr zXQZ/Yzv+NHFj9Ucg1jHsOKpz4wKSSFdi1bhMW+3UymQhvZBBoc1TZE7oT8z/31XaYks iSj5RkkbKZQLXtjmfH9TIbPayJlmrf+jIMWQ+wpGMEE2aPZjJY6nHWigOIJ+zFQJMh2M jLvA== X-Gm-Message-State: AOJu0Yxb85EVYcKTG6u7TmdhJ2aPZ0tmkh6OLeVQ+XxGA5SusJ8dHfBa YoCJtRQJ7jL1Rxr+7/Eb7OA6vPJ46qBW99PCY6LwRu3OFefv2XJoirT3/Es5JajGI1BS/qrP9cK d X-Google-Smtp-Source: AGHT+IFdW0kax42rLgItyEEOWYAkOto/YtbLa80UVJKfCn0MH9m2V6QJhdd1EQujAwwV3XZEmg7iFA== X-Received: by 2002:a05:6402:538d:b0:5c5:c2a7:d535 with SMTP id 4fb4d7f45d1cf-5cba208256bmr2588565a12.16.1729780018684; Thu, 24 Oct 2024 07:26:58 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: "Daniel P. Smith" , Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 1/5] x86/boot: Drop initial_images pointer Date: Thu, 24 Oct 2024 15:26:50 +0100 Message-Id: <20241024142654.989980-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241024142654.989980-1-andrew.cooper3@citrix.com> References: <20241024142654.989980-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1729780047833116600 From: "Daniel P. Smith" Now that the module list is encapsulated inside boot_info, we can do away w= ith the initial_images pointer. No functional change. Signed-off-by: Daniel P. Smith Signed-off-by: Andrew Cooper Reviewed-by: Daniel P. Smith --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Daniel P. Smith v7.5: * Rearranged from several later patches --- xen/arch/x86/setup.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index fc18ba3e35b5..8c10fe51dfad 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 module_t *__initdata initial_images; - struct boot_info __initdata xen_boot_info =3D { .loader =3D "unknown", .cmdline =3D "", @@ -332,8 +330,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 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); @@ -349,14 +347,13 @@ 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 pfn_to_paddr(bi->mods[i].mod->mod_start); =20 init_domheap_pages(start, - start + PAGE_ALIGN(initial_images[i].mod_end)); + 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) @@ -1376,8 +1373,6 @@ void asmlinkage __init noreturn __start_xen(void) set_kexec_crash_area_size((u64)nr_pages << PAGE_SHIFT); kexec_reserve_area(); =20 - initial_images =3D mod; - for ( i =3D 0; !efi_enabled(EFI_LOADER) && i < bi->nr_modules; i++ ) { if ( mod[i].mod_start & (PAGE_SIZE - 1) ) --=20 2.39.5 From nobody Sat Nov 23 10:16:16 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; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1729780061; cv=none; d=zohomail.com; s=zohoarc; b=Hcj2rbAugFb6q7DvuFG5vTUY8bBuq5OvwEikP+gcvRlELeRUP+PAXd0J4G8lNd5C6oh03bZNcRpdktixtOBse0Dv7kMU1+Ol+nCOPV/WuD8MOKu5saatLftQEfEMI1KWUr+uhkI0xY/vwRvsJGuoD3n8vaA9lJkDaJY9auYV4Gg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729780061; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nlxvwzJVPPnRSm1WJDmkyMNWEmqNga8e4AWKAxVxRWA=; b=Xei1m2rmrQLELevwfy1vqht2T9OSfZ9uVSV27QtCUMH//ROCQVrdxEniFsZXXkVhBnzkqOzMsMgjlZ8RIyNlSAZyqORyTOTf5rMm0sY6Iwt/EvOFPolfhRhuCNN16rwx2XzVstBL2Or+GK0fOexxUoVEzsl/TV6aOQ24i+w7JT8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1729780061238714.2164927828817; Thu, 24 Oct 2024 07:27:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.825348.1239566 (Exim 4.92) (envelope-from ) id 1t3ynn-0004b6-Vj; Thu, 24 Oct 2024 14:27:03 +0000 Received: by outflank-mailman (output) from mailman id 825348.1239566; Thu, 24 Oct 2024 14:27:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t3ynn-0004az-RF; Thu, 24 Oct 2024 14:27:03 +0000 Received: by outflank-mailman (input) for mailman id 825348; Thu, 24 Oct 2024 14:27:01 +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 1t3ynl-00048L-UH for xen-devel@lists.xenproject.org; Thu, 24 Oct 2024 14:27:01 +0000 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [2a00:1450:4864:20::52a]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0890c943-9214-11ef-a0bf-8be0dac302b0; Thu, 24 Oct 2024 16:27:01 +0200 (CEST) Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-5c9709c9b0cso1290425a12.1 for ; Thu, 24 Oct 2024 07:27:01 -0700 (PDT) Received: from andrewcoop.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cb66c6b4e4sm5707409a12.61.2024.10.24.07.26.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 07:26:58 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 0890c943-9214-11ef-a0bf-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1729780020; x=1730384820; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nlxvwzJVPPnRSm1WJDmkyMNWEmqNga8e4AWKAxVxRWA=; b=HRCg04WwAOI2f0GqWFgij3bAYN3/FPkao2mC6HtcA5YbFMzjsQFMUDnVBBPFE3gFUO KrCO/NkaDkYmE07bYUB8zf5kZktKDN7jSTAFUaCnslgcVx1hT9IIAalsctT+LeY20tXm 1mZEUC+jYh9+Tj/GrhlgBZO2q+IFHssubHh2E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729780020; x=1730384820; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nlxvwzJVPPnRSm1WJDmkyMNWEmqNga8e4AWKAxVxRWA=; b=l98oc41f4kldqQJHaaFP08vXNwH9oYwmab5yzH15o9nAmUAg6j34RbmolBe1vnR6LL IGTTQ74w42Uz5CyUIsHlqbkSzYauOaQnSofN5F1Y+rfNvqGidZ51wT1tcccVxSrTazWu 32mpE8IgMJOfz+gXPr49dMwzt0kRjREsjDRLBkhHFxCZ6aynJQ4dE71uAbZ1UQBFiunx HpwCHS6eU5h5uC8eJiLCx7yzJ7GXzDVX3tfRdS0ddcZlxcbnry6QRxoKjY0/O4KKxr/1 C4cOj/dHeX+pHziwWD6MHSwgm0GZfpkQ7OdhOCgaxPFZHuubOJj2OapROii0DnJNQoBo gM3w== X-Gm-Message-State: AOJu0YzZWnUj39BwdlYJBFzi1l5jPURzeFrXlVQKyzraHny0V7GPMDZO vS/nXUszinkbEwVjr9O5//FRQ2jgjmE7TO37EWTfbQQiiA2O9Oryzb7ywqdVX4ry3M66/ZHYHB7 s X-Google-Smtp-Source: AGHT+IF9HdVMlJ7LWUwQaPIk62zIToVeIBN+RTzdkSEC2LQrfp3ljwUPiPjrJjR6BLnJNygnDlM/qA== X-Received: by 2002:a05:6402:3510:b0:5c9:8ac6:5f11 with SMTP id 4fb4d7f45d1cf-5cb8b1cefcamr5190098a12.36.1729780020357; Thu, 24 Oct 2024 07:27:00 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Daniel P . Smith" Subject: [PATCH 2/5] x86/boot: Introduce bootstrap_unmap() Date: Thu, 24 Oct 2024 15:26:51 +0100 Message-Id: <20241024142654.989980-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241024142654.989980-1-andrew.cooper3@citrix.com> References: <20241024142654.989980-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1729780061746116600 We're about to introduce alternative mapping functions, and passing NULL was always a slightly weird way to express unmap. Make an explicit unmap function, to avoid having two different valid ways of unmapping. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Daniel P. Smith --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Daniel P. Smith v7.5: * New --- xen/arch/x86/cpu/microcode/core.c | 6 +++--- xen/arch/x86/include/asm/setup.h | 2 ++ xen/arch/x86/pv/dom0_build.c | 2 +- xen/arch/x86/setup.c | 10 ++++++---- xen/xsm/xsm_core.c | 4 ++-- xen/xsm/xsm_policy.c | 2 +- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode= /core.c index 1d58cb0f3bc1..cf6517293375 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -198,7 +198,7 @@ static void __init microcode_scan_module(struct boot_in= fo *bi) ucode_blob.data =3D cd.data; break; } - bootstrap_map(NULL); + bootstrap_unmap(); } } =20 @@ -763,13 +763,13 @@ static int __init cf_check microcode_init(void) */ if ( ucode_blob.size ) { - bootstrap_map(NULL); + bootstrap_unmap(); ucode_blob.size =3D 0; ucode_blob.data =3D NULL; } else if ( ucode_mod.mod_end ) { - bootstrap_map(NULL); + bootstrap_unmap(); ucode_mod.mod_end =3D 0; } =20 diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/se= tup.h index 811855e57478..8b7843104ff7 100644 --- a/xen/arch/x86/include/asm/setup.h +++ b/xen/arch/x86/include/asm/setup.h @@ -37,7 +37,9 @@ 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_unmap(void); =20 int remove_xen_ranges(struct rangeset *r); =20 diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c index ee9ecdc2abbf..cdae17b27654 100644 --- a/xen/arch/x86/pv/dom0_build.c +++ b/xen/arch/x86/pv/dom0_build.c @@ -830,7 +830,7 @@ static int __init dom0_construct(struct domain *d, printk("Failed to load the kernel binary\n"); goto out; } - bootstrap_map(NULL); + bootstrap_unmap(); =20 if ( UNSET_ADDR !=3D parms.virt_hypercall ) { diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 8c10fe51dfad..8e32d6c49c54 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -471,13 +471,15 @@ static void *__init bootstrap_map_addr(paddr_t start,= paddr_t end) =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); } =20 +void __init bootstrap_unmap(void) +{ + bootstrap_map_addr(0, 0); +} + static void __init move_memory( uint64_t dst, uint64_t src, unsigned int size) { @@ -1402,7 +1404,7 @@ void asmlinkage __init noreturn __start_xen(void) } =20 modules_headroom =3D bzimage_headroom(bootstrap_map(mod), mod->mod_end= ); - bootstrap_map(NULL); + bootstrap_unmap(); =20 #ifndef highmem_start /* Don't allow split below 4Gb. */ diff --git a/xen/xsm/xsm_core.c b/xen/xsm/xsm_core.c index 6e3fac68c057..f255fb63bf6f 100644 --- a/xen/xsm/xsm_core.c +++ b/xen/xsm/xsm_core.c @@ -153,14 +153,14 @@ int __init xsm_multiboot_init(struct boot_info *bi) ret =3D xsm_multiboot_policy_init(bi, &policy_buffer, &policy_size= ); if ( ret ) { - bootstrap_map(NULL); + bootstrap_unmap(); 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); + bootstrap_unmap(); =20 return 0; } diff --git a/xen/xsm/xsm_policy.c b/xen/xsm/xsm_policy.c index 6f799dd28f5b..35f36c6f2359 100644 --- a/xen/xsm/xsm_policy.c +++ b/xen/xsm/xsm_policy.c @@ -63,7 +63,7 @@ int __init xsm_multiboot_policy_init( =20 } =20 - bootstrap_map(NULL); + bootstrap_unmap(); } =20 return rc; --=20 2.39.5 From nobody Sat Nov 23 10:16:16 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; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1729780054; cv=none; d=zohomail.com; s=zohoarc; b=FBvlDC+mDf3iB+WKiWMzBScO4s2K2+29OPP4a5wHzs/T9Fdh8tJrbIijNorA5s996AcDK8LLyDS3aqDLwUMzLHrDPWjbexccOpicGYoetFBlG8X8NTN+D0Q18PJ0GPo11+yIqIGQFIkRCRmWA01k2RCpVkvGLK07K5usix4SrtY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729780054; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=k/1V36zu8pl8T7xYRf9La+mccrttDt5v1Zny77BeDlA=; b=dTYOymYQHUyGGK5oVg246VMnm/4DBurR3JctDzfgupvafYxJl3Bf36zHttw+6+UyvtTtIR7cKJbeq40oNU4ocW4bLJwbw2YrIYM4v8ZVZvUXEp5TBPzzAqF0J7XkE+R3dK8CGTvXbZbYVP0WHUN6umlCJmtaeWjCK90ZUvFQBHM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1729780054399281.29529024761746; Thu, 24 Oct 2024 07:27:34 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.825349.1239576 (Exim 4.92) (envelope-from ) id 1t3ynq-0004rW-A8; Thu, 24 Oct 2024 14:27:06 +0000 Received: by outflank-mailman (output) from mailman id 825349.1239576; Thu, 24 Oct 2024 14:27:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t3ynq-0004rL-7Y; Thu, 24 Oct 2024 14:27:06 +0000 Received: by outflank-mailman (input) for mailman id 825349; Thu, 24 Oct 2024 14:27:04 +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 1t3yno-00048O-Th for xen-devel@lists.xenproject.org; Thu, 24 Oct 2024 14:27:04 +0000 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [2a00:1450:4864:20::52d]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 09bc6782-9214-11ef-99a3-01e77a169b0f; Thu, 24 Oct 2024 16:27:03 +0200 (CEST) Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-5c948c41edeso1127887a12.1 for ; Thu, 24 Oct 2024 07:27:03 -0700 (PDT) Received: from andrewcoop.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cb66c6b4e4sm5707409a12.61.2024.10.24.07.27.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 07:27: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: 09bc6782-9214-11ef-99a3-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1729780022; x=1730384822; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k/1V36zu8pl8T7xYRf9La+mccrttDt5v1Zny77BeDlA=; b=oLJXcoQ2tWqUqHnNg+vTYDB7AFRbqlJHm0KRL/prGZ71CjRDGlpbhv9jXIRYnmv4OC UUr7wpjePTYUoEg7p+0REsrFv1WlcMwFSvg5DgZx9SIqdxayY/L3lj30pFt1zmWtAA4B 4baywjGUwXtAKogEvcGJ2ljfkphOhC5pU5vSA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729780022; x=1730384822; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k/1V36zu8pl8T7xYRf9La+mccrttDt5v1Zny77BeDlA=; b=UZCl0vN4CjEAPsHHRwy3izVJbS7/FwXeTsuY3PGkFV56eSSgKVCbyE8Yez8NsaMW9n 2axhFktbQARLQ7tsvY0DxNA7jBSSIvg2onxhSK45ASgsPpjTKC6LKJc1HcqRJjwbPqkJ +wjI+QbB2oyMZDDli0F4Og1dkLIHTxM2QU9dEXsjOA+zbMszECceSRLAYM6Gf2elL4EA UGzsF4/FMvt2vr/55EkJ60PgknIv7bU096NHqiCzPCGsObtal4QC8WVsXUUgrcy1Jzbn iDDUaEjvaR+LFsz6MgGLg2JItOqJev8McFk/DIle0Q76GBjBaEK2UPH+XqrO2WhGAk8u pwEA== X-Gm-Message-State: AOJu0YwnLaVWKU/WhSr82VXShwK9vKcToHETQiCf7rEyoD4uEcGuLZAE zN4Y8dqivOwCt18PB0aFoXkdTpiJwPS1i7wM6T9QZuWYQ79Bl7OzDmsKU93kZy02T62QLwFMLEL l X-Google-Smtp-Source: AGHT+IH6p9gdO0AX6mLGCwEkRJD/oDfxz+x/AJPocHh/3hD6qDzdaNJNyDPqbrO7R32Qwdz4y9sHdg== X-Received: by 2002:a05:6402:254b:b0:5ca:da2:b2ca with SMTP id 4fb4d7f45d1cf-5cb8acba591mr6178431a12.19.1729780021899; Thu, 24 Oct 2024 07:27:01 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: "Daniel P. Smith" , Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 3/5] x86/boot: Introduce bootstrap_map_bm() to map boot_module's Date: Thu, 24 Oct 2024 15:26:52 +0100 Message-Id: <20241024142654.989980-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241024142654.989980-1-andrew.cooper3@citrix.com> References: <20241024142654.989980-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1729780055738116600 From: "Daniel P. Smith" Convert converting the call to bzimage_headroom(), as well as using bi->mod[0]. It will be used externally by later changes. No functional change. Signed-off-by: Daniel P. Smith Signed-off-by: Andrew Cooper Reviewed-by: Daniel P. Smith --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Daniel P. Smith v7.5: * Refectored/extracted from later in the series. --- xen/arch/x86/include/asm/setup.h | 2 ++ xen/arch/x86/setup.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/se= tup.h index 8b7843104ff7..4874ee8936fc 100644 --- a/xen/arch/x86/include/asm/setup.h +++ b/xen/arch/x86/include/asm/setup.h @@ -38,6 +38,8 @@ extern struct boot_info xen_boot_info; unsigned long initial_images_nrpages(nodeid_t node); void discard_initial_images(void); =20 +struct boot_module; +void *bootstrap_map_bm(const struct boot_module *bm); void *bootstrap_map(const module_t *mod); void bootstrap_unmap(void); =20 diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 8e32d6c49c54..ee03725af380 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -475,6 +475,11 @@ 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) +{ + return bootstrap_map(bm->mod); +} + void __init bootstrap_unmap(void) { bootstrap_map_addr(0, 0); @@ -1403,7 +1408,9 @@ void asmlinkage __init noreturn __start_xen(void) mod[bi->nr_modules].mod_end =3D __2M_rwdata_end - _stext; } =20 - modules_headroom =3D bzimage_headroom(bootstrap_map(mod), mod->mod_end= ); + modules_headroom =3D + bzimage_headroom(bootstrap_map_bm(&bi->mods[0]), + bi->mods[0].mod->mod_end); bootstrap_unmap(); =20 #ifndef highmem_start --=20 2.39.5 From nobody Sat Nov 23 10:16:16 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; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1729780076; cv=none; d=zohomail.com; s=zohoarc; b=CSAO5RQEkfNLVRkn/akZaThBBMZrJFQSJNFYfaeZyIBVM1oql42IqmrTK44EA5ttzylV9unCTA5G1jKIrbIVLSIpYvixNn7RBAfJxj9p0qT9omr7n4fgwCiYabo7IvOOxmcJxKU5RIvWe0Ps+EtpwuBYsQ3LzNkm3BKBKbKMNRI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729780076; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hkGTFmIsU8uVl1vUxZAmxH9TN/jWgRT2CVKi7nypqKo=; b=Vu/3qTl3PEYBF5EDnI/yKoFWgedKH0y1nBBcJBZdPPeA6zUaNpbrIzYbVo9Da/ck/KtQiX00Kphhmi8GT9K9nErJboYv24lPzdRsl9o2pyijjxdDcY4MTwg4FPgI2Y3+UgBppfCAk8PnDNjvg99fB37zWfASm0bAp5BlEgz7qR0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 172978007668427.49020474873828; Thu, 24 Oct 2024 07:27:56 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.825351.1239596 (Exim 4.92) (envelope-from ) id 1t3yns-0005Oy-QR; Thu, 24 Oct 2024 14:27:08 +0000 Received: by outflank-mailman (output) from mailman id 825351.1239596; Thu, 24 Oct 2024 14:27: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 1t3yns-0005O8-Ne; Thu, 24 Oct 2024 14:27:08 +0000 Received: by outflank-mailman (input) for mailman id 825351; Thu, 24 Oct 2024 14:27:07 +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 1t3ynr-00048O-4m for xen-devel@lists.xenproject.org; Thu, 24 Oct 2024 14:27:07 +0000 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [2a00:1450:4864:20::52f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 0afba90a-9214-11ef-99a3-01e77a169b0f; Thu, 24 Oct 2024 16:27:05 +0200 (CEST) Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-5c957d8bce2so510635a12.2 for ; Thu, 24 Oct 2024 07:27:05 -0700 (PDT) Received: from andrewcoop.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cb66c6b4e4sm5707409a12.61.2024.10.24.07.27.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 07:27: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: 0afba90a-9214-11ef-99a3-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1729780024; x=1730384824; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hkGTFmIsU8uVl1vUxZAmxH9TN/jWgRT2CVKi7nypqKo=; b=kgCXbykcUw0gGRmGf6wSTmo6C8NZE0lXcwCsNn152Yv73OQOZPXePPzrhWNZ+VwzSu NPaM8x9oZeJj8Y5CPul11qgxwuEXzn3SKMq9POt8PD6ZhoRGN+OPRqakBw1iIxlGdiID jtM1jHs28nZv8Wu5AzLqgCsqTSlnxc9IX61fE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729780024; x=1730384824; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hkGTFmIsU8uVl1vUxZAmxH9TN/jWgRT2CVKi7nypqKo=; b=xVZD//rXhOc5H6Cu2Rfe+fujad2e2VGSjGe9hhpUct9RTytClrOOYhY1gOmgCjM8tP 1WW/ai3nUQcHHsBPMyQMeNMIJD+3K3i7pl4KZsip8KNBAUJfsEEvqnP+vh5qe5AJbQ9q fBpGdZu7kuNmRKqGbioIn/MDrDMe2B/l6B2GPxczKxNaIhkyPoB1RUy84TUBtH3JB9Iq VGfRLpkGbECV0hYwUWVOhFsRw1bcm603ynZf9OtV8bPmZS5Aj07BFecl0U/59SPCWn1c ebncySXJBxmA2b/Z4wW8BAzWSxGbnhICmMwI47bxCQXWJILHoJ+kAtl+Ua0FaSrcFh0o D10A== X-Gm-Message-State: AOJu0YyEeSaPXcSnBIqAlnOiUiIjqJsLnqv6Ggn2CcJRPO+IkgQvuXrY HXh+tI7roz+ch8srdJ3M8BXaIKXEH435ZVTEbhgoablU/0JIz/3qQ/6PMfnHX8w8LIAHRnHAePq a X-Google-Smtp-Source: AGHT+IGFmhwnmNKSrxMQ2nLtOFpPT2TfElRIUQMDZRSNandfpDYCYSVT9qRaApu/eTcVnyxk677kEQ== X-Received: by 2002:a05:6402:3489:b0:5c9:48df:713c with SMTP id 4fb4d7f45d1cf-5cb8af7defbmr6676395a12.2.1729780023866; Thu, 24 Oct 2024 07:27:03 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: "Daniel P. Smith" , Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 4/5] x86/boot: Convert mod[] to bi->mods[] in __start_xen() Date: Thu, 24 Oct 2024 15:26:53 +0100 Message-Id: <20241024142654.989980-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241024142654.989980-1-andrew.cooper3@citrix.com> References: <20241024142654.989980-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1729780077844116600 From: "Daniel P. Smith" The former is about to disappear. In some cases, introduce a local struct boot_module pointer. Judgement on where to do this, and on constness, is based on what creates least churn overall. No functional change. Signed-off-by: Daniel P. Smith Signed-off-by: Andrew Cooper Reviewed-by: Daniel P. Smith --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Daniel P. Smith v7.5: * Rearranged from several later patches --- xen/arch/x86/setup.c | 59 +++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index ee03725af380..5413e1c71be6 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1382,11 +1382,11 @@ void asmlinkage __init noreturn __start_xen(void) =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 /* @@ -1397,6 +1397,8 @@ void asmlinkage __init noreturn __start_xen(void) =20 if ( xen_phys_start ) { + struct boot_module *xen =3D &bi->mods[bi->nr_modules]; + relocated =3D true; =20 /* @@ -1404,8 +1406,8 @@ void asmlinkage __init noreturn __start_xen(void) * 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; + xen->mod->mod_start =3D virt_to_mfn(_stext); + xen->mod->mod_end =3D __2M_rwdata_end - _stext; } =20 modules_headroom =3D @@ -1490,15 +1492,17 @@ void asmlinkage __init noreturn __start_xen(void) /* Is the region suitable for relocating the multiboot modules? */ for ( j =3D bi->nr_modules - 1; j >=3D 0; j-- ) { + struct boot_module *bm =3D &bi->mods[j]; + /* * 'headroom' is a guess for the decompressed size and * 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); + unsigned long size =3D PAGE_ALIGN(headroom + bm->mod->mod_end); =20 - if ( mod[j].reserved ) + if ( bm->mod->reserved ) continue; =20 /* Don't overlap with other modules (or Xen itself). */ @@ -1510,14 +1514,13 @@ void asmlinkage __init noreturn __start_xen(void) =20 if ( s < end && (headroom || - ((end - size) >> PAGE_SHIFT) > mod[j].mod_start) ) + ((end - size) >> PAGE_SHIFT) > bm->mod->mod_start) ) { move_memory(end - size + 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].reserved =3D 1; + pfn_to_paddr(bm->mod->mod_start), bm->mod->mod= _end); + bm->mod->mod_start =3D (end - size) >> PAGE_SHIFT; + bm->mod->mod_end +=3D headroom; + bm->mod->reserved =3D 1; } } =20 @@ -1543,13 +1546,14 @@ void asmlinkage __init noreturn __start_xen(void) #endif } =20 - if ( modules_headroom && !mod->reserved ) + if ( modules_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; + const struct boot_module *bm =3D &bi->mods[i]; + uint64_t s =3D pfn_to_paddr(bm->mod->mod_start); =20 - reserve_e820_ram(&boot_e820, s, s + PAGE_ALIGN(mod[i].mod_end)); + reserve_e820_ram(&boot_e820, s, s + PAGE_ALIGN(bm->mod->mod_end)); } =20 if ( !xen_phys_start ) @@ -1627,8 +1631,8 @@ void asmlinkage __init noreturn __start_xen(void) 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_sta= rt) + + bi->mods[j].mod->mod_end; =20 if ( map_e < end ) map_e =3D end; @@ -1702,11 +1706,13 @@ void asmlinkage __init noreturn __start_xen(void) =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); + const struct boot_module *bm =3D &bi->mods[i]; + + set_pdx_range(bm->mod->mod_start, + bm->mod->mod_start + PFN_UP(bm->mod->mod_end)); + map_pages_to_xen((unsigned long)mfn_to_virt(bm->mod->mod_start), + _mfn(bm->mod->mod_start), + PFN_UP(bm->mod->mod_end), PAGE_HYPERVISOR); } =20 #ifdef CONFIG_KEXEC @@ -2095,8 +2101,9 @@ void asmlinkage __init noreturn __start_xen(void) * 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, - initrdidx < bi->nr_modules ? mod + initrdidx : NULL, + dom0 =3D create_dom0(bi->mods[0].mod, modules_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.39.5 From nobody Sat Nov 23 10:16:16 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; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1729780049; cv=none; d=zohomail.com; s=zohoarc; b=DlGtNX2vzWw3dG7A57WoN/GJqwPuOZqV3Pt1Frtuara/dy5q98pz7AIx8qfWRzthX0E1VOIWvD+q/HXKb2RqZ2w0ER39FQ4j2mrxN2OrxgDt8QtlBl7uh1dLOSjLNO9Z+eNKbn9kCZAU0AQc46y09TuCCfJ2GyPUM13UxS0H7h4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729780049; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=26Kd1CZ5EW/rvd6sicVOHZnpVwSK6DqF92g9LkP2sKY=; b=VHp4dPM3prrIbZqhZ8rW07nC+WAnS1bQsTesgoi0UsiV3eBBop9ImtKXcWcoJ2cXLiSsr7Zu9D78nc/qWyFixin1TPBMU9iJ5IGiRIq2xxdK3hiOduzxQ3U2IfQGPmK7eKs2lxNITj3uDagjkVQUvovmAX0TZXeDK3MI+HYcBn8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1729780049423325.3276365220431; Thu, 24 Oct 2024 07:27:29 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.825350.1239586 (Exim 4.92) (envelope-from ) id 1t3ynr-00057U-JU; Thu, 24 Oct 2024 14:27:07 +0000 Received: by outflank-mailman (output) from mailman id 825350.1239586; Thu, 24 Oct 2024 14:27:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t3ynr-00057H-Eb; Thu, 24 Oct 2024 14:27:07 +0000 Received: by outflank-mailman (input) for mailman id 825350; Thu, 24 Oct 2024 14:27:06 +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 1t3ynq-00048L-FE for xen-devel@lists.xenproject.org; Thu, 24 Oct 2024 14:27:06 +0000 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [2a00:1450:4864:20::52f]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0b4e705e-9214-11ef-a0bf-8be0dac302b0; Thu, 24 Oct 2024 16:27:06 +0200 (CEST) Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-5cb72918bddso1308115a12.3 for ; Thu, 24 Oct 2024 07:27:05 -0700 (PDT) Received: from andrewcoop.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cb66c6b4e4sm5707409a12.61.2024.10.24.07.27.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 07:27: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: 0b4e705e-9214-11ef-a0bf-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1729780025; x=1730384825; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=26Kd1CZ5EW/rvd6sicVOHZnpVwSK6DqF92g9LkP2sKY=; b=LN+agBkzDbFDIvYPJbL2oCjm+JIKTvqpG7orGYGYkm67zySfejSgGW632EavNqqYkt Ytk9NBc8n6/aFFwBFlcOa3n8GFcQW9JfzkAPDnWpDkmc8xFcXzyKd0xs+50+1p5CQXaQ Cj5jOhqRIbo4izFyf2QTm1f4AuA3sCRI7mD8U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729780025; x=1730384825; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=26Kd1CZ5EW/rvd6sicVOHZnpVwSK6DqF92g9LkP2sKY=; b=EaPW3NBA7lrBk80fh2Tt/ywLThLahF0ip5ue1a2f0NSb2kXMIZwbqO35gEw9bZBAlv +eXexfpMEfaeK5o9JuBFndlvWfXbH9cBor3BFJCR2JxTbfFAfT0zmeoakp4lqebnb7hc Ue9y5Z0t4OXkuYuvQ4uwcKMSsvL2rSr79iUH2enOfBFpkj2k1UF3fCJ8OPDuQrf8Cin8 cYDkNgdQvv85jxzh4YkuKKvGvlzuuf6EJhhDz6WK8ZGbSO2hd8pOAkhGmsILfTQYePfu IcRa91VuEGwUHphGjvQbthSVovrDOLvHiOQejPto+/fI0NaoREtWaYsr19MwmwNRX5P9 mdDg== X-Gm-Message-State: AOJu0YxKGDBx8GKnn9EPVcfdbbR0LfPLDVoqo4B0MyGogqPiWdTo/rRj NSHmmBFXKct/ogG4hJxGhbfRdyke+eyZCHR8lCLQuxFdXw2BiWeVjeP+DodhzUn+s1KmL8VBBMR J X-Google-Smtp-Source: AGHT+IHeJl50mZDISF1NQ6MLFe8fQzTOtXWRCvcbgTukvJ7hfs09TarAKjqp3QVYBzCgBU1kJbcCyw== X-Received: by 2002:a05:6402:254d:b0:5c9:4281:4515 with SMTP id 4fb4d7f45d1cf-5cb8acb7b0amr5833462a12.17.1729780024768; Thu, 24 Oct 2024 07:27:04 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Daniel P . Smith" Subject: [PATCH 5/5] x86/boot: Drop the mbi and mod pointers in __start_xen() Date: Thu, 24 Oct 2024 15:26:54 +0100 Message-Id: <20241024142654.989980-6-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241024142654.989980-1-andrew.cooper3@citrix.com> References: <20241024142654.989980-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1729780049668116600 We can't drop them fully yet, but we can limit their scope to almost nothin= g, which serves the same purpose. This removes the ability to accidentally reintroduce buggy uses of __va(mbi->mods_addr). No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Daniel P. Smith --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Daniel P. Smith v7.5: * New --- 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 5413e1c71be6..511cf5b97909 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1026,8 +1026,6 @@ void asmlinkage __init noreturn __start_xen(void) 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]; int i, j, e820_warn =3D 0, bytes =3D 0; unsigned long eb_start, eb_end; @@ -1063,16 +1061,22 @@ void asmlinkage __init noreturn __start_xen(void) =20 if ( pvh_boot ) { + multiboot_info_t *mbi; + module_t *mod; + pvh_init(&mbi, &mod); /* * mbi and mod are regular pointers to .initdata. These remain va= lid * across move_xen(). */ + + bi =3D multiboot_fill_boot_info(mbi, mod); } else { - mbi =3D __va(multiboot_ptr); - mod =3D __va(mbi->mods_addr); + multiboot_info_t *mbi =3D __va(multiboot_ptr); + + bi =3D multiboot_fill_boot_info(mbi, __va(mbi->mods_addr)); =20 /* * For MB1/2, mbi and mod are directmap pointers into the trampoli= ne. @@ -1085,12 +1089,8 @@ void asmlinkage __init noreturn __start_xen(void) ASSERT(multiboot_ptr < MB(1) || xen_phys_start); } =20 - bi =3D multiboot_fill_boot_info(mbi, mod); bi->module_map =3D module_map; /* Temporary */ =20 - /* Use bi-> instead */ -#define mbi DO_NOT_USE - /* Parse the command-line options. */ if ( (kextra =3D strstr(bi->cmdline, " -- ")) !=3D NULL ) { --=20 2.39.5