Skip to content

Commit f9ac7bb

Browse files
greentimeMarc Zyngier
authored andcommitted
irqchip/sifive-plic: Fix chip_data access within a hierarchy
The plic driver crashes in plic_irq_unmask() when the interrupt is within a hierarchy, as it picks the top-level chip_data instead of its local one. Using irq_data_get_irq_chip_data() instead of irq_get_chip_data() solves the issue for good. Fixes: f1ad113 ("irqchip/sifive-plic: Add support for multiple PLICs") Signed-off-by: Greentime Hu <greentime.hu@sifive.com> [maz: rewrote commit message] Signed-off-by: Marc Zyngier <maz@kernel.org> Reviewed-by: Anup Patel <anup@brainfault.org> Reviewed-by: Atish Patra <atish.patra@wdc.com> Link: https://lore.kernel.org/r/20201029023738.127472-1-greentime.hu@sifive.com
1 parent a7480c5 commit f9ac7bb

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/irqchip/irq-sifive-plic.c

Lines changed: 4 additions & 4 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

0 commit comments

Comments
 (0)