soc: Add ability for SOC to specify runtime CPU detection

Add Kconfig SOC_HAS_RUNTIME_NUM_CPUS symbol that an SoC can
set to specify that it supports determining the number of CPUs
at runtime.

On xtensa add support for SOC_HAS_RUNTIME_NUM_CPUS and expose
soc_num_cpus that the SoC code should set early in boot as the
means to expose the number of cpus.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
This commit is contained in:
Kumar Gala 2022-10-27 08:37:15 -05:00 committed by Anas Nashif
commit 6bdd91e9b1
2 changed files with 14 additions and 0 deletions

View file

@ -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 */

View file

@ -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.