Skip to content

Commit 1e1d137

Browse files
author
Marc Zyngier
committed
Merge branch irq/modular-irqchips into irq/irqchip-next
* irq/modular-irqchips: : . : Update a set of irqchip drivers to be build as modules. : : This includes an Amlogic and multiple Broadcom drivers, triggering : a cascade of other changes (MIPS arch code, symbols being exported, : config changes) : . irqchip: Fix kernel-doc parameter typo for IRQCHIP_DECLARE ARM: bcm: Removed forced select of interrupt controllers arm64: broadcom: Removed forced select of interrupt controllers irqchip/irq-bcm7120-l2: Switch to IRQCHIP_PLATFORM_DRIVER genirq: Export irq_gc_noop() irqchip/irq-brcmstb-l2: Switch to IRQCHIP_PLATFORM_DRIVER genirq: Export irq_gc_{unmask_enable,mask_disable}_reg irqchip/irq-bcm7038-l1: Switch to IRQCHIP_PLATFORM_DRIVER irqchip/irq-bcm7038-l1: Restrict affinity setting to MIPS irqchip/irq-bcm7038-l1: Gate use of CPU logical map to MIPS irqchip/irq-bcm7038-l1: Use irq_get_irq_data() irqchip/irq-bcm7038-l1: Remove .irq_cpu_offline() MIPS: BMIPS: Remove use of irq_cpu_offline arm64: meson: remove MESON_IRQ_GPIO selection irqchip/meson-gpio: Make it possible to build as a module irqchip: Provide stronger type checking for IRQCHIP_MATCH/IRQCHIP_DECLARE Signed-off-by: Marc Zyngier <[email protected]>
2 parents 12f04f9 + b8419e7 commit 1e1d137

File tree

11 files changed

+74
-72
lines changed

11 files changed

+74
-72
lines changed

arch/arm/mach-bcm/Kconfig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ config ARCH_BCM2835
161161
select ARM_TIMER_SP804
162162
select HAVE_ARM_ARCH_TIMER if ARCH_MULTI_V7
163163
select BCM2835_TIMER
164-
select BRCMSTB_L2_IRQ
165164
select PINCTRL
166165
select PINCTRL_BCM2835
167166
select MFD_CORE
@@ -209,9 +208,6 @@ config ARCH_BRCMSTB
209208
select ARM_GIC
210209
select ARM_ERRATA_798181 if SMP
211210
select HAVE_ARM_ARCH_TIMER
212-
select BCM7038_L1_IRQ
213-
select BRCMSTB_L2_IRQ
214-
select BCM7120_L2_IRQ
215211
select ZONE_DMA if ARM_LPAE
216212
select SOC_BRCMSTB
217213
select SOC_BUS

arch/arm64/Kconfig.platforms

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ config ARCH_BCM2835
4444
select ARM_AMBA
4545
select ARM_GIC
4646
select ARM_TIMER_SP804
47-
select BRCMSTB_L2_IRQ
4847
help
4948
This enables support for the Broadcom BCM2837 and BCM2711 SoC.
5049
These SoCs are used in the Raspberry Pi 3 and 4 devices.
@@ -82,8 +81,6 @@ config ARCH_BITMAIN
8281
config ARCH_BRCMSTB
8382
bool "Broadcom Set-Top-Box SoCs"
8483
select ARCH_HAS_RESET_CONTROLLER
85-
select BCM7038_L1_IRQ
86-
select BRCMSTB_L2_IRQ
8784
select GENERIC_IRQ_CHIP
8885
select PINCTRL
8986
help
@@ -167,7 +164,6 @@ config ARCH_MEDIATEK
167164
config ARCH_MESON
168165
bool "Amlogic Platforms"
169166
select COMMON_CLK
170-
select MESON_IRQ_GPIO
171167
help
172168
This enables support for the arm64 based Amlogic SoCs
173169
such as the s905, S905X/D, S912, A113X/D or S905X/D2

