From 3130ff691e386934eb276587a24d1efacf3bb30b Mon Sep 17 00:00:00 2001 From: Alin Jerpelea Date: Sat, 1 May 2021 14:44:54 +0200 Subject: [PATCH] risc-v/k210: Fix SMP interrupt stack size calculation manual cherry-pick from #3636 Signed-off-by: Alin Jerpelea --- arch/risc-v/src/k210/k210_irq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/risc-v/src/k210/k210_irq.c b/arch/risc-v/src/k210/k210_irq.c index 84767d8406..1bf9f05124 100644 --- a/arch/risc-v/src/k210/k210_irq.c +++ b/arch/risc-v/src/k210/k210_irq.c @@ -81,7 +81,12 @@ void up_irqinitialize(void) /* Colorize the interrupt stack for debug purposes */ #if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 15 - size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~15); + size_t intstack_size = 0; +#ifndef CONFIG_SMP + intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~15); +#else + intstack_size = ((CONFIG_ARCH_INTERRUPTSTACK * CONFIG_SMP_NCPUS) & ~15); +#endif riscv_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size), intstack_size); #endif