The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Stephan Gerhold <stephan.gerhold@linaro.org>
To: Shawn Guo <shengchao.guo@oss.qualcomm.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Abel Vesa <abel.vesa@oss.qualcomm.com>,
	linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] remoteproc: qcom: q6v5: Ignore stale handover IRQ delivered on attach
Date: Fri, 31 Jul 2026 10:42:20 +0200	[thread overview]
Message-ID: <amxf7MODINj26a4m@linaro.org> (raw)
In-Reply-To: <20260731025655.2642860-3-shengchao.guo@oss.qualcomm.com>

On Fri, Jul 31, 2026 at 10:56:54AM +0800, Shawn Guo wrote:
> Commit bb7c5d6f5b41 ("remoteproc: qcom: q6v5: Make handover IRQ one-shot")
> dropped the check that ignored a handover interrupt after handover
> had already been issued, relying instead on disabling the IRQ after
> its first delivery to make it one-shot.
> 
> That is not sufficient for qcom_pas_attach(): when attaching to a
> remote processor that was already booted by the bootloader, handover
> has already happened out-of-band, before this driver ever probed.
> qcom_pas_attach() sets handover_issued = true and unmasks the
> handover IRQ to keep the enable/disable tracking consistent, but the
> transition that signals handover is latched at the interrupt
> controller while masked, so unmasking still delivers that one IRQ.
> 
> Since this driver instance never ran qcom_pas_start() for that boot,
> it never took the proxy power-domain/clock/regulator votes that
> q6v5->handover() releases. Running the handover callback for this
> stale, already-accounted-for signal disables those votes without a
> matching enable, producing:
> 
>   genpd genpd:0:4c00000.remoteproc: Runtime PM usage count underflow!
>   genpd genpd:1:4c00000.remoteproc: Runtime PM usage count underflow!
> 
> Restore the early-return when handover_issued is already set, so a
> stale IRQ delivered on attach is dropped after being disabled instead
> of re-running the handover callback.
> 
> Fixes: bb7c5d6f5b41 ("remoteproc: qcom: q6v5: Make handover IRQ one-shot")
> Assisted-by: Claude:claude-sonnet-5
> Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
> ---
>  drivers/remoteproc/qcom_q6v5.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/remoteproc/qcom_q6v5.c b/drivers/remoteproc/qcom_q6v5.c
> index 10fa38f264c8..e715083846aa 100644
> --- a/drivers/remoteproc/qcom_q6v5.c
> +++ b/drivers/remoteproc/qcom_q6v5.c
> @@ -210,10 +210,23 @@ static irqreturn_t q6v5_handover_interrupt(int irq, void *data)
>  {
>  	struct qcom_q6v5 *q6v5 = data;
>  
> -	q6v5->handover_issued = true;
> -
>  	qcom_q6v5_handover_irq_disable(q6v5, false);
>  
> +	/*
> +	 * When attaching to an already-running remote processor,
> +	 * handover_issued is set before the IRQ is unmasked, since the
> +	 * handover already happened out-of-band, before this driver probed.
> +	 * The transition that signals it is latched at the interrupt
> +	 * controller while masked, so unmasking still delivers this one
> +	 * IRQ. Ignore it: this driver instance never enabled the resources
> +	 * (proxy PDs, clocks, etc.) that the handover callback would tear
> +	 * down.
> +	 */
> +	if (q6v5->handover_issued)
> +		return IRQ_HANDLED;
> +

The goal of Abel's patch was to have the handover interrupt unmasked
only when needed. If you just bail out here and do nothing then there
was no need to unmask it in the first place. Can you just drop enabling
the handover IRQ in qcom_pas_attach()?

Thanks,
Stephan

  parent reply	other threads:[~2026-07-31  8:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31  2:56 [PATCH 0/2] remoteproc: qcom: q6v5: Fix handover IRQ regressions on attach Shawn Guo
2026-07-31  2:56 ` [PATCH 1/2] remoteproc: qcom: q6v5_pas: Fix unbalanced handover IRQ enable " Shawn Guo
2026-07-31  6:57   ` Abel Vesa
2026-07-31  2:56 ` [PATCH 2/2] remoteproc: qcom: q6v5: Ignore stale handover IRQ delivered " Shawn Guo
2026-07-31  7:00   ` Abel Vesa
2026-07-31  8:42   ` Stephan Gerhold [this message]
2026-07-31 13:02     ` Shawn Guo
2026-07-31 13:22       ` Stephan Gerhold

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=amxf7MODINj26a4m@linaro.org \
    --to=stephan.gerhold@linaro.org \
    --cc=abel.vesa@oss.qualcomm.com \
    --cc=andersson@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=shengchao.guo@oss.qualcomm.com \
    /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