arch/mips/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1782,6 +1782,7 @@ config CPU_BMIPS
17821782
select CPU_HAS_PREFETCH
17831783
select CPU_SUPPORTS_CPUFREQ
17841784
select MIPS_EXTERNAL_TIMER
1785+
select GENERIC_IRQ_MIGRATION if HOTPLUG_CPU
17851786
help
17861787
Support for BMIPS32/3300/4350/4380 and BMIPS5000 processors.
17871788

arch/mips/kernel/smp-bmips.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/bug.h>
2727
#include <linux/kernel.h>
2828
#include <linux/kexec.h>
29+
#include <linux/irq.h>
2930

3031
#include <asm/time.h>
3132
#include <asm/processor.h>
@@ -373,7 +374,7 @@ static int bmips_cpu_disable(void)
373374

374375
set_cpu_online(cpu, false);
375376
calculate_cpu_foreign_map();
376-
irq_cpu_offline();
377+
irq_migrate_all_off_this_cpu();
377378
clear_c0_status(IE_IRQ5);
378379

379380
local_flush_tlb_all();

drivers/irqchip/Kconfig

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,18 +115,24 @@ config BCM6345_L1_IRQ
115115
select GENERIC_IRQ_EFFECTIVE_AFF_MASK
116116

117117
config BCM7038_L1_IRQ
118-
bool
118+
tristate "Broadcom STB 7038-style L1/L2 interrupt controller driver"
119+
depends on ARCH_BRCMSTB || BMIPS_GENERIC
120+
default ARCH_BRCMSTB || BMIPS_GENERIC
119121
select GENERIC_IRQ_CHIP
120122
select IRQ_DOMAIN
121123
select GENERIC_IRQ_EFFECTIVE_AFF_MASK
122124

123125
config BCM7120_L2_IRQ
124-
bool
126+
tristate "Broadcom STB 7120-style L2 interrupt controller driver"
127+
depends on ARCH_BRCMSTB || BMIPS_GENERIC
128+
default ARCH_BRCMSTB || BMIPS_GENERIC
125129
select GENERIC_IRQ_CHIP
126130
select IRQ_DOMAIN
127131

128132
config BRCMSTB_L2_IRQ
129-
bool
133+
tristate "Broadcom STB generic L2 interrupt controller driver"
134+
depends on ARCH_BCM2835 || ARCH_BRCMSTB || BMIPS_GENERIC
135+
default ARCH_BCM2835 || ARCH_BRCMSTB || BMIPS_GENERIC
130136
select GENERIC_IRQ_CHIP
131137
select IRQ_DOMAIN
132138

@@ -400,8 +406,9 @@ config IRQ_UNIPHIER_AIDET
400406
Support for the UniPhier AIDET (ARM Interrupt Detector).
401407

402408
config MESON_IRQ_GPIO
403-
bool "Meson GPIO Interrupt Multiplexer"
404-
depends on ARCH_MESON
409+
tristate "Meson GPIO Interrupt Multiplexer"
410+
depends on ARCH_MESON || COMPILE_TEST
411+
default ARCH_MESON
405412
select IRQ_DOMAIN_HIERARCHY
406413
help
407414
Support Meson SoC Family GPIO Interrupt Multiplexer

drivers/irqchip/irq-bcm7038-l1.c

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
#include <linux/irqchip.h>
2929
#include <linux/irqchip/chained_irq.h>
3030
#include <linux/syscore_ops.h>
31-
#ifdef CONFIG_ARM
32-
#include <asm/smp_plat.h>
33-
#endif
3431

3532
#define IRQS_PER_WORD 32
3633
#define REG_BYTES_PER_IRQ_WORD (sizeof(u32) * 4)
@@ -127,7 +124,7 @@ static void bcm7038_l1_irq_handle(struct irq_desc *desc)
127124
struct irq_chip *chip = irq_desc_get_chip(desc);
128125
unsigned int idx;
129126

130-
#ifdef CONFIG_SMP
127+
#if defined(CONFIG_SMP) && defined(CONFIG_MIPS)
131128
cpu = intc->cpus[cpu_logical_map(smp_processor_id())];
132129
#else
133130
cpu = intc->cpus[0];
@@ -194,6 +191,7 @@ static void bcm7038_l1_mask(struct irq_data *d)
194191
raw_spin_unlock_irqrestore(&intc->lock, flags);
195192
}
196193

