arch: support customized up_cpu_index() in AMP mode
Some app with same code runs on different cores in AMP mode, need the physical core on which the function is called. Signed-off-by: hujun5 <hujun5@xiaomi.com> Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
This commit is contained in:
parent
092bdec20b
commit
e249dd2672
56 changed files with 266 additions and 504 deletions
|
@ -231,34 +231,32 @@ static inline irqstate_t up_irq_enable(void)
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
int up_cpu_index(void) noinstrument_function;
|
int up_cpu_index(void) noinstrument_function;
|
||||||
#else
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
# define up_cpu_index() 0
|
|
||||||
#endif /* CONFIG_SMP */
|
|
||||||
|
|
||||||
noinstrument_function
|
noinstrument_function
|
||||||
static inline_function uint32_t *up_current_regs(void)
|
static inline_function uint32_t *up_current_regs(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
return (uint32_t *)g_current_regs[up_cpu_index()];
|
return (uint32_t *)g_current_regs[up_cpu_index()];
|
||||||
|
#else
|
||||||
|
return (uint32_t *)g_current_regs[0];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
noinstrument_function
|
noinstrument_function
|
||||||
static inline_function void up_set_current_regs(uint32_t *regs)
|
static inline_function void up_set_current_regs(uint32_t *regs)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
g_current_regs[up_cpu_index()] = regs;
|
g_current_regs[up_cpu_index()] = regs;
|
||||||
|
#else
|
||||||
|
g_current_regs[0] = regs;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
noinstrument_function
|
noinstrument_function
|
||||||
|
|
|
@ -342,23 +342,13 @@ static inline void setcontrol(uint32_t control)
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
int up_cpu_index(void) noinstrument_function;
|
int up_cpu_index(void) noinstrument_function;
|
||||||
#else
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
# define up_cpu_index() 0
|
|
||||||
#endif /* CONFIG_SMP */
|
|
||||||
|
|
||||||
static inline_function uint32_t up_getsp(void)
|
static inline_function uint32_t up_getsp(void)
|
||||||
{
|
{
|
||||||
|
@ -376,13 +366,21 @@ static inline_function uint32_t up_getsp(void)
|
||||||
noinstrument_function
|
noinstrument_function
|
||||||
static inline_function uint32_t *up_current_regs(void)
|
static inline_function uint32_t *up_current_regs(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
return (uint32_t *)g_current_regs[up_cpu_index()];
|
return (uint32_t *)g_current_regs[up_cpu_index()];
|
||||||
|
#else
|
||||||
|
return (uint32_t *)g_current_regs[0];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
noinstrument_function
|
noinstrument_function
|
||||||
static inline_function void up_set_current_regs(uint32_t *regs)
|
static inline_function void up_set_current_regs(uint32_t *regs)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
g_current_regs[up_cpu_index()] = regs;
|
g_current_regs[up_cpu_index()] = regs;
|
||||||
|
#else
|
||||||
|
g_current_regs[0] = regs;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
noinstrument_function
|
noinstrument_function
|
||||||
|
|
|
@ -433,19 +433,11 @@ noinstrument_function static inline void up_irq_restore(irqstate_t flags)
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
noinstrument_function
|
noinstrument_function
|
||||||
static inline_function int up_cpu_index(void)
|
static inline_function int up_cpu_index(void)
|
||||||
{
|
{
|
||||||
|
@ -459,9 +451,7 @@ static inline_function int up_cpu_index(void)
|
||||||
|
|
||||||
return (mpidr & MPIDR_CPUID_MASK) >> MPIDR_CPUID_SHIFT;
|
return (mpidr & MPIDR_CPUID_MASK) >> MPIDR_CPUID_SHIFT;
|
||||||
}
|
}
|
||||||
#else
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
# define up_cpu_index() 0
|
|
||||||
#endif /* CONFIG_SMP */
|
|
||||||
|
|
||||||
static inline_function uint32_t up_getsp(void)
|
static inline_function uint32_t up_getsp(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -547,23 +547,13 @@ static inline void setcontrol(uint32_t control)
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
int up_cpu_index(void) noinstrument_function;
|
int up_cpu_index(void) noinstrument_function;
|
||||||
#else
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
# define up_cpu_index() 0
|
|
||||||
#endif /* CONFIG_SMP */
|
|
||||||
|
|
||||||
static inline_function uint32_t up_getsp(void)
|
static inline_function uint32_t up_getsp(void)
|
||||||
{
|
{
|
||||||
|
@ -581,13 +571,21 @@ static inline_function uint32_t up_getsp(void)
|
||||||
noinstrument_function
|
noinstrument_function
|
||||||
static inline_function uint32_t *up_current_regs(void)
|
static inline_function uint32_t *up_current_regs(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
return (uint32_t *)g_current_regs[up_cpu_index()];
|
return (uint32_t *)g_current_regs[up_cpu_index()];
|
||||||
|
#else
|
||||||
|
return (uint32_t *)g_current_regs[0];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
noinstrument_function
|
noinstrument_function
|
||||||
static inline_function void up_set_current_regs(uint32_t *regs)
|
static inline_function void up_set_current_regs(uint32_t *regs)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
g_current_regs[up_cpu_index()] = regs;
|
g_current_regs[up_cpu_index()] = regs;
|
||||||
|
#else
|
||||||
|
g_current_regs[0] = regs;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
noinstrument_function
|
noinstrument_function
|
||||||
|
|
|
@ -428,19 +428,11 @@ noinstrument_function static inline void up_irq_restore(irqstate_t flags)
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
noinstrument_function
|
noinstrument_function
|
||||||
static inline_function int up_cpu_index(void)
|
static inline_function int up_cpu_index(void)
|
||||||
{
|
{
|
||||||
|
@ -454,9 +446,7 @@ static inline_function int up_cpu_index(void)
|
||||||
|
|
||||||
return (mpidr & MPIDR_CPUID_MASK) >> MPIDR_CPUID_SHIFT;
|
return (mpidr & MPIDR_CPUID_MASK) >> MPIDR_CPUID_SHIFT;
|
||||||
}
|
}
|
||||||
#else
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
# define up_cpu_index() 0
|
|
||||||
#endif /* CONFIG_SMP */
|
|
||||||
|
|
||||||
static inline_function uint32_t up_getsp(void)
|
static inline_function uint32_t up_getsp(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -520,23 +520,13 @@ static inline void setcontrol(uint32_t control)
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
int up_cpu_index(void) noinstrument_function;
|
int up_cpu_index(void) noinstrument_function;
|
||||||
#else
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
# define up_cpu_index() 0
|
|
||||||
#endif /* CONFIG_SMP */
|
|
||||||
|
|
||||||
static inline_function uint32_t up_getsp(void)
|
static inline_function uint32_t up_getsp(void)
|
||||||
{
|
{
|
||||||
|
@ -554,13 +544,21 @@ static inline_function uint32_t up_getsp(void)
|
||||||
noinstrument_function
|
noinstrument_function
|
||||||
static inline_function uint32_t *up_current_regs(void)
|
static inline_function uint32_t *up_current_regs(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
return (uint32_t *)g_current_regs[up_cpu_index()];
|
return (uint32_t *)g_current_regs[up_cpu_index()];
|
||||||
|
#else
|
||||||
|
return (uint32_t *)g_current_regs[0];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
noinstrument_function
|
noinstrument_function
|
||||||
static inline_function void up_set_current_regs(uint32_t *regs)
|
static inline_function void up_set_current_regs(uint32_t *regs)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
g_current_regs[up_cpu_index()] = regs;
|
g_current_regs[up_cpu_index()] = regs;
|
||||||
|
#else
|
||||||
|
g_current_regs[0] = regs;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
noinstrument_function
|
noinstrument_function
|
||||||
|
|
|
@ -428,19 +428,11 @@ noinstrument_function static inline void up_irq_restore(irqstate_t flags)
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
noinstrument_function
|
noinstrument_function
|
||||||
static inline_function int up_cpu_index(void)
|
static inline_function int up_cpu_index(void)
|
||||||
{
|
{
|
||||||
|
@ -454,9 +446,7 @@ static inline_function int up_cpu_index(void)
|
||||||
|
|
||||||
return (mpidr & MPIDR_CPUID_MASK) >> MPIDR_CPUID_SHIFT;
|
return (mpidr & MPIDR_CPUID_MASK) >> MPIDR_CPUID_SHIFT;
|
||||||
}
|
}
|
||||||
#else
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
# define up_cpu_index() 0
|
|
||||||
#endif /* CONFIG_SMP */
|
|
||||||
|
|
||||||
static inline_function uint32_t up_getsp(void)
|
static inline_function uint32_t up_getsp(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -247,23 +247,13 @@ static inline uint32_t getcontrol(void)
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
int up_cpu_index(void) noinstrument_function;
|
int up_cpu_index(void) noinstrument_function;
|
||||||
#else
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
# define up_cpu_index() 0
|
|
||||||
#endif /* CONFIG_SMP */
|
|
||||||
|
|
||||||
static inline_function uint32_t up_getsp(void)
|
static inline_function uint32_t up_getsp(void)
|
||||||
{
|
{
|
||||||
|
@ -281,13 +271,21 @@ static inline_function uint32_t up_getsp(void)
|
||||||
noinstrument_function
|
noinstrument_function
|
||||||
static inline_function uint32_t *up_current_regs(void)
|
static inline_function uint32_t *up_current_regs(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
return (uint32_t *)g_current_regs[up_cpu_index()];
|
return (uint32_t *)g_current_regs[up_cpu_index()];
|
||||||
|
#else
|
||||||
|
return (uint32_t *)g_current_regs[0];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
noinstrument_function
|
noinstrument_function
|
||||||
static inline_function void up_set_current_regs(uint32_t *regs)
|
static inline_function void up_set_current_regs(uint32_t *regs)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
g_current_regs[up_cpu_index()] = regs;
|
g_current_regs[up_cpu_index()] = regs;
|
||||||
|
#else
|
||||||
|
g_current_regs[0] = regs;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
noinstrument_function
|
noinstrument_function
|
||||||
|
|
|
@ -73,7 +73,7 @@ static void arm_gic_init_done(void)
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
flags = spin_lock_irqsave(NULL);
|
flags = spin_lock_irqsave(NULL);
|
||||||
CPU_SET(up_cpu_index(), &g_gic_init_done);
|
CPU_SET(this_cpu(), &g_gic_init_done);
|
||||||
spin_unlock_irqrestore(NULL, flags);
|
spin_unlock_irqrestore(NULL, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -244,7 +244,7 @@ void arm_gic_irq_enable(unsigned int intid)
|
||||||
|
|
||||||
if (GIC_IS_SPI(intid))
|
if (GIC_IS_SPI(intid))
|
||||||
{
|
{
|
||||||
arm_gic_write_irouter(up_cpu_index(), intid);
|
arm_gic_write_irouter(this_cpu(), intid);
|
||||||
}
|
}
|
||||||
|
|
||||||
putreg32(mask, ISENABLER(GET_DIST_BASE(intid), idx));
|
putreg32(mask, ISENABLER(GET_DIST_BASE(intid), idx));
|
||||||
|
@ -797,8 +797,7 @@ static void arm_gic_init(void)
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
cpu = this_cpu();
|
cpu = this_cpu();
|
||||||
g_gic_rdists[cpu] = CONFIG_GICR_BASE +
|
g_gic_rdists[cpu] = CONFIG_GICR_BASE + cpu * CONFIG_GICR_OFFSET;
|
||||||
up_cpu_index() * CONFIG_GICR_OFFSET;
|
|
||||||
|
|
||||||
err = gic_validate_redist_version();
|
err = gic_validate_redist_version();
|
||||||
if (err)
|
if (err)
|
||||||
|
|
|
@ -41,7 +41,6 @@ set(SRCS
|
||||||
|
|
||||||
if(CONFIG_SMP)
|
if(CONFIG_SMP)
|
||||||
list(APPEND SRCS cxd56_cpuidlestack.c)
|
list(APPEND SRCS cxd56_cpuidlestack.c)
|
||||||
list(APPEND SRCS cxd56_cpuindex.c)
|
|
||||||
list(APPEND SRCS cxd56_smpcall.c)
|
list(APPEND SRCS cxd56_smpcall.c)
|
||||||
list(APPEND SRCS cxd56_cpustart.c)
|
list(APPEND SRCS cxd56_cpustart.c)
|
||||||
if(CONFIG_CXD56_TESTSET)
|
if(CONFIG_CXD56_TESTSET)
|
||||||
|
@ -49,6 +48,10 @@ if(CONFIG_SMP)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_ARCH_HAVE_MULTICPU)
|
||||||
|
list(APPEND SRCS cxd56_cpuindex.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CONFIG_ARCH_USE_TEXT_HEAP)
|
if(CONFIG_ARCH_USE_TEXT_HEAP)
|
||||||
list(APPEND SRCS cxd56_textheap.c)
|
list(APPEND SRCS cxd56_textheap.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -40,7 +40,6 @@ CHIP_CSRCS += cxd56_sysctl.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_SMP), y)
|
ifeq ($(CONFIG_SMP), y)
|
||||||
CHIP_CSRCS += cxd56_cpuidlestack.c
|
CHIP_CSRCS += cxd56_cpuidlestack.c
|
||||||
CHIP_CSRCS += cxd56_cpuindex.c
|
|
||||||
CHIP_CSRCS += cxd56_smpcall.c
|
CHIP_CSRCS += cxd56_smpcall.c
|
||||||
CHIP_CSRCS += cxd56_cpustart.c
|
CHIP_CSRCS += cxd56_cpustart.c
|
||||||
ifeq ($(CONFIG_CXD56_TESTSET),y)
|
ifeq ($(CONFIG_CXD56_TESTSET),y)
|
||||||
|
@ -49,6 +48,10 @@ CMN_ASRCS := $(filter-out arm_testset.S,$(CMN_ASRCS))
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_HAVE_MULTICPU), y)
|
||||||
|
CHIP_CSRCS += cxd56_cpuindex.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_USE_TEXT_HEAP), y)
|
ifeq ($(CONFIG_ARCH_USE_TEXT_HEAP), y)
|
||||||
CHIP_CSRCS += cxd56_textheap.c
|
CHIP_CSRCS += cxd56_textheap.c
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include "arm_internal.h"
|
#include "arm_internal.h"
|
||||||
#include "cxd56_cpuindex.h"
|
#include "cxd56_cpuindex.h"
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
|
@ -39,15 +39,7 @@
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -58,4 +50,4 @@ int up_cpu_index(void)
|
||||||
return getreg32(CXD56_ADSP_PID) - 2;
|
return getreg32(CXD56_ADSP_PID) - 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_SMP */
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
|
|
|
@ -91,13 +91,16 @@ endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_SMP), y)
|
ifeq ($(CONFIG_SMP), y)
|
||||||
CHIP_CSRCS += lc823450_cpuidlestack.c
|
CHIP_CSRCS += lc823450_cpuidlestack.c
|
||||||
CHIP_CSRCS += lc823450_cpuindex.c
|
|
||||||
CHIP_CSRCS += lc823450_smpcall.c
|
CHIP_CSRCS += lc823450_smpcall.c
|
||||||
CHIP_CSRCS += lc823450_cpustart.c
|
CHIP_CSRCS += lc823450_cpustart.c
|
||||||
CHIP_CSRCS += lc823450_testset.c
|
CHIP_CSRCS += lc823450_testset.c
|
||||||
CMN_ASRCS := $(filter-out arm_testset.S,$(CMN_ASRCS))
|
CMN_ASRCS := $(filter-out arm_testset.S,$(CMN_ASRCS))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_HAVE_MULTICPU), y)
|
||||||
|
CHIP_CSRCS += lc823450_cpuindex.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_LC823450_SDRAM), y)
|
ifeq ($(CONFIG_LC823450_SDRAM), y)
|
||||||
CHIP_CSRCS += lc823450_sdram.c
|
CHIP_CSRCS += lc823450_sdram.c
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -44,15 +44,7 @@
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@ CHIP_CSRCS += rp2040_xosc.c
|
||||||
CHIP_CSRCS += rp2040_pll.c
|
CHIP_CSRCS += rp2040_pll.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_SMP),y)
|
ifeq ($(CONFIG_SMP),y)
|
||||||
CHIP_CSRCS += rp2040_cpuindex.c
|
|
||||||
CHIP_CSRCS += rp2040_cpustart.c
|
CHIP_CSRCS += rp2040_cpustart.c
|
||||||
CHIP_CSRCS += rp2040_smpcall.c
|
CHIP_CSRCS += rp2040_smpcall.c
|
||||||
CHIP_CSRCS += rp2040_cpuidlestack.c
|
CHIP_CSRCS += rp2040_cpuidlestack.c
|
||||||
|
@ -43,6 +42,10 @@ CHIP_CSRCS += rp2040_testset.c
|
||||||
CMN_ASRCS := $(filter-out arm_testset.S,$(CMN_ASRCS))
|
CMN_ASRCS := $(filter-out arm_testset.S,$(CMN_ASRCS))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_HAVE_MULTICPU),y)
|
||||||
|
CHIP_CSRCS += rp2040_cpuindex.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_RP2040_DMAC),y)
|
ifeq ($(CONFIG_RP2040_DMAC),y)
|
||||||
CHIP_CSRCS += rp2040_dmac.c
|
CHIP_CSRCS += rp2040_dmac.c
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include "arm_internal.h"
|
#include "arm_internal.h"
|
||||||
#include "hardware/rp2040_sio.h"
|
#include "hardware/rp2040_sio.h"
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
|
@ -39,15 +39,7 @@
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -56,4 +48,4 @@ int up_cpu_index(void)
|
||||||
return getreg32(RP2040_SIO_CPUID);
|
return getreg32(RP2040_SIO_CPUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_SMP */
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
|
|
|
@ -137,11 +137,15 @@ endif # CONFIG_SCHED_TICKLESS
|
||||||
endif # CONFIG_SAM34_TC
|
endif # CONFIG_SAM34_TC
|
||||||
|
|
||||||
ifeq ($(CONFIG_SMP),y)
|
ifeq ($(CONFIG_SMP),y)
|
||||||
CHIP_CSRCS += sam4cm_cpuindex.c sam4cm_cpuidlestack.c
|
CHIP_CSRCS += sam4cm_cpuidlestack.c
|
||||||
CHIP_CSRCS += sam4cm_smpcall.c sam4cm_cpustart.c
|
CHIP_CSRCS += sam4cm_smpcall.c sam4cm_cpustart.c
|
||||||
ifneq ($(CONFIG_ARCH_IDLE_CUSTOM),y)
|
ifneq ($(CONFIG_ARCH_IDLE_CUSTOM),y)
|
||||||
CHIP_CSRCS += sam4cm_idle.c
|
CHIP_CSRCS += sam4cm_idle.c
|
||||||
endif
|
endif
|
||||||
endif # CONFIG_SMP
|
endif # CONFIG_SMP
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_HAVE_MULTICPU),y)
|
||||||
|
CHIP_CSRCS += sam4cm_cpuindex.c
|
||||||
|
endif # CONFIG_ARCH_HAVE_MULTICPU
|
||||||
|
|
||||||
endif # CONFIG_ARCH_CHIP_SAM4CM
|
endif # CONFIG_ARCH_CHIP_SAM4CM
|
||||||
|
|
|
@ -27,8 +27,9 @@
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
|
|
||||||
#include "mpu.h"
|
#include "mpu.h"
|
||||||
|
#include "arm_internal.h"
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
|
@ -38,15 +39,7 @@
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -57,4 +50,4 @@ int up_cpu_index(void)
|
||||||
return (getreg32(MPU_TYPE) == 0) ? 1 : 0;
|
return (getreg32(MPU_TYPE) == 0) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_SMP */
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
|
|
|
@ -368,23 +368,13 @@ static inline void up_irq_restore(irqstate_t flags)
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
# define up_cpu_index() ((int)MPID_TO_CORE(GET_MPIDR()))
|
# define up_cpu_index() ((int)MPID_TO_CORE(GET_MPIDR()))
|
||||||
#else
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
# define up_cpu_index() (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name:
|
* Name:
|
||||||
|
|
|
@ -931,8 +931,7 @@ static void arm64_gic_init(void)
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
cpu = this_cpu();
|
cpu = this_cpu();
|
||||||
g_gic_rdists[cpu] = CONFIG_GICR_BASE +
|
g_gic_rdists[cpu] = CONFIG_GICR_BASE + cpu * CONFIG_GICR_OFFSET;
|
||||||
up_cpu_index() * CONFIG_GICR_OFFSET;
|
|
||||||
|
|
||||||
err = gic_validate_redist_version();
|
err = gic_validate_redist_version();
|
||||||
if (err)
|
if (err)
|
||||||
|
|
|
@ -101,7 +101,7 @@ void arm64_el_init(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
|
@ -111,19 +111,7 @@ void arm64_el_init(void)
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* If TLS is enabled, then the RTOS can get this information from the TLS
|
|
||||||
* info structure. Otherwise, the MCU-specific logic must provide some
|
|
||||||
* mechanism to provide the CPU index.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -165,7 +153,7 @@ int arm64_get_cpuid(uint64_t mpid)
|
||||||
return MPID_TO_CORE(mpid, 0);
|
return MPID_TO_CORE(mpid, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_SMP */
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: arm64_chip_boot
|
* Name: arm64_chip_boot
|
||||||
|
|
|
@ -87,24 +87,6 @@ EXTERN volatile uint8_t *g_current_regs;
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: up_cpu_index
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#define up_cpu_index() (0)
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Inline functions
|
* Inline functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
|
@ -113,23 +113,13 @@ EXTERN uint32_t *volatile g_current_regs[CONFIG_SMP_NCPUS];
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
int up_cpu_index(void);
|
int up_cpu_index(void) noinstrument_function;
|
||||||
#else
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
# define up_cpu_index() (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Inline functions
|
* Inline functions
|
||||||
|
@ -137,12 +127,20 @@ int up_cpu_index(void);
|
||||||
|
|
||||||
static inline_function uint32_t *up_current_regs(void)
|
static inline_function uint32_t *up_current_regs(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
return (uint32_t *)g_current_regs[up_cpu_index()];
|
return (uint32_t *)g_current_regs[up_cpu_index()];
|
||||||
|
#else
|
||||||
|
return (uint32_t *)g_current_regs[0];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline_function void up_set_current_regs(uint32_t *regs)
|
static inline_function void up_set_current_regs(uint32_t *regs)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
g_current_regs[up_cpu_index()] = regs;
|
g_current_regs[up_cpu_index()] = regs;
|
||||||
|
#else
|
||||||
|
g_current_regs[0] = regs;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|
|
@ -100,24 +100,6 @@ EXTERN volatile uint8_t *g_current_regs;
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: up_cpu_index
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#define up_cpu_index() (0)
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Inline functions
|
* Inline functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
|
@ -104,24 +104,6 @@ EXTERN volatile uint32_t *g_current_regs;
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: up_cpu_index
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#define up_cpu_index() (0)
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Inline functions
|
* Inline functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
|
@ -86,24 +86,6 @@ EXTERN volatile uint32_t *g_current_regs;
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: up_cpu_index
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#define up_cpu_index() (0)
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Inline functions
|
* Inline functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
|
@ -94,23 +94,13 @@ EXTERN volatile uint32_t *g_current_regs[CONFIG_SMP_NCPUS];
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
int up_cpu_index(void);
|
int up_cpu_index(void) noinstrument_function;
|
||||||
#else
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
# define up_cpu_index() (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Inline functions
|
* Inline functions
|
||||||
|
@ -118,12 +108,20 @@ int up_cpu_index(void);
|
||||||
|
|
||||||
static inline_function uint32_t *up_current_regs(void)
|
static inline_function uint32_t *up_current_regs(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
return (uint32_t *)g_current_regs[up_cpu_index()];
|
return (uint32_t *)g_current_regs[up_cpu_index()];
|
||||||
|
#else
|
||||||
|
return (uint32_t *)g_current_regs[0];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline_function void up_set_current_regs(uint32_t *regs)
|
static inline_function void up_set_current_regs(uint32_t *regs)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
g_current_regs[up_cpu_index()] = regs;
|
g_current_regs[up_cpu_index()] = regs;
|
||||||
|
#else
|
||||||
|
g_current_regs[0] = regs;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|
|
@ -69,24 +69,6 @@ EXTERN volatile uint32_t *g_current_regs;
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: up_cpu_index
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#define up_cpu_index() (0)
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Inline functions
|
* Inline functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
|
@ -701,23 +701,13 @@ irqstate_t up_irq_enable(void);
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
int up_cpu_index(void);
|
int up_cpu_index(void) noinstrument_function;
|
||||||
#else
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
# define up_cpu_index() (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Inline Functions
|
* Inline Functions
|
||||||
|
@ -725,12 +715,20 @@ int up_cpu_index(void);
|
||||||
|
|
||||||
static inline_function uintreg_t *up_current_regs(void)
|
static inline_function uintreg_t *up_current_regs(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
return (uintreg_t *)g_current_regs[up_cpu_index()];
|
return (uintreg_t *)g_current_regs[up_cpu_index()];
|
||||||
|
#else
|
||||||
|
return (uintreg_t *)g_current_regs[0];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline_function void up_set_current_regs(uintreg_t *regs)
|
static inline_function void up_set_current_regs(uintreg_t *regs)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
g_current_regs[up_cpu_index()] = regs;
|
g_current_regs[up_cpu_index()] = regs;
|
||||||
|
#else
|
||||||
|
g_current_regs[0] = regs;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|
|
@ -44,7 +44,11 @@ if(NOT CONFIG_ALARM_ARCH)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CONFIG_SMP)
|
if(CONFIG_SMP)
|
||||||
list(APPEND SRCS riscv_cpuindex.c riscv_smpcall.c riscv_cpustart.c)
|
list(APPEND SRCS riscv_smpcall.c riscv_cpustart.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_ARCH_HAVE_MULTICPU)
|
||||||
|
list(APPEND SRCS riscv_cpuindex.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CONFIG_RISCV_MISALIGNED_HANDLER)
|
if(CONFIG_RISCV_MISALIGNED_HANDLER)
|
||||||
|
|
|
@ -47,7 +47,11 @@ ifneq ($(CONFIG_ALARM_ARCH),y)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_SMP),y)
|
ifeq ($(CONFIG_SMP),y)
|
||||||
CMN_CSRCS += riscv_cpuindex.c riscv_smpcall.c riscv_cpustart.c
|
CMN_CSRCS += riscv_smpcall.c riscv_cpustart.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_HAVE_MULTICPU),y)
|
||||||
|
CMN_CSRCS += riscv_cpuindex.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_RISCV_MISALIGNED_HANDLER),y)
|
ifeq ($(CONFIG_RISCV_MISALIGNED_HANDLER),y)
|
||||||
|
|
|
@ -39,15 +39,7 @@
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -86,23 +86,13 @@ EXTERN volatile xcpt_reg_t *g_current_regs[CONFIG_SMP_NCPUS];
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
int up_cpu_index(void);
|
int up_cpu_index(void) noinstrument_function;
|
||||||
#else
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
# define up_cpu_index() (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Name: up_irq_save, up_irq_restore, and friends.
|
/* Name: up_irq_save, up_irq_restore, and friends.
|
||||||
*
|
*
|
||||||
|
@ -124,12 +114,20 @@ void up_irq_enable(void);
|
||||||
|
|
||||||
static inline_function xcpt_reg_t *up_current_regs(void)
|
static inline_function xcpt_reg_t *up_current_regs(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
return (xcpt_reg_t *)g_current_regs[up_cpu_index()];
|
return (xcpt_reg_t *)g_current_regs[up_cpu_index()];
|
||||||
|
#else
|
||||||
|
return (xcpt_reg_t *)g_current_regs[0];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline_function void up_set_current_regs(xcpt_reg_t *regs)
|
static inline_function void up_set_current_regs(xcpt_reg_t *regs)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
g_current_regs[up_cpu_index()] = regs;
|
g_current_regs[up_cpu_index()] = regs;
|
||||||
|
#else
|
||||||
|
g_current_regs[0] = regs;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the current value of the stack pointer */
|
/* Return the current value of the stack pointer */
|
||||||
|
|
|
@ -154,6 +154,9 @@ endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_SMP),y)
|
ifeq ($(CONFIG_SMP),y)
|
||||||
CSRCS += sim_smpsignal.c sim_cpuidlestack.c
|
CSRCS += sim_smpsignal.c sim_cpuidlestack.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_HAVE_MULTICPU),y)
|
||||||
HOSTSRCS += sim_hostsmp.c
|
HOSTSRCS += sim_hostsmp.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -174,6 +174,9 @@ endif()
|
||||||
|
|
||||||
if(CONFIG_SMP)
|
if(CONFIG_SMP)
|
||||||
list(APPEND SRCS sim_smpsignal.c sim_cpuidlestack.c)
|
list(APPEND SRCS sim_smpsignal.c sim_cpuidlestack.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_ARCH_HAVE_MULTICPU)
|
||||||
list(APPEND HOSTSRCS sim_hostsmp.c)
|
list(APPEND HOSTSRCS sim_hostsmp.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,8 @@ struct sim_cpuinfo_s
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static pthread_key_t g_cpu_key;
|
static pthread_key_t g_cpu_key;
|
||||||
|
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
static pthread_t g_cpu_thread[CONFIG_SMP_NCPUS];
|
static pthread_t g_cpu_thread[CONFIG_SMP_NCPUS];
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -163,28 +165,6 @@ void host_cpu0_start(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: up_cpu_index
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
int up_cpu_index(void)
|
|
||||||
{
|
|
||||||
void *value = pthread_getspecific(g_cpu_key);
|
|
||||||
return (int)((uintptr_t)value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_cpu_start
|
* Name: up_cpu_start
|
||||||
*
|
*
|
||||||
|
@ -266,8 +246,6 @@ void host_send_ipi(int cpu)
|
||||||
pthread_kill(g_cpu_thread[cpu], SIGUSR1);
|
pthread_kill(g_cpu_thread[cpu], SIGUSR1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: host_send_func_call_ipi(int cpu)
|
* Name: host_send_func_call_ipi(int cpu)
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -277,3 +255,19 @@ void host_send_func_call_ipi(int cpu)
|
||||||
pthread_kill(g_cpu_thread[cpu], SIGUSR2);
|
pthread_kill(g_cpu_thread[cpu], SIGUSR2);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: up_cpu_index
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
|
int up_cpu_index(void)
|
||||||
|
{
|
||||||
|
void *value = pthread_getspecific(g_cpu_key);
|
||||||
|
return (int)((uintptr_t)value);
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -112,23 +112,13 @@ EXTERN volatile uint32_t *g_current_regs[CONFIG_SMP_NCPUS];
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
int up_cpu_index(void);
|
int up_cpu_index(void) noinstrument_function;
|
||||||
#else
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
# define up_cpu_index() (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Inline functions
|
* Inline functions
|
||||||
|
@ -136,12 +126,20 @@ int up_cpu_index(void);
|
||||||
|
|
||||||
static inline_function uint32_t *up_current_regs(void)
|
static inline_function uint32_t *up_current_regs(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
return (uint32_t *)g_current_regs[up_cpu_index()];
|
return (uint32_t *)g_current_regs[up_cpu_index()];
|
||||||
|
#else
|
||||||
|
return (uint32_t *)g_current_regs[0];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline_function void up_set_current_regs(uint32_t *regs)
|
static inline_function void up_set_current_regs(uint32_t *regs)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
g_current_regs[up_cpu_index()] = regs;
|
g_current_regs[up_cpu_index()] = regs;
|
||||||
|
#else
|
||||||
|
g_current_regs[0] = regs;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|
|
@ -54,5 +54,9 @@ endif
|
||||||
# Configuration-dependent files
|
# Configuration-dependent files
|
||||||
|
|
||||||
ifeq ($(CONFIG_SMP),y)
|
ifeq ($(CONFIG_SMP),y)
|
||||||
CHIP_CSRCS += s698pm_cpuindex.c s698pm_cpustart.c s698pm_smpcall.c s698pm_cpuidlestack.c
|
CHIP_CSRCS += s698pm_cpustart.c s698pm_smpcall.c s698pm_cpuidlestack.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_HAVE_MULTICPU),y)
|
||||||
|
CHIP_CSRCS += s698pm_cpuindex.c
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -39,19 +39,11 @@
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
int up_cpu_index(void)
|
int up_cpu_index(void)
|
||||||
{
|
{
|
||||||
int cpu = 0;
|
int cpu = 0;
|
||||||
|
|
|
@ -80,23 +80,13 @@ EXTERN volatile uintptr_t *g_current_regs[CONFIG_SMP_NCPUS];
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
int up_cpu_index(void) noinstrument_function;
|
int up_cpu_index(void) noinstrument_function;
|
||||||
#else
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
# define up_cpu_index() (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_irq_enable
|
* Name: up_irq_enable
|
||||||
|
@ -153,12 +143,20 @@ noinstrument_function static inline void up_irq_restore(irqstate_t flags)
|
||||||
|
|
||||||
static inline_function uintptr_t *up_current_regs(void)
|
static inline_function uintptr_t *up_current_regs(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
return (uintptr_t *)g_current_regs[up_cpu_index()];
|
return (uintptr_t *)g_current_regs[up_cpu_index()];
|
||||||
|
#else
|
||||||
|
return (uintptr_t *)g_current_regs[0];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline_function void up_set_current_regs(uintptr_t *regs)
|
static inline_function void up_set_current_regs(uintptr_t *regs)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
g_current_regs[up_cpu_index()] = regs;
|
g_current_regs[up_cpu_index()] = regs;
|
||||||
|
#else
|
||||||
|
g_current_regs[0] = regs;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|
|
@ -86,24 +86,6 @@ EXTERN volatile uint32_t *g_current_regs;
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: up_cpu_index
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#define up_cpu_index() (0)
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Inline functions
|
* Inline functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
|
@ -83,19 +83,11 @@ extern "C"
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
static inline_function int up_cpu_index(void)
|
static inline_function int up_cpu_index(void)
|
||||||
{
|
{
|
||||||
int cpu;
|
int cpu;
|
||||||
|
@ -108,9 +100,7 @@ static inline_function int up_cpu_index(void)
|
||||||
|
|
||||||
return cpu;
|
return cpu;
|
||||||
}
|
}
|
||||||
#else
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
# define up_cpu_index() (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Inline functions
|
* Inline functions
|
||||||
|
|
|
@ -405,33 +405,31 @@ irqstate_t xtensa_disable_interrupts(irqstate_t mask);
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
int up_cpu_index(void);
|
int up_cpu_index(void) noinstrument_function;
|
||||||
#else
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
# define up_cpu_index() (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
noinstrument_function static inline_function uint32_t *up_current_regs(void)
|
noinstrument_function static inline_function uint32_t *up_current_regs(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
return (uint32_t *)g_current_regs[up_cpu_index()];
|
return (uint32_t *)g_current_regs[up_cpu_index()];
|
||||||
|
#else
|
||||||
|
return (uint32_t *)g_current_regs[0];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
noinstrument_function
|
noinstrument_function
|
||||||
static inline_function void up_set_current_regs(uint32_t *regs)
|
static inline_function void up_set_current_regs(uint32_t *regs)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
g_current_regs[up_cpu_index()] = regs;
|
g_current_regs[up_cpu_index()] = regs;
|
||||||
|
#else
|
||||||
|
g_current_regs[0] = regs;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|
|
@ -189,7 +189,7 @@ IRAM_ATTR void spiflash_start(void)
|
||||||
|
|
||||||
nxmutex_lock(&s_flash_op_mutex);
|
nxmutex_lock(&s_flash_op_mutex);
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
cpu = up_cpu_index();
|
cpu = this_cpu();
|
||||||
s_sched_suspended[cpu] = true;
|
s_sched_suspended[cpu] = true;
|
||||||
|
|
||||||
#ifndef CONFIG_ARCH_CHIP_ESP32S2
|
#ifndef CONFIG_ARCH_CHIP_ESP32S2
|
||||||
|
@ -225,7 +225,7 @@ IRAM_ATTR void spiflash_end(void)
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
|
|
||||||
cpu = up_cpu_index();
|
cpu = this_cpu();
|
||||||
|
|
||||||
cache_invalidate_icache_all();
|
cache_invalidate_icache_all();
|
||||||
cache_resume_icache(s_flash_op_cache_state[cpu] >> 16);
|
cache_resume_icache(s_flash_op_cache_state[cpu] >> 16);
|
||||||
|
|
|
@ -128,10 +128,13 @@ endif
|
||||||
# Configuration-dependent ESP32 files
|
# Configuration-dependent ESP32 files
|
||||||
|
|
||||||
ifeq ($(CONFIG_SMP),y)
|
ifeq ($(CONFIG_SMP),y)
|
||||||
CHIP_ASRCS = esp32_cpuindex.S
|
|
||||||
CHIP_CSRCS += esp32_cpuidlestack.c esp32_cpustart.c esp32_intercpu_interrupt.c
|
CHIP_CSRCS += esp32_cpuidlestack.c esp32_cpustart.c esp32_intercpu_interrupt.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_HAVE_MULTICPU),y)
|
||||||
|
CHIP_ASRCS = esp32_cpuindex.S
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ESP32_UART),y)
|
ifeq ($(CONFIG_ESP32_UART),y)
|
||||||
CHIP_CSRCS += esp32_serial.c
|
CHIP_CSRCS += esp32_serial.c
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -35,19 +35,7 @@
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* If TLS is enabled, then the RTOS can get this information from the TLS
|
|
||||||
* info structure. Otherwise, the MCU-specific logic must provide some
|
|
||||||
* mechanism to provide the CPU index.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -44,10 +44,13 @@ CHIP_CSRCS += esp32s3_userspace.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_SMP),y)
|
ifeq ($(CONFIG_SMP),y)
|
||||||
CHIP_ASRCS = esp32s3_cpuindex.S
|
|
||||||
CHIP_CSRCS += esp32s3_cpuidlestack.c esp32s3_cpustart.c esp32s3_intercpu_interrupt.c
|
CHIP_CSRCS += esp32s3_cpuidlestack.c esp32s3_cpustart.c esp32s3_intercpu_interrupt.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_HAVE_MULTICPU),y)
|
||||||
|
CHIP_ASRCS = esp32s3_cpuindex.S
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ESP32S3_EFUSE),y)
|
ifeq ($(CONFIG_ESP32S3_EFUSE),y)
|
||||||
CHIP_CSRCS += esp32s3_efuse.c
|
CHIP_CSRCS += esp32s3_efuse.c
|
||||||
CHIP_CSRCS += esp32s3_efuse_table.c
|
CHIP_CSRCS += esp32s3_efuse_table.c
|
||||||
|
|
|
@ -35,19 +35,7 @@
|
||||||
* Name: up_cpu_index
|
* Name: up_cpu_index
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* If TLS is enabled, then the RTOS can get this information from the TLS
|
|
||||||
* info structure. Otherwise, the MCU-specific logic must provide some
|
|
||||||
* mechanism to provide the CPU index.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -73,24 +73,6 @@ EXTERN volatile FAR chipreg_t *g_current_regs;
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: up_cpu_index
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
||||||
* corresponds to the currently executing CPU.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#define up_cpu_index() (0)
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Inline functions
|
* Inline functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
|
@ -215,7 +215,7 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SMP)
|
#if defined(CONFIG_SMP)
|
||||||
, up_cpu_index()
|
, this_cpu()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SYSLOG_PROCESSID)
|
#if defined(CONFIG_SYSLOG_PROCESSID)
|
||||||
|
|
|
@ -99,6 +99,18 @@
|
||||||
#define DEBUGPOINT_BREAKPOINT 0x04
|
#define DEBUGPOINT_BREAKPOINT 0x04
|
||||||
#define DEBUGPOINT_STEPPOINT 0x05
|
#define DEBUGPOINT_STEPPOINT 0x05
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: up_cpu_index
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Return the real core number regardless CONFIG_SMP setting
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef CONFIG_ARCH_HAVE_MULTICPU
|
||||||
|
# define up_cpu_index() 0
|
||||||
|
#endif /* CONFIG_ARCH_HAVE_MULTICPU */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Types
|
* Public Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
|
|
||||||
#include <nuttx/compiler.h>
|
#include <nuttx/compiler.h>
|
||||||
#include <nuttx/irq.h>
|
#include <nuttx/irq.h>
|
||||||
|
#include <nuttx/arch.h>
|
||||||
|
|
||||||
#if defined(CONFIG_TICKET_SPINLOCK) || defined(CONFIG_RW_SPINLOCK)
|
#if defined(CONFIG_TICKET_SPINLOCK) || defined(CONFIG_RW_SPINLOCK)
|
||||||
# include <nuttx/atomic.h>
|
# include <nuttx/atomic.h>
|
||||||
|
@ -531,7 +532,7 @@ irqstate_t spin_lock_irqsave_wo_note(FAR volatile spinlock_t *lock)
|
||||||
|
|
||||||
if (NULL == lock)
|
if (NULL == lock)
|
||||||
{
|
{
|
||||||
int me = up_cpu_index();
|
int me = this_cpu();
|
||||||
if (0 == g_irq_spin_count[me])
|
if (0 == g_irq_spin_count[me])
|
||||||
{
|
{
|
||||||
spin_lock_wo_note(&g_irq_spin);
|
spin_lock_wo_note(&g_irq_spin);
|
||||||
|
@ -698,7 +699,7 @@ void spin_unlock_irqrestore_wo_note(FAR volatile spinlock_t *lock,
|
||||||
{
|
{
|
||||||
if (NULL == lock)
|
if (NULL == lock)
|
||||||
{
|
{
|
||||||
int me = up_cpu_index();
|
int me = this_cpu();
|
||||||
DEBUGASSERT(0 < g_irq_spin_count[me]);
|
DEBUGASSERT(0 < g_irq_spin_count[me]);
|
||||||
g_irq_spin_count[me]--;
|
g_irq_spin_count[me]--;
|
||||||
|
|
||||||
|
|
|
@ -606,7 +606,7 @@ static ssize_t tcp_recvfrom_result(int result, struct tcp_recvfrom_s *pstate)
|
||||||
#ifdef CONFIG_NETDEV_RSS
|
#ifdef CONFIG_NETDEV_RSS
|
||||||
static void tcp_notify_recvcpu(FAR struct tcp_conn_s *conn)
|
static void tcp_notify_recvcpu(FAR struct tcp_conn_s *conn)
|
||||||
{
|
{
|
||||||
int cpu = up_cpu_index();
|
int cpu = this_cpu();
|
||||||
|
|
||||||
if (cpu != conn->rcvcpu)
|
if (cpu != conn->rcvcpu)
|
||||||
{
|
{
|
||||||
|
|
|
@ -628,7 +628,7 @@ static void udp_notify_recvcpu(FAR struct udp_conn_s *conn)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu = up_cpu_index();
|
cpu = this_cpu();
|
||||||
if (cpu != conn->rcvcpu)
|
if (cpu != conn->rcvcpu)
|
||||||
{
|
{
|
||||||
if (conn->domain == PF_INET)
|
if (conn->domain == PF_INET)
|
||||||
|
|
|
@ -193,7 +193,7 @@ irqstate_t write_lock_irqsave(rwlock_t *lock)
|
||||||
|
|
||||||
if (NULL == lock)
|
if (NULL == lock)
|
||||||
{
|
{
|
||||||
int me = up_cpu_index();
|
int me = this_cpu();
|
||||||
if (0 == g_irq_rwspin_count[me])
|
if (0 == g_irq_rwspin_count[me])
|
||||||
{
|
{
|
||||||
write_lock(&g_irq_rwspin);
|
write_lock(&g_irq_rwspin);
|
||||||
|
@ -243,7 +243,7 @@ void write_unlock_irqrestore(rwlock_t *lock, irqstate_t flags)
|
||||||
{
|
{
|
||||||
if (NULL == lock)
|
if (NULL == lock)
|
||||||
{
|
{
|
||||||
int me = up_cpu_index();
|
int me = this_cpu();
|
||||||
DEBUGASSERT(0 < g_irq_rwspin_count[me]);
|
DEBUGASSERT(0 < g_irq_rwspin_count[me]);
|
||||||
g_irq_rwspin_count[me]--;
|
g_irq_rwspin_count[me]--;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue