This is an automated email from the ASF dual-hosted git repository. GUIDINGLI pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit c95124d4f4d743504ae366c7ce256e3cc960d325 Author: makejian <[email protected]> AuthorDate: Mon Nov 23 16:38:27 2026 +0800 arch/tricore: clean and flush both D-cache ways CACHEI.W/WI selects the D-cache line by index and way, with the way in address bit 0. The previous line-sized increments only accessed way 0. Halve the set iteration count and issue each operation for both ways so dirty lines in way 1 are also cleaned or invalidated. Signed-off-by: makejian <[email protected]> --- arch/tricore/src/common/tricore_cache.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/tricore/src/common/tricore_cache.c b/arch/tricore/src/common/tricore_cache.c index 9c85ec7453c..c4be92bbba0 100644 --- a/arch/tricore/src/common/tricore_cache.c +++ b/arch/tricore/src/common/tricore_cache.c @@ -414,12 +414,15 @@ void up_clean_dcache_all(void) { uintptr_t cache_addr = CONFIG_ARCH_DCACHE_ADDR; size_t line_size = up_get_dcache_linesize(); - size_t line_cnt = up_get_dcache_size() / line_size; + size_t line_cnt = up_get_dcache_size() / line_size / 2; size_t i; + /* 2-way cache: bit 0 of the CACHEI address selects the way */ + for (i = 0; i < line_cnt; i++) { tc_clear_cache_byline(cache_addr); + tc_clear_cache_byline(cache_addr + 1); cache_addr += line_size; } @@ -477,12 +480,15 @@ void up_flush_dcache_all(void) { uintptr_t cache_addr = CONFIG_ARCH_DCACHE_ADDR; size_t line_size = up_get_dcache_linesize(); - size_t line_cnt = up_get_dcache_size() / line_size; + size_t line_cnt = up_get_dcache_size() / line_size / 2; size_t i; + /* 2-way cache: bit 0 of the CACHEI address selects the way */ + for (i = 0; i < line_cnt; i++) { tc_flush_cache_byline(cache_addr); + tc_flush_cache_byline(cache_addr + 1); cache_addr += line_size; }
