Skip to content

Commit 15a9844

Browse files
committed
Merge tag 'irq-urgent-2020-11-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull irq fixes from Thomas Gleixner: "A set of fixes for interrupt chip drivers: - Fix the fallout of the IPI as interrupt conversion in Kconfig and the BCM2836 interrupt chip driver - Fixes for interrupt affinity setting and the handling of hierarchical irq domains in the SiFive PLIC driver - Make the unmapped event handling in the TI SCI driver work correctly - A few minor fixes and cleanups in various chip drivers and Kconfig" * tag 'irq-urgent-2020-11-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: dt-bindings: irqchip: ti, sci-inta: Fix diagram indentation for unmapped events irqchip/ti-sci-inta: Add support for unmapped event handling dt-bindings: irqchip: ti, sci-inta: Update for unmapped event handling irqchip/renesas-intc-irqpin: Merge irlm_bit and needs_irlm irqchip/sifive-plic: Fix chip_data access within a hierarchy irqchip/sifive-plic: Fix broken irq_set_affinity() callback irqchip/stm32-exti: Add all LP timer exti direct events support irqchip/bcm2836: Fix missing __init annotation irqchip/mips: Drop selection of IRQ_DOMAIN_HIERARCHY irqchip/mst: Make mst_intc_of_init static irqchip/mst: MST_IRQ should depend on ARCH_MEDIATEK or ARCH_MSTARV7 genirq: Let GENERIC_IRQ_IPI select IRQ_DOMAIN_HIERARCHY
2 parents 6a8d0d2 + 82768a8 commit 15a9844

9 files changed

Lines changed: 107 additions & 18 deletions

File tree

Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ description: |
3232
| | vint | bit | | 0 |.....|63| vintx |
3333
| +--------------+ +------------+ |
3434
| |
35+
| Unmap |
36+
| +--------------+ |
37+
Unmapped events ---->| | umapidx |-------------------------> Globalevents
38+
| +--------------+ |
39+
| |
3540
+-----------------------------------------+
3641
3742
Configuration of these Intmap registers that maps global events to vint is
@@ -70,6 +75,11 @@ properties:
7075
- description: |
7176
"limit" specifies the limit for translation
7277
78+
ti,unmapped-event-sources:
79+
$ref: /schemas/types.yaml#definitions/phandle-array
80+
description:
81+
Array of phandles to DMA controllers where the unmapped events originate.
82+
7383
required:
7484
- compatible
7585
- reg

drivers/irqchip/Kconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ config IRQ_MIPS_CPU
180180
select GENERIC_IRQ_CHIP
181181
select GENERIC_IRQ_IPI if SYS_SUPPORTS_MULTITHREADING
182182
select IRQ_DOMAIN
183-
select IRQ_DOMAIN_HIERARCHY if GENERIC_IRQ_IPI
184183
select GENERIC_IRQ_EFFECTIVE_AFF_MASK
185184

186185
config CLPS711X_IRQCHIP
@@ -315,7 +314,6 @@ config KEYSTONE_IRQ
315314
config MIPS_GIC
316315
bool
317316
select GENERIC_IRQ_IPI
318-
select IRQ_DOMAIN_HIERARCHY
319317
select MIPS_CM
320318

321319
config INGENIC_IRQ
@@ -591,6 +589,7 @@ config LOONGSON_PCH_MSI
591589

592590
config MST_IRQ
593591
bool "MStar Interrupt Controller"
592+
depends on ARCH_MEDIATEK || ARCH_MSTARV7 || COMPILE_TEST
594593
default ARCH_MEDIATEK
595594
select IRQ_DOMAIN
596595
select IRQ_DOMAIN_HIERARCHY

drivers/irqchip/irq-bcm2836.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ static int bcm2836_cpu_dying(unsigned int cpu)
244244

245245
#define BITS_PER_MBOX 32
246246

