Skip to content

Commit 8b39d4a

Browse files
andyrosshenrikbrixandersen
authored andcommitted
arch/xtensa: Add build-time validation of cache line kconfig
Xtensa cache line sizes aren't an obtuse area of pedantry like they are in x86. Different cores already in Zephyr are already using variant cache line sizes (64 and 128 bytes are both common). And I tripped over this by using the wrong value because the kconfig was being inherited (incorrectly) from a default somewhere. Xtensa exposes the correct value in core-isa.h (well, unless the toolchain/hal gets messed up). Add a check to make sure that our platform kconfig gets it right. Note that qemu/dc233c was already getting this wrong, leaving the value at the kconfig default of zero. That was benign (qemu doesn't provide any cache emulation for incoherent DMA), but needs to be fixed. Signed-off-by: Andy Ross <[email protected]>
1 parent dadd1a3 commit 8b39d4a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

arch/xtensa/core/prep_c.c

+7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ extern FUNC_NORETURN void z_cstart(void);
1313
/* defined by the SoC in case of CONFIG_SOC_HAS_RUNTIME_NUM_CPUS=y */
1414
extern void soc_num_cpus_init(void);
1515

16+
/* Make sure the platform configuration matches what the toolchain
17+
* thinks the hardware is doing.
18+
*/
19+
#ifdef CONFIG_DCACHE_LINE_SIZE
20+
BUILD_ASSERT(CONFIG_DCACHE_LINE_SIZE == XCHAL_DCACHE_LINESIZE);
21+
#endif
22+
1623
/**
1724
*
1825
* @brief Prepare to and run C code

boards/qemu/xtensa/Kconfig.defconfig

+4
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@ config BUILD_OUTPUT_BIN
99
config IPM_CONSOLE_STACK_SIZE
1010
default 2048 if IPM_CONSOLE_RECEIVER
1111

12+
# Must match XCHAL_DCACHE_LINESIZE form core-isa.h
13+
config DCACHE_LINE_SIZE
14+
default 32
15+
1216
endif # BOARD_QEMU_XTENSA

0 commit comments

Comments
 (0)