[PATCH] soc: fujitsu: Add A64FX diagnostic interrupt driver

Arnd Bergmann arnd at arndb.de
Fri Feb 18 02:35:29 PST 2022


On Fri, Feb 18, 2022 at 10:20 AM Hitomi Hasegawa
<hasegawa-hitomi at fujitsu.com> wrote:
> +
> +static irqreturn_t a64fx_panic_interrupt_nmi(int irq, void *dev_id)
> +{
> +       nmi_panic(NULL, "a64fx_panic_interrupt: interrupt received\n");
> +
> +       return IRQ_HANDLED;
> +}
> +
> +static irqreturn_t a64fx_panic_interrupt_irq(int irq, void *dev_id)
> +{
> +       panic("a64fx_panic_interrupt: interrupt received\n");
> +
> +       return IRQ_HANDLED;
> +}

Is panic() the best action for this? I'm not familiar with this feature, but
it sounds like handle_sysrq() might be more appropriate. How does a
user trigger the event, and is there any sideband data that can be
sent along with the interrupt?

> +static void a64fx_diag_interrupt_clear(struct a64fx_diag_priv *priv)
> +{
> +       u32 mmsc;
> +       const void __iomem *diag_status_reg_addr;
> +
> +       diag_status_reg_addr = priv->mmsc_reg_base + BMC_DIAG_INTERRUPT_STATUS_OFFSET;
> +       mmsc = readl_relaxed(diag_status_reg_addr);
> +       if (mmsc & BMC_INTERRUPT_STATUS_MASK)
> +               writel_relaxed(BMC_INTERRUPT_STATUS_MASK, (void *)diag_status_reg_addr);
> +}

Normal driver code should use readl()/writel(), not
readl_relaxed()/writel_relaxed().
If you do need the relaxed versions, please add a comment explaining why,
otherwise change the code here and below.

       Arnd



More information about the linux-arm-kernel mailing list