]> xenbits.xensource.com Git - xen.git/commitdiff
x86/boot: introduce boot module flags
authorDaniel P. Smith <dpsmith@apertussolutions.com>
Sat, 2 Nov 2024 17:25:42 +0000 (13:25 -0400)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 6 Nov 2024 19:06:44 +0000 (19:06 +0000)
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 bitfield 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@apertussolutions.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/include/asm/bootinfo.h
xen/arch/x86/setup.c

index b828c679391e6fb48a8464d89baebf0c0c0f1323..d369c79ec437e9006336c4f6d1aaf5246e26c7f7 100644 (file)
@@ -29,6 +29,12 @@ struct boot_module {
     module_t *mod;
 
     enum bootmod_type type;
+
+    /*
+     * Module State Flags:
+     *   relocated: indicates module has been relocated in memory.
+     */
+    bool relocated:1;
 };
 
 /*
index 92dbdfe12a3de2f5b189601fe19b292beb61a73a..d061ece0541f02d6b76956c1c0f05418459891a2 100644 (file)
@@ -1392,7 +1392,6 @@ void asmlinkage __init noreturn __start_xen(void)
             panic("Bootloader didn't honor module alignment request\n");
         bi->mods[i].mod->mod_end -= bi->mods[i].mod->mod_start;
         bi->mods[i].mod->mod_start >>= PAGE_SHIFT;
-        bi->mods[i].mod->reserved = 0;
     }
 
     /*
@@ -1508,7 +1507,7 @@ void asmlinkage __init noreturn __start_xen(void)
             unsigned long headroom = j ? 0 : modules_headroom;
             unsigned long size = PAGE_ALIGN(headroom + bm->mod->mod_end);
 
-            if ( bm->mod->reserved )
+            if ( bm->relocated )
                 continue;
 
             /* Don't overlap with other modules (or Xen itself). */
@@ -1526,7 +1525,7 @@ void asmlinkage __init noreturn __start_xen(void)
                             pfn_to_paddr(bm->mod->mod_start), bm->mod->mod_end);
                 bm->mod->mod_start = (end - size) >> PAGE_SHIFT;
                 bm->mod->mod_end += headroom;
-                bm->mod->reserved = 1;
+                bm->relocated = true;
             }
         }
 
@@ -1552,7 +1551,7 @@ void asmlinkage __init noreturn __start_xen(void)
 #endif
     }
 
-    if ( modules_headroom && !bi->mods[0].mod->reserved )
+    if ( modules_headroom && !bi->mods[0].relocated )
         panic("Not enough memory to relocate the dom0 kernel image\n");
     for ( i = 0; i < bi->nr_modules; ++i )
     {