194+
#if defined(CONFIG_MIPS) && defined(CONFIG_SMP)
197195
static int bcm7038_l1_set_affinity(struct irq_data *d,
198196
const struct cpumask *dest,
199197
bool force)
@@ -220,32 +218,6 @@ static int bcm7038_l1_set_affinity(struct irq_data *d,
220218

221219
return 0;
222220
}
223-
224-
#ifdef CONFIG_SMP
225-
static void bcm7038_l1_cpu_offline(struct irq_data *d)
226-
{
227-
struct cpumask *mask = irq_data_get_affinity_mask(d);
228-
int cpu = smp_processor_id();
229-
cpumask_t new_affinity;
230-
231-
/* This CPU was not on the affinity mask */
232-
if (!cpumask_test_cpu(cpu, mask))
233-
return;
234-
235-
if (cpumask_weight(mask) > 1) {
236-
/*
237-
* Multiple CPU affinity, remove this CPU from the affinity
238-
* mask
239-
*/
240-
cpumask_copy(&new_affinity, mask);
241-
cpumask_clear_cpu(cpu, &new_affinity);
242-
} else {
243-
/* Only CPU, put on the lowest online CPU */
244-
cpumask_clear(&new_affinity);
245-
cpumask_set_cpu(cpumask_first(cpu_online_mask), &new_affinity);
246-
}
247-
irq_set_affinity_locked(d, &new_affinity, false);
248-
}
249221
#endif
250222

251223
static int __init bcm7038_l1_init_one(struct device_node *dn,
@@ -328,7 +300,7 @@ static int bcm7038_l1_suspend(void)
328300
u32 val;
329301

330302
/* Wakeup interrupt should only come from the boot cpu */
331-
#ifdef CONFIG_SMP
303+
#if defined(CONFIG_SMP) && defined(CONFIG_MIPS)
332304
boot_cpu = cpu_logical_map(0);
333305
#else
334306
boot_cpu = 0;
@@ -352,7 +324,7 @@ static void bcm7038_l1_resume(void)
352324
struct bcm7038_l1_chip *intc;
353325
int boot_cpu, word;
354326

355-
#ifdef CONFIG_SMP
327+
#if defined(CONFIG_SMP) && defined(CONFIG_MIPS)
356328
boot_cpu = cpu_logical_map(0);
357329
#else
358330
boot_cpu = 0;
@@ -395,9 +367,8 @@ static struct irq_chip bcm7038_l1_irq_chip = {
395367
.name = "bcm7038-l1",
396368
.irq_mask = bcm7038_l1_mask,
397369
.irq_unmask = bcm7038_l1_unmask,
370+
#if defined(CONFIG_SMP) && defined(CONFIG_MIPS)
398371
.irq_set_affinity = bcm7038_l1_set_affinity,
399-
#ifdef CONFIG_SMP
400-
.irq_cpu_offline = bcm7038_l1_cpu_offline,
401372
#endif
402373
#ifdef CONFIG_PM_SLEEP
403374
.irq_set_wake = bcm7038_l1_set_wake,
@@ -416,7 +387,7 @@ static int bcm7038_l1_map(struct irq_domain *d, unsigned int virq,
416387

417388
irq_set_chip_and_handler(virq, &bcm7038_l1_irq_chip, handle_level_irq);
418389
irq_set_chip_data(virq, d->host_data);
419-
irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(virq)));
390+
irqd_set_single_target(irq_get_irq_data(virq));
420391
return 0;
421392
}
422393

@@ -484,4 +455,8 @@ static int __init bcm7038_l1_of_init(struct device_node *dn,
484455
return ret;
485456
}
486457

487-
IRQCHIP_DECLARE(bcm7038_l1, "brcm,bcm7038-l1-intc", bcm7038_l1_of_init);
458+
IRQCHIP_PLATFORM_DRIVER_BEGIN(bcm7038_l1)
459+
IRQCHIP_MATCH("brcm,bcm7038-l1-intc", bcm7038_l1_of_init)
460+
IRQCHIP_PLATFORM_DRIVER_END(bcm7038_l1)
461+
MODULE_DESCRIPTION("Broadcom STB 7038-style L1/L2 interrupt controller");
462+
MODULE_LICENSE("GPL v2");