247-
static void bcm2836_arm_irqchip_smp_init(void)
247+
static void __init bcm2836_arm_irqchip_smp_init(void)
248248
{
249249
struct irq_fwspec ipi_fwspec = {
250250
.fwnode = intc.domain->fwnode,

drivers/irqchip/irq-mst-intc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ static const struct irq_domain_ops mst_intc_domain_ops = {
154154
.free = irq_domain_free_irqs_common,
155155
};
156156

157-
int __init
158-
mst_intc_of_init(struct device_node *dn, struct device_node *parent)
157+
static int __init mst_intc_of_init(struct device_node *dn,
158+
struct device_node *parent)
159159
{
160160
struct irq_domain *domain, *domain_parent;
161161
struct mst_intc_chip_data *cd;

drivers/irqchip/irq-renesas-intc-irqpin.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ struct intc_irqpin_priv {
7171
};
7272

7373
struct intc_irqpin_config {
74-
unsigned int irlm_bit;
75-
unsigned needs_irlm:1;
74+
int irlm_bit; /* -1 if non-existent */
7675
};
7776

7877
static unsigned long intc_irqpin_read32(void __iomem *iomem)
@@ -349,11 +348,10 @@ static const struct irq_domain_ops intc_irqpin_irq_domain_ops = {
349348

350349
static const struct intc_irqpin_config intc_irqpin_irlm_r8a777x = {
351350
.irlm_bit = 23, /* ICR0.IRLM0 */
352-
.needs_irlm = 1,
353351
};
354352

355353
static const struct intc_irqpin_config intc_irqpin_rmobile = {
356-
.needs_irlm = 0,
354+
.irlm_bit = -1,
357355
};
358356

359357
static const struct of_device_id intc_irqpin_dt_ids[] = {
@@ -470,7 +468,7 @@ static int intc_irqpin_probe(struct platform_device *pdev)
470468
}
471469

472470
/* configure "individual IRQ mode" where needed */
473-
if (config && config->needs_irlm) {
471+
if (config && config->irlm_bit >= 0) {
474472
if (io[INTC_IRQPIN_REG_IRLM])
475473
intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_IRLM,
476474
config->irlm_bit, 1, 1);

drivers/irqchip/irq-sifive-plic.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static inline void plic_irq_toggle(const struct cpumask *mask,
9999
struct irq_data *d, int enable)
100100
{
101101
int cpu;
102-
struct plic_priv *priv = irq_get_chip_data(d->irq);
102+
struct plic_priv *priv = irq_data_get_irq_chip_data(d);
103103

104104
writel(enable, priv->regs + PRIORITY_BASE + d->hwirq * PRIORITY_PER_ID);
105105
for_each_cpu(cpu, mask) {
@@ -115,7 +115,7 @@ static void plic_irq_unmask(struct irq_data *d)
115115
{
116116
struct cpumask amask;
117117
unsigned int cpu;
118-
struct plic_priv *priv = irq_get_chip_data(d->irq);
118+
struct plic_priv *priv = irq_data_get_irq_chip_data(d);
119119

120120
cpumask_and(&amask, &priv->lmask, cpu_online_mask);
121121
cpu = cpumask_any_and(irq_data_get_affinity_mask(d),
@@ -127,7 +127,7 @@ static void plic_irq_unmask(struct irq_data *d)
127127

128128
static void plic_irq_mask(struct irq_data *d)
129129
{
130-
struct plic_priv *priv = irq_get_chip_data(d->irq);
130+
struct plic_priv *priv = irq_data_get_irq_chip_data(d);
131131

132132
plic_irq_toggle(&priv->lmask, d, 0);
133133
}
@@ -138,7 +138,7 @@ static int plic_set_affinity(struct irq_data *d,
138138
{
139139
unsigned int cpu;
140140
struct cpumask amask;
141-
struct plic_priv *priv = irq_get_chip_data(d->irq);
141+
struct plic_priv *priv = irq_data_get_irq_chip_data(d);
142142

143143
cpumask_and(&amask, &priv->lmask, mask_val);
144144

@@ -151,7 +151,7 @@ static int plic_set_affinity(struct irq_data *d,
151151
return -EINVAL;
152152

153153
plic_irq_toggle(&priv->lmask, d, 0);
154-
plic_irq_toggle(cpumask_of(cpu), d, 1);
154+
plic_irq_toggle(cpumask_of(cpu), d, !irqd_irq_masked(d));
155155

156156
irq_data_update_effective_affinity(d, cpumask_of(cpu));
157157

drivers/irqchip/irq-stm32-exti.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ static const struct stm32_desc_irq stm32mp1_desc_irq[] = {
195195
{ .exti = 25, .irq_parent = 107, .chip = &stm32_exti_h_chip_direct },
196196
{ .exti = 30, .irq_parent = 52, .chip = &stm32_exti_h_chip_direct },
197197
{ .exti = 47, .irq_parent = 93, .chip = &stm32_exti_h_chip_direct },
198+
{ .exti = 48, .irq_parent = 138, .chip = &stm32_exti_h_chip_direct },
199+
{ .exti = 50, .irq_parent = 139, .chip = &stm32_exti_h_chip_direct },
200+
{ .exti = 52, .irq_parent = 140, .chip = &stm32_exti_h_chip_direct },
201+
{ .exti = 53, .irq_parent = 141, .chip = &stm32_exti_h_chip_direct },
198202
{ .exti = 54, .irq_parent = 135, .chip = &stm32_exti_h_chip_direct },
199203
{ .exti = 61, .irq_parent = 100, .chip = &stm32_exti_h_chip_direct },
200204
{ .exti = 65, .irq_parent = 144, .chip = &stm32_exti_h_chip },

drivers/irqchip/irq-ti-sci-inta.c

Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,17 @@ struct ti_sci_inta_vint_desc {
8585
* @base: Base address of the memory mapped IO registers
8686
* @pdev: Pointer to platform device.
8787
* @ti_sci_id: TI-SCI device identifier
88+
* @unmapped_cnt: Number of @unmapped_dev_ids entries
89+
* @unmapped_dev_ids: Pointer to an array of TI-SCI device identifiers of
90+
* unmapped event sources.
91+
* Unmapped Events are not part of the Global Event Map and
92+
* they are converted to Global event within INTA to be
93+
* received by the same INTA to generate an interrupt.
94+
* In case an interrupt request comes for a device which is
95+
* generating Unmapped Event, we must use the INTA's TI-SCI
96+
* device identifier in place of the source device
97+
* identifier to let sysfw know where it has to program the
98+
* Global Event number.
8899
*/
89100
struct ti_sci_inta_irq_domain {
90101
const struct ti_sci_handle *sci;
@@ -96,11 +107,37 @@ struct ti_sci_inta_irq_domain {
96107
void __iomem *base;
97108
struct platform_device *pdev;
98109
u32 ti_sci_id;
110+
111+
int unmapped_cnt;
112+
u16 *unmapped_dev_ids;
99113
};
100114

101115
#define to_vint_desc(e, i) container_of(e, struct ti_sci_inta_vint_desc, \
102116
events[i])
103117

118+
static u16 ti_sci_inta_get_dev_id(struct ti_sci_inta_irq_domain *inta, u32 hwirq)
119+
{
120+
u16 dev_id = HWIRQ_TO_DEVID(hwirq);
121+
int i;
122+
123+
if (inta->unmapped_cnt == 0)
124+
return dev_id;
125+
126+
/*
127+
* For devices sending Unmapped Events we must use the INTA's TI-SCI
128+
* device identifier number to be able to convert it to a Global Event
129+
* and map it to an interrupt.
130+
*/
131+
for (i = 0; i < inta->unmapped_cnt; i++) {
132+
if (dev_id == inta->unmapped_dev_ids[i]) {
133+
dev_id = inta->ti_sci_id;
134+
break;
135+
}
136+
}
137+
138+
return dev_id;
139+
}
140+
104141
/**
105142
* ti_sci_inta_irq_handler() - Chained IRQ handler for the vint irqs
106143
* @desc: Pointer to irq_desc corresponding to the irq
@@ -251,7 +288,7 @@ static struct ti_sci_inta_event_desc *ti_sci_inta_alloc_event(struct ti_sci_inta
251288
u16 dev_id, dev_index;
252289
int err;
253290

254-
dev_id = HWIRQ_TO_DEVID(hwirq);
291+
dev_id = ti_sci_inta_get_dev_id(inta, hwirq);
255292
dev_index = HWIRQ_TO_IRQID(hwirq);
256293

257294
event_desc = &vint_desc->events[free_bit];
@@ -352,14 +389,15 @@ static void ti_sci_inta_free_irq(struct ti_sci_inta_event_desc *event_desc,
352389
{
353390
struct ti_sci_inta_vint_desc *vint_desc;
354391
struct ti_sci_inta_irq_domain *inta;
392+
u16 dev_id;
355393

356394
vint_desc = to_vint_desc(event_desc, event_desc->vint_bit);
357395
inta = vint_desc->domain->host_data;
396+
dev_id = ti_sci_inta_get_dev_id(inta, hwirq);
358397
/* free event irq */
359398
mutex_lock(&inta->vint_mutex);
360399
inta->sci->ops.rm_irq_ops.free_event_map(inta->sci,
361-
HWIRQ_TO_DEVID(hwirq),
362-
HWIRQ_TO_IRQID(hwirq),
400+
dev_id, HWIRQ_TO_IRQID(hwirq),
363401
inta->ti_sci_id,
364402
vint_desc->vint_id,
365403
event_desc->global_event,
@@ -574,6 +612,41 @@ static struct msi_domain_info ti_sci_inta_msi_domain_info = {
574612
.chip = &ti_sci_inta_msi_irq_chip,
575613
};
576614

615+
static int ti_sci_inta_get_unmapped_sources(struct ti_sci_inta_irq_domain *inta)
616+
{
617+
struct device *dev = &inta->pdev->dev;
618+
struct device_node *node = dev_of_node(dev);
619+
struct of_phandle_iterator it;
620+
int count, err, ret, i;
621+
622+
count = of_count_phandle_with_args(node, "ti,unmapped-event-sources", NULL);
623+
if (count <= 0)
624+
return 0;
625+
626+
inta->unmapped_dev_ids = devm_kcalloc(dev, count,
627+
sizeof(*inta->unmapped_dev_ids),
628+
GFP_KERNEL);
629+
if (!inta->unmapped_dev_ids)
630+
return -ENOMEM;
631+
632+
i = 0;
633+
of_for_each_phandle(&it, err, node, "ti,unmapped-event-sources", NULL, 0) {
634+
u32 dev_id;
635+
636+
ret = of_property_read_u32(it.node, "ti,sci-dev-id", &dev_id);
637+
if (ret) {
638+
dev_err(dev, "ti,sci-dev-id read failure for %pOFf\n", it.node);
639+
of_node_put(it.node);
640+
return ret;
641+
}
642+
inta->unmapped_dev_ids[i++] = dev_id;
643+
}
644+
645+
inta->unmapped_cnt = count;
646+
647+
return 0;
648+
}
649+
577650
static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev)
578651
{
579652
struct irq_domain *parent_domain, *domain, *msi_domain;
@@ -629,6 +702,10 @@ static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev)
629702
if (IS_ERR(inta->base))
630703
return PTR_ERR(inta->base);
631704

705+
ret = ti_sci_inta_get_unmapped_sources(inta);
706+
if (ret)
707+
return ret;
708+
632709
domain = irq_domain_add_linear(dev_of_node(dev),
633710
ti_sci_get_num_resources(inta->vint),
634711
&ti_sci_inta_irq_domain_ops, inta);

kernel/irq/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ config IRQ_FASTEOI_HIERARCHY_HANDLERS
8282
# Generic IRQ IPI support
8383
config GENERIC_IRQ_IPI
8484
bool
85+
select IRQ_DOMAIN_HIERARCHY
8586

8687
# Generic MSI interrupt support
8788
config GENERIC_MSI_IRQ

0 commit comments

Comments
 (0)