RISC-V: Add setintstack for k210 and qemu

This fixes CI issue, and I think the old implementation with SMP
shared 1 IRQ stack for multiple CPUs.
This commit is contained in:
Ville Juven 2022-04-08 08:59:34 +03:00 committed by Xiang Xiao
parent b0a71ce3e7
commit 2670f143b5
2 changed files with 57 additions and 1 deletions

View File

@ -29,4 +29,32 @@
#include "k210_memorymap.h"
#include "riscv_internal.h"
/****************************************************************************
* Macro Definitions
****************************************************************************/
#ifdef __ASSEMBLY__
/****************************************************************************
* Name: setintstack
*
* Description:
* Set the current stack pointer to the "top" the correct interrupt stack
* for the current CPU.
*
****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15
.macro setintstack tmp0, tmp1
csrr \tmp0, mhartid
li \tmp1, STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK)
mul \tmp1, \tmp0, \tmp1
la \tmp0, g_intstacktop
sub sp, \tmp0, \tmp1
.endm
#endif /* CONFIG_SMP && CONFIG_ARCH_INTERRUPTSTACK > 15 */
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_RISCV_SRC_K210_CHIP_H */

View File

@ -38,7 +38,7 @@
extern void up_earlyserialinit(void);
extern void up_serialinit(void);
#endif
#endif /* __ASSEMBLY__ */
#include "qemu_rv_memorymap.h"
@ -46,4 +46,32 @@ extern void up_serialinit(void);
#include "hardware/qemu_rv_memorymap.h"
#include "hardware/qemu_rv_plic.h"
#include "riscv_internal.h"
/****************************************************************************
* Macro Definitions
****************************************************************************/
#ifdef __ASSEMBLY__
/****************************************************************************
* Name: setintstack
*
* Description:
* Set the current stack pointer to the "top" the correct interrupt stack
* for the current CPU.
*
****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15
.macro setintstack tmp0, tmp1
csrr \tmp0, mhartid
li \tmp1, STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK)
mul \tmp1, \tmp0, \tmp1
la \tmp0, g_intstacktop
sub sp, \tmp0, \tmp1
.endm
#endif /* CONFIG_SMP && CONFIG_ARCH_INTERRUPTSTACK > 15 */
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_RISCV_SRC_QEMU_RV_CHIP_H */