Add spinlock to serialize Intel microcode updates
Updating microcode on several threads in a core at once can be harmful. Hence add a spinlock to make sure that does not happen. Change-Id: I0c9526b6194202ae7ab5c66361fe04ce137372cc Signed-off-by: Stefan Reinauer <reinauer@google.com> Reviewed-on: http://review.coreboot.org/1778 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
parent
0a405bafc5
commit
a42e2f4daa
|
@ -28,12 +28,16 @@
|
||||||
#include <cpu/x86/msr.h>
|
#include <cpu/x86/msr.h>
|
||||||
#include <cpu/intel/microcode.h>
|
#include <cpu/intel/microcode.h>
|
||||||
|
|
||||||
#if CONFIG_CPU_MICROCODE_IN_CBFS
|
|
||||||
#ifdef __PRE_RAM__
|
#ifdef __PRE_RAM__
|
||||||
|
#if CONFIG_CPU_MICROCODE_IN_CBFS
|
||||||
#include <arch/cbfs.h>
|
#include <arch/cbfs.h>
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
|
#if CONFIG_CPU_MICROCODE_IN_CBFS
|
||||||
#include <cbfs.h>
|
#include <cbfs.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <smp/spinlock.h>
|
||||||
|
DECLARE_SPIN_LOCK(microcode_lock)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct microcode {
|
struct microcode {
|
||||||
|
@ -112,6 +116,9 @@ void intel_update_microcode(const void *microcode_updates)
|
||||||
printk(BIOS_DEBUG, "microcode: sig=0x%x pf=0x%x revision=0x%x\n",
|
printk(BIOS_DEBUG, "microcode: sig=0x%x pf=0x%x revision=0x%x\n",
|
||||||
sig, pf, rev);
|
sig, pf, rev);
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(__ROMCC__) && !defined(__PRE_RAM__)
|
||||||
|
spin_lock(µcode_lock);
|
||||||
|
#endif
|
||||||
|
|
||||||
m = microcode_updates;
|
m = microcode_updates;
|
||||||
for(c = microcode_updates; m->hdrver; m = (const struct microcode *)c) {
|
for(c = microcode_updates; m->hdrver; m = (const struct microcode *)c) {
|
||||||
|
@ -142,6 +149,10 @@ void intel_update_microcode(const void *microcode_updates)
|
||||||
c += 2048;
|
c += 2048;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(__ROMCC__) && !defined(__PRE_RAM__)
|
||||||
|
spin_unlock(µcode_lock);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_CPU_MICROCODE_IN_CBFS
|
#if CONFIG_CPU_MICROCODE_IN_CBFS
|
||||||
|
|
Loading…
Reference in New Issue