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

[PATCH v4 10/44] x86/boot: introduce boot module types


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Date: Fri, 30 Aug 2024 17:46:55 -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=1725054472; 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=Q0pSe2RfpDMnhePm+Qzlz8IPsCD571W7svuapogeYRE=; b=Dr2m674YWJRHRI16wy+9BAmDVULJAzf01TaxRpWrAH+JuvG1KmL3xIPpogks/IgFqgCAojJ17pKTJEhPCZR/GNF9wj/JrS+Ffyoo/SIvsi28vFJPmWULj8MsIT+DpZHSHWVdtBZscxTWlJLre0cRKBTwAOWH3WVjCTIJPe18aQM=
  • Arc-seal: i=1; a=rsa-sha256; t=1725054472; cv=none; d=zohomail.com; s=zohoarc; b=W+sWhKs2BNLPpb3UGBqNNQ3s/h+I85dvSqj/MVRDT2a5B2IcR6G/dUXEvuH598i1uSjBYpDqoak4a8XnMdVnH33X01k6etUA+eOsvpi92Ye9NyD/uhOrS78rt52nzgJ1guNzH3SDCBUW/KXVVvP4WKpPKt11maAxQQEePsZTXqQ=
  • 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:22 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

This commit introduces module types of xen, kernel, and ramdisk to allow boot
module detect code to tag the purpose of a boot module. This reduces the need
for hard coded order assumptions and global variables to be used by consumers
of boot modules, such as domain construction.

Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
---
 xen/arch/x86/include/asm/bootinfo.h | 9 +++++++++
 xen/arch/x86/setup.c                | 3 +++
 2 files changed, 12 insertions(+)

diff --git a/xen/arch/x86/include/asm/bootinfo.h 
b/xen/arch/x86/include/asm/bootinfo.h
index 3e0e36df096b..1b1b640f83f7 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -11,9 +11,18 @@
 #include <xen/multiboot.h>
 #include <xen/types.h>
 
+/* Boot module binary type / purpose */
+enum bootmod_type {
+    BOOTMOD_UNKNOWN,
+    BOOTMOD_XEN,
+    BOOTMOD_KERNEL,
+    BOOTMOD_RAMDISK,
+};
+
 struct boot_module {
     module_t *early_mod;
     unsigned long headroom;
+    enum bootmod_type type;
 };
 
 struct boot_info {
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index d4f557b4c50d..8d5450c981a8 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -314,6 +314,7 @@ static void __init multiboot_to_bootinfo(multiboot_info_t 
*mbi, module_t *mods)
         boot_mods[i].early_mod = &mods[i];
 
     /* map the last mb module for xen entry */
+    boot_mods[info.nr_mods].type = BOOTMOD_XEN;
     boot_mods[info.nr_mods].early_mod = &mods[info.nr_mods];
 
     boot_info = &info;
@@ -1197,6 +1198,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long 
mbi_p)
 
     bitmap_fill(module_map, boot_info->nr_mods);
     __clear_bit(0, module_map); /* Dom0 kernel is always first */
+    boot_info->mods[0].type = BOOTMOD_KERNEL;
 
     if ( pvh_boot )
     {
@@ -2085,6 +2087,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long 
mbi_p)
            cpu_has_nx ? "" : "not ");
 
     initrdidx = find_first_bit(module_map, boot_info->nr_mods);
+    boot_info->mods[initrdidx].type = BOOTMOD_RAMDISK;
     if ( bitmap_weight(module_map, boot_info->nr_mods) > 1 )
         printk(XENLOG_WARNING
                "Multiple initrd candidates, picking module #%u\n",
-- 
2.30.2




 


Rackspace

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