Skip to content

Commit dc0f97c

Browse files
committed
Merge tag 'irq-urgent-2021-09-26' 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: - Work around a bad GIC integration on a Renesas platform which can't handle byte-sized MMIO access - Plug a potential memory leak in the GICv4 driver - Fix a regression in the Armada 370-XP IPI code which was caused by issuing EOI instack of ACK. - A couple of small fixes here and there" * tag 'irq-urgent-2021-09-26' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: irqchip/gic: Work around broken Renesas integration irqchip/renesas-rza1: Use semicolons instead of commas irqchip/gic-v3-its: Fix potential VPE leak on error irqchip/goldfish-pic: Select GENERIC_IRQ_CHIP to fix build irqchip/mbigen: Repair non-kernel-doc notation irqdomain: Change the type of 'size' in __irq_domain_add() to be consistent irqchip/armada-370-xp: Fix ack/eoi breakage Documentation: Fix irq-domain.rst build warning
2 parents a3b397b + f9bfed3 commit dc0f97c

File tree

9 files changed

+69
-17
lines changed

9 files changed

+69
-17
lines changed

Documentation/core-api/irq/irq-domain.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,10 @@ for IRQ numbers that are passed to struct device registrations. In that
175175
case the Linux IRQ numbers cannot be dynamically assigned and the legacy
176176
mapping should be used.
177177

178-
As the name implies, the *_legacy() functions are deprecated and only
178+
As the name implies, the \*_legacy() functions are deprecated and only
179179
exist to ease the support of ancient platforms. No new users should be
180-
added.
180+
added. Same goes for the \*_simple() functions when their use results
181+
in the legacy behaviour.
181182

182183
The legacy map assumes a contiguous range of IRQ numbers has already
183184
been allocated for the controller and that the IRQ number can be

drivers/irqchip/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ config MESON_IRQ_GPIO
409409
config GOLDFISH_PIC
410410
bool "Goldfish programmable interrupt controller"
411411
depends on MIPS && (GOLDFISH || COMPILE_TEST)
412+
select GENERIC_IRQ_CHIP
412413
select IRQ_DOMAIN
413414
help
414415
Say yes here to enable Goldfish interrupt controller driver used

drivers/irqchip/irq-armada-370-xp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,16 +359,16 @@ static void armada_370_xp_ipi_send_mask(struct irq_data *d,
359359
ARMADA_370_XP_SW_TRIG_INT_OFFS);
360360
}
361361

362-
static void armada_370_xp_ipi_eoi(struct irq_data *d)
362+
static void armada_370_xp_ipi_ack(struct irq_data *d)
363363
{
364364
writel(~BIT(d->hwirq), per_cpu_int_base + ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS);
365365
}
366366

367367
static struct irq_chip ipi_irqchip = {
368368
.name = "IPI",
369+
.irq_ack = armada_370_xp_ipi_ack,
369370
.irq_mask = armada_370_xp_ipi_mask,
370371
.irq_unmask = armada_370_xp_ipi_unmask,
371-
.irq_eoi = armada_370_xp_ipi_eoi,
372372
.ipi_send_mask = armada_370_xp_ipi_send_mask,
373373
};
374374

drivers/irqchip/irq-gic-v3-its.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4501,7 +4501,7 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virq
45014501

