summaryrefslogtreecommitdiff
path: root/make_helpers
diff options
context:
space:
mode:
authorSoby Mathew <soby.mathew@arm.com>2019-09-25 14:03:41 +0100
committerOlivier Deprez <olivier.deprez@arm.com>2019-10-04 10:19:35 +0200
commitc97cba4ea44910df1f7b1af5dba79013fb44c383 (patch)
tree9d2965a2b9610413dea548a95e2f5094fc84b6e8 /make_helpers
parentace23683beb81354d6edbc61c087ab8c384d0631 (diff)
Fix the CAS spinlock implementation
Make the spinlock implementation use ARMv8.1-LSE CAS instruction based on a platform build option. The CAS-based implementation used to be unconditionally selected for all ARM8.1+ platforms. The previous CAS spinlock implementation had a bug wherein the spin_unlock() implementation had an `sev` after `stlr` which is not sufficient. A dsb is needed to ensure that the stlr completes prior to the sev. Having a dsb is heavyweight and a better solution would be to use load exclusive semantics to monitor the lock and wake up from wfe when a store happens to the lock. The patch implements the same. Change-Id: I5283ce4a889376e4cc01d1b9d09afa8229a2e522 Signed-off-by: Soby Mathew <soby.mathew@arm.com> Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Diffstat (limited to 'make_helpers')
-rw-r--r--make_helpers/defaults.mk5
1 files changed, 5 insertions, 0 deletions
diff --git a/make_helpers/defaults.mk b/make_helpers/defaults.mk
index b6f76559..b7fb173b 100644
--- a/make_helpers/defaults.mk
+++ b/make_helpers/defaults.mk
@@ -234,3 +234,8 @@ else
endif
SANITIZE_UB := off
+
+# For ARMv8.1 (AArch64) platforms, enabling this option selects the spinlock
+# implementation variant using the ARMv8.1-LSE compare-and-swap instruction.
+# Default: disabled
+USE_SPINLOCK_CAS := 0