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

[Xen-devel] [PATCH 3/3] x86/microcode: Use the exported bootstrap_map() function



... rather than obtaining it via function pointer.  The internal ucode_mod_map
function pointer can also be dropped.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>

I'm not entirely convinced of the correctness of the uses of
bootstrap_map(NULL) here especially as it is used over an extended period of
booting, but only behavioural change I've introduced is to remove the risk of
accidentially calling a NULL ucode_mod_map pointer.  I'll see about revisiting
this when I've got a bit more time and brainpower to spare.
---
 xen/arch/x86/microcode.c    | 20 ++++++++------------
 xen/arch/x86/setup.c        |  2 +-
 xen/include/asm-x86/setup.h |  2 +-
 3 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/microcode.c b/xen/arch/x86/microcode.c
index 77c1efc..4163f50 100644
--- a/xen/arch/x86/microcode.c
+++ b/xen/arch/x86/microcode.c
@@ -40,7 +40,6 @@
 #include <asm/microcode.h>
 
 static module_t __initdata ucode_mod;
-static void *(*__initdata ucode_mod_map)(const module_t *);
 static signed int __initdata ucode_mod_idx;
 static bool_t __initdata ucode_mod_forced;
 
@@ -96,8 +95,7 @@ custom_param("ucode", parse_ucode);
 
 void __init microcode_scan_module(
     unsigned long *module_map,
-    const multiboot_info_t *mbi,
-    void *(*bootmap)(const module_t *))
+    const multiboot_info_t *mbi)
 {
     module_t *mod = (module_t *)__va(mbi->mods_addr);
     uint64_t *_blob_start;
@@ -126,7 +124,7 @@ void __init microcode_scan_module(
         if ( !test_bit(i, module_map) )
             continue;
 
-        _blob_start = bootmap(&mod[i]);
+        _blob_start = bootstrap_map(&mod[i]);
         _blob_size = mod[i].mod_end;
         if ( !_blob_start )
         {
@@ -157,18 +155,17 @@ void __init microcode_scan_module(
                 else
                     memcpy(ucode_blob.data, cd.data, cd.size);
         }
-        bootmap(NULL);
+        bootstrap_map(NULL);
         if ( cd.data )
             break;
     }
     return;
 err:
-    bootmap(NULL);
+    bootstrap_map(NULL);
 }
 void __init microcode_grab_module(
     unsigned long *module_map,
-    const multiboot_info_t *mbi,
-    void *(*map)(const module_t *))
+    const multiboot_info_t *mbi)
 {
     module_t *mod = (module_t *)__va(mbi->mods_addr);
 
@@ -178,10 +175,9 @@ void __init microcode_grab_module(
          !__test_and_clear_bit(ucode_mod_idx, module_map) )
         goto scan;
     ucode_mod = mod[ucode_mod_idx];
-    ucode_mod_map = map;
 scan:
     if ( ucode_scan )
-        microcode_scan_module(module_map, mbi, map);
+        microcode_scan_module(module_map, mbi);
 }
 
 const struct microcode_ops *microcode_ops;
@@ -358,7 +354,7 @@ static int __init microcode_init(void)
     }
     else if ( ucode_mod.mod_end )
     {
-        ucode_mod_map(NULL);
+        bootstrap_map(NULL);
         ucode_mod.mod_end = 0;
     }
 
@@ -399,7 +395,7 @@ int __init early_microcode_update_cpu(bool start_update)
     else if ( ucode_mod.mod_end )
     {
         len = ucode_mod.mod_end;
-        data = ucode_mod_map(&ucode_mod);
+        data = bootstrap_map(&ucode_mod);
     }
     if ( data )
     {
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 5c5c643..65170fe 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1473,7 +1473,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 
     xsm_multiboot_init(module_map, mbi);
 
-    microcode_grab_module(module_map, mbi, bootstrap_map);
+    microcode_grab_module(module_map, mbi);
 
     timer_init();
 
diff --git a/xen/include/asm-x86/setup.h b/xen/include/asm-x86/setup.h
index 46e9ca6..05d647d 100644
--- a/xen/include/asm-x86/setup.h
+++ b/xen/include/asm-x86/setup.h
@@ -50,7 +50,7 @@ unsigned int dom0_max_vcpus(void);
 int xen_in_range(unsigned long mfn);
 
 void microcode_grab_module(
-    unsigned long *, const multiboot_info_t *, void *(*)(const module_t *));
+    unsigned long *, const multiboot_info_t *);
 
 extern uint8_t kbd_shift_flags;
 
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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