arch/init: call up_color_intstack before up_irq_enable

Make sure interrupt stack is colored before IRQ is enabled.

Currently, after calling irq_initialize in nx_start to
enable interrupts, there is still a period of execution
path before the interrupt stack is colored.

Signed-off-by: guoshengyuan1 <guoshengyuan1@xiaomi.com>
This commit is contained in:
guoshengyuan1
2025-10-13 10:01:49 +08:00
committed by Xiang Xiao
parent 5874f46a5b
commit 79711737bc
112 changed files with 363 additions and 293 deletions
+1
View File
@@ -151,6 +151,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
+1
View File
@@ -125,6 +125,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -127,6 +127,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -364,6 +364,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -158,6 +158,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_restore(PSR_MODE_SYS | PSR_F_BIT);
#endif
}
+25
View File
@@ -49,6 +49,31 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: arm_color_intstack
*
* Description:
* Set the interrupt stack to a value so that later we can determine how
* much stack space was used by interrupt handling logic
*
****************************************************************************/
#if defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
void arm_color_intstack(void)
{
#ifdef CONFIG_SMP
int cpu;
for (cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++)
{
arm_stack_color((void *)up_get_intstackbase(cpu), INTSTACK_SIZE);
}
#else
arm_stack_color((void *)g_intstackalloc, INTSTACK_SIZE);
#endif
}
#endif
/****************************************************************************
* Name: arm_stack_check
*
-35
View File
@@ -38,37 +38,6 @@
volatile bool g_interrupt_context[CONFIG_SMP_NCPUS];
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: arm_color_intstack
*
* Description:
* Set the interrupt stack to a value so that later we can determine how
* much stack space was used by interrupt handling logic
*
****************************************************************************/
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
static inline void arm_color_intstack(void)
{
#ifdef CONFIG_SMP
int cpu;
for (cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++)
{
arm_stack_color((void *)up_get_intstackbase(cpu), INTSTACK_SIZE);
}
#else
arm_stack_color((void *)g_intstackalloc, INTSTACK_SIZE);
#endif
}
#else
# define arm_color_intstack()
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -98,10 +67,6 @@ void up_initialize(void)
arm_initialize_stack();
#endif
/* Colorize the interrupt stack */
arm_color_intstack();
/* Add any extra memory fragments to the memory manager */
arm_addregion();
+7
View File
@@ -479,6 +479,13 @@ size_t arm_stack_check(void *stackbase, size_t nbytes);
void arm_stack_color(void *stackbase, size_t nbytes);
#endif
#if defined(CONFIG_STACK_COLORATION) &&\
defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
void arm_color_intstack(void);
#else
# define arm_color_intstack()
#endif
#ifdef CONFIG_ARCH_TRUSTZONE_SECURE
int arm_gen_nonsecurefault(int irq, uint32_t *regs);
#else
+1
View File
@@ -208,6 +208,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -317,6 +317,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -368,6 +368,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -91,6 +91,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_restore(PSR_MODE_SYS | PSR_F_BIT);
#endif
}
+1
View File
@@ -366,6 +366,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -347,6 +347,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -371,6 +371,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -124,6 +124,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -63,6 +63,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_restore(PSR_MODE_SYS | PSR_F_BIT);
#endif
}
+1
View File
@@ -149,6 +149,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -510,6 +510,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -398,6 +398,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -222,6 +222,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -525,6 +525,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -371,6 +371,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -74,6 +74,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_restore(PSR_MODE_SYS | PSR_F_BIT);
#endif
}
+1
View File
@@ -87,6 +87,7 @@ void up_irqinitialize(void)
/* Enable global ARM interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_restore(PSR_MODE_SYS | PSR_F_BIT);
#endif
}
+1
View File
@@ -87,6 +87,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_restore(PSR_MODE_SYS | PSR_F_BIT);
#endif
}
+1
View File
@@ -351,6 +351,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -356,6 +356,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
@@ -356,6 +356,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -116,6 +116,7 @@ void up_irqinitialize(void)
getreg32(0x98800020));
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_restore(PSR_MODE_SYS | PSR_F_BIT);
#endif
}
+1
View File
@@ -251,6 +251,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -416,6 +416,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -362,6 +362,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -360,6 +360,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -368,6 +368,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -214,6 +214,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -345,6 +345,7 @@ void up_irqinitialize(void)
/* svc(SVC_CALL_WR); */
arm_color_intstack();
up_irq_enable();
#endif
+1
View File
@@ -130,6 +130,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -261,6 +261,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -369,6 +369,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
}
@@ -177,6 +177,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
@@ -391,6 +391,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -396,6 +396,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -420,6 +420,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -536,6 +536,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -170,6 +170,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -505,6 +505,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable global interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -429,6 +429,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -365,6 +365,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}
+1
View File
@@ -223,6 +223,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

Some files were not shown because too many files have changed in this diff Show More