Skip to content

Commit 021f653

Browse files
Marc ZyngierJason Cooper
authored andcommitted
irqchip: gic-v3: Initial support for GICv3
The Generic Interrupt Controller (version 3) offers services that are similar to GICv2, with a number of additional features: - Affinity routing based on the CPU MPIDR (ARE) - System register for the CPU interfaces (SRE) - Support for more that 8 CPUs - Locality-specific Peripheral Interrupts (LPIs) - Interrupt Translation Services (ITS) This patch adds preliminary support for GICv3 with ARE and SRE, non-secure mode only. It relies on higher exception levels to grant ARE and SRE access. Support for LPI and ITS will be added at a later time. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Jason Cooper <jason@lakedaemon.net> Reviewed-by: Zi Shen Lim <zlim@broadcom.com> Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org> Reviewed-by: Tirumalesh Chalamarla <tchalamarla@cavium.com> Reviewed-by: Yun Wu <wuyun.wu@huawei.com> Reviewed-by: Zhen Lei <thunder.leizhen@huawei.com> Tested-by: Tirumalesh Chalamarla<tchalamarla@cavium.com> Tested-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com> Acked-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Reviewed-by: Mark Rutland <mark.rutland@arm.com> Link: https://lkml.kernel.org/r/1404140510-5382-3-git-send-email-marc.zyngier@arm.com Signed-off-by: Jason Cooper <jason@lakedaemon.net>
1 parent d51d0af commit 021f653

7 files changed

Lines changed: 916 additions & 0 deletions

File tree

‎arch/arm64/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ config ARM64
99
select ARM_AMBA
1010
select ARM_ARCH_TIMER
1111
select ARM_GIC
12+
select ARM_GIC_V3
1213
select BUILDTIME_EXTABLE_SORT
1314
select CLONE_BACKWARDS
1415
select COMMON_CLK

‎arch/arm64/kernel/head.S‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include <linux/linkage.h>
2424
#include <linux/init.h>
25+
#include <linux/irqchip/arm-gic-v3.h>
2526

2627
#include <asm/assembler.h>
2728
#include <asm/ptrace.h>
@@ -296,6 +297,23 @@ CPU_LE( bic x0, x0, #(3 << 24) ) // Clear the EE and E0E bits for EL1
296297
msr cnthctl_el2, x0
297298
msr cntvoff_el2, xzr // Clear virtual offset
298299

300+
#ifdef CONFIG_ARM_GIC_V3
301+
/* GICv3 system register access */
302+
mrs x0, id_aa64pfr0_el1
303+
ubfx x0, x0, #24, #4
304+
cmp x0, #1
305+
b.ne 3f
306+
307+
mrs x0, ICC_SRE_EL2
308+
orr x0, x0, #ICC_SRE_EL2_SRE // Set ICC_SRE_EL2.SRE==1
309+
orr x0, x0, #ICC_SRE_EL2_ENABLE // Set ICC_SRE_EL2.Enable==1
310+
msr ICC_SRE_EL2, x0
311+
isb // Make sure SRE is now set
312+
msr ICH_HCR_EL2, xzr // Reset ICC_HCR_EL2 to defaults
313+
314+
3:
315+
#endif
316+
299317
/* Populate ID registers. */
300318
mrs x0, midr_el1
301319
mrs x1, mpidr_el1

‎arch/arm64/kernel/hyp-stub.S‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <linux/init.h>
2121
#include <linux/linkage.h>
22+
#include <linux/irqchip/arm-gic-v3.h>
2223

2324
#include <asm/assembler.h>
2425
#include <asm/ptrace.h>

‎drivers/irqchip/Kconfig‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ config ARM_GIC
1010
config GIC_NON_BANKED
1111
bool
1212

13+
config ARM_GIC_V3
14+
bool
15+
select IRQ_DOMAIN
16+
select MULTI_IRQ_HANDLER
17+
1318
config ARM_NVIC
1419
bool
1520
select IRQ_DOMAIN

‎drivers/irqchip/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ obj-$(CONFIG_ARCH_SUNXI) += irq-sun4i.o
1616
obj-$(CONFIG_ARCH_SUNXI) += irq-sunxi-nmi.o
1717
obj-$(CONFIG_ARCH_SPEAR3XX) += spear-shirq.o
1818
obj-$(CONFIG_ARM_GIC) += irq-gic.o irq-gic-common.o
19+
obj-$(CONFIG_ARM_GIC_V3) += irq-gic-v3.o irq-gic-common.o
1920
obj-$(CONFIG_ARM_NVIC) += irq-nvic.o
2021
obj-$(CONFIG_ARM_VIC) += irq-vic.o
2122
obj-$(CONFIG_IMGPDC_IRQ) += irq-imgpdc.o

0 commit comments

Comments
 (0)