public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: linux-renesas-soc@vger.kernel.org, roman.gushchin@linux.dev
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Marek Vasut <marek.vasut@mailbox.org>,
	linux-kernel@vger.kernel.org,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	Jassi Brar <jassisinghbrar@gmail.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Magnus Damm <magnus.damm@gmail.com>
Subject: Sashiko review (Re: [PATCH v4 2/3] soc: renesas: Add Renesas R-Car MFIS driver)
Date: Thu, 2 Apr 2026 17:08:32 +0200	[thread overview]
Message-ID: <ac6GcLutDew1wMkS@shikoro> (raw)
In-Reply-To: <20260402112709.13002-3-wsa+renesas@sang-engineering.com>

[-- Attachment #1: Type: text/plain, Size: 2629 bytes --]


Answering Sashiko:

> > +static irqreturn_t mfis_mb_iicr_interrupt(int irq, void *data)
> > +{
> > +	struct mbox_chan *chan = data;
> > +	struct mfis_priv *priv = mfis_mb_mbox_to_priv(chan->mbox);
> > +	struct mfis_chan_priv *chan_priv = chan->con_priv;
> > +
> > +	mbox_chan_received_data(chan, NULL);
> > +	/* Stop remote(!) doorbell */
> > +	mfis_write(&priv->mbox_reg, chan_priv->reg, 0);
> Does this clear the correct register for bidirectional channels?
> In mfis_mb_of_xlate(), for bidirectional channels (!mb_channels_are_unidir),
> a single register is stored in chan_priv->reg. 
> When the receive interrupt triggers, this writes 0 to chan_priv->reg. If
> this points to the transmit register, it looks like it would fail to clear
> the receive interrupt and inadvertently cancel pending outgoing
> transmissions.
> Could this lead to an interrupt storm?

While technically correct, this does not matter in practice. The HW with
bidirectional channels looks quite different and will need a different
interrupt handler. Sashiko cannot detect this because the part for
bidirectional channels will be added incrementally once HW is available.

> > +static int mfis_mb_startup(struct mbox_chan *chan)
> > +{
> > +	struct mfis_chan_priv *chan_priv = chan->con_priv;
> > +
> > +	if (!chan_priv->irq)
> > +		return 0;
> > +
> > +	return request_irq(chan_priv->irq, mfis_mb_iicr_interrupt, 0,
> > +			   dev_name(chan->mbox->dev), chan);
> > +}
> > +
> > +static void mfis_mb_shutdown(struct mbox_chan *chan)
> > +{
> > +	struct mfis_chan_priv *chan_priv = chan->con_priv;
> > +
> > +	if (chan_priv->irq)
> > +		free_irq(chan_priv->irq, chan);
> > +}
> What happens if request_irq() fails in mfis_mb_startup()?
> If request_irq() returns an error, the mailbox framework handles the startup
> failure by calling the shutdown() callback.
> Since chan_priv->irq is populated earlier during of_xlate(), it will be
> non-zero here. Will this cause free_irq() to be called on an IRQ that was
> never successfully allocated, triggering a warning?

Uuuhh, yes! But this is not a problem of this driver but more of the
subsystem. It is definitely not intuitive that shutdown() is called when
startup() failed. There are more mailbox drivers which fell into this
trap, mostly by freeing an irq they never got. I will have a look at
this, but as said, I think it should be solved on subsystem level.

While this adds another item to my todo-list, it also means that none of
the above issues are related to the driver itself \o/ Looks like it is
good to go upstream, finally!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-04-02 15:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-02 11:27 [PATCH v4 0/3] soc: renesas: add MFIS driver Wolfram Sang
2026-04-02 11:27 ` [PATCH v4 1/3] dt-bindings: soc: renesas: Document MFIS IP core Wolfram Sang
2026-04-02 11:27 ` [PATCH v4 2/3] soc: renesas: Add Renesas R-Car MFIS driver Wolfram Sang
2026-04-02 15:08   ` Wolfram Sang [this message]
2026-04-02 11:27 ` [PATCH v4 3/3] soc: renesas: add X5H PRR support Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ac6GcLutDew1wMkS@shikoro \
    --to=wsa+renesas@sang-engineering.com \
    --cc=geert+renesas@glider.be \
    --cc=jassisinghbrar@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=marek.vasut@mailbox.org \
    --cc=roman.gushchin@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox