From nobody Fri Nov 22 06:46:33 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