drivers/irqchip/irq-bcm7120-l2.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn,
220220
{
221221
unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
222222
struct bcm7120_l2_intc_data *data;
223+
struct platform_device *pdev;
223224
struct irq_chip_generic *gc;
224225
struct irq_chip_type *ct;
225226
int ret = 0;
@@ -230,7 +231,13 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn,
230231
if (!data)
231232
return -ENOMEM;
232233

233-
data->num_parent_irqs = of_irq_count(dn);
234+
pdev = of_find_device_by_node(dn);
235+
if (!pdev) {
236+
ret = -ENODEV;
237+
goto out_free_data;
238+
}
239+
240+
data->num_parent_irqs = platform_irq_count(pdev);
234241
if (data->num_parent_irqs <= 0) {
235242
pr_err("invalid number of parent interrupts\n");
236243
ret = -ENOMEM;
@@ -329,6 +336,7 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn,
329336
if (data->map_base[idx])
330337
iounmap(data->map_base[idx]);
331338
}
339+
out_free_data:
332340
kfree(data);
333341
return ret;
334342
}
@@ -347,8 +355,9 @@ static int __init bcm7120_l2_intc_probe_3380(struct device_node *dn,
347355
"BCM3380 L2");
348356
}
349357

350-
IRQCHIP_DECLARE(bcm7120_l2_intc, "brcm,bcm7120-l2-intc",
351-
bcm7120_l2_intc_probe_7120);
352-
353-
IRQCHIP_DECLARE(bcm3380_l2_intc, "brcm,bcm3380-l2-intc",
354-
bcm7120_l2_intc_probe_3380);
358+
IRQCHIP_PLATFORM_DRIVER_BEGIN(bcm7120_l2)
359+
IRQCHIP_MATCH("brcm,bcm7120-l2-intc", bcm7120_l2_intc_probe_7120)
360+
IRQCHIP_MATCH("brcm,bcm3380-l2-intc", bcm7120_l2_intc_probe_3380)
361+
IRQCHIP_PLATFORM_DRIVER_END(bcm7120_l2)
362+
MODULE_DESCRIPTION("Broadcom STB 7120-style L2 interrupt controller driver");
363+
MODULE_LICENSE("GPL v2");

