Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
783fd8e0
Unverified
Commit
783fd8e0
authored
Sep 05, 2018
by
Dimitris Papastamos
Committed by
GitHub
Sep 05, 2018
Browse files
Merge pull request #1561 from jeenu-arm/bakery-barrier
Add missing barriers to Bakery Locks
parents
42dc3310
24dc9709
Changes
3
Show whitespace changes
Inline
Side-by-side
include/lib/aarch32/arch_helpers.h
View file @
783fd8e0
...
@@ -210,7 +210,12 @@ DEFINE_SYSOP_FUNC(sev)
...
@@ -210,7 +210,12 @@ DEFINE_SYSOP_FUNC(sev)
DEFINE_SYSOP_TYPE_FUNC
(
dsb
,
sy
)
DEFINE_SYSOP_TYPE_FUNC
(
dsb
,
sy
)
DEFINE_SYSOP_TYPE_FUNC
(
dmb
,
sy
)
DEFINE_SYSOP_TYPE_FUNC
(
dmb
,
sy
)
DEFINE_SYSOP_TYPE_FUNC
(
dmb
,
st
)
DEFINE_SYSOP_TYPE_FUNC
(
dmb
,
st
)
/* dmb ld is not valid for armv7/thumb machines */
#if ARM_ARCH_MAJOR != 7
DEFINE_SYSOP_TYPE_FUNC
(
dmb
,
ld
)
DEFINE_SYSOP_TYPE_FUNC
(
dmb
,
ld
)
#endif
DEFINE_SYSOP_TYPE_FUNC
(
dsb
,
ish
)
DEFINE_SYSOP_TYPE_FUNC
(
dsb
,
ish
)
DEFINE_SYSOP_TYPE_FUNC
(
dsb
,
ishst
)
DEFINE_SYSOP_TYPE_FUNC
(
dsb
,
ishst
)
DEFINE_SYSOP_TYPE_FUNC
(
dmb
,
ish
)
DEFINE_SYSOP_TYPE_FUNC
(
dmb
,
ish
)
...
@@ -323,6 +328,11 @@ DEFINE_DCOP_PARAM_FUNC(cvac, DCCMVAC)
...
@@ -323,6 +328,11 @@ DEFINE_DCOP_PARAM_FUNC(cvac, DCCMVAC)
#define dsb() dsbsy()
#define dsb() dsbsy()
#define dmb() dmbsy()
#define dmb() dmbsy()
/* dmb ld is not valid for armv7/thumb machines, so alias it to dmb */
#if ARM_ARCH_MAJOR == 7
#define dmbld() dmb()
#endif
#define IS_IN_SECURE() \
#define IS_IN_SECURE() \
(GET_NS_BIT(read_scr()) == 0)
(GET_NS_BIT(read_scr()) == 0)
...
...
lib/locks/bakery/bakery_lock_coherent.c
View file @
783fd8e0
/*
/*
* Copyright (c) 2013-201
5
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-201
8
, ARM Limited and Contributors. All rights reserved.
*
*
* SPDX-License-Identifier: BSD-3-Clause
* SPDX-License-Identifier: BSD-3-Clause
*/
*/
...
@@ -133,7 +133,12 @@ void bakery_lock_get(bakery_lock_t *bakery)
...
@@ -133,7 +133,12 @@ void bakery_lock_get(bakery_lock_t *bakery)
bakery_ticket_number
(
bakery
->
lock_data
[
they
]));
bakery_ticket_number
(
bakery
->
lock_data
[
they
]));
}
}
}
}
/* Lock acquired */
/*
* Lock acquired. Ensure that any reads from a shared resource in the
* critical section read values after the lock is acquired.
*/
dmbld
();
}
}
...
@@ -146,9 +151,11 @@ void bakery_lock_release(bakery_lock_t *bakery)
...
@@ -146,9 +151,11 @@ void bakery_lock_release(bakery_lock_t *bakery)
assert
(
bakery_ticket_number
(
bakery
->
lock_data
[
me
]));
assert
(
bakery_ticket_number
(
bakery
->
lock_data
[
me
]));
/*
/*
* Release lock by resetting ticket. Then signal other
* Ensure that other observers see any stores in the critical section
* waiting contenders
* before releasing the lock. Release the lock by resetting ticket.
* Then signal other waiting contenders.
*/
*/
dmbst
();
bakery
->
lock_data
[
me
]
=
0
;
bakery
->
lock_data
[
me
]
=
0
;
dsb
();
dsb
();
sev
();
sev
();
...
...
lib/locks/bakery/bakery_lock_normal.c
View file @
783fd8e0
...
@@ -204,7 +204,12 @@ void bakery_lock_get(bakery_lock_t *lock)
...
@@ -204,7 +204,12 @@ void bakery_lock_get(bakery_lock_t *lock)
==
bakery_ticket_number
(
their_bakery_info
->
lock_data
));
==
bakery_ticket_number
(
their_bakery_info
->
lock_data
));
}
}
}
}
/* Lock acquired */
/*
* Lock acquired. Ensure that any reads from a shared resource in the
* critical section read values after the lock is acquired.
*/
dmbld
();
}
}
void
bakery_lock_release
(
bakery_lock_t
*
lock
)
void
bakery_lock_release
(
bakery_lock_t
*
lock
)
...
@@ -220,6 +225,12 @@ void bakery_lock_release(bakery_lock_t *lock)
...
@@ -220,6 +225,12 @@ void bakery_lock_release(bakery_lock_t *lock)
assert
(
is_lock_acquired
(
my_bakery_info
,
is_cached
));
assert
(
is_lock_acquired
(
my_bakery_info
,
is_cached
));
/*
* Ensure that other observers see any stores in the critical section
* before releasing the lock. Release the lock by resetting ticket.
* Then signal other waiting contenders.
*/
dmbst
();
my_bakery_info
->
lock_data
=
0
;
my_bakery_info
->
lock_data
=
0
;
write_cache_op
(
my_bakery_info
,
is_cached
);
write_cache_op
(
my_bakery_info
,
is_cached
);
sev
();
sev
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment