Re: [PATCH v3 3/6] remoteproc: pru: Add support for PRU specific interrupt configuration

From: Lee Jones
Date: Tue Dec 08 2020 - 06:05:32 EST


On Mon, 07 Dec 2020, Mathieu Poirier wrote:

> On Fri, Dec 04, 2020 at 09:18:04PM +0100, Grzegorz Jaszczyk wrote:
> > The firmware blob can contain optional ELF sections: .resource_table
> > section and .pru_irq_map one. The second one contains the PRUSS
> > interrupt mapping description, which needs to be setup before powering
> > on the PRU core. To avoid RAM wastage this ELF section is not mapped to
> > any ELF segment (by the firmware linker) and therefore is not loaded to
> > PRU memory.
> >
> > The PRU interrupt configuration is handled within the PRUSS INTC irqchip
> > driver and leverages the system events to interrupt channels and host
> > interrupts mapping configuration. Relevant irq routing information is
> > passed through a special .pru_irq_map ELF section (for interrupts routed
> > to and used by PRU cores) or via the PRU application's device tree node
> > (for interrupts routed to and used by the main CPU). The mappings are
> > currently programmed during the booting/shutdown of the PRU.
> >
> > The interrupt configuration passed through .pru_irq_map ELF section is
> > optional. It varies on specific firmware functionality and therefore
> > have to be unwinded during PRU stop and performed again during
> > PRU start.
> >
> > Co-developed-by: Suman Anna <s-anna@xxxxxx>
> > Signed-off-by: Suman Anna <s-anna@xxxxxx>
> > Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@xxxxxxxxxx>
> > ---

[...]

> > drivers/remoteproc/pru_rproc.c | 180 +++++++++++++++++++++++++++++++++
> > drivers/remoteproc/pru_rproc.h | 46 +++++++++
> > 2 files changed, 226 insertions(+)
> > create mode 100644 drivers/remoteproc/pru_rproc.h
> >
> > diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c
> > index d33392bbd8af..4ef59d15d888 100644
> > --- a/drivers/remoteproc/pru_rproc.c
> > +++ b/drivers/remoteproc/pru_rproc.c
> > @@ -11,13 +11,16 @@
> > */

[...]

> > +static int pru_handle_intrmap(struct rproc *rproc)
> > +{
> > + struct device *dev = rproc->dev.parent;
> > + struct pru_rproc *pru = rproc->priv;
> > + struct pru_irq_rsc *rsc = pru->pru_interrupt_map;
> > + struct irq_fwspec fwspec;
> > + struct device_node *irq_parent;
> > + int i, ret = 0;
> > +
> > + /* not having pru_interrupt_map is not an error */
> > + if (!rsc)
> > + return 0;
> > +
> > + /* currently supporting only type 0 */
> > + if (rsc->type != 0) {
> > + dev_err(dev, "unsupported rsc type: %d\n", rsc->type);
> > + return -EINVAL;
> > + }
> > +
> > + if (rsc->num_evts > MAX_PRU_SYS_EVENTS)
> > + return -EINVAL;
> > +
> > + if (sizeof(*rsc) + rsc->num_evts * sizeof(struct pruss_int_map) !=
> > + pru->pru_interrupt_map_sz)
> > + return -EINVAL;
> > +
> > + pru->evt_count = rsc->num_evts;
> > + pru->mapped_irq = kcalloc(pru->evt_count, sizeof(int), GFP_KERNEL);
>
> sizeof(unsigned int)

Would you mind trimming your replies please?

Brain grepping through 200+ lines of quote for a one line review
comment is a little frustrating.

TIA.

--
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog