Skip to content

Commit eb27171

Browse files
committed
drivers/irqchip: xtensa-mx: fix mask and unmask
xtensa_irq_mask and xtensa_irq_unmask don't do the right thing when called for the first two external IRQs. Treat these IRQs as per-CPU IRQs. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
1 parent bb66523 commit eb27171

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

drivers/irqchip/irq-xtensa-mx.c

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,29 +71,35 @@ static void xtensa_mx_irq_mask(struct irq_data *d)
7171
unsigned int mask = 1u << d->hwirq;
7272

7373
if (mask & (XCHAL_INTTYPE_MASK_EXTERN_EDGE |
74-
XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) {
75-
set_er(1u << (xtensa_get_ext_irq_no(d->hwirq) -
76-
HW_IRQ_MX_BASE), MIENG);
77-
} else {
78-
mask = __this_cpu_read(cached_irq_mask) & ~mask;
79-
__this_cpu_write(cached_irq_mask, mask);
80-
xtensa_set_sr(mask, intenable);
74+
XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) {
75+
unsigned int ext_irq = xtensa_get_ext_irq_no(d->hwirq);
76+
77+
if (ext_irq >= HW_IRQ_MX_BASE) {
78+
set_er(1u << (ext_irq - HW_IRQ_MX_BASE), MIENG);
79+
return;
80+
}
8181
}
82+
mask = __this_cpu_read(cached_irq_mask) & ~mask;
83+
__this_cpu_write(cached_irq_mask, mask);
84+
xtensa_set_sr(mask, intenable);
8285
}
8386

8487
static void xtensa_mx_irq_unmask(struct irq_data *d)
8588
{
8689
unsigned int mask = 1u << d->hwirq;
8790

8891
if (mask & (XCHAL_INTTYPE_MASK_EXTERN_EDGE |
89-
XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) {
90-
set_er(1u << (xtensa_get_ext_irq_no(d->hwirq) -
91-
HW_IRQ_MX_BASE), MIENGSET);
92-
} else {
93-
mask |= __this_cpu_read(cached_irq_mask);
94-
__this_cpu_write(cached_irq_mask, mask);
95-
xtensa_set_sr(mask, intenable);
92+
XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) {
93+
unsigned int ext_irq = xtensa_get_ext_irq_no(d->hwirq);
94+
95+
if (ext_irq >= HW_IRQ_MX_BASE) {
96+
set_er(1u << (ext_irq - HW_IRQ_MX_BASE), MIENGSET);
97+
return;
98+
}
9699
}
100+
mask |= __this_cpu_read(cached_irq_mask);
101+
__this_cpu_write(cached_irq_mask, mask);
102+
xtensa_set_sr(mask, intenable);
97103
}
98104

99105
static void xtensa_mx_irq_enable(struct irq_data *d)

0 commit comments

Comments
 (0)