Re: [PATCH v1 4/5] irqchip: starfive: Increase the interrupt source number up to 64

Thomas Gleixner
2026-04-10T14:37:05Z

On Fri, Apr 10 2026 at 02:01, Changhuang Liang wrote:

> From: Mason Huo <mason.huo@starfivetech.com>
>
> StarFive JHB100 SoC interrupt controller actually supports 64 interrupt
> sources, the original code only supported up to 32. now it is extended
> to 64.
>
> Signed-off-by: Mason Huo <mason.huo@starfivetech.com>
> Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
> ---
> drivers/irqchip/irq-starfive-jhb100-intc.c | 43 ++++++++++++++--------
> 1 file changed, 28 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/irqchip/irq-starfive-jhb100-intc.c b/drivers/irqchip/irq-starfive-jhb100-intc.c
> index 312a4634870a..d5ecbb603a58 100644
> --- a/drivers/irqchip/irq-starfive-jhb100-intc.c
> +++ b/drivers/irqchip/irq-starfive-jhb100-intc.c
> @@ -18,10 +18,11 @@
> #include <linux/reset.h>
> #include <linux/spinlock.h>
>
> -#define STARFIVE_INTC_SRC0_CLEAR 0x10
> -#define STARFIVE_INTC_SRC0_MASK 0x14
> -#define STARFIVE_INTC_SRC0_INT 0x1c
> +#define STARFIVE_INTC_SRC_CLEAR(n) (0x10 + ((n) * 0x20))
> +#define STARFIVE_INTC_SRC_MASK(n) (0x14 + ((n) * 0x20))
> +#define STARFIVE_INTC_SRC_INT(n) (0x1c + ((n) * 0x20))
>
> +#define STARFIVE_INTC_NUM 2
> #define STARFIVE_INTC_SRC_IRQ_NUM 32
>
> struct starfive_irq_chip {
> @@ -53,18 +54,26 @@ static void starfive_intc_bit_clear(struct starfive_irq_chip *irqc,
> static void starfive_intc_unmask(struct irq_data *d)
> {
> struct starfive_irq_chip *irqc = irq_data_get_irq_chip_data(d);
> + int i, bitpos;
> +
> + i = d->hwirq / STARFIVE_INTC_SRC_IRQ_NUM;
> + bitpos = d->hwirq % STARFIVE_INTC_SRC_IRQ_NUM;
>
> raw_spin_lock(&irqc->lock);
> - starfive_intc_bit_clear(irqc, STARFIVE_INTC_SRC0_MASK, BIT(d->hwirq));
> + starfive_intc_bit_clear(irqc, STARFIVE_INTC_SRC_MASK(i), BIT(bitpos));
> raw_spin_unlock(&irqc->lock);
> }

As you are touching this code, please convert the locking to guard()

guard(raw_spinlock)(&irqc->lock);
starfive_intc_bit_clear(irqc, STARFIVE_INTC_SRC0_MASK, BIT(d->hwirq));

> + for (i = 0; i < STARFIVE_INTC_NUM; i++) {

for (int i = 0; ...)

Thanks,

tglx