[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v4 11/44] x86/boot: introduce boot module flags


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Date: Fri, 30 Aug 2024 17:46:56 -0400
  • Arc-authentication-results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@xxxxxxxxxxxxxxxxxxxx; dmarc=pass header.from=<dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725054474; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=5tRW/AonFx6PkMudQZ5UfviW7yOCGUwEDitNjDx5cYw=; b=P2RZyBCBWzg0mXe89rpIkcQ59rMsls/HXUJftpwSGUiGPS0zBhrAevJorYsL+HSroAlas1NIBhfkBtsXAvV5LSEo9zqvPkEltsIp1t1HTaDRy/DRO7VaOwsE3LSi+VgN3NW7Z3ESgpgAE0e5L6ObQQSqIaONU0ZjLGzrEvCBtEE=
  • Arc-seal: i=1; a=rsa-sha256; t=1725054474; cv=none; d=zohomail.com; s=zohoarc; b=lasNya4BFw/XtdtSGjwfRiCwlJ2VNmaP/DFwPqwMxuNlpnFaYBJBhFgki3cfogDxU9wZYf3sUP2yDsT6xSYk7Efsvn+j0zHp59BdR6GcpVpgSjjETUkRpT0qWonoxJ/5mPk6bV0H/C25eSmuy0/Im70MrNAskpaEUf5ZHQ6PKQQ=
  • Cc: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, jason.andryuk@xxxxxxx, christopher.w.clark@xxxxxxxxx, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivered-to: dpsmith@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 30 Aug 2024 21:56:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

The existing startup code employs various ad-hoc state tracking about certain
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 <dpsmith@xxxxxxxxxxxxxxxxxxxx>
---
 xen/arch/x86/include/asm/bootinfo.h | 4 ++++
 xen/arch/x86/setup.c                | 8 ++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/include/asm/bootinfo.h 
b/xen/arch/x86/include/asm/bootinfo.h
index 1b1b640f83f7..baf6d74db754 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -23,6 +23,10 @@ struct boot_module {
     module_t *early_mod;
     unsigned long headroom;
     enum bootmod_type type;
+
+    uint32_t flags;
+#define BOOTMOD_FLAG_X86_RELOCATED     (1U << 0)
+
 };
 
 struct boot_info {
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 8d5450c981a8..47e4fcc2a8ce 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1377,7 +1377,6 @@ void asmlinkage __init noreturn __start_xen(unsigned long 
mbi_p)
             panic("Bootloader didn't honor module alignment request\n");
         boot_info->mods[i].early_mod->mod_end -= 
boot_info->mods[i].early_mod->mod_start;
         boot_info->mods[i].early_mod->mod_start >>= PAGE_SHIFT;
-        boot_info->mods[i].early_mod->reserved = 0;
     }
 
     /*
@@ -1492,7 +1491,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long 
mbi_p)
 
             size = PAGE_ALIGN(bm->headroom + bm->early_mod->mod_end);
 
-            if ( boot_info->mods[j].early_mod->reserved )
+            if ( boot_info->mods[j].flags & BOOTMOD_FLAG_X86_RELOCATED )
                 continue;
 
             /* Don't overlap with other modules (or Xen itself). */
@@ -1511,7 +1510,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long 
mbi_p)
                             bm->early_mod->mod_end);
                 bm->early_mod->mod_start = (end - size) >> PAGE_SHIFT;
                 bm->early_mod->mod_end += bm->headroom;
-                bm->early_mod->reserved = 1;
+                bm->flags |= BOOTMOD_FLAG_X86_RELOCATED;
             }
         }
 
@@ -1537,7 +1536,8 @@ void asmlinkage __init noreturn __start_xen(unsigned long 
mbi_p)
 #endif
     }
 
-    if ( boot_info->mods[0].headroom && 
!boot_info->mods[0].early_mod->reserved )
+    if ( boot_info->mods[0].headroom &&
+         !(boot_info->mods[0].flags & BOOTMOD_FLAG_X86_RELOCATED) )
         panic("Not enough memory to relocate the dom0 kernel image\n");
     for ( i = 0; i < boot_info->nr_mods; ++i )
     {
-- 
2.30.2




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.