aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAchin Gupta <achin.gupta@arm.com>2014-11-10 11:50:30 +0000
committerAchin Gupta <achin.gupta@arm.com>2014-11-10 11:50:30 +0000
commit66ce001e7d9125f386eb254ec1645f4391e4f537 (patch)
tree39bd179f7eaaab22cfce06f1046f25b51635569a /lib
parent82b9b2973b108e91367159f2f42dec2fc45f168d (diff)
downloadtrusted-firmware-a-66ce001e7d9125f386eb254ec1645f4391e4f537.tar.gz
Precede a 'sev' with a 'dsb' in bakery lock code
This patch fixes a bug in the bakery lock implementation where a data synchronisation barrier instruction is not issued before sending an event as mandated by the ARMv8 ARM. This can cause a event to be signalled before the related memory accesses have completed resulting in erroneous execution. Fixes ARM-software/tf-issues#272 Change-Id: I5ce02bf70afb001d967b9fa4c3f77442931d5349
Diffstat (limited to 'lib')
-rw-r--r--lib/locks/bakery/bakery_lock.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/locks/bakery/bakery_lock.c b/lib/locks/bakery/bakery_lock.c
index 877f5262e9..7e71dec0f9 100644
--- a/lib/locks/bakery/bakery_lock.c
+++ b/lib/locks/bakery/bakery_lock.c
@@ -107,6 +107,7 @@ static unsigned int bakery_get_ticket(bakery_lock_t *bakery, unsigned int me)
++my_ticket;
bakery->number[me] = my_ticket;
bakery->entering[me] = 0;
+ dsb();
sev();
return my_ticket;
@@ -189,5 +190,6 @@ void bakery_lock_release(bakery_lock_t *bakery)
*/
bakery->owner = NO_OWNER;
bakery->number[me] = 0;
+ dsb();
sev();
}