|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 2/5] x86/ucode: Fold early_update_cache() into microcode_init_cache()
It is not valid to retain a bootstrap_map() across returning back to
__start_xen(), but various pointers get stashed across calls.
Begin to address this by folding early_update_cache() into it's single caller,
rearranging the exit path to always invalidate the mapping.
No practical change.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
CC: Sergey Dyasli <sergey.dyasli@xxxxxxxxxx>
---
xen/arch/x86/cpu/microcode/core.c | 54 +++++++++++++++++--------------
1 file changed, 29 insertions(+), 25 deletions(-)
diff --git a/xen/arch/x86/cpu/microcode/core.c
b/xen/arch/x86/cpu/microcode/core.c
index 11c471cc3f83..3d23e3ed7ee4 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -755,47 +755,51 @@ int microcode_update_one(void)
return microcode_update_cpu(NULL);
}
-static int __init early_update_cache(const void *data, size_t len)
+int __init microcode_init_cache(unsigned long *module_map,
+ const struct multiboot_info *mbi)
{
int rc = 0;
struct microcode_patch *patch;
+ struct ucode_mod_blob blob = {};
- if ( !data )
- return -ENOMEM;
+ if ( ucode_scan )
+ /* Need to rescan the modules because they might have been relocated */
+ microcode_scan_module(module_map, mbi);
+
+ if ( ucode_mod.mod_end )
+ {
+ blob.data = bootstrap_map(&ucode_mod);
+ blob.size = ucode_mod.mod_end;
+ }
+ else if ( ucode_blob.size )
+ {
+ blob = ucode_blob;
+ }
- patch = parse_blob(data, len);
+ if ( !blob.data )
+ return 0;
+
+ patch = parse_blob(blob.data, blob.size);
if ( IS_ERR(patch) )
{
- printk(XENLOG_WARNING "Parsing microcode blob error %ld\n",
- PTR_ERR(patch));
- return PTR_ERR(patch);
+ rc = PTR_ERR(patch);
+ printk(XENLOG_WARNING "Parsing microcode blob error %d\n", rc);
+ goto out;
}
if ( !patch )
- return -ENOENT;
+ {
+ rc = -ENOENT;
+ goto out;
+ }
spin_lock(µcode_mutex);
rc = microcode_update_cache(patch);
spin_unlock(µcode_mutex);
ASSERT(rc);
- return rc;
-}
-
-int __init microcode_init_cache(unsigned long *module_map,
- const struct multiboot_info *mbi)
-{
- int rc = 0;
-
- if ( ucode_scan )
- /* Need to rescan the modules because they might have been relocated */
- microcode_scan_module(module_map, mbi);
-
- if ( ucode_mod.mod_end )
- rc = early_update_cache(bootstrap_map(&ucode_mod),
- ucode_mod.mod_end);
- else if ( ucode_blob.size )
- rc = early_update_cache(ucode_blob.data, ucode_blob.size);
+ out:
+ bootstrap_map(NULL);
return rc;
}
--
2.30.2
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |