diff --git a/include/zephyr/arch/xtensa/arch_inlines.h b/include/zephyr/arch/xtensa/arch_inlines.h index 567ef1f0997..d5fcc55af47 100644 --- a/include/zephyr/arch/xtensa/arch_inlines.h +++ b/include/zephyr/arch/xtensa/arch_inlines.h @@ -50,9 +50,17 @@ static ALWAYS_INLINE uint32_t arch_proc_id(void) return prid; } +#ifdef CONFIG_SOC_HAS_RUNTIME_NUM_CPUS +extern unsigned int soc_num_cpus; +#endif + static ALWAYS_INLINE unsigned int arch_num_cpus(void) { +#ifdef CONFIG_SOC_HAS_RUNTIME_NUM_CPUS + return soc_num_cpus; +#else return CONFIG_MP_MAX_NUM_CPUS; +#endif } #endif /* !_ASMLANGUAGE */ diff --git a/soc/Kconfig b/soc/Kconfig index da9febef2ce..fcb02a982a4 100644 --- a/soc/Kconfig +++ b/soc/Kconfig @@ -53,3 +53,9 @@ config SOC_HAS_TIMING_FUNCTIONS help Should be selected if SoC provides custom method for retrieving timestamps and cycle count. + +config SOC_HAS_RUNTIME_NUM_CPUS + bool + help + Should be selected if SoC handles determining the number of CPUs + at runtime.