Skip to content

Commit

Permalink
arch/arm64: add support to config SPI interrupt affinity routing to C…
Browse files Browse the repository at this point in the history
…PU0 by default

Signed-off-by: chao an <[email protected]>
  • Loading branch information
anchao committed Oct 14, 2024
1 parent 1764bad commit 73d4b00
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
7 changes: 7 additions & 0 deletions arch/arm64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,13 @@ config ARM64_GICV3_SPI_EDGE
---help---
Configure all SPIs(Shared Peripheral Interrupts) as edge-triggered by default.

config ARM64_GICV3_SPI_ROUTING_CPU0
bool "Configure SPI interrupt affinity routing to CPU0 by default"
default y if SMP
default n
---help---
Configure SPI interrupt affinity routing to CPU0 by default.

endif

config ARM64_SEMIHOSTING_HOSTFS
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/src/common/arm64_arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ void arm64_cpu_enable(void);
#ifdef CONFIG_SMP
uint64_t arm64_get_mpid(int cpu);
#else
# define arm64_get_mpid(cpu) GET_MPIDR()
# define arm64_get_mpid(cpu) (GET_MPIDR() & MPIDR_ID_MASK)
#endif /* CONFIG_SMP */

/****************************************************************************
Expand Down
13 changes: 13 additions & 0 deletions arch/arm64/src/common/arm64_gicv3.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,12 @@ void arm64_gic_irq_enable(unsigned int intid)
* SPI's affinity, now set it to be the PE on which it is enabled.
*/

#ifndef CONFIG_ARM64_GICV3_SPI_ROUTING_CPU0
if (GIC_IS_SPI(intid))
{
arm64_gic_write_irouter((GET_MPIDR() & MPIDR_ID_MASK), intid);
}
#endif

putreg32(mask, ISENABLER(GET_DIST_BASE(intid), idx));
}
Expand Down Expand Up @@ -618,6 +620,17 @@ static void gicv3_dist_init(void)
#endif
}

/* Configure SPI interrupt affinity routing to CPU0 */

#ifdef CONFIG_ARM64_GICV3_SPI_ROUTING_CPU0
uint64_t mpid = arm64_get_mpid(0);

for (intid = GIC_SPI_INT_BASE; intid < num_ints; intid++)
{
putreg64(mpid, IROUTER(base, intid));
}
#endif

/* TODO: Some arrch64 Cortex-A core maybe without security state
* it has different GIC configure with standard arrch64 A or R core
*/
Expand Down

0 comments on commit 73d4b00

Please sign in to comment.