diff options
author | Rudolf Marek <r.marek@assembler.cz> | 2011-07-02 16:03:24 +0200 |
---|---|---|
committer | Patrick Georgi <patrick@georgi-clan.de> | 2011-07-04 08:36:42 +0200 |
commit | 7f76290e2d085da8975a8a011f93e50a5460645b (patch) | |
tree | e89db510169944028f45ede5b9e8e57f1ac2ff7e /src | |
parent | c0458e63d080223c7ee31367b8259f41a8f03405 (diff) |
Small SMM fixups
Align the spinlock to the 4 byte boundary (CPU will guarantee atomicity of XCHG).
While at it add the PAUSE instruction to spinlock loop to hint the CPU we are just
spinlocking. The rep nop could not be used because "as" complains that rep is used
without string instructions.
Change-Id: I325cd83de3a6557b1bee6758bc151bc81e874f8c
Signed-off-by: Rudolf Marek <r.marek@assembler.cz>
Reviewed-on: http://review.coreboot.org/81
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/cpu/x86/smm/smihandler.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cpu/x86/smm/smihandler.c b/src/cpu/x86/smm/smihandler.c index d44a3eae1b..a6ab87fd65 100644 --- a/src/cpu/x86/smm/smihandler.c +++ b/src/cpu/x86/smm/smihandler.c @@ -28,7 +28,7 @@ typedef enum { SMI_LOCKED, SMI_UNLOCKED } smi_semaphore; /* SMI multiprocessing semaphore */ -static volatile smi_semaphore smi_handler_status = SMI_UNLOCKED; +static volatile smi_semaphore smi_handler_status __attribute__ ((aligned (4))) = SMI_UNLOCKED; static int smi_obtain_lock(void) { @@ -121,7 +121,11 @@ void smi_handler(u32 smm_revision) /* For security reasons we don't release the other CPUs * until the CPU with the lock is actually done */ - while (smi_handler_status == SMI_LOCKED) /* wait */ ; + while (smi_handler_status == SMI_LOCKED) { + asm volatile ( + ".byte 0xf3, 0x90\n" /* hint a CPU we are in spinlock (PAUSE instruction, REP NOP) */ + ); + } return; } |