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()

+4 -2
drivers/irqchip/irq-loongarch-cpu.c
··· 18 18 19 19 static u32 lpic_gsi_to_irq(u32 gsi) 20 20 { 21 + int irq = 0; 22 + 21 23 /* Only pch irqdomain transferring is required for LoongArch. */ 22 24 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); 24 26 25 - return 0; 27 + return (irq > 0) ? irq : 0; 26 28 } 27 29 28 30 static struct fwnode_handle *lpic_get_gsi_domain_id(u32 gsi)
+16 -4
drivers/irqchip/irq-mbigen.c
··· 64 64 void __iomem *base; 65 65 }; 66 66 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 + 67 81 static inline unsigned int get_mbigen_vec_reg(irq_hw_number_t hwirq) 68 82 { 69 83 unsigned int nid, pin; ··· 86 72 nid = hwirq / IRQS_PER_MBIGEN_NODE + 1; 87 73 pin = hwirq % IRQS_PER_MBIGEN_NODE; 88 74 89 - return pin * 4 + nid * MBIGEN_NODE_OFFSET 90 - + REG_MBIGEN_VEC_OFFSET; 75 + return pin * 4 + get_mbigen_node_offset(nid) + REG_MBIGEN_VEC_OFFSET; 91 76 } 92 77 93 78 static inline void get_mbigen_type_reg(irq_hw_number_t hwirq, ··· 101 88 *mask = 1 << (irq_ofst % 32); 102 89 ofst = irq_ofst / 32 * 4; 103 90 104 - *addr = ofst + nid * MBIGEN_NODE_OFFSET 105 - + REG_MBIGEN_TYPE_OFFSET; 91 + *addr = ofst + get_mbigen_node_offset(nid) + REG_MBIGEN_TYPE_OFFSET; 106 92 } 107 93 108 94 static inline void get_mbigen_clear_reg(irq_hw_number_t hwirq,
+7 -7
drivers/irqchip/irq-meson-gpio.c
··· 178 178 void __iomem *base; 179 179 u32 channel_irqs[MAX_NUM_CHANNEL]; 180 180 DECLARE_BITMAP(channel_map, MAX_NUM_CHANNEL); 181 - spinlock_t lock; 181 + raw_spinlock_t lock; 182 182 }; 183 183 184 184 static void meson_gpio_irq_update_bits(struct meson_gpio_irq_controller *ctl, ··· 187 187 unsigned long flags; 188 188 u32 tmp; 189 189 190 - spin_lock_irqsave(&ctl->lock, flags); 190 + raw_spin_lock_irqsave(&ctl->lock, flags); 191 191 192 192 tmp = readl_relaxed(ctl->base + reg); 193 193 tmp &= ~mask; 194 194 tmp |= val; 195 195 writel_relaxed(tmp, ctl->base + reg); 196 196 197 - spin_unlock_irqrestore(&ctl->lock, flags); 197 + raw_spin_unlock_irqrestore(&ctl->lock, flags); 198 198 } 199 199 200 200 static void meson_gpio_irq_init_dummy(struct meson_gpio_irq_controller *ctl) ··· 244 244 unsigned long flags; 245 245 unsigned int idx; 246 246 247 - spin_lock_irqsave(&ctl->lock, flags); 247 + raw_spin_lock_irqsave(&ctl->lock, flags); 248 248 249 249 /* Find a free channel */ 250 250 idx = find_first_zero_bit(ctl->channel_map, ctl->params->nr_channels); 251 251 if (idx >= ctl->params->nr_channels) { 252 - spin_unlock_irqrestore(&ctl->lock, flags); 252 + raw_spin_unlock_irqrestore(&ctl->lock, flags); 253 253 pr_err("No channel available\n"); 254 254 return -ENOSPC; 255 255 } ··· 257 257 /* Mark the channel as used */ 258 258 set_bit(idx, ctl->channel_map); 259 259 260 - spin_unlock_irqrestore(&ctl->lock, flags); 260 + raw_spin_unlock_irqrestore(&ctl->lock, flags); 261 261 262 262 /* 263 263 * Setup the mux of the channel to route the signal of the pad ··· 567 567 if (!ctl) 568 568 return -ENOMEM; 569 569 570 - spin_lock_init(&ctl->lock); 570 + raw_spin_lock_init(&ctl->lock); 571 571 572 572 ctl->base = of_iomap(node, 0); 573 573 if (!ctl->base) {
+3 -3
drivers/irqchip/irq-pic32-evic.c
··· 161 161 return ret; 162 162 } 163 163 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) 167 167 { 168 168 struct evic_chip_data *priv = d->host_data; 169 169