Skip to content

Commit 953f776

Browse files
committed
Merge tag 'irq-urgent-2024-08-04' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull irq fixes from Thomas Gleixner: "A couple of fixes for interrupt chip drivers: - Make sure to skip the clear register space in the MBIGEN driver when calculating the node register index. Otherwise the clear register is clobbered and the wrong node registers are accessed. - Fix a signed/unsigned confusion in the loongarch CPU driver which converts an error code to a huge "valid" interrupt number. - Convert the mesion GPIO interrupt controller lock to a raw spinlock so it works on RT. - Add a missing static to a internal function in the pic32 EVIC driver" * tag 'irq-urgent-2024-08-04' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: irqchip/mbigen: Fix mbigen node address layout irqchip/meson-gpio: Convert meson_gpio_irq_controller::lock to 'raw_spinlock_t' irqchip/irq-pic32-evic: Add missing 'static' to internal function irqchip/loongarch-cpu: Fix return value of lpic_gsi_to_irq()
2 parents 3bc70ad + 6be6cba commit 953f776

File tree

4 files changed

+30
-16
lines changed

4 files changed

+30
-16
lines changed

drivers/irqchip/irq-loongarch-cpu.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ struct fwnode_handle *cpuintc_handle;
1818

1919
static u32 lpic_gsi_to_irq(u32 gsi)
2020
{
21+
int irq = 0;
22+
2123
/* Only pch irqdomain transferring is required for LoongArch. */
2224
if (gsi >= GSI_MIN_PCH_IRQ && gsi <= GSI_MAX_PCH_IRQ)
23-
return acpi_register_gsi(NULL, gsi, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_HIGH);
25+
irq = acpi_register_gsi(NULL, gsi, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_HIGH);
2426

25-
return 0;
27+
return (irq > 0) ? irq : 0;
2628
}
2729

2830
static struct fwnode_handle *lpic_get_gsi_domain_id(u32 gsi)

drivers/irqchip/irq-mbigen.c

+16-4
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,20 @@ struct mbigen_device {
6464
void __iomem *base;
6565
};
6666

67+
static inline unsigned int get_mbigen_node_offset(unsigned int nid)
68+
{
69+
unsigned int offset = nid * MBIGEN_NODE_OFFSET;
70+
71+
/*
72+
* To avoid touched clear register in unexpected way, we need to directly
73+
* skip clear register when access to more than 10 mbigen nodes.
74+
*/
75+
if (nid >= (REG_MBIGEN_CLEAR_OFFSET / MBIGEN_NODE_OFFSET))
76+
offset += MBIGEN_NODE_OFFSET;
77+
78+
return offset;
79+
}
80+
6781
static inline unsigned int get_mbigen_vec_reg(irq_hw_number_t hwirq)
6882
{
6983
unsigned int nid, pin;
@@ -72,8 +86,7 @@ static inline unsigned int get_mbigen_vec_reg(irq_hw_number_t hwirq)
7286
nid = hwirq / IRQS_PER_MBIGEN_NODE + 1;
7387
pin = hwirq % IRQS_PER_MBIGEN_NODE;
7488

75-
return pin * 4 + nid * MBIGEN_NODE_OFFSET
76-
+ REG_MBIGEN_VEC_OFFSET;
89+
return pin * 4 + get_mbigen_node_offset(nid) + REG_MBIGEN_VEC_OFFSET;
7790
}
7891

7992
static inline void get_mbigen_type_reg(irq_hw_number_t hwirq,
@@ -88,8 +101,7 @@ static inline void get_mbigen_type_reg(irq_hw_number_t hwirq,
88101
*mask = 1 << (irq_ofst % 32);
89102
ofst = irq_ofst / 32 * 4;
90103

91-
*addr = ofst + nid * MBIGEN_NODE_OFFSET
92-
+ REG_MBIGEN_TYPE_OFFSET;
104+
*addr = ofst + get_mbigen_node_offset(nid) + REG_MBIGEN_TYPE_OFFSET;
93105
}
94106

95107
static inline void get_mbigen_clear_reg(irq_hw_number_t hwirq,

drivers/irqchip/irq-meson-gpio.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ struct meson_gpio_irq_controller {
178178
void __iomem *base;
179179
u32 channel_irqs[MAX_NUM_CHANNEL];
180180
DECLARE_BITMAP(channel_map, MAX_NUM_CHANNEL);
181-
spinlock_t lock;
181+
raw_spinlock_t lock;
182182
};
183183

184184
static void meson_gpio_irq_update_bits(struct meson_gpio_irq_controller *ctl,
@@ -187,14 +187,14 @@ static void meson_gpio_irq_update_bits(struct meson_gpio_irq_controller *ctl,
187187
unsigned long flags;
188188
u32 tmp;
189189

190-
spin_lock_irqsave(&ctl->lock, flags);
190+
raw_spin_lock_irqsave(&ctl->lock, flags);
191191

192192
tmp = readl_relaxed(ctl->base + reg);
193193
tmp &= ~mask;
194194
tmp |= val;
195195
writel_relaxed(tmp, ctl->base + reg);
196196

197-
spin_unlock_irqrestore(&ctl->lock, flags);
197+
raw_spin_unlock_irqrestore(&ctl->lock, flags);
198198
}
199199

200200
static void meson_gpio_irq_init_dummy(struct meson_gpio_irq_controller *ctl)
@@ -244,20 +244,20 @@ meson_gpio_irq_request_channel(struct meson_gpio_irq_controller *ctl,
244244
unsigned long flags;
245245
unsigned int idx;
246246

247-
spin_lock_irqsave(&ctl->lock, flags);
247+
raw_spin_lock_irqsave(&ctl->lock, flags);
248248

249249
/* Find a free channel */
250250
idx = find_first_zero_bit(ctl->channel_map, ctl->params->nr_channels);
251251
if (idx >= ctl->params->nr_channels) {
252-
spin_unlock_irqrestore(&ctl->lock, flags);
252+
raw_spin_unlock_irqrestore(&ctl->lock, flags);
253253
pr_err("No channel available\n");
254254
return -ENOSPC;
255255
}
256256

257257
/* Mark the channel as used */
258258
set_bit(idx, ctl->channel_map);
259259

260-
spin_unlock_irqrestore(&ctl->lock, flags);
260+
raw_spin_unlock_irqrestore(&ctl->lock, flags);
261261

262262
/*
263263
* Setup the mux of the channel to route the signal of the pad
@@ -567,7 +567,7 @@ static int meson_gpio_irq_of_init(struct device_node *node, struct device_node *
567567
if (!ctl)
568568
return -ENOMEM;
569569

570-
spin_lock_init(&ctl->lock);
570+
raw_spin_lock_init(&ctl->lock);
571571

572572
ctl->base = of_iomap(node, 0);
573573
if (!ctl->base) {

drivers/irqchip/irq-pic32-evic.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ static int pic32_irq_domain_map(struct irq_domain *d, unsigned int virq,
161161
return ret;
162162
}
163163

164-
int pic32_irq_domain_xlate(struct irq_domain *d, struct device_node *ctrlr,
165-
const u32 *intspec, unsigned int intsize,
166-
irq_hw_number_t *out_hwirq, unsigned int *out_type)
164+
static int pic32_irq_domain_xlate(struct irq_domain *d, struct device_node *ctrlr,
165+
const u32 *intspec, unsigned int intsize,
166+
irq_hw_number_t *out_hwirq, unsigned int *out_type)
167167
{
168168
struct evic_chip_data *priv = d->host_data;
169169

0 commit comments

Comments
 (0)