Skip to content

Commit 2ff1b08

Browse files
author
Marc Zyngier
committed
Merge branch irq/misc-6.4 into irq/irqchip-next
* irq/misc-6.4: : . : Misc irqchip changes for 6.4: : : - Replace uses of of_find_property() with the more : appropriate of_property_read_bool() : : - Make bcm-6345-l1 request its MMIO region : : - Add suspend support to the SiFive PLIC : : - Drop support for stih415, stih416 and stid127 platforms : . irqchip/st: Remove stih415/stih416 and stid127 platforms support irqchip/irq-sifive-plic: Add syscore callbacks for hibernation irqchip: Use of_property_read_bool() for boolean properties irqchip/bcm-6345-l1: Request memory region Signed-off-by: Marc Zyngier <[email protected]>
2 parents 275232c + 0989ffb commit 2ff1b08

File tree

5 files changed

+97
-21
lines changed

5 files changed

+97
-21
lines changed

drivers/irqchip/irq-bcm6345-l1.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ static int __init bcm6345_l1_init_one(struct device_node *dn,
257257
if (!cpu->map_base)
258258
return -ENOMEM;
259259

260+
if (!request_mem_region(res.start, sz, res.name))
261+
pr_err("failed to request intc memory");
262+
260263
for (i = 0; i < n_words; i++) {
261264
cpu->enable_cache[i] = 0;
262265
__raw_writel(0, cpu->map_base + reg_enable(intc, i));
@@ -335,8 +338,7 @@ static int __init bcm6345_l1_of_init(struct device_node *dn,
335338
for_each_cpu(idx, &intc->cpumask) {
336339
struct bcm6345_l1_cpu *cpu = intc->cpus[idx];
337340

338-
pr_info(" CPU%u at MMIO 0x%p (irq = %d)\n", idx,
339-
cpu->map_base, cpu->parent_irq);
341+
pr_info(" CPU%u (irq = %d)\n", idx, cpu->parent_irq);
340342
}
341343

342344
return 0;

drivers/irqchip/irq-csky-apb-intc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static void __init ck_set_gc(struct device_node *node, void __iomem *reg_base,
6868
gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit;
6969
gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit;
7070

71-
if (of_find_property(node, "csky,support-pulse-signal", NULL))
71+
if (of_property_read_bool(node, "csky,support-pulse-signal"))
7272
gc->chip_types[0].chip.irq_unmask = irq_ck_mask_set_bit;
7373
}
7474

drivers/irqchip/irq-gic-v2m.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ static int __init gicv2m_of_init(struct fwnode_handle *parent_handle,
421421
u32 spi_start = 0, nr_spis = 0;
422422
struct resource res;
423423

424-
if (!of_find_property(child, "msi-controller", NULL))
424+
if (!of_property_read_bool(child, "msi-controller"))
425425
continue;
426426

427427
ret = of_address_to_resource(child, 0, &res);

drivers/irqchip/irq-sifive-plic.c

Lines changed: 91 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/of_irq.h>
1818
#include <linux/platform_device.h>
1919
#include <linux/spinlock.h>
20+
#include <linux/syscore_ops.h>
2021
#include <asm/smp.h>
2122

2223
/*
@@ -67,6 +68,8 @@ struct plic_priv {
6768
struct irq_domain *irqdomain;
6869
void __iomem *regs;
6970
unsigned long plic_quirks;
71+
unsigned int nr_irqs;
72+
unsigned long *prio_save;
7073
};
7174

7275
struct plic_handler {
@@ -78,6 +81,7 @@ struct plic_handler {
7881
*/
7982
raw_spinlock_t enable_lock;
8083
void __iomem *enable_base;
84+
u32 *enable_save;
8185
struct plic_priv *priv;
8286
};
8387
static int plic_parent_irq __ro_after_init;
@@ -229,6 +233,71 @@ static int plic_irq_set_type(struct irq_data *d, unsigned int type)
229233
return IRQ_SET_MASK_OK;
230234
}
231235

236+
static int plic_irq_suspend(void)
237+
{
238+
unsigned int i, cpu;
239+
u32 __iomem *reg;
240+
struct plic_priv *priv;
241+
242+
priv = per_cpu_ptr(&plic_handlers, smp_processor_id())->priv;
243+
244+
for (i = 0; i < priv->nr_irqs; i++)
245+
if (readl(priv->regs + PRIORITY_BASE + i * PRIORITY_PER_ID))
246+
__set_bit(i, priv->prio_save);
247+
else
248+
__clear_bit(i, priv->prio_save);
249+
250+
for_each_cpu(cpu, cpu_present_mask) {
251+
struct plic_handler *handler = per_cpu_ptr(&plic_handlers, cpu);
252+
253+
if (!handler->present)
254+
continue;
255+
256+
raw_spin_lock(&handler->enable_lock);
257+
for (i = 0; i < DIV_ROUND_UP(priv->nr_irqs, 32); i++) {
258+
reg = handler->enable_base + i * sizeof(u32);
259+
handler->enable_save[i] = readl(reg);
260+
}
261+
raw_spin_unlock(&handler->enable_lock);
262+
}
263+
264+
return 0;
265+
}
266+
267+
static void plic_irq_resume(void)
268+
{
269+
unsigned int i, index, cpu;
270+
u32 __iomem *reg;
271+
struct plic_priv *priv;
272+
273+
priv = per_cpu_ptr(&plic_handlers, smp_processor_id())->priv;
274+
275+
for (i = 0; i < priv->nr_irqs; i++) {
276+
index = BIT_WORD(i);
277+
writel((priv->prio_save[index] & BIT_MASK(i)) ? 1 : 0,
278+
priv->regs + PRIORITY_BASE + i * PRIORITY_PER_ID);
279+
}
280+
281+
for_each_cpu(cpu, cpu_present_mask) {
282+
struct plic_handler *handler = per_cpu_ptr(&plic_handlers, cpu);
283+
284+
if (!handler->present)
285+
continue;
286+
287+
raw_spin_lock(&handler->enable_lock);
288+
for (i = 0; i < DIV_ROUND_UP(priv->nr_irqs, 32); i++) {
289+
reg = handler->enable_base + i * sizeof(u32);
290+
writel(handler->enable_save[i], reg);
291+
}
292+
raw_spin_unlock(&handler->enable_lock);
293+
}
294+
}
295+
296+
static struct syscore_ops plic_irq_syscore_ops = {
297+
.suspend = plic_irq_suspend,
298+
.resume = plic_irq_resume,
299+
};
300+
232301
static int plic_irqdomain_map(struct irq_domain *d, unsigned int irq,
233302
irq_hw_number_t hwirq)
234303
{
@@ -345,6 +414,7 @@ static int __init __plic_init(struct device_node *node,
345414
u32 nr_irqs;
346415
struct plic_priv *priv;
347416
struct plic_handler *handler;
417+
unsigned int cpu;
348418

349419
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
350420
if (!priv)
@@ -363,15 +433,21 @@ static int __init __plic_init(struct device_node *node,
363433
if (WARN_ON(!nr_irqs))
364434
goto out_iounmap;
365435

436+
priv->nr_irqs = nr_irqs;
437+
438+
priv->prio_save = bitmap_alloc(nr_irqs, GFP_KERNEL);
439+
if (!priv->prio_save)
440+
goto out_free_priority_reg;
441+
366442
nr_contexts = of_irq_count(node);
367443
if (WARN_ON(!nr_contexts))
368-
goto out_iounmap;
444+
goto out_free_priority_reg;
369445

370446
error = -ENOMEM;
371447
priv->irqdomain = irq_domain_add_linear(node, nr_irqs + 1,
372448
&plic_irqdomain_ops, priv);
373449
if (WARN_ON(!priv->irqdomain))
374-
goto out_iounmap;
450+
goto out_free_priority_reg;
375451

376452
for (i = 0; i < nr_contexts; i++) {
377453
struct of_phandle_args parent;
@@ -441,6 +517,11 @@ static int __init __plic_init(struct device_node *node,
441517
handler->enable_base = priv->regs + CONTEXT_ENABLE_BASE +
442518
i * CONTEXT_ENABLE_SIZE;
443519
handler->priv = priv;
520+
521+
handler->enable_save = kcalloc(DIV_ROUND_UP(nr_irqs, 32),
522+
sizeof(*handler->enable_save), GFP_KERNEL);
523+
if (!handler->enable_save)
524+
goto out_free_enable_reg;
444525
done:
445526
for (hwirq = 1; hwirq <= nr_irqs; hwirq++) {
446527
plic_toggle(handler, hwirq, 0);
@@ -461,11 +542,19 @@ static int __init __plic_init(struct device_node *node,
461542
plic_starting_cpu, plic_dying_cpu);
462543
plic_cpuhp_setup_done = true;
463544
}
545+
register_syscore_ops(&plic_irq_syscore_ops);
464546

465547
pr_info("%pOFP: mapped %d interrupts with %d handlers for"
466548
" %d contexts.\n", node, nr_irqs, nr_handlers, nr_contexts);
467549
return 0;
468550

551+
out_free_enable_reg:
552+
for_each_cpu(cpu, cpu_present_mask) {
553+
handler = per_cpu_ptr(&plic_handlers, cpu);
554+
kfree(handler->enable_save);
555+
}
556+
out_free_priority_reg:
557+
kfree(priv->prio_save);
469558
out_iounmap:
470559
iounmap(priv->regs);
471560
out_free_priv:

drivers/irqchip/irq-st.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
#include <linux/regmap.h>
1616
#include <linux/slab.h>
1717

18-
#define STIH415_SYSCFG_642 0x0a8
19-
#define STIH416_SYSCFG_7543 0x87c
2018
#define STIH407_SYSCFG_5102 0x198
21-
#define STID127_SYSCFG_734 0x088
2219

2320
#define ST_A9_IRQ_MASK 0x001FFFFF
2421
#define ST_A9_IRQ_MAX_CHANS 2
@@ -44,22 +41,10 @@ struct st_irq_syscfg {
4441
};
4542

4643
static const struct of_device_id st_irq_syscfg_match[] = {
47-
{
48-
.compatible = "st,stih415-irq-syscfg",
49-
.data = (void *)STIH415_SYSCFG_642,
50-
},
51-
{
52-
.compatible = "st,stih416-irq-syscfg",
53-
.data = (void *)STIH416_SYSCFG_7543,
54-
},
5544
{
5645
.compatible = "st,stih407-irq-syscfg",
5746
.data = (void *)STIH407_SYSCFG_5102,
5847
},
59-
{
60-
.compatible = "st,stid127-irq-syscfg",
61-
.data = (void *)STID127_SYSCFG_734,
62-
},
6348
{}
6449
};
6550

0 commit comments

Comments
 (0)