From nobody Thu Dec 26 23:55:05 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