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

[xen master] x86/boot: Introduce bootstrap_unmap()



commit 0ba5392e70b366a7a7f280e480eda74ad7ef7220
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Wed Oct 23 16:55:55 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu Oct 24 17:57:59 2024 +0100

    x86/boot: Introduce bootstrap_unmap()
    
    We're about to introduce alternative mapping functions, and passing NULL was
    always a slightly weird way to express unmap.  Make an explicit unmap
    function, to avoid having two different valid ways of unmapping.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
---
 xen/arch/x86/cpu/microcode/core.c |  6 +++---
 xen/arch/x86/include/asm/setup.h  |  2 ++
 xen/arch/x86/pv/dom0_build.c      |  2 +-
 xen/arch/x86/setup.c              | 10 ++++++----
 xen/xsm/xsm_core.c                |  4 ++--
 xen/xsm/xsm_policy.c              |  2 +-
 6 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/core.c 
b/xen/arch/x86/cpu/microcode/core.c
index 2a4c65744f..8d916d891e 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -201,7 +201,7 @@ static void __init microcode_scan_module(struct boot_info 
*bi)
             ucode_blob.data = cd.data;
             break;
         }
-        bootstrap_map(NULL);
+        bootstrap_unmap();
     }
 }
 
@@ -766,13 +766,13 @@ static int __init cf_check microcode_init(void)
      */
     if ( ucode_blob.size )
     {
-        bootstrap_map(NULL);
+        bootstrap_unmap();
         ucode_blob.size = 0;
         ucode_blob.data = NULL;
     }
     else if ( ucode_mod.mod_end )
     {
-        bootstrap_map(NULL);
+        bootstrap_unmap();
         ucode_mod.mod_end = 0;
     }
 
diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index 811855e574..8b7843104f 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -37,7 +37,9 @@ extern struct boot_info xen_boot_info;
 
 unsigned long initial_images_nrpages(nodeid_t node);
 void discard_initial_images(void);
+
 void *bootstrap_map(const module_t *mod);
+void bootstrap_unmap(void);
 
 int remove_xen_ranges(struct rangeset *r);
 
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index ee9ecdc2ab..cdae17b276 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -830,7 +830,7 @@ static int __init dom0_construct(struct domain *d,
         printk("Failed to load the kernel binary\n");
         goto out;
     }
-    bootstrap_map(NULL);
+    bootstrap_unmap();
 
     if ( UNSET_ADDR != parms.virt_hypercall )
     {
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 8c10fe51df..8e32d6c49c 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -471,13 +471,15 @@ static void *__init bootstrap_map_addr(paddr_t start, 
paddr_t end)
 
 void *__init bootstrap_map(const module_t *mod)
 {
-    if ( !mod )
-        return bootstrap_map_addr(0, 0);
-
     return bootstrap_map_addr(pfn_to_paddr(mod->mod_start),
                               pfn_to_paddr(mod->mod_start) + mod->mod_end);
 }
 
+void __init bootstrap_unmap(void)
+{
+    bootstrap_map_addr(0, 0);
+}
+
 static void __init move_memory(
     uint64_t dst, uint64_t src, unsigned int size)
 {
@@ -1402,7 +1404,7 @@ void asmlinkage __init noreturn __start_xen(void)
     }
 
     modules_headroom = bzimage_headroom(bootstrap_map(mod), mod->mod_end);
-    bootstrap_map(NULL);
+    bootstrap_unmap();
 
 #ifndef highmem_start
     /* Don't allow split below 4Gb. */
diff --git a/xen/xsm/xsm_core.c b/xen/xsm/xsm_core.c
index 6e3fac68c0..f255fb63bf 100644
--- a/xen/xsm/xsm_core.c
+++ b/xen/xsm/xsm_core.c
@@ -153,14 +153,14 @@ int __init xsm_multiboot_init(struct boot_info *bi)
         ret = xsm_multiboot_policy_init(bi, &policy_buffer, &policy_size);
         if ( ret )
         {
-            bootstrap_map(NULL);
+            bootstrap_unmap();
             printk(XENLOG_ERR "Error %d initializing XSM policy\n", ret);
             return -EINVAL;
         }
     }
 
     ret = xsm_core_init(policy_buffer, policy_size);
-    bootstrap_map(NULL);
+    bootstrap_unmap();
 
     return 0;
 }
diff --git a/xen/xsm/xsm_policy.c b/xen/xsm/xsm_policy.c
index 6f799dd28f..35f36c6f23 100644
--- a/xen/xsm/xsm_policy.c
+++ b/xen/xsm/xsm_policy.c
@@ -63,7 +63,7 @@ int __init xsm_multiboot_policy_init(
 
         }
 
-        bootstrap_map(NULL);
+        bootstrap_unmap();
     }
 
     return rc;
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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