Skip to content

Commit cb69d86

Browse files
committed
Merge tag 'irq-core-2024-09-16' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull irq updates from Thomas Gleixner: "Core: - Remove a global lock in the affinity setting code The lock protects a cpumask for intermediate results and the lock causes a bottleneck on simultaneous start of multiple virtual machines. Replace the lock and the static cpumask with a per CPU cpumask which is nicely serialized by raw spinlock held when executing this code. - Provide support for giving a suffix to interrupt domain names. That's required to support devices with subfunctions so that the domain names are distinct even if they originate from the same device node. - The usual set of cleanups and enhancements all over the place Drivers: - Support for longarch AVEC interrupt chip - Refurbishment of the Armada driver so it can be extended for new variants. - The usual set of cleanups and enhancements all over the place" * tag 'irq-core-2024-09-16' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (73 commits) genirq: Use cpumask_intersects() genirq/cpuhotplug: Use cpumask_intersects() irqchip/apple-aic: Only access system registers on SoCs which provide them irqchip/apple-aic: Add a new "Global fast IPIs only" feature level irqchip/apple-aic: Skip unnecessary enabling of use_fast_ipi dt-bindings: apple,aic: Document A7-A11 compatibles irqdomain: Use IS_ERR_OR_NULL() in irq_domain_trim_hierarchy() genirq/msi: Use kmemdup_array() instead of kmemdup() genirq/proc: Change the return value for set affinity permission error genirq/proc: Use irq_move_pending() in show_irq_affinity() genirq/proc: Correctly set file permissions for affinity control files genirq: Get rid of global lock in irq_do_set_affinity() genirq: Fix typo in struct comment irqchip/loongarch-avec: Add AVEC irqchip support irqchip/loongson-pch-msi: Prepare get_pch_msi_handle() for AVECINTC irqchip/loongson-eiointc: Rename CPUHP_AP_IRQ_LOONGARCH_STARTING LoongArch: Architectural preparation for AVEC irqchip LoongArch: Move irqchip function prototypes to irq-loongson.h irqchip/loongson-pch-msi: Switch to MSI parent domains softirq: Remove unused 'action' parameter from action callback ...
2 parents a64405b + a6fe30d commit cb69d86

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1267
-682
lines changed

Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,25 @@ description: |
3131
This device also represents the FIQ interrupt sources on platforms using AIC,
3232
which do not go through a discrete interrupt controller.
3333
34+
IPIs may be performed via MMIO registers on all variants of AIC. Starting
35+
from A11, system registers may also be used for "fast" IPIs. Starting from
36+
M1, even faster IPIs within the same cluster may be achieved by writing to
37+
a "local" fast IPI register as opposed to using the "global" fast IPI
38+
register.
39+
3440
allOf:
3541
- $ref: /schemas/interrupt-controller.yaml#
3642

3743
properties:
3844
compatible:
3945
items:
40-
- const: apple,t8103-aic
46+
- enum:
47+
- apple,s5l8960x-aic
48+
- apple,t7000-aic
49+
- apple,s8000-aic
50+
- apple,t8010-aic
51+
- apple,t8015-aic
52+
- apple,t8103-aic
4153
- const: apple,aic
4254

4355
interrupt-controller: true

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/cpu-features.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,6 @@
6565
#define cpu_has_guestid cpu_opt(LOONGARCH_CPU_GUESTID)
6666
#define cpu_has_hypervisor cpu_opt(LOONGARCH_CPU_HYPERVISOR)
6767
#define cpu_has_ptw cpu_opt(LOONGARCH_CPU_PTW)
68+
#define cpu_has_avecint cpu_opt(LOONGARCH_CPU_AVECINT)
6869

6970
#endif /* __ASM_CPU_FEATURES_H */

