soc: riscv: privileged: Conditionally override arch_cpu_idle()

The current configuration comes with a common implementation of
`arch_cpu_idle()` for the whole riscv-privileged family, utilizing the
`WFI` instruction to place the CPU into a light sleep state, with the
assumption that it will be awakened later by interrupts such as SYSTICK.
However, this approach is not always effective, particularly in scenarios
where the SYSTICK is not a valid wake source.

This commit uses `CONFIG_RISCV_HAS_CPU_IDLE` as the build condition of the
family-level `idle.c`, allowing CPUs that do not enable this option to
fallback to a generic arch-level implementation in
`arch/riscv/core/cpu_idle.c`.

Signed-off-by: Chen Xingyu <hi@xingrz.me>
This commit is contained in:
Chen Xingyu 2023-11-26 12:58:23 +08:00 committed by Carles Cufí
parent fcee384aad
commit 34d2c4d6b2

View file

@ -3,8 +3,9 @@
zephyr_include_directories(.)
zephyr_sources(
idle.c
soc_irq.S
soc_common_irq.c
vector.S
)
zephyr_sources_ifdef(CONFIG_RISCV_HAS_CPU_IDLE idle.c)