Browse Source

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 <Jiafei.Pan@nxp.com>
pull/91016/head
Jiafei Pan 2 months ago committed by Benjamin Cabé
parent
commit
abcdb18568
  1. 7
      arch/arm64/core/Kconfig
  2. 21
      include/zephyr/arch/arm64/cache.h

7
arch/arm64/core/Kconfig

@ -357,4 +357,11 @@ config MAX_XLAT_TABLES @@ -357,4 +357,11 @@ config MAX_XLAT_TABLES
endif # ARM_MMU
config ARM64_DCACHE_ALL_OPS
bool "Provide data cache APIs to operate all data caches"
depends on CACHE_MANAGEMENT && DCACHE
help
Enable this option to provide the data cache APIs to flush or
invalidate all data caches.
endif # CPU_CORTEX_A || CPU_AARCH64_CORTEX_R

21
include/zephyr/arch/arm64/cache.h

@ -139,6 +139,8 @@ done: @@ -139,6 +139,8 @@ done:
return 0;
}
#ifdef CONFIG_ARM64_DCACHE_ALL_OPS
/*
* operation for all data cache
* ops: K_CACHE_INVD: invalidate
@ -227,6 +229,25 @@ static ALWAYS_INLINE int arch_dcache_flush_and_invd_all(void) @@ -227,6 +229,25 @@ static ALWAYS_INLINE int arch_dcache_flush_and_invd_all(void)
return arm64_dcache_all(K_CACHE_WB_INVD);
}
#else
static ALWAYS_INLINE int arch_dcache_flush_all(void)
{
return -ENOTSUP;
}
static ALWAYS_INLINE int arch_dcache_invd_all(void)
{
return -ENOTSUP;
}
static ALWAYS_INLINE int arch_dcache_flush_and_invd_all(void)
{
return -ENOTSUP;
}
#endif /* CONFIG_ARM64_DCACHE_ALL_OPS */
static ALWAYS_INLINE int arch_dcache_flush_range(void *addr, size_t size)
{
return arm64_dcache_range(addr, size, K_CACHE_WB);

Loading…
Cancel
Save