drivers/irqchip/irq-brcmstb-l2.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,18 @@ static int __init brcmstb_l2_edge_intc_of_init(struct device_node *np,
275275
{
276276
return brcmstb_l2_intc_of_init(np, parent, &l2_edge_intc_init);
277277
}
278-
IRQCHIP_DECLARE(brcmstb_l2_intc, "brcm,l2-intc", brcmstb_l2_edge_intc_of_init);
279-
IRQCHIP_DECLARE(brcmstb_hif_spi_l2_intc, "brcm,hif-spi-l2-intc",
280-
brcmstb_l2_edge_intc_of_init);
281-
IRQCHIP_DECLARE(brcmstb_upg_aux_aon_l2_intc, "brcm,upg-aux-aon-l2-intc",
282-
brcmstb_l2_edge_intc_of_init);
283278

284279
static int __init brcmstb_l2_lvl_intc_of_init(struct device_node *np,
285280
struct device_node *parent)
286281
{
287282
return brcmstb_l2_intc_of_init(np, parent, &l2_lvl_intc_init);
288283
}
289-
IRQCHIP_DECLARE(bcm7271_l2_intc, "brcm,bcm7271-l2-intc",
290-
brcmstb_l2_lvl_intc_of_init);
284+
285+
IRQCHIP_PLATFORM_DRIVER_BEGIN(brcmstb_l2)
286+
IRQCHIP_MATCH("brcm,l2-intc", brcmstb_l2_edge_intc_of_init)
287+
IRQCHIP_MATCH("brcm,hif-spi-l2-intc", brcmstb_l2_edge_intc_of_init)
288+
IRQCHIP_MATCH("brcm,upg-aux-aon-l2-intc", brcmstb_l2_edge_intc_of_init)
289+
IRQCHIP_MATCH("brcm,bcm7271-l2-intc", brcmstb_l2_lvl_intc_of_init)
290+
IRQCHIP_PLATFORM_DRIVER_END(brcmstb_l2)
291+
MODULE_DESCRIPTION("Broadcom STB generic L2 interrupt controller");
292+
MODULE_LICENSE("GPL v2");

drivers/irqchip/irq-meson-gpio.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,7 @@ static const struct irq_domain_ops meson_gpio_irq_domain_ops = {
436436
.translate = meson_gpio_irq_domain_translate,
437437
};
438438

439-
static int __init meson_gpio_irq_parse_dt(struct device_node *node,
440-
struct meson_gpio_irq_controller *ctl)
439+
static int meson_gpio_irq_parse_dt(struct device_node *node, struct meson_gpio_irq_controller *ctl)
441440
{
442441
const struct of_device_id *match;
443442
int ret;
@@ -463,8 +462,7 @@ static int __init meson_gpio_irq_parse_dt(struct device_node *node,
463462
return 0;
464463
}
465464

466-
static int __init meson_gpio_irq_of_init(struct device_node *node,
467-
struct device_node *parent)
465+
static int meson_gpio_irq_of_init(struct device_node *node, struct device_node *parent)
468466
{
469467
struct irq_domain *domain, *parent_domain;
470468
struct meson_gpio_irq_controller *ctl;
@@ -521,5 +519,10 @@ static int __init meson_gpio_irq_of_init(struct device_node *node,
521519
return ret;
522520
}
523521

524-
IRQCHIP_DECLARE(meson_gpio_intc, "amlogic,meson-gpio-intc",
525-
meson_gpio_irq_of_init);
522+
IRQCHIP_PLATFORM_DRIVER_BEGIN(meson_gpio_intc)
523+
IRQCHIP_MATCH("amlogic,meson-gpio-intc", meson_gpio_irq_of_init)
524+
IRQCHIP_PLATFORM_DRIVER_END(meson_gpio_intc)
525+
526+
MODULE_AUTHOR("Jerome Brunet <[email protected]>");
527+
MODULE_LICENSE("GPL v2");
528+
MODULE_ALIAS("platform:meson-gpio-intc");

include/linux/irqchip.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,35 @@
1414
#include <linux/acpi.h>
1515
#include <linux/module.h>
1616
#include <linux/of.h>
17+
#include <linux/of_irq.h>
1718
#include <linux/platform_device.h>
1819

20+
/* Undefined on purpose */
21+
extern of_irq_init_cb_t typecheck_irq_init_cb;
22+
23+
#define typecheck_irq_init_cb(fn) \
24+
(__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
25+
1926
/*
2027
* This macro must be used by the different irqchip drivers to declare
2128
* the association between their DT compatible string and their
2229
* initialization function.
2330
*
2431
* @name: name that must be unique across all IRQCHIP_DECLARE of the
2532
* same file.
26-
* @compstr: compatible string of the irqchip driver
33+
* @compat: compatible string of the irqchip driver
2734
* @fn: initialization function
2835
*/
29-
#define IRQCHIP_DECLARE(name, compat, fn) OF_DECLARE_2(irqchip, name, compat, fn)
36+
#define IRQCHIP_DECLARE(name, compat, fn) \
37+
OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
3038

3139
extern int platform_irqchip_probe(struct platform_device *pdev);
3240

3341
#define IRQCHIP_PLATFORM_DRIVER_BEGIN(drv_name) \
3442
static const struct of_device_id drv_name##_irqchip_match_table[] = {
3543

36-
#define IRQCHIP_MATCH(compat, fn) { .compatible = compat, .data = fn },
44+
#define IRQCHIP_MATCH(compat, fn) { .compatible = compat, \
45+
.data = typecheck_irq_init_cb(fn), },
3746

3847
#define IRQCHIP_PLATFORM_DRIVER_END(drv_name) \
3948
{}, \

0 commit comments

Comments
 (0)