[PATCH v4 36/44] x86/boot: remove remaining early_mod references

Daniel P. Smith posted 44 patches 3 months ago
There is a newer version of this series
[PATCH v4 36/44] x86/boot: remove remaining early_mod references
Posted by Daniel P. Smith 3 months ago
Any direct usages of struct mod have been transitioned, remove the remaining
references to early_mod fields.

Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/setup.c | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 81610405a53c..46f6bf82fe63 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -336,9 +336,8 @@ unsigned long __init initial_images_nrpages(nodeid_t node)
 
     for ( nr = i = 0; i < boot_info->nr_mods; ++i )
     {
-        unsigned long start = boot_info->mods[i].early_mod->mod_start;
-        unsigned long end = start +
-                            PFN_UP(boot_info->mods[i].early_mod->mod_end);
+        unsigned long start = boot_info->mods[i].start;
+        unsigned long end = start + PFN_UP(boot_info->mods[i].size);
 
         if ( end > node_start && node_end > start )
             nr += min(node_end, end) - max(node_start, start);
@@ -665,8 +664,8 @@ static uint64_t __init consider_modules(
 
     for ( i = 0; i < nr_mods ; ++i )
     {
-        uint64_t start = (uint64_t)mods[i].early_mod->mod_start << PAGE_SHIFT;
-        uint64_t end = start + PAGE_ALIGN(mods[i].early_mod->mod_end);
+        uint64_t start = (uint64_t)mods[i].start;
+        uint64_t end = start + PAGE_ALIGN(mods[i].size);
 
         if ( i == this_mod )
             continue;
@@ -1397,10 +1396,8 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 
     for ( i = 0; !efi_enabled(EFI_LOADER) && i < boot_info->nr_mods; i++ )
     {
-        if ( boot_info->mods[i].early_mod->mod_start & (PAGE_SIZE - 1) )
+        if ( boot_info->mods[i].start & (PAGE_SIZE - 1) )
             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;
     }
 
     /*
@@ -1419,15 +1416,13 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
          * respective reserve_e820_ram() invocation below. No need to
          * query efi_boot_mem_unused() here, though.
          */
-        boot_info->mods[idx].start = boot_info->mods[idx].early_mod->mod_start
-                                   = virt_to_mfn(_stext);
-        boot_info->mods[idx].size = boot_info->mods[idx].early_mod->mod_end
-                                  = __2M_rwdata_end - _stext;
+        boot_info->mods[idx].start = virt_to_maddr(_stext);
+        boot_info->mods[idx].size = __2M_rwdata_end - _stext;
     }
 
     boot_info->mods[0].headroom = bzimage_headroom(
-                        bootstrap_map(boot_info->mods[0].early_mod),
-                        boot_info->mods[0].early_mod->mod_end);
+                        bootstrap_map_bm(&boot_info->mods[0]),
+                        boot_info->mods[0].size);
     bootstrap_map(NULL);
 
 #ifndef highmem_start
@@ -1533,8 +1528,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
             {
                 move_memory(end - size + bm->headroom, bm->start, bm->size);
                 bm->start = (end - size);
-                bm->early_mod->mod_start = paddr_to_pfn(bm->start);
-                bm->size = bm->early_mod->mod_end += bm->headroom;
+                bm->size += bm->headroom;
                 bm->flags |= BOOTMOD_FLAG_X86_RELOCATED;
             }
         }
@@ -1724,7 +1718,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     {
         set_pdx_range(paddr_to_pfn(boot_info->mods[i].start),
                       paddr_to_pfn(boot_info->mods[i].start) +
-                      PFN_UP(boot_info->mods[i].early_mod->mod_end));
+                      PFN_UP(boot_info->mods[i].size));
         map_pages_to_xen(
             (unsigned long)maddr_to_virt(boot_info->mods[i].start),
             maddr_to_mfn(boot_info->mods[i].start),
-- 
2.30.2