diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2019-05-28 17:04:13 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-06-14 10:44:53 +0000 |
commit | 32f88254973f2fc8eada1b80feea338ac8931731 (patch) | |
tree | 7b66b2763d5c29c5f88f6a5e778b75152d4cb709 /chip | |
parent | 24577344b97f63a1fd28a1a7bd187887445b7193 (diff) | |
download | chrome-ec-32f88254973f2fc8eada1b80feea338ac8931731.tar.gz |
chip/mt_scp: Add dummy read in D-cache invalidation functions
With this, we only need to call cpu_invalidate_dcache once.
Only tested thoroughly on boot, but the dummy reads should not
hurt for the other operations.
BRANCH=none
BUG=b:123205971
TEST=See bug, check that cache is invalidated after first flush,
on boot.
Change-Id: I74f4fa89c0b9254c324955f4079b7db3832eaf43
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1632129
Reviewed-by: Yilun Lin <yllin@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r-- | chip/mt_scp/memmap.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/chip/mt_scp/memmap.c b/chip/mt_scp/memmap.c index 8250b4f6ec..574256c58e 100644 --- a/chip/mt_scp/memmap.c +++ b/chip/mt_scp/memmap.c @@ -70,6 +70,8 @@ void cpu_invalidate_dcache(void) SCP_CACHE_OP(CACHE_DCACHE) &= ~SCP_CACHE_OP_OP_MASK; SCP_CACHE_OP(CACHE_DCACHE) |= OP_INVALIDATE_ALL_LINES | SCP_CACHE_OP_EN; + /* Dummy read is necessary to confirm the invalidation finish. */ + REG32(CACHE_TRANS_SCP_CACHE_ADDR); asm volatile("dsb;"); } @@ -83,6 +85,8 @@ void cpu_invalidate_dcache_range(uintptr_t base, unsigned int length) SCP_CACHE_OP(CACHE_DCACHE) = addr & SCP_CACHE_OP_TADDR_MASK; SCP_CACHE_OP(CACHE_DCACHE) |= OP_INVALIDATE_ONE_LINE_BY_ADDRESS | SCP_CACHE_OP_EN; + /* Dummy read necessary to confirm the invalidation finish. */ + REG32(addr); } asm volatile("dsb;"); } @@ -95,6 +99,8 @@ void cpu_clean_invalidate_dcache(void) SCP_CACHE_OP(CACHE_DCACHE) &= ~SCP_CACHE_OP_OP_MASK; SCP_CACHE_OP(CACHE_DCACHE) |= OP_INVALIDATE_ALL_LINES | SCP_CACHE_OP_EN; + /* Dummy read necessary to confirm the invalidation finish. */ + REG32(CACHE_TRANS_SCP_CACHE_ADDR); asm volatile("dsb;"); } @@ -111,6 +117,8 @@ void cpu_clean_invalidate_dcache_range(uintptr_t base, unsigned int length) SCP_CACHE_OP(CACHE_DCACHE) = addr & SCP_CACHE_OP_TADDR_MASK; SCP_CACHE_OP(CACHE_DCACHE) |= OP_INVALIDATE_ONE_LINE_BY_ADDRESS | SCP_CACHE_OP_EN; + /* Dummy read necessary to confirm the invalidation finish. */ + REG32(addr); } asm volatile("dsb;"); } @@ -164,11 +172,6 @@ static void scp_cache_init(void) } cpu_invalidate_icache(); - /* - * TODO(b/123205971): It seems like we need to call this twice, else the - * cache keeps stale data. - */ - cpu_invalidate_dcache(); cpu_invalidate_dcache(); } |