arch/arm: enable eoimode only select CONFIG_XXX_GIC_EOIMODE

On a GICv2 implementation, setting GICC_CTLR.EOImode to 1 separates
the priority drop and interrupt deactivation operations.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
This commit is contained in:
zhangyuan21 2023-03-21 11:45:21 +08:00 committed by Alin Jerpelea
parent c239d19df0
commit 024b13f3ed
6 changed files with 75 additions and 12 deletions

View File

@ -13,6 +13,17 @@ config ARMV7A_HAVE_GICv2
Selected by the configuration tool if the architecture supports the
Generic Interrupt Controller (GIC)
if ARMV7A_HAVE_GICv2
config ARMV7A_GIC_EOIMODE
bool "Enable GIC EOImode"
default n
---help---
Enable GICC_CTLR.EOImode, this will separates the priority drop and interrupt
deactivation operations.
endif # ARMV7A_HAVE_GICv2
config ARMV7A_HAVE_GTM
bool
default n

View File

@ -244,6 +244,7 @@ void arm_gic_initialize(void)
iccicr |= GIC_ICCICRS_CBPR;
#endif
#ifdef CONFIG_ARMV7A_GIC_EOIMODE
# if defined(CONFIG_ARCH_TRUSTZONE_SECURE) || defined(CONFIG_ARCH_TRUSTZONE_BOTH)
/* Set EnableS=1 to enable CPU interface to signal secure interrupts.
*
@ -268,6 +269,7 @@ void arm_gic_initialize(void)
*/
iccicr |= GIC_ICCICRU_EOIMODENS;
# endif
#endif
#ifdef CONFIG_ARCH_TRUSTZONE_BOTH
@ -370,6 +372,10 @@ uint32_t *arm_decodeirq(uint32_t *regs)
regval = getreg32(GIC_ICCIAR);
irq = (regval & GIC_ICCIAR_INTID_MASK) >> GIC_ICCIAR_INTID_SHIFT;
#ifdef CONFIG_ARMV7A_GIC_EOIMODE
putreg32(regval, GIC_ICCEOIR);
#endif
/* Ignore spurions IRQs. ICCIAR will report 1023 if there is no pending
* interrupt.
*/
@ -384,7 +390,11 @@ uint32_t *arm_decodeirq(uint32_t *regs)
/* Write to the end-of-interrupt register */
#ifdef CONFIG_ARMV7A_GIC_EOIMODE
putreg32(regval, GIC_ICCDIR);
#else
putreg32(regval, GIC_ICCEOIR);
#endif
return regs;
}

View File

@ -13,6 +13,17 @@ config ARMV7R_HAVE_GICv2
Selected by the configuration tool if the architecture supports the
Generic Interrupt Controller (GIC)
if ARMV7R_HAVE_GICv2
config ARMV7R_GIC_EOIMODE
bool
default n
---help---
Enable GICC_CTLR.EOImode, this will separates the priority drop and interrupt
deactivation operations.
endif # ARMV7R_GIC_EOIMODE
config ARMV7R_HAVE_PTM
bool
default n

View File

@ -228,6 +228,7 @@ void arm_gic_initialize(void)
#endif
#ifdef CONFIG_ARMV7R_GIC_EOIMODE
# if defined(CONFIG_ARCH_TRUSTZONE_SECURE) || defined(CONFIG_ARCH_TRUSTZONE_BOTH)
/* Set EnableS=1 to enable CPU interface to signal secure interrupts.
*
@ -253,6 +254,7 @@ void arm_gic_initialize(void)
iccicr |= GIC_ICCICRU_EOIMODENS;
# endif
#endif
#ifdef CONFIG_ARCH_TRUSTZONE_BOTH
/* If the processor operates in both security states and SBPR=0, then it
@ -343,6 +345,10 @@ uint32_t *arm_decodeirq(uint32_t *regs)
regval = getreg32(GIC_ICCIAR);
irq = (regval & GIC_ICCIAR_INTID_MASK) >> GIC_ICCIAR_INTID_SHIFT;
#ifdef CONFIG_ARMV7R_GIC_EOIMODE
putreg32(regval, GIC_ICCEOIR);
#endif
/* Ignore spurions IRQs. ICCIAR will report 1023 if there is no pending
* interrupt.
*/
@ -357,7 +363,11 @@ uint32_t *arm_decodeirq(uint32_t *regs)
/* Write to the end-of-interrupt register */
#ifdef CONFIG_ARMV7R_GIC_EOIMODE
putreg32(regval, GIC_ICCDIR);
#else
putreg32(regval, GIC_ICCEOIR);
#endif
return regs;
}

View File

@ -203,6 +203,17 @@ config ARM_GIC_VERSION
Version of Generic Interrupt Controller (GIC) supported by the
architecture
if ARM_GIC_VERSION = 2
config ARM_GIC_EOIMODE
bool
default n
---help---
Enable GICC_CTLR.EOImode, this will separates the priority drop and interrupt
deactivation operations.
endif
if ARCH_CHIP_A64
source "arch/arm64/src/a64/Kconfig"
endif

View File

@ -952,6 +952,7 @@ static void arm_gic_initialize(void)
iccicr |= GIC_ICCICRS_CBPR;
#endif
#ifdef CONFIG_ARM_GIC_EOIMODE
# if defined(CONFIG_ARCH_TRUSTZONE_SECURE) || defined(CONFIG_ARCH_TRUSTZONE_BOTH)
/* Set EnableS=1 to enable CPU interface to signal secure interrupts.
*
@ -976,6 +977,7 @@ static void arm_gic_initialize(void)
*/
iccicr |= GIC_ICCICRU_EOIMODENS;
# endif
#endif
#ifdef CONFIG_ARCH_TRUSTZONE_BOTH
@ -1081,6 +1083,10 @@ uint64_t * arm64_decodeirq(uint64_t * regs)
regval = getreg32(GIC_ICCIAR);
irq = (regval & GIC_ICCIAR_INTID_MASK) >> GIC_ICCIAR_INTID_SHIFT;
#ifdef CONFIG_ARM_GIC_EOIMODE
putreg32(regval, GIC_ICCEOIR);
#endif
/* Ignore spurions IRQs. ICCIAR will report 1023 if there is no pending
* interrupt.
*/
@ -1095,7 +1101,11 @@ uint64_t * arm64_decodeirq(uint64_t * regs)
/* Write to the end-of-interrupt register */
#ifdef CONFIG_ARM_GIC_EOIMODE
putreg32(regval, GIC_ICCDIR);
#else
putreg32(regval, GIC_ICCEOIR);
#endif
return regs;
}