smp: Implement empty macro for obtaining logical CPU index

This implements empty hooks to the arch/chip layer, which can implement
an optional translation between logical<->physical CPU/core id.

The default mapping is 1:1 i.e. logical=physical.
This commit is contained in:
Ville Juven 2024-10-15 14:01:35 +03:00 committed by Xiang Xiao
parent f47c0a1953
commit 2195b47655
3 changed files with 19 additions and 1 deletions

View file

@ -417,6 +417,11 @@ config ARCH_HAVE_MULTICPU
bool
default n
config ARCH_HAVE_CPUID_MAPPING
bool
default n
depends on ARCH_HAVE_MULTICPU
config ARCH_HAVE_FORK
bool
default n

View file

@ -111,6 +111,19 @@
# define up_cpu_index() 0
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
/****************************************************************************
* Name: up_this_cpu
*
* Description:
* Return the logical core number. Default implementation is 1:1 mapping,
* i.e. physical=logical.
*
****************************************************************************/
#ifndef CONFIG_ARCH_HAVE_CPUID_MAPPING
# define up_this_cpu() up_cpu_index()
#endif
/****************************************************************************
* Public Types
****************************************************************************/

View file

@ -237,7 +237,7 @@
*/
#ifdef CONFIG_SMP
# define this_cpu() up_cpu_index()
# define this_cpu() up_this_cpu()
#else
# define this_cpu() (0)
#endif