45024502
if (err) {
45034503
if (i > 0)
4504-
its_vpe_irq_domain_free(domain, virq, i - 1);
4504+
its_vpe_irq_domain_free(domain, virq, i);
45054505

45064506
its_lpi_free(bitmap, base, nr_ids);
45074507
its_free_prop_table(vprop_page);

drivers/irqchip/irq-gic.c

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ static DEFINE_RAW_SPINLOCK(cpu_map_lock);
107107

108108
#endif
109109

110+
static DEFINE_STATIC_KEY_FALSE(needs_rmw_access);
111+
110112
/*
111113
* The GIC mapping of CPU interfaces does not necessarily match
112114
* the logical CPU numbering. Let's use a mapping as returned
@@ -774,6 +776,25 @@ static int gic_pm_init(struct gic_chip_data *gic)
774776
#endif
775777

776778
#ifdef CONFIG_SMP
779+
static void rmw_writeb(u8 bval, void __iomem *addr)
780+
{
781+
static DEFINE_RAW_SPINLOCK(rmw_lock);
782+
unsigned long offset = (unsigned long)addr & 3UL;
783+
unsigned long shift = offset * 8;
784+
unsigned long flags;
785+
u32 val;
786+
787+
raw_spin_lock_irqsave(&rmw_lock, flags);
788+
789+
addr -= offset;
790+
val = readl_relaxed(addr);
791+
val &= ~GENMASK(shift + 7, shift);
792+
val |= bval << shift;
793+
writel_relaxed(val, addr);
794+
795+
raw_spin_unlock_irqrestore(&rmw_lock, flags);
796+
}
797+
777798
static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
778799
bool force)
779800
{
@@ -788,7 +809,10 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
788809
if (cpu >= NR_GIC_CPU_IF || cpu >= nr_cpu_ids)
789810
return -EINVAL;
790811

791-
writeb_relaxed(gic_cpu_map[cpu], reg);
812+
if (static_branch_unlikely(&needs_rmw_access))
813+
rmw_writeb(gic_cpu_map[cpu], reg);
814+
else
815+
writeb_relaxed(gic_cpu_map[cpu], reg);
792816
irq_data_update_effective_affinity(d, cpumask_of(cpu));
793817

794818
return IRQ_SET_MASK_OK_DONE;
@@ -1375,6 +1399,30 @@ static bool gic_check_eoimode(struct device_node *node, void __iomem **base)
13751399
return true;
13761400
}
13771401

1402+
static bool gic_enable_rmw_access(void *data)
1403+
{
1404+
/*
1405+
* The EMEV2 class of machines has a broken interconnect, and
1406+
* locks up on accesses that are less than 32bit. So far, only
1407+
* the affinity setting requires it.
1408+
*/
1409+
if (of_machine_is_compatible("renesas,emev2")) {
1410+
static_branch_enable(&needs_rmw_access);
1411+
return true;
1412+
}
1413+
1414+
return false;
1415+
}
1416+
1417+
static const struct gic_quirk gic_quirks[] = {
1418+
{
1419+
.desc = "broken byte access",
1420+
.compatible = "arm,pl390",
1421+
.init = gic_enable_rmw_access,
1422+
},
1423+
{ },
1424+
};
1425+
13781426
static int gic_of_setup(struct gic_chip_data *gic, struct device_node *node)
13791427
{
13801428
if (!gic || !node)
@@ -1391,6 +1439,8 @@ static int gic_of_setup(struct gic_chip_data *gic, struct device_node *node)
13911439
if (of_property_read_u32(node, "cpu-offset", &gic->percpu_offset))
13921440
gic->percpu_offset = 0;
13931441

1442+
gic_enable_of_quirks(node, gic_quirks, gic);
1443+
13941444
return 0;
13951445

13961446
error:

drivers/irqchip/irq-mbigen.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
/* The maximum IRQ pin number of mbigen chip(start from 0) */
2626
#define MAXIMUM_IRQ_PIN_NUM 1407
2727

28-
/**
28+
/*
2929
* In mbigen vector register
3030
* bit[21:12]: event id value
3131
* bit[11:0]: device id
@@ -39,14 +39,14 @@
3939
/* offset of vector register in mbigen node */
4040
#define REG_MBIGEN_VEC_OFFSET 0x200
4141

42-
/**
42+
/*
4343
* offset of clear register in mbigen node
4444
* This register is used to clear the status
4545
* of interrupt
4646
*/
4747
#define REG_MBIGEN_CLEAR_OFFSET 0xa000
4848

49-
/**
49+
/*
5050
* offset of interrupt type register
5151
* This register is used to configure interrupt
5252
* trigger type

drivers/irqchip/irq-renesas-rza1.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,12 @@ static int rza1_irqc_probe(struct platform_device *pdev)
223223
goto out_put_node;
224224
}
225225

226-
priv->chip.name = "rza1-irqc",
227-
priv->chip.irq_mask = irq_chip_mask_parent,
228-
priv->chip.irq_unmask = irq_chip_unmask_parent,
229-
priv->chip.irq_eoi = rza1_irqc_eoi,
230-
priv->chip.irq_retrigger = irq_chip_retrigger_hierarchy,
231-
priv->chip.irq_set_type = rza1_irqc_set_type,
226+
priv->chip.name = "rza1-irqc";
227+
priv->chip.irq_mask = irq_chip_mask_parent;
228+
priv->chip.irq_unmask = irq_chip_unmask_parent;
229+
priv->chip.irq_eoi = rza1_irqc_eoi;
230+
priv->chip.irq_retrigger = irq_chip_retrigger_hierarchy;
231+
priv->chip.irq_set_type = rza1_irqc_set_type;
232232
priv->chip.flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_SKIP_SET_WAKE;
233233

234234
priv->irq_domain = irq_domain_add_hierarchy(parent, 0, IRQC_NUM_IRQ,

include/linux/irqdomain.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ static inline struct fwnode_handle *irq_domain_alloc_fwnode(phys_addr_t *pa)
251251
}
252252

253253
void irq_domain_free_fwnode(struct fwnode_handle *fwnode);
254-
struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
254+
struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, unsigned int size,
255255
irq_hw_number_t hwirq_max, int direct_max,
256256
const struct irq_domain_ops *ops,
257257
void *host_data);

kernel/irq/irqdomain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ EXPORT_SYMBOL_GPL(irq_domain_free_fwnode);
136136
* Allocates and initializes an irq_domain structure.
137137
* Returns pointer to IRQ domain, or NULL on failure.
138138
*/
139-
struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
139+
struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, unsigned int size,
140140
irq_hw_number_t hwirq_max, int direct_max,
141141
const struct irq_domain_ops *ops,
142142
void *host_data)

0 commit comments

Comments
 (0)