You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/05/01 16:12:09 UTC

[incubator-nuttx] 02/02: risc-v/k210: Fix SMP interrupt stack size calculation

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch releases/10.1
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 3130ff691e386934eb276587a24d1efacf3bb30b
Author: Alin Jerpelea <al...@sony.com>
AuthorDate: Sat May 1 14:44:54 2021 +0200

    risc-v/k210: Fix SMP interrupt stack size calculation
    
    manual cherry-pick from #3636
    
    Signed-off-by: Alin Jerpelea <al...@sony.com>
---
 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 84767d8..1bf9f05 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