Linux Media Controller development
 help / color / mirror / Atom feed
From: Bryan O'Donoghue <bod@kernel.org>
To: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>,
	Vikash Garodia <vikash.garodia@oss.qualcomm.com>,
	Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>,
	Abhinav Kumar <abhinav.kumar@linux.dev>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
	Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	Hungyu Lin <dennylin0707@gmail.com>,
	Stefan Schmidt <stefan.schmidt@linaro.org>,
	Hans Verkuil <hverkuil@kernel.org>
Cc: Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Wangao Wang <wangao.wang@oss.qualcomm.com>
Subject: Re: [PATCH v4 2/3] media: qcom: iris: Fix IRQ disable depth imbalance on watchdog interrupt
Date: Thu, 3 Dec 2026 09:18:29 +0000	[thread overview]
Message-ID: <a1556826-ec7c-49a2-9ab0-5268f7db64f1@kernel.org> (raw)
In-Reply-To: <20261203-fix-disable-irq-safely-v4-2-2774a9e036b2@oss.qualcomm.com>

On 03/12/2026 06:59, Vishnu Reddy wrote:
> Currently, the hard IRQ handler disables the IRQ for every interrupt
> to keep the level triggered IRQ from firing again until the threaded
> handler clears its source. The threaded handler then re-enables it for
> non-watchdog interrupts. Instead of doing this manually, IRQF_ONESHOT
> can be used, which keeps the IRQ masked until the threaded handler
> completes.
> 
> If power-off runs after the hard handler disables the IRQ but before
> the threaded handler updates core->intr_status, and the stale status
> indicates a non-watchdog interrupt, power-off disables the IRQ again.
> The watchdog handler does not re-enable the IRQ, so the two disables
> are not balanced by the single enable in power-on.
> 
> Request the IRQ with IRQF_ONESHOT and remove the hard IRQ handler.
> The watchdog interrupt stays asserted until the VPU is reset, so mask
> it in the wrapper interrupt mask register when it fires to prevent
> repeated triggering. The next power-on unmasks it again when it
> initializes the interrupts. Power-off disables the IRQ once and
> power-on enables it once.

Great.

> Fixes: bb8a95aa038e ("media: iris: implement power management")
> Cc: stable@vger.kernel.org
> Reviewed-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>

With the amount of change since the RB was given, I don't think this 
patch can continue to carry it. A significant change to code should also 
come with an honest appraisal of whether RB should be carried and "doing 
the right thing" if not.

I think this patch now requires a re-up for RB and TB since it has 
experienced non-trivial churn.

> Tested-by: Wangao Wang <wangao.wang@oss.qualcomm.com>
> Signed-off-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>

That said, I think this patch is correct now.

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

>   drivers/media/platform/qcom/iris/iris_hfi_common.c | 12 ++----------
>   drivers/media/platform/qcom/iris/iris_hfi_common.h |  1 -
>   drivers/media/platform/qcom/iris/iris_probe.c      |  5 +++--
>   drivers/media/platform/qcom/iris/iris_vpu_common.c | 13 +++++++++++--
>   drivers/media/platform/qcom/iris/iris_vpu_common.h |  1 +
>   5 files changed, 17 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_common.c b/drivers/media/platform/qcom/iris/iris_hfi_common.c
> index dad906d03fdc..ed8d6e0368b4 100644
> --- a/drivers/media/platform/qcom/iris/iris_hfi_common.c
> +++ b/drivers/media/platform/qcom/iris/iris_hfi_common.c
> @@ -90,13 +90,6 @@ int iris_hfi_core_init(struct iris_core *core)
>   	return hfi_ops->sys_interframe_powercollapse(core);
>   }
> 
> -irqreturn_t iris_hfi_isr(int irq, void *data)
> -{
> -	disable_irq_nosync(irq);
> -
> -	return IRQ_WAKE_THREAD;
> -}
> -
>   irqreturn_t iris_hfi_isr_handler(int irq, void *data)
>   {
>   	struct iris_core *core = data;
> @@ -107,14 +100,13 @@ irqreturn_t iris_hfi_isr_handler(int irq, void *data)
>   	mutex_lock(&core->lock);
>   	pm_runtime_mark_last_busy(core->dev);
>   	iris_vpu_clear_interrupt(core);
> +	if (iris_vpu_watchdog(core, core->intr_status))
> +		iris_vpu_mask_watchdog_interrupt(core);
>   	mutex_unlock(&core->lock);
> 
>   	if (core->hfi_sys_ops)
>   		core->hfi_sys_ops->sys_hfi_response_handler(core);
> 
> -	if (!iris_vpu_watchdog(core, core->intr_status))
> -		enable_irq(irq);
> -
>   	return IRQ_HANDLED;
>   }
> 
> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_common.h b/drivers/media/platform/qcom/iris/iris_hfi_common.h
> index 16099f9a25b6..366c9b81675c 100644
> --- a/drivers/media/platform/qcom/iris/iris_hfi_common.h
> +++ b/drivers/media/platform/qcom/iris/iris_hfi_common.h
> @@ -157,7 +157,6 @@ int iris_hfi_core_init(struct iris_core *core);
>   int iris_hfi_pm_suspend(struct iris_core *core);
>   int iris_hfi_pm_resume(struct iris_core *core);
> 
> -irqreturn_t iris_hfi_isr(int irq, void *data);
>   irqreturn_t iris_hfi_isr_handler(int irq, void *data);
> 
>   #endif
> diff --git a/drivers/media/platform/qcom/iris/iris_probe.c b/drivers/media/platform/qcom/iris/iris_probe.c
> index 343e44c6b9c4..cecd2282e29c 100644
> --- a/drivers/media/platform/qcom/iris/iris_probe.c
> +++ b/drivers/media/platform/qcom/iris/iris_probe.c
> @@ -311,9 +311,10 @@ static int iris_probe(struct platform_device *pdev)
>   	if (IS_ERR(core->ubwc_cfg))
>   		return PTR_ERR(core->ubwc_cfg);
> 
> -	ret = devm_request_threaded_irq(core->dev, core->irq, iris_hfi_isr,
> +	ret = devm_request_threaded_irq(core->dev, core->irq, NULL,
>   					iris_hfi_isr_handler,
> -					IRQF_TRIGGER_HIGH | IRQF_NO_AUTOEN,
> +					IRQF_TRIGGER_HIGH | IRQF_NO_AUTOEN |
> +					IRQF_ONESHOT,
>   					"iris", core);
>   	if (ret)
>   		return ret;
> diff --git a/drivers/media/platform/qcom/iris/iris_vpu_common.c b/drivers/media/platform/qcom/iris/iris_vpu_common.c
> index 1e183fc4e58c..a1bab1fb236a 100644
> --- a/drivers/media/platform/qcom/iris/iris_vpu_common.c
> +++ b/drivers/media/platform/qcom/iris/iris_vpu_common.c
> @@ -135,6 +135,16 @@ int iris_vpu_watchdog(struct iris_core *core, u32 intr_status)
>   	return 0;
>   }
> 
> +void iris_vpu_mask_watchdog_interrupt(struct iris_core *core)
> +{
> +	u32 wd_intr_mask = core->iris_platform_data->wd_intr_mask;
> +	u32 mask_val;
> +
> +	mask_val = readl(core->reg_base + WRAPPER_INTR_MASK);
> +	mask_val |= wd_intr_mask;
> +	writel(mask_val, core->reg_base + WRAPPER_INTR_MASK);
> +}
> +
>   int iris_vpu_prepare_pc(struct iris_core *core)
>   {
>   	u32 wfi_status, idle_status, pc_ready;
> @@ -239,8 +249,7 @@ void iris_vpu_power_off(struct iris_core *core)
>   	core->iris_platform_data->vpu_ops->power_off_controller(core);
>   	iris_unset_icc_bw(core);
> 
> -	if (!iris_vpu_watchdog(core, core->intr_status))
> -		disable_irq_nosync(core->irq);
> +	disable_irq_nosync(core->irq);
>   }
> 
>   int iris_vpu_power_on_controller(struct iris_core *core)
> diff --git a/drivers/media/platform/qcom/iris/iris_vpu_common.h b/drivers/media/platform/qcom/iris/iris_vpu_common.h
> index a62b6184bde7..7ab77c786e35 100644
> --- a/drivers/media/platform/qcom/iris/iris_vpu_common.h
> +++ b/drivers/media/platform/qcom/iris/iris_vpu_common.h
> @@ -32,6 +32,7 @@ int iris_vpu_boot_firmware(struct iris_core *core);
>   void iris_vpu_raise_interrupt(struct iris_core *core);
>   void iris_vpu_clear_interrupt(struct iris_core *core);
>   int iris_vpu_watchdog(struct iris_core *core, u32 intr_status);
> +void iris_vpu_mask_watchdog_interrupt(struct iris_core *core);
>   int iris_vpu_prepare_pc(struct iris_core *core);
>   int iris_vpu_power_on_controller(struct iris_core *core);
>   int iris_vpu_power_on_hw(struct iris_core *core);
> 
> --
> 2.34.1


  reply	other threads:[~2026-12-03  9:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  6:59 [PATCH v4 0/3] media: qcom: iris: Fix IRQ synchronization during power-off Vishnu Reddy
2026-12-03  6:59 ` [PATCH v4 1/3] Revert "media: qcom: iris: use disable_irq() during power-off" Vishnu Reddy
2026-12-03  6:59 ` [PATCH v4 2/3] media: qcom: iris: Fix IRQ disable depth imbalance on watchdog interrupt Vishnu Reddy
2026-12-03  9:18   ` Bryan O'Donoghue [this message]
2026-12-03  6:59 ` [PATCH v4 3/3] media: qcom: iris: Skip register access in IRQ handler after power-off Vishnu Reddy

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=a1556826-ec7c-49a2-9ab0-5268f7db64f1@kernel.org \
    --to=bod@kernel.org \
    --cc=abhinav.kumar@linux.dev \
    --cc=bryan.odonoghue@linaro.org \
    --cc=busanna.reddy@oss.qualcomm.com \
    --cc=dennylin0707@gmail.com \
    --cc=dikshita.agarwal@oss.qualcomm.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=hverkuil@kernel.org \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=stefan.schmidt@linaro.org \
    --cc=vikash.garodia@oss.qualcomm.com \
    --cc=wangao.wang@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