armv7-m, cxd56xx, lc823450: Refactor interrupt stack related code

Summary:
- Remove +4/-8 offset coding
- Also, fix alignments for g_intstackalloc
- NOTE: stack pointer alignment is 8-byte

Impact:
- Affects armv7-m with interrupt stack enabled

Testing:
- Tested with spresense:wifi_smp
- Tested with lc823450:smp
- Tested with stm32f4discovery:wifi

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
Masayuki Ishikawa 2020-10-22 14:06:31 +09:00 committed by David Sidrane
parent 8547ea2c72
commit d553515758
5 changed files with 17 additions and 17 deletions

View File

@ -244,7 +244,7 @@ static void up_dumpstate(void)
* stack?
*/
if (sp <= istackbase && sp > istackbase - istacksize)
if (sp < istackbase && sp > istackbase - istacksize)
{
/* Yes.. dump the interrupt stack */

View File

@ -67,7 +67,7 @@
* no privileged task has run.
*/
# if defined(CONFIG_BUILD_PROTECTED) && CONFIG_ARCH_INTERRUPTSTACK < 4
# if defined(CONFIG_BUILD_PROTECTED) && CONFIG_ARCH_INTERRUPTSTACK < 8
# error Interrupt stack must be used with high priority interrupts in kernel mode
# endif
@ -197,7 +197,7 @@ exception_common:
* here prohibits nested interrupts without some additional logic!
*/
setintstack r2, r3
setintstack r2, r3 /* SP = IRQ stack top */
#else
/* Otherwise, we will re-use the interrupted thread's stack. That may
@ -321,7 +321,7 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
.align 8
.balign 8
g_intstackalloc:
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
g_intstackbase:

View File

@ -50,7 +50,7 @@
* nested interrupt, the interrupt stack if no privileged task has run.
*/
# if defined(CONFIG_BUILD_PROTECTED) && CONFIG_ARCH_INTERRUPTSTACK < 4
# if defined(CONFIG_BUILD_PROTECTED) && CONFIG_ARCH_INTERRUPTSTACK < 8
# error Interrupt stack must be used with high priority interrupts in kernel mode
# endif
@ -192,7 +192,7 @@ exception_common:
* here prohibits nested interrupts without some additional logic!
*/
setintstack r2, r3
setintstack r2, r3 /* SP = IRQ stack top */
#else
/* Otherwise, we will re-use the interrupted thread's stack. That may
@ -340,7 +340,7 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
.align 8
.balign 8
g_intstackalloc:
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
g_intstackbase:

View File

@ -112,17 +112,17 @@ static uint64_t g_intstack_alloc[INTSTACK_ALLOC >> 3];
const uint32_t g_cpu_intstack_top[CONFIG_SMP_NCPUS] =
{
(uint32_t)g_intstack_alloc + INTSTACK_SIZE - 8,
(uint32_t)g_intstack_alloc + INTSTACK_SIZE,
#if CONFIG_SMP_NCPUS > 1
(uint32_t)g_intstack_alloc + (2 * INTSTACK_SIZE) - 8,
(uint32_t)g_intstack_alloc + (2 * INTSTACK_SIZE),
#if CONFIG_SMP_NCPUS > 2
(uint32_t)g_intstack_alloc + (3 * INTSTACK_SIZE) - 8,
(uint32_t)g_intstack_alloc + (3 * INTSTACK_SIZE),
#if CONFIG_SMP_NCPUS > 3
(uint32_t)g_intstack_alloc + (4 * INTSTACK_SIZE) - 8,
(uint32_t)g_intstack_alloc + (4 * INTSTACK_SIZE),
#if CONFIG_SMP_NCPUS > 4
(uint32_t)g_intstack_alloc + (5 * INTSTACK_SIZE) - 8,
(uint32_t)g_intstack_alloc + (5 * INTSTACK_SIZE),
#if CONFIG_SMP_NCPUS > 5
(uint32_t)g_intstack_alloc + (6 * INTSTACK_SIZE) - 8,
(uint32_t)g_intstack_alloc + (6 * INTSTACK_SIZE),
#endif /* CONFIG_SMP_NCPUS > 5 */
#endif /* CONFIG_SMP_NCPUS > 4 */
#endif /* CONFIG_SMP_NCPUS > 3 */
@ -667,6 +667,6 @@ uintptr_t arm_intstack_base(void)
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_alloc(void)
{
return g_cpu_intstack_top[up_cpu_index()] - (INTSTACK_SIZE - 8);
return g_cpu_intstack_top[up_cpu_index()] - INTSTACK_SIZE;
}
#endif

View File

@ -95,9 +95,9 @@ uint64_t g_intstack_alloc[INTSTACK_ALLOC >> 3];
const uint32_t g_cpu_intstack_top[CONFIG_SMP_NCPUS] =
{
(uint32_t)g_intstack_alloc + INTSTACK_SIZE - 8,
(uint32_t)g_intstack_alloc + INTSTACK_SIZE,
#if CONFIG_SMP_NCPUS > 1
(uint32_t)g_intstack_alloc + (2 * INTSTACK_SIZE) - 8,
(uint32_t)g_intstack_alloc + (2 * INTSTACK_SIZE),
#endif /* CONFIG_SMP_NCPUS > 1 */
};
#endif
@ -888,6 +888,6 @@ uintptr_t arm_intstack_base(void)
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_alloc(void)
{
return g_cpu_intstack_top[up_cpu_index()] - (INTSTACK_SIZE - 8);
return g_cpu_intstack_top[up_cpu_index()] - INTSTACK_SIZE;
}
#endif