Refactored code by introducing a two-module solution. There is one<snip>
general module in which vendor specific modules can hook into.
However, that is exclusive, there is only one vendor specific module
allowed at a time. A CPU vendor check makes sure only the corect
module for the underlying system gets called. Functinally in terms
of patch loading itself there are no changes. This refactoring
provides a basis for future implementations of other vendors'
patch loaders.
Signed-off-by: Peter Oruba <peter.oruba@xxxxxxx>
diff --git a/arch/x86/kernel/microcode.c b/arch/x86/kernel/microcode.c<snip>
index c1047d7..1e42e79 100644
--- a/arch/x86/kernel/microcode.c
+++ b/arch/x86/kernel/microcode.c
@@ -244,9 +243,9 @@ static void microcode_init_cpu(int cpu, int resume)
set_cpus_allowed_ptr(current, newmask);
mutex_lock(µcode_mutex);
- collect_cpu_info(cpu);
+ microcode_ops->collect_cpu_info(cpu);
if (uci->valid && system_state == SYSTEM_RUNNING && !resume)
- cpu_request_microcode(cpu);
+ microcode_ops->cpu_request_microcode(cpu);
mutex_unlock(µcode_mutex);
set_cpus_allowed_ptr(current, &old);
@@ -274,7 +273,7 @@ static ssize_t reload_store(struct sys_device *dev,
mutex_lock(µcode_mutex);
if (uci->valid)
- err = cpu_request_microcode(cpu);
+ err = microcode_ops->cpu_request_microcode(cpu);
mutex_unlock(µcode_mutex);
put_online_cpus();
set_cpus_allowed_ptr(current, &old);