Skip to content

Commit abcdb18

Browse files
JiafeiPankartben
authored andcommitted
arch: arm64: cache: optionally enable APIs for operation all dcache
Added new configuration item to optionally enable APIs for operation all data cache, by default these APIs are disabled. Signed-off-by: Jiafei Pan <[email protected]>
1 parent 6aba505 commit abcdb18

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

arch/arm64/core/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,4 +357,11 @@ config MAX_XLAT_TABLES
357357

358358
endif # ARM_MMU
359359

360+
config ARM64_DCACHE_ALL_OPS
361+
bool "Provide data cache APIs to operate all data caches"
362+
depends on CACHE_MANAGEMENT && DCACHE
363+
help
364+
Enable this option to provide the data cache APIs to flush or
365+
invalidate all data caches.
366+
360367
endif # CPU_CORTEX_A || CPU_AARCH64_CORTEX_R

include/zephyr/arch/arm64/cache.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ static ALWAYS_INLINE int arm64_dcache_range(void *addr, size_t size, int op)
139139
return 0;
140140
}
141141

142+
#ifdef CONFIG_ARM64_DCACHE_ALL_OPS
143+
142144
/*
143145
* operation for all data cache
144146
* ops: K_CACHE_INVD: invalidate
@@ -227,6 +229,25 @@ static ALWAYS_INLINE int arch_dcache_flush_and_invd_all(void)
227229
return arm64_dcache_all(K_CACHE_WB_INVD);
228230
}
229231

232+
#else
233+
234+
static ALWAYS_INLINE int arch_dcache_flush_all(void)
235+
{
236+
return -ENOTSUP;
237+
}
238+
239+
static ALWAYS_INLINE int arch_dcache_invd_all(void)
240+
{
241+
return -ENOTSUP;
242+
}
243+
244+
static ALWAYS_INLINE int arch_dcache_flush_and_invd_all(void)
245+
{
246+
return -ENOTSUP;
247+
}
248+
249+
#endif /* CONFIG_ARM64_DCACHE_ALL_OPS */
250+
230251
static ALWAYS_INLINE int arch_dcache_flush_range(void *addr, size_t size)
231252
{
232253
return arm64_dcache_range(addr, size, K_CACHE_WB);

0 commit comments

Comments
 (0)