summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexei Pososin <m09123874@bk.ru>2017-05-11 14:33:10 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-06-14 15:37:58 +0200
commitfd10817a8355653043f8addfe2ef975bedad093a (patch)
tree9487122c9a898c0e34e400a6f2d6522783b524b5
parent3dd67dd16e90bf1ec62c991f824116ec5b5c625f (diff)
downloadrtems-fd10817a8355653043f8addfe2ef975bedad093a.tar.bz2
Remove excessive locking from cache operations.
According to manual, the used operations (Clean Line by PA, Clean and Invalidate Line by PA, Cache Sync) are atomic and do not require locking. Update #3007.
-rw-r--r--c/src/lib/libbsp/arm/shared/arm-l2c-310/cache_.h44
1 files changed, 9 insertions, 35 deletions
diff --git a/c/src/lib/libbsp/arm/shared/arm-l2c-310/cache_.h b/c/src/lib/libbsp/arm/shared/arm-l2c-310/cache_.h
index f7017b7688..81b34a62fa 100644
--- a/c/src/lib/libbsp/arm/shared/arm-l2c-310/cache_.h
+++ b/c/src/lib/libbsp/arm/shared/arm-l2c-310/cache_.h
@@ -882,30 +882,17 @@ l2c_310_flush_range( const void* d_addr, const size_t n_bytes )
& ~L2C_310_DATA_LINE_MASK;
const uint32_t ADDR_LAST =
(uint32_t)( (size_t)d_addr + n_bytes - 1 );
- uint32_t block_end =
- L2C_310_MIN( ADDR_LAST, adx + L2C_310_MAX_LOCKING_BYTES );
volatile L2CC *l2cc = (volatile L2CC *) BSP_ARM_L2C_310_BASE;
if ( n_bytes == 0 ) {
return;
}
- for (;
- adx <= ADDR_LAST;
- adx = block_end + 1,
- block_end = L2C_310_MIN( ADDR_LAST, adx + L2C_310_MAX_LOCKING_BYTES )) {
- rtems_interrupt_lock_context lock_context;
-
- rtems_interrupt_lock_acquire( &l2c_310_lock, &lock_context );
-
- for (; adx <= block_end; adx += CPU_DATA_CACHE_ALIGNMENT ) {
- l2c_310_flush_1_line( l2cc, adx );
- }
-
- l2c_310_sync( l2cc );
-
- rtems_interrupt_lock_release( &l2c_310_lock, &lock_context );
+ for (; adx <= ADDR_LAST; adx += CPU_DATA_CACHE_ALIGNMENT ) {
+ l2c_310_flush_1_line( l2cc, adx );
}
+
+ l2c_310_sync( l2cc );
}
static inline void
@@ -950,31 +937,18 @@ l2c_310_invalidate_range( const void* d_addr, const size_t n_bytes )
& ~L2C_310_DATA_LINE_MASK;
const uint32_t ADDR_LAST =
(uint32_t)( (size_t)d_addr + n_bytes - 1 );
- uint32_t block_end =
- L2C_310_MIN( ADDR_LAST, adx + L2C_310_MAX_LOCKING_BYTES );
volatile L2CC *l2cc = (volatile L2CC *) BSP_ARM_L2C_310_BASE;
if ( n_bytes == 0 ) {
return;
}
- for (;
- adx <= ADDR_LAST;
- adx = block_end + 1,
- block_end = L2C_310_MIN( ADDR_LAST, adx + L2C_310_MAX_LOCKING_BYTES )) {
- rtems_interrupt_lock_context lock_context;
-
- rtems_interrupt_lock_acquire( &l2c_310_lock, &lock_context );
-
- for (; adx <= block_end; adx += CPU_DATA_CACHE_ALIGNMENT ) {
- /* Invalidate L2 cache line */
- l2cc->inv_pa = adx;
- }
-
- l2c_310_sync( l2cc );
-
- rtems_interrupt_lock_release( &l2c_310_lock, &lock_context );
+ for (; adx <= ADDR_LAST; adx += CPU_DATA_CACHE_ALIGNMENT ) {
+ /* Invalidate L2 cache line */
+ l2cc->inv_pa = adx;
}
+
+ l2c_310_sync( l2cc );
}