Stefan Reinauer (stefan.reinauer@coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1778
-gerrit
commit df705995edff81e551090b13e0caa7f7f8bf49f3 Author: Stefan Reinauer reinauer@chromium.org Date: Mon Oct 15 13:18:06 2012 -0700
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 --- src/cpu/intel/microcode/microcode.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/src/cpu/intel/microcode/microcode.c b/src/cpu/intel/microcode/microcode.c index a4471ca..8f3c926 100644 --- a/src/cpu/intel/microcode/microcode.c +++ b/src/cpu/intel/microcode/microcode.c @@ -32,7 +32,9 @@ #ifdef __PRE_RAM__ #include <arch/cbfs.h> #else +#include <smp/spinlock.h> #include <cbfs.h> +DECLARE_SPIN_LOCK(microcode_lock) #endif #endif
@@ -111,6 +113,9 @@ void intel_update_microcode(const void *microcode_updates) */ printk(BIOS_DEBUG, "microcode: sig=0x%x pf=0x%x revision=0x%x\n", sig, pf, rev); +#if !defined(__PRE_RAM__) + spin_lock(µcode_lock); +#endif #endif
m = microcode_updates; @@ -142,6 +147,10 @@ void intel_update_microcode(const void *microcode_updates) c += 2048; } } + +#if !defined(__ROMCC__) && !defined(__PRE_RAM__) + spin_unlock(µcode_lock); +#endif }
#if CONFIG_CPU_MICROCODE_IN_CBFS