Skip to content

Commit 0f01013

Browse files
Lorenzo PieralisiMarc Zyngier
authored andcommitted
irqchip/gic-v5: Add GICv5 LPI/IPI support
An IRS supports Logical Peripheral Interrupts (LPIs) and implement Linux IPIs on top of it. LPIs are used for interrupt signals that are translated by a GICv5 ITS (Interrupt Translation Service) but also for software generated IRQs - namely interrupts that are not driven by a HW signal, ie IPIs. LPIs rely on memory storage for interrupt routing and state. LPIs state and routing information is kept in the Interrupt State Table (IST). IRSes provide support for 1- or 2-level IST tables configured to support a maximum number of interrupts that depend on the OS configuration and the HW capabilities. On systems that provide 2-level IST support, always allow the maximum number of LPIs; On systems with only 1-level support, limit the number of LPIs to 2^12 to prevent wasting memory (presumably a system that supports a 1-level only IST is not expecting a large number of interrupts). On a 2-level IST system, L2 entries are allocated on demand. The IST table memory is allocated using the kmalloc() interface; the allocation required may be smaller than a page and must be made up of contiguous physical pages if larger than a page. On systems where the IRS is not cache-coherent with the CPUs, cache mainteinance operations are executed to clean and invalidate the allocated memory to the point of coherency making it visible to the IRS components. On GICv5 systems, IPIs are implemented using LPIs. Add an LPI IRQ domain and implement an IPI-specific IRQ domain created as a child/subdomain of the LPI domain to allocate the required number of LPIs needed to implement the IPIs. IPIs are backed by LPIs, add LPIs allocation/de-allocation functions. The LPI INTID namespace is managed using an IDA to alloc/free LPI INTIDs. Associate an IPI irqchip with IPI IRQ descriptors to provide core code with the irqchip.ipi_send_single() method required to raise an IPI. Co-developed-by: Sascha Bischoff <[email protected]> Signed-off-by: Sascha Bischoff <[email protected]> Co-developed-by: Timothy Hayes <[email protected]> Signed-off-by: Timothy Hayes <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Reviewed-by: Marc Zyngier <[email protected]> Cc: Will Deacon <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Marc Zyngier <[email protected]> Acked-by: Catalin Marinas <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marc Zyngier <[email protected]>
1 parent 5cb1b6d commit 0f01013

File tree

6 files changed

+746
-20
lines changed

6 files changed

+746
-20
lines changed

arch/arm64/include/asm/smp.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,23 @@ struct seq_file;
5050
*/
5151
extern void smp_init_cpus(void);
5252

53+
enum ipi_msg_type {
54+
IPI_RESCHEDULE,
55+
IPI_CALL_FUNC,
56+
IPI_CPU_STOP,
57+
IPI_CPU_STOP_NMI,
58+
IPI_TIMER,
59+
IPI_IRQ_WORK,
60+
NR_IPI,
61+
/*
62+
* Any enum >= NR_IPI and < MAX_IPI is special and not tracable
63+
* with trace_ipi_*
64+
*/
65+
IPI_CPU_BACKTRACE = NR_IPI,
66+
IPI_KGDB_ROUNDUP,
67+
MAX_IPI
68+
};
69+
5370
/*
5471
* Register IPI interrupts with the arch SMP code
5572
*/

arch/arm64/include/asm/sysreg.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,7 @@
10881088
#define GICV5_OP_GIC_CDAFF sys_insn(1, 0, 12, 1, 3)
10891089
#define GICV5_OP_GIC_CDDI sys_insn(1, 0, 12, 2, 0)
10901090
#define GICV5_OP_GIC_CDDIS sys_insn(1, 0, 12, 1, 0)
1091+
#define GICV5_OP_GIC_CDHM sys_insn(1, 0, 12, 2, 1)
10911092
#define GICV5_OP_GIC_CDEN sys_insn(1, 0, 12, 1, 1)
10921093
#define GICV5_OP_GIC_CDEOI sys_insn(1, 0, 12, 1, 7)
10931094
#define GICV5_OP_GIC_CDPEND sys_insn(1, 0, 12, 1, 4)
@@ -1115,6 +1116,11 @@
11151116
#define GICV5_GIC_CDEN_TYPE_MASK GENMASK_ULL(31, 29)
11161117
#define GICV5_GIC_CDEN_ID_MASK GENMASK_ULL(23, 0)
11171118

1119+
/* Definitions for GIC CDHM */
1120+
#define GICV5_GIC_CDHM_HM_MASK BIT_ULL(32)
1121+
#define GICV5_GIC_CDHM_TYPE_MASK GENMASK_ULL(31, 29)
1122+
#define GICV5_GIC_CDHM_ID_MASK GENMASK_ULL(23, 0)
1123+
11181124
/* Definitions for GIC CDPEND */
11191125
#define GICV5_GIC_CDPEND_PENDING_MASK BIT_ULL(32)
11201126
#define GICV5_GIC_CDPEND_TYPE_MASK GENMASK_ULL(31, 29)

arch/arm64/kernel/smp.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,6 @@ struct secondary_data secondary_data;
6464
/* Number of CPUs which aren't online, but looping in kernel text. */
6565
static int cpus_stuck_in_kernel;
6666

67-
enum ipi_msg_type {
68-
IPI_RESCHEDULE,
69-
IPI_CALL_FUNC,
70-
IPI_CPU_STOP,
71-
IPI_CPU_STOP_NMI,
72-
IPI_TIMER,
73-
IPI_IRQ_WORK,
74-
NR_IPI,
75-
/*
76-
* Any enum >= NR_IPI and < MAX_IPI is special and not tracable
77-
* with trace_ipi_*
78-
*/
79-
IPI_CPU_BACKTRACE = NR_IPI,
80-
IPI_KGDB_ROUNDUP,
81-
MAX_IPI
82-
};
83-
8467
static int ipi_irq_base __ro_after_init;
8568
static int nr_ipi __ro_after_init = NR_IPI;
8669

0 commit comments

Comments
 (0)