From f8dc4bc0224f18a33fcf19e3d754ac96a383a863 Mon Sep 17 00:00:00 2001 From: Kyösti Mälkki Date: Mon, 19 Aug 2019 16:14:15 +0300 Subject: arch/x86: Remove spinlocks inside CAR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was only used with amdfam10h-15h, where cache coherency between nodes was supposed to be guaranteed with this code. We could want a cleaner and more generic approach for this, possibly utilising .data sections. Change-Id: I00da5c2b0570c26f2e3bb464274485cc2c08c8f0 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/34929 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans Reviewed-by: Aaron Durbin --- src/arch/x86/include/arch/smp/spinlock.h | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) (limited to 'src/arch/x86/include') diff --git a/src/arch/x86/include/arch/smp/spinlock.h b/src/arch/x86/include/arch/smp/spinlock.h index f9186787af..8bdb125223 100644 --- a/src/arch/x86/include/arch/smp/spinlock.h +++ b/src/arch/x86/include/arch/smp/spinlock.h @@ -14,11 +14,6 @@ #ifndef ARCH_SMP_SPINLOCK_H #define ARCH_SMP_SPINLOCK_H -#if !defined(__PRE_RAM__) \ - || CONFIG(HAVE_ROMSTAGE_CONSOLE_SPINLOCK) \ - || CONFIG(HAVE_ROMSTAGE_NVRAM_CBFS_SPINLOCK) \ - || CONFIG(HAVE_ROMSTAGE_MICROCODE_CBFS_SPINLOCK) - /* * Your basic SMP spinlocks, allowing only a single CPU anywhere */ @@ -27,23 +22,14 @@ typedef struct { volatile unsigned int lock; } spinlock_t; -#ifdef __PRE_RAM__ -spinlock_t *romstage_console_lock(void); -void initialize_romstage_console_lock(void); -spinlock_t *romstage_nvram_cbfs_lock(void); -void initialize_romstage_nvram_cbfs_lock(void); -spinlock_t *romstage_microcode_cbfs_lock(void); -void initialize_romstage_microcode_cbfs_lock(void); -#endif - #define SPIN_LOCK_UNLOCKED { 1 } -#ifndef __PRE_RAM__ +#define STAGE_HAS_SPINLOCKS !ENV_ROMSTAGE_OR_BEFORE + +#if STAGE_HAS_SPINLOCKS + #define DECLARE_SPIN_LOCK(x) \ static spinlock_t x = SPIN_LOCK_UNLOCKED; -#else -#define DECLARE_SPIN_LOCK(x) -#endif /* * Simple spin lock operations. There are two variants, one clears IRQ's @@ -93,7 +79,7 @@ static __always_inline void cpu_relax(void) __asm__ __volatile__("rep;nop" : : : "memory"); } -#else /* !__PRE_RAM__ */ +#else #define DECLARE_SPIN_LOCK(x) #define barrier() do {} while (0) @@ -103,6 +89,6 @@ static __always_inline void cpu_relax(void) #define spin_unlock(lock) do {} while (0) #define cpu_relax() do {} while (0) -#endif /* !__PRE_RAM__ */ +#endif #endif /* ARCH_SMP_SPINLOCK_H */ -- cgit v1.2.3