[PATCH RFC 2/2] irqchip/sifive-plic: Add support for Renesas RZ/Five SoC

Marc Zyngier maz at kernel.org
Wed Jun 8 03:27:47 PDT 2022


On Tue, 07 Jun 2022 13:41:16 +0100,
"Lad, Prabhakar" <prabhakar.csengg at gmail.com> wrote:
> 
> Hi Marc,
> 
> On Mon, Jun 6, 2022 at 4:41 PM Marc Zyngier <maz at kernel.org> wrote:
> >
> > On Fri, 27 May 2022 12:05:38 +0100,
> > "Lad, Prabhakar" <prabhakar.csengg at gmail.com> wrote:
> > >
> > > I sometimes still see an interrupt miss!
> > >
> > > As per [0], we first need to claim the interrupt by reading the claim
> > > register which needs to be done in the ack callback (which should be
> > > doable) for edge interrupts, but the problem arises in the chained
> > > handler callback where it does claim the interrupt by reading the
> > > claim register.
> > >
> > > static void plic_handle_irq(struct irq_desc *desc)
> > > {
> > >     struct plic_handler *handler = this_cpu_ptr(&plic_handlers);
> > >     struct irq_chip *chip = irq_desc_get_chip(desc);
> > >     void __iomem *claim = handler->hart_base + CONTEXT_CLAIM;
> > >     irq_hw_number_t hwirq;
> > >
> > >     WARN_ON_ONCE(!handler->present);
> > >
> > >     chained_irq_enter(chip, desc);
> > >
> > >     while ((hwirq = readl(claim))) {
> > >         int err = generic_handle_domain_irq(handler->priv->irqdomain,
> > >                             hwirq);
> > >         if (unlikely(err))
> > >             pr_warn_ratelimited("can't find mapping for hwirq %lu\n",
> > >                     hwirq);
> > >     }
> > >
> > >     chained_irq_exit(chip, desc);
> > > }
> > >
> > > I was thinking I would get around by getting the irqdata in
> > > plic_handle_irq() callback using the irq_desc (struct irq_data *d =
> > > &desc->irq_data;) and check the d->hwirq but this will be always 9.
> > >
> > >         plic: interrupt-controller at 12c00000 {
> > >             compatible = "renesas-r9a07g043-plic";
> > >             #interrupt-cells = <2>;
> > >             #address-cells = <0>;
> > >             riscv,ndev = <543>;
> > >             interrupt-controller;
> > >             reg = <0x0 0x12c00000 0 0x400000>;
> > >             clocks = <&cpg CPG_MOD R9A07G043_NCEPLIC_ACLK>;
> > >             clock-names = "plic100ss";
> > >             power-domains = <&cpg>;
> > >             resets = <&cpg R9A07G043_NCEPLIC_ARESETN>;
> > >             interrupts-extended = <&cpu0_intc 11 &cpu0_intc 9>;
> > >         };
> > >
> > > Any pointers on how this could be done sanely.
> >
> > Why doesn't the chained interrupt also get the ack-aware irq_chip?
> >
> Sorry for being naive, could you please elaborate on this.

There are two main reasons why the above code fails: these interrupts
are not using either

- the irqchip you think they are using (which one then?),

- the interrupt flow they should be using.

Dumping /sys/kernel/debug/irq/irqs/$IRQ should give you a clue.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-riscv mailing list