Commit 596929b9 authored by Varun Wadekar's avatar Varun Wadekar
Browse files

locks: linker variables to calculate per-cpu bakery lock size



This patch introduces explicit linker variables to mark the start and
end of the per-cpu bakery lock section to help bakery_lock_normal.c
calculate the size of the section. This patch removes the previously
used '__PERCPU_BAKERY_LOCK_SIZE__' linker variable to make the code
uniform across GNU linker and ARM linker.

Change-Id: Ie0c51702cbc0fe8a2076005344a1fcebb48e7cca
Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
parent 5e2fe3a3
...@@ -224,9 +224,11 @@ SECTIONS ...@@ -224,9 +224,11 @@ SECTIONS
*/ */
. = ALIGN(CACHE_WRITEBACK_GRANULE); . = ALIGN(CACHE_WRITEBACK_GRANULE);
__BAKERY_LOCK_START__ = .; __BAKERY_LOCK_START__ = .;
__PERCPU_BAKERY_LOCK_START__ = .;
*(bakery_lock) *(bakery_lock)
. = ALIGN(CACHE_WRITEBACK_GRANULE); . = ALIGN(CACHE_WRITEBACK_GRANULE);
__PERCPU_BAKERY_LOCK_SIZE__ = ABSOLUTE(. - __BAKERY_LOCK_START__); __PERCPU_BAKERY_LOCK_END__ = .;
__PERCPU_BAKERY_LOCK_SIZE__ = ABSOLUTE(__PERCPU_BAKERY_LOCK_END__ - __PERCPU_BAKERY_LOCK_START__);
. = . + (__PERCPU_BAKERY_LOCK_SIZE__ * (PLATFORM_CORE_COUNT - 1)); . = . + (__PERCPU_BAKERY_LOCK_SIZE__ * (PLATFORM_CORE_COUNT - 1));
__BAKERY_LOCK_END__ = .; __BAKERY_LOCK_END__ = .;
......
...@@ -151,9 +151,11 @@ SECTIONS ...@@ -151,9 +151,11 @@ SECTIONS
*/ */
. = ALIGN(CACHE_WRITEBACK_GRANULE); . = ALIGN(CACHE_WRITEBACK_GRANULE);
__BAKERY_LOCK_START__ = .; __BAKERY_LOCK_START__ = .;
__PERCPU_BAKERY_LOCK_START__ = .;
*(bakery_lock) *(bakery_lock)
. = ALIGN(CACHE_WRITEBACK_GRANULE); . = ALIGN(CACHE_WRITEBACK_GRANULE);
__PERCPU_BAKERY_LOCK_SIZE__ = ABSOLUTE(. - __BAKERY_LOCK_START__); __PERCPU_BAKERY_LOCK_END__ = .;
__PERCPU_BAKERY_LOCK_SIZE__ = ABSOLUTE(__PERCPU_BAKERY_LOCK_END__ - __PERCPU_BAKERY_LOCK_START__);
. = . + (__PERCPU_BAKERY_LOCK_SIZE__ * (PLATFORM_CORE_COUNT - 1)); . = . + (__PERCPU_BAKERY_LOCK_SIZE__ * (PLATFORM_CORE_COUNT - 1));
__BAKERY_LOCK_END__ = .; __BAKERY_LOCK_END__ = .;
#ifdef PLAT_PERCPU_BAKERY_LOCK_SIZE #ifdef PLAT_PERCPU_BAKERY_LOCK_SIZE
......
...@@ -51,7 +51,9 @@ CASSERT((PLAT_PERCPU_BAKERY_LOCK_SIZE & (CACHE_WRITEBACK_GRANULE - 1)) == 0, \ ...@@ -51,7 +51,9 @@ CASSERT((PLAT_PERCPU_BAKERY_LOCK_SIZE & (CACHE_WRITEBACK_GRANULE - 1)) == 0, \
* Use the linker defined symbol which has evaluated the size reqiurement. * Use the linker defined symbol which has evaluated the size reqiurement.
* This is not as efficient as using a platform defined constant * This is not as efficient as using a platform defined constant
*/ */
IMPORT_SYM(uintptr_t, __PERCPU_BAKERY_LOCK_SIZE__, PERCPU_BAKERY_LOCK_SIZE); IMPORT_SYM(uintptr_t, __PERCPU_BAKERY_LOCK_START__, BAKERY_LOCK_START);
IMPORT_SYM(uintptr_t, __PERCPU_BAKERY_LOCK_END__, BAKERY_LOCK_END);
#define PERCPU_BAKERY_LOCK_SIZE (BAKERY_LOCK_END - BAKERY_LOCK_START)
#endif #endif
static inline bakery_lock_t *get_bakery_info(unsigned int cpu_ix, static inline bakery_lock_t *get_bakery_info(unsigned int cpu_ix,
......
...@@ -113,9 +113,11 @@ SECTIONS ...@@ -113,9 +113,11 @@ SECTIONS
*/ */
. = ALIGN(CACHE_WRITEBACK_GRANULE); . = ALIGN(CACHE_WRITEBACK_GRANULE);
__BAKERY_LOCK_START__ = .; __BAKERY_LOCK_START__ = .;
__PERCPU_BAKERY_LOCK_START__ = .;
*(bakery_lock) *(bakery_lock)
. = ALIGN(CACHE_WRITEBACK_GRANULE); . = ALIGN(CACHE_WRITEBACK_GRANULE);
__PERCPU_BAKERY_LOCK_SIZE__ = ABSOLUTE(. - __BAKERY_LOCK_START__); __PERCPU_BAKERY_LOCK_END__ = .;
__PERCPU_BAKERY_LOCK_SIZE__ = ABSOLUTE(__PERCPU_BAKERY_LOCK_END__ - __PERCPU_BAKERY_LOCK_START__);
. = . + (__PERCPU_BAKERY_LOCK_SIZE__ * (PLATFORM_CORE_COUNT - 1)); . = . + (__PERCPU_BAKERY_LOCK_SIZE__ * (PLATFORM_CORE_COUNT - 1));
__BAKERY_LOCK_END__ = .; __BAKERY_LOCK_END__ = .;
#ifdef PLAT_PERCPU_BAKERY_LOCK_SIZE #ifdef PLAT_PERCPU_BAKERY_LOCK_SIZE
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment