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

[PATCH v7 10/38] x86/boot: introduce consumed flag for struct boot_module


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Date: Sun, 20 Oct 2024 20:45:45 -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=1729471597; 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=YvJ2m/YsYOZLoEyM2p3qJT9+gJiHXjraaWi+kBWIksU=; b=gt0hBNrw1cMHJe7/URFosCDFGhah22QoJYaj+ufVmKPMIiBgu4n6SCJLqliVZQL3YTu/Rq0eyl/VdWvtADiNsUCJG6mv+h1i5G+yomkM7pX8AXC3JK+WuzY9TFTHhNhFKDZuQz+WYwYCucypXZ10xq8PGxHEau5eRBqIjdOhBX0=
  • Arc-seal: i=1; a=rsa-sha256; t=1729471597; cv=none; d=zohomail.com; s=zohoarc; b=gbTJwubuLjGLXIHRQ/v0sQ4sKwXEXkxqBfrsPp1jvJhZptzb8RFMpfMyZIUj7q8mtwRlMDPURn4xa/J/zyPhbAhvl3fEEAdDO6Zhdl2enuFsVYsN7aSPY02HX8Fqr+1ifwzL3TKspy1J/y4H1CBgguS0CihiDM1EV2vFOMC+OSY=
  • Cc: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, jason.andryuk@xxxxxxx, christopher.w.clark@xxxxxxxxx, stefano.stabellini@xxxxxxx, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 21 Oct 2024 00:57:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Allow the tracking of when a boot module has been consumed by a handler in the
hypervisor independent of when it is claimed. The instances where the
hypervisor does nothing beyond claiming, the dom0 kernel, dom0 ramdisk, and a
placeholder for itself, are updated as being consumed at the time of being
claimed.

Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
---
Changes since v6:
- changed flag from bitmap to bitfield.

Changes since v5:
- first flag assignment can be = instead of |=
---
 xen/arch/x86/include/asm/bootinfo.h | 3 +++
 xen/arch/x86/setup.c                | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/xen/arch/x86/include/asm/bootinfo.h 
b/xen/arch/x86/include/asm/bootinfo.h
index dbd22db3d063..3eb9930904c0 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -44,8 +44,11 @@ struct boot_module {
     /*
      * Module State Flags:
      *   relocated: indicates module has been relocated in memory.
+     *   consumed:  indicates that the subystem that claimed the module has
+     *              finished with it.
      */
     bool relocated:1;
+    bool consumed:1;
 
     paddr_t start;
     size_t size;
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index b02391b887b1..a623f9cd9df9 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -335,6 +335,7 @@ static struct boot_info *__init 
multiboot_fill_boot_info(unsigned long mbi_p)
     bi->mods[i].start = mods[i].mod_start;
     bi->mods[i].size = mods[i].mod_end - mods[i].mod_start;
     bi->mods[i].type = BOOTMOD_XEN;
+    bi->mods[i].consumed = true;
 
     return bi;
 }
@@ -1211,6 +1212,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long 
mbi_p)
     bitmap_fill(module_map, bi->nr_modules);
     __clear_bit(0, module_map); /* Dom0 kernel is always first */
     bi->mods[0].type = BOOTMOD_KERNEL;
+    bi->mods[0].consumed = true;
 
     if ( pvh_boot )
     {
@@ -2094,7 +2096,10 @@ void asmlinkage __init noreturn __start_xen(unsigned 
long mbi_p)
 
     initrdidx = find_first_bit(module_map, bi->nr_modules);
     if ( initrdidx < bi->nr_modules )
+    {
         bi->mods[initrdidx].type = BOOTMOD_RAMDISK;
+        bi->mods[initrdidx].consumed = true;
+    }
     if ( bitmap_weight(module_map, bi->nr_modules) > 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®.