arch/loongarch/include/asm/cpu.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ enum cpu_type_enum {
9999
#define CPU_FEATURE_GUESTID 24 /* CPU has GuestID feature */
100100
#define CPU_FEATURE_HYPERVISOR 25 /* CPU has hypervisor (running in VM) */
101101
#define CPU_FEATURE_PTW 26 /* CPU has hardware page table walker */
102+
#define CPU_FEATURE_AVECINT 27 /* CPU has avec interrupt */
102103

103104
#define LOONGARCH_CPU_CPUCFG BIT_ULL(CPU_FEATURE_CPUCFG)
104105
#define LOONGARCH_CPU_LAM BIT_ULL(CPU_FEATURE_LAM)
@@ -127,5 +128,6 @@ enum cpu_type_enum {
127128
#define LOONGARCH_CPU_GUESTID BIT_ULL(CPU_FEATURE_GUESTID)
128129
#define LOONGARCH_CPU_HYPERVISOR BIT_ULL(CPU_FEATURE_HYPERVISOR)
129130
#define LOONGARCH_CPU_PTW BIT_ULL(CPU_FEATURE_PTW)
131+
#define LOONGARCH_CPU_AVECINT BIT_ULL(CPU_FEATURE_AVECINT)
130132

131133
#endif /* _ASM_CPU_H */

arch/loongarch/include/asm/hardirq.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
extern void ack_bad_irq(unsigned int irq);
1313
#define ack_bad_irq ack_bad_irq
1414

15-
#define NR_IPI 3
15+
#define NR_IPI 4
1616

1717
enum ipi_msg_type {
1818
IPI_RESCHEDULE,
1919
IPI_CALL_FUNCTION,
2020
IPI_IRQ_WORK,
21+
IPI_CLEAR_VECTOR,
2122
};
2223

2324
typedef struct {

arch/loongarch/include/asm/irq.h

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,22 @@ void spurious_interrupt(void);
3939

4040
#define NR_IRQS_LEGACY 16
4141

42+
/*
43+
* 256 Vectors Mapping for AVECINTC:
44+
*
45+
* 0 - 15: Mapping classic IPs, e.g. IP0-12.
46+
* 16 - 255: Mapping vectors for external IRQ.
47+
*
48+
*/
49+
#define NR_VECTORS 256
50+
#define NR_LEGACY_VECTORS 16
51+
#define IRQ_MATRIX_BITS NR_VECTORS
52+
4253
#define arch_trigger_cpumask_backtrace arch_trigger_cpumask_backtrace
4354
void arch_trigger_cpumask_backtrace(const struct cpumask *mask, int exclude_cpu);
4455

4556
#define MAX_IO_PICS 2
46-
#define NR_IRQS (64 + (256 * MAX_IO_PICS))
57+
#define NR_IRQS (64 + NR_VECTORS * (NR_CPUS + MAX_IO_PICS))
4758

4859
struct acpi_vector_group {
4960
int node;
@@ -65,7 +76,7 @@ extern struct acpi_vector_group msi_group[MAX_IO_PICS];
6576
#define LOONGSON_LPC_LAST_IRQ (LOONGSON_LPC_IRQ_BASE + 15)
6677

6778
#define LOONGSON_CPU_IRQ_BASE 16
68-
#define LOONGSON_CPU_LAST_IRQ (LOONGSON_CPU_IRQ_BASE + 14)
79+
#define LOONGSON_CPU_LAST_IRQ (LOONGSON_CPU_IRQ_BASE + 15)
6980

7081
#define LOONGSON_PCH_IRQ_BASE 64
7182
#define LOONGSON_PCH_ACPI_IRQ (LOONGSON_PCH_IRQ_BASE + 47)
@@ -88,20 +99,8 @@ struct acpi_madt_bio_pic;
8899
struct acpi_madt_msi_pic;
89100
struct acpi_madt_lpc_pic;
90101

91-
int liointc_acpi_init(struct irq_domain *parent,
92-
struct acpi_madt_lio_pic *acpi_liointc);
93-
int eiointc_acpi_init(struct irq_domain *parent,
94-
struct acpi_madt_eio_pic *acpi_eiointc);
95-
96-
int htvec_acpi_init(struct irq_domain *parent,
97-
struct acpi_madt_ht_pic *acpi_htvec);
98-
int pch_lpc_acpi_init(struct irq_domain *parent,
99-
struct acpi_madt_lpc_pic *acpi_pchlpc);
100-
int pch_msi_acpi_init(struct irq_domain *parent,
101-
struct acpi_madt_msi_pic *acpi_pchmsi);
102-
int pch_pic_acpi_init(struct irq_domain *parent,
103-
struct acpi_madt_bio_pic *acpi_pchpic);
104-
int find_pch_pic(u32 gsi);
102+
void complete_irq_moving(void);
103+
105104
struct fwnode_handle *get_pch_msi_handle(int pci_segment);
106105

107106
extern struct acpi_madt_lio_pic *acpi_liointc;

arch/loongarch/include/asm/loongarch.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@
246246
#define CSR_ESTAT_EXC_WIDTH 6
247247
#define CSR_ESTAT_EXC (_ULCAST_(0x3f) << CSR_ESTAT_EXC_SHIFT)
248248
#define CSR_ESTAT_IS_SHIFT 0
249-
#define CSR_ESTAT_IS_WIDTH 14
250-
#define CSR_ESTAT_IS (_ULCAST_(0x3fff) << CSR_ESTAT_IS_SHIFT)
249+
#define CSR_ESTAT_IS_WIDTH 15
250+
#define CSR_ESTAT_IS (_ULCAST_(0x7fff) << CSR_ESTAT_IS_SHIFT)
251251

252252
#define LOONGARCH_CSR_ERA 0x6 /* ERA */
253253

@@ -642,6 +642,13 @@
642642

643643
#define LOONGARCH_CSR_CTAG 0x98 /* TagLo + TagHi */
644644

645+
#define LOONGARCH_CSR_ISR0 0xa0
646+
#define LOONGARCH_CSR_ISR1 0xa1
647+
#define LOONGARCH_CSR_ISR2 0xa2
648+
#define LOONGARCH_CSR_ISR3 0xa3
649+
650+
#define LOONGARCH_CSR_IRR 0xa4
651+
645652
#define LOONGARCH_CSR_PRID 0xc0
646653

647654
/* Shadow MCSR : 0xc0 ~ 0xff */
@@ -1004,7 +1011,7 @@
10041011
/*
10051012
* CSR_ECFG IM
10061013
*/
1007-
#define ECFG0_IM 0x00001fff
1014+
#define ECFG0_IM 0x00005fff
10081015
#define ECFGB_SIP0 0
10091016
#define ECFGF_SIP0 (_ULCAST_(1) << ECFGB_SIP0)
10101017
#define ECFGB_SIP1 1
@@ -1047,6 +1054,7 @@
10471054
#define IOCSRF_EIODECODE BIT_ULL(9)
10481055
#define IOCSRF_FLATMODE BIT_ULL(10)
10491056
#define IOCSRF_VM BIT_ULL(11)
1057+
#define IOCSRF_AVEC BIT_ULL(15)
10501058

10511059
#define LOONGARCH_IOCSR_VENDOR 0x10
10521060

@@ -1058,6 +1066,7 @@
10581066
#define IOCSR_MISC_FUNC_SOFT_INT BIT_ULL(10)
10591067
#define IOCSR_MISC_FUNC_TIMER_RESET BIT_ULL(21)
10601068
#define IOCSR_MISC_FUNC_EXT_IOI_EN BIT_ULL(48)
1069+
#define IOCSR_MISC_FUNC_AVEC_EN BIT_ULL(51)
10611070

10621071
#define LOONGARCH_IOCSR_CPUTEMP 0x428
10631072

@@ -1380,9 +1389,10 @@ __BUILD_CSR_OP(tlbidx)
13801389
#define INT_TI 11 /* Timer */
13811390
#define INT_IPI 12
13821391
#define INT_NMI 13
1392+
#define INT_AVEC 14
13831393

13841394
/* ExcCodes corresponding to interrupts */
1385-
#define EXCCODE_INT_NUM (INT_NMI + 1)
1395+
#define EXCCODE_INT_NUM (INT_AVEC + 1)
13861396
#define EXCCODE_INT_START 64
13871397
#define EXCCODE_INT_END (EXCCODE_INT_START + EXCCODE_INT_NUM - 1)
13881398

arch/loongarch/include/asm/smp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,12 @@ extern int __cpu_logical_map[NR_CPUS];
7070
#define ACTION_RESCHEDULE 1
7171
#define ACTION_CALL_FUNCTION 2
7272
#define ACTION_IRQ_WORK 3
73+
#define ACTION_CLEAR_VECTOR 4
7374
#define SMP_BOOT_CPU BIT(ACTION_BOOT_CPU)
7475
#define SMP_RESCHEDULE BIT(ACTION_RESCHEDULE)
7576
#define SMP_CALL_FUNCTION BIT(ACTION_CALL_FUNCTION)
7677
#define SMP_IRQ_WORK BIT(ACTION_IRQ_WORK)
78+
#define SMP_CLEAR_VECTOR BIT(ACTION_CLEAR_VECTOR)
7779

7880
struct secondary_data {
7981
unsigned long stack;

arch/loongarch/kernel/cpu-probe.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ static void cpu_probe_common(struct cpuinfo_loongarch *c)
106106
elf_hwcap |= HWCAP_LOONGARCH_CRC32;
107107
}
108108

109-
110109
config = read_cpucfg(LOONGARCH_CPUCFG2);
111110
if (config & CPUCFG2_LAM) {
112111
c->options |= LOONGARCH_CPU_LAM;
@@ -174,6 +173,8 @@ static void cpu_probe_common(struct cpuinfo_loongarch *c)
174173
c->options |= LOONGARCH_CPU_FLATMODE;
175174
if (config & IOCSRF_EIODECODE)
176175
c->options |= LOONGARCH_CPU_EIODECODE;
176+
if (config & IOCSRF_AVEC)
177+
c->options |= LOONGARCH_CPU_AVECINT;
177178
if (config & IOCSRF_VM)
178179
c->options |= LOONGARCH_CPU_HYPERVISOR;
179180

arch/loongarch/kernel/irq.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,18 @@ static void __init init_vec_parent_group(void)
8787
acpi_table_parse(ACPI_SIG_MCFG, early_pci_mcfg_parse);
8888
}
8989

90+
int __init arch_probe_nr_irqs(void)
91+
{
92+
int nr_io_pics = bitmap_weight(loongson_sysconf.cores_io_master, NR_CPUS);
93+
94+
if (!cpu_has_avecint)
95+
nr_irqs = (64 + NR_VECTORS * nr_io_pics);
96+
else
97+
nr_irqs = (64 + NR_VECTORS * (nr_cpu_ids + nr_io_pics));
98+
99+
return NR_IRQS_LEGACY;
100+
}
101+
90102
void __init init_IRQ(void)
91103
{
92104
int i;

0 commit comments

Comments
 (0)