Skip to content

Commit ae16f05

Browse files
zhangtianyang-ztyKAGA-KOKO
authored andcommitted
irqchip/loongarch-avec: Add AVEC irqchip support
Introduce the advanced extended interrupt controllers (AVECINTC). This feature will allow each core to have 256 independent interrupt vectors and MSI interrupts can be independently routed to any vector on any CPU. The whole topology of irqchips in LoongArch machines looks like this if AVECINTC is supported: +-----+ +-----------------------+ +-------+ | IPI | --> | CPUINTC | <-- | Timer | +-----+ +-----------------------+ +-------+ ^ ^ ^ | | | +---------+ +----------+ +---------+ +-------+ | EIOINTC | | AVECINTC | | LIOINTC | <-- | UARTs | +---------+ +----------+ +---------+ +-------+ ^ ^ | | +---------+ +---------+ | PCH-PIC | | PCH-MSI | +---------+ +---------+ ^ ^ ^ | | | +---------+ +---------+ +---------+ | Devices | | PCH-LPC | | Devices | +---------+ +---------+ +---------+ ^ | +---------+ | Devices | +---------+ Co-developed-by: Jianmin Lv <[email protected]> Signed-off-by: Jianmin Lv <[email protected]> Co-developed-by: Liupu Wang <[email protected]> Signed-off-by: Liupu Wang <[email protected]> Co-developed-by: Huacai Chen <[email protected]> Signed-off-by: Huacai Chen <[email protected]> Signed-off-by: Tianyang Zhang <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent a1d4646 commit ae16f05

File tree

11 files changed

+464
-2
lines changed

11 files changed

+464
-2
lines changed

arch/loongarch/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ config LOONGARCH
8585
select GENERIC_ENTRY
8686
select GENERIC_GETTIMEOFDAY
8787
select GENERIC_IOREMAP if !ARCH_IOREMAP
88+
select GENERIC_IRQ_MATRIX_ALLOCATOR
8889
select GENERIC_IRQ_MULTI_HANDLER
8990
select GENERIC_IRQ_PROBE
9091
select GENERIC_IRQ_SHOW

arch/loongarch/include/asm/irq.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ struct acpi_madt_bio_pic;
9999
struct acpi_madt_msi_pic;
100100
struct acpi_madt_lpc_pic;
101101

102+
void complete_irq_moving(void);
103+
102104
struct fwnode_handle *get_pch_msi_handle(int pci_segment);
103105

104106
extern struct acpi_madt_lio_pic *acpi_liointc;

arch/loongarch/kernel/paravirt.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ static irqreturn_t pv_ipi_interrupt(int irq, void *dev)
134134
info->ipi_irqs[IPI_IRQ_WORK]++;
135135
}
136136

137+
if (action & SMP_CLEAR_VECTOR) {
138+
complete_irq_moving();
139+
info->ipi_irqs[IPI_CLEAR_VECTOR]++;
140+
}
141+
137142
return IRQ_HANDLED;
138143
}
139144

arch/loongarch/kernel/smp.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ static const char *ipi_types[NR_IPI] __tracepoint_string = {
7272
[IPI_RESCHEDULE] = "Rescheduling interrupts",
7373
[IPI_CALL_FUNCTION] = "Function call interrupts",
7474
[IPI_IRQ_WORK] = "IRQ work interrupts",
75+
[IPI_CLEAR_VECTOR] = "Clear vector interrupts",
7576
};
7677

7778
void show_ipi_list(struct seq_file *p, int prec)
@@ -248,6 +249,11 @@ static irqreturn_t loongson_ipi_interrupt(int irq, void *dev)
248249
per_cpu(irq_stat, cpu).ipi_irqs[IPI_IRQ_WORK]++;
249250
}
250251

252+
if (action & SMP_CLEAR_VECTOR) {
253+
complete_irq_moving();
254+
per_cpu(irq_stat, cpu).ipi_irqs[IPI_CLEAR_VECTOR]++;
255+
}
256+
251257
return IRQ_HANDLED;
252258
}
253259

drivers/irqchip/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ obj-$(CONFIG_LS1X_IRQ) += irq-ls1x.o
110110
obj-$(CONFIG_TI_SCI_INTR_IRQCHIP) += irq-ti-sci-intr.o
111111
obj-$(CONFIG_TI_SCI_INTA_IRQCHIP) += irq-ti-sci-inta.o
112112
obj-$(CONFIG_TI_PRUSS_INTC) += irq-pruss-intc.o
113-
obj-$(CONFIG_IRQ_LOONGARCH_CPU) += irq-loongarch-cpu.o
113+
obj-$(CONFIG_IRQ_LOONGARCH_CPU) += irq-loongarch-cpu.o irq-loongarch-avec.o
114114
obj-$(CONFIG_LOONGSON_LIOINTC) += irq-loongson-liointc.o
115115
obj-$(CONFIG_LOONGSON_EIOINTC) += irq-loongson-eiointc.o
116116
obj-$(CONFIG_LOONGSON_HTPIC) += irq-loongson-htpic.o

0 commit comments

Comments
 (0)