[PATCH v3 07/23] mailbox: Add RISC-V SBI message proxy (MPXY) based mailbox driver
Anup Patel
apatel at ventanamicro.com
Tue May 20 23:08:50 PDT 2025
On Tue, May 13, 2025 at 12:24 AM Thomas Gleixner <tglx at linutronix.de> wrote:
>
> On Sun, May 11 2025 at 19:09, Anup Patel wrote:
> > +
> > +static irqreturn_t mpxy_mbox_irq_event(int irq, void *dev_id)
> > +{
> > + /* We only have MSI for notification so just wakeup IRQ thread */
> > + return IRQ_WAKE_THREAD;
>
> I was idly reading through this because I looked at the irq chip.
>
> This function is competely pointless.
>
> > +}
> > +
> > +static irqreturn_t mpxy_mbox_irq_thread(int irq, void *dev_id)
> > +{
> > + mpxy_mbox_peek_data(dev_id);
> > + return IRQ_HANDLED;
> > +}
> > +
> > +static int mpxy_mbox_setup_msi(struct mbox_chan *chan,
> > + struct mpxy_mbox_channel *mchan)
> > +{
> > + struct device *dev = mchan->mbox->dev;
> > + int rc;
> > +
> > + /* Do nothing if MSI not supported */
> > + if (mchan->msi_irq == U32_MAX)
> > + return 0;
> > +
> > + /* Fail if MSI already enabled */
> > + if (mchan->attrs.msi_control)
> > + return -EALREADY;
> > +
> > + /* Request channel MSI handler */
> > + rc = request_threaded_irq(mchan->msi_irq,
> > + mpxy_mbox_irq_event,
> > + mpxy_mbox_irq_thread,
> > + 0, dev_name(dev), chan);
>
> Just do:
>
> rc = request_threaded_irq(mchan->msi_irq, NULL, mpxy_mbox_irq_thread,
> 0, dev_name(dev), chan);
>
> and be done with it. The core code will happily wake up your thread.
I did not see the irq_default_primary_handler() set by irq core.
Thanks for catching it, I will update in the next revision.
Regards,
Anup
More information about the linux-riscv
mailing list