Skip to content

Commit e6ff6b0

Browse files
Nicolas Pitrecfriedt
authored andcommitted
arm64: isr_wrapper.S: make GICv2 usable on SMP systems
GICC_IAR (GICv2) includes the source processor for SGIs in bits 12-10. Mask them away otherwise IPIs sent from any CPU other than CPU0 will be considered out of bounds. Signed-off-by: Nicolas Pitre <[email protected]>
1 parent b4eb116 commit e6ff6b0

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

arch/arm64/core/isr_wrapper.S

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ SECTION_FUNC(TEXT, _isr_wrapper)
6464
bl z_soc_irq_get_active
6565
#endif /* !CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER */
6666

67+
/* Preserve original IAR value */
68+
str x0, [sp, #-16]!
69+
70+
#if CONFIG_GIC_VER == 2 && defined(CONFIG_SMP)
71+
/* Mask out GICC_IAR.CPUID [12:10] */
72+
bic x0, x0, #0x1c00
73+
#endif
74+
6775
#if CONFIG_GIC_VER >= 3
6876
/*
6977
* Ignore Special INTIDs 1020..1023 see 2.2.1 of Arm Generic Interrupt Controller
@@ -82,8 +90,6 @@ oob:
8290
cmp x0, x1
8391
b.hi spurious_continue
8492

85-
stp x0, xzr, [sp, #-16]!
86-
8793
/* Retrieve the interrupt service routine */
8894
ldr x1, =_sw_isr_table
8995
add x1, x1, x0, lsl #4 /* table is 16-byte wide */
@@ -97,10 +103,12 @@ oob:
97103
blr x3
98104
msr daifset, #(DAIFSET_IRQ_BIT)
99105

100-
/* Signal end-of-interrupt */
101-
ldp x0, xzr, [sp], #16
102-
103106
spurious_continue:
107+
108+
/* Retrieve original IAR value */
109+
ldr x0, [sp], #16
110+
111+
/* Signal end-of-interrupt */
104112
#if !defined(CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER)
105113
bl arm_gic_eoi
106114
#else

0 commit comments

Comments
 (0)