public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Bryan O'Donoghue <bod@kernel.org>
To: 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>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Saravana Kannan <saravanak@kernel.org>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Stefan Schmidt <stefan.schmidt@linaro.org>,
	Hans Verkuil <hverkuil@kernel.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Vishnu Reddy <busanna.reddy@oss.qualcomm.com>,
	Hans Verkuil <hverkuil+cisco@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	iommu@lists.linux.dev,
	Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Subject: Re: [PATCH 4/7] media: iris: Switch to hardware mode after firmware boot
Date: Mon, 2 Feb 2026 15:09:26 +0000	[thread overview]
Message-ID: <dd36c365-cffb-4fac-bf11-40e4896cbab5@kernel.org> (raw)
In-Reply-To: <20260126-kaanapali-iris-v1-4-e2646246bfc1@oss.qualcomm.com>

On 26/01/2026 12:25, Vikash Garodia wrote:
> Currently the driver switches the vcodec GDSC to hardware (HW) mode
> before firmware load and boot sequence. GDSC can be powered off,
> keeping in hw mode, thereby the vcodec registers programmed in TrustZone
> (TZ) carry default (reset) values.
> Move the transition to HW mode after firmware load and boot sequence.
> 
> The bug was exposed with driver configuring different stream ids to
> different devices via iommu-map. With registers carrying reset values,
> VPU would not generate desired stream-id, thereby leading to SMMU fault.
> 
> Fixes: dde659d37036 ("media: iris: Introduce vpu ops for vpu4 with necessary hooks")
> Co-developed-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
> Signed-off-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
> Signed-off-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
> ---
>   drivers/media/platform/qcom/iris/iris_core.c       |  4 ++++
>   drivers/media/platform/qcom/iris/iris_hfi_common.c |  4 ++++
>   drivers/media/platform/qcom/iris/iris_vpu2.c       |  1 +
>   drivers/media/platform/qcom/iris/iris_vpu3x.c      |  9 +++-----
>   drivers/media/platform/qcom/iris/iris_vpu4x.c      | 24 ++++++++++++----------
>   drivers/media/platform/qcom/iris/iris_vpu_common.c | 16 +++++++++------
>   drivers/media/platform/qcom/iris/iris_vpu_common.h |  3 +++
>   7 files changed, 38 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/iris/iris_core.c b/drivers/media/platform/qcom/iris/iris_core.c
> index 8406c48d635b6eba0879396ce9f9ae2292743f09..dbaac01eb15a0e622e85635fddd29c1f7fc18662 100644
> --- a/drivers/media/platform/qcom/iris/iris_core.c
> +++ b/drivers/media/platform/qcom/iris/iris_core.c
> @@ -75,6 +75,10 @@ int iris_core_init(struct iris_core *core)
>   	if (ret)
>   		goto error_unload_fw;
> 
> +	ret = iris_vpu_switch_to_hwmode(core);
> +	if (ret)
> +		goto error_unload_fw;
> +
>   	ret = iris_hfi_core_init(core);
>   	if (ret)
>   		goto error_unload_fw;
> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_common.c b/drivers/media/platform/qcom/iris/iris_hfi_common.c
> index 92112eb16c11048e28230a2926dfb46e3163aada..621c66593d88d47ef3438c98a07cb29421c4e375 100644
> --- a/drivers/media/platform/qcom/iris/iris_hfi_common.c
> +++ b/drivers/media/platform/qcom/iris/iris_hfi_common.c
> @@ -159,6 +159,10 @@ int iris_hfi_pm_resume(struct iris_core *core)
>   	if (ret)
>   		goto err_suspend_hw;
> 
> +	ret = iris_vpu_switch_to_hwmode(core);
> +	if (ret)
> +		goto err_suspend_hw;
> +
>   	ret = ops->sys_interframe_powercollapse(core);
>   	if (ret)
>   		goto err_suspend_hw;
> diff --git a/drivers/media/platform/qcom/iris/iris_vpu2.c b/drivers/media/platform/qcom/iris/iris_vpu2.c
> index 9c103a2e4e4eafee101a8a9b168fdc8ca76e277d..01ef40f3895743b3784464e2d5ba2de1aeca5a4a 100644
> --- a/drivers/media/platform/qcom/iris/iris_vpu2.c
> +++ b/drivers/media/platform/qcom/iris/iris_vpu2.c
> @@ -44,4 +44,5 @@ const struct vpu_ops iris_vpu2_ops = {
>   	.power_off_controller = iris_vpu_power_off_controller,
>   	.power_on_controller = iris_vpu_power_on_controller,
>   	.calc_freq = iris_vpu2_calc_freq,
> +	.set_hwmode = iris_vpu_set_hwmode,
>   };
> diff --git a/drivers/media/platform/qcom/iris/iris_vpu3x.c b/drivers/media/platform/qcom/iris/iris_vpu3x.c
> index fe4423b951b1e9e31d06dffc69d18071cc985731..3dad47be78b58f6cd5ed6f333b3376571a04dbf0 100644
> --- a/drivers/media/platform/qcom/iris/iris_vpu3x.c
> +++ b/drivers/media/platform/qcom/iris/iris_vpu3x.c
> @@ -234,14 +234,8 @@ static int iris_vpu35_power_on_hw(struct iris_core *core)
>   	if (ret)
>   		goto err_disable_hw_free_clk;
> 
> -	ret = dev_pm_genpd_set_hwmode(core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN], true);
> -	if (ret)
> -		goto err_disable_hw_clk;
> -
>   	return 0;
> 
> -err_disable_hw_clk:
> -	iris_disable_unprepare_clock(core, IRIS_HW_CLK);
>   err_disable_hw_free_clk:
>   	iris_disable_unprepare_clock(core, IRIS_HW_FREERUN_CLK);
>   err_disable_axi_clk:
> @@ -266,6 +260,7 @@ const struct vpu_ops iris_vpu3_ops = {
>   	.power_off_controller = iris_vpu_power_off_controller,
>   	.power_on_controller = iris_vpu_power_on_controller,
>   	.calc_freq = iris_vpu3x_vpu4x_calculate_frequency,
> +	.set_hwmode = iris_vpu_set_hwmode,
>   };
> 
>   const struct vpu_ops iris_vpu33_ops = {
> @@ -274,6 +269,7 @@ const struct vpu_ops iris_vpu33_ops = {
>   	.power_off_controller = iris_vpu33_power_off_controller,
>   	.power_on_controller = iris_vpu_power_on_controller,
>   	.calc_freq = iris_vpu3x_vpu4x_calculate_frequency,
> +	.set_hwmode = iris_vpu_set_hwmode,
>   };
> 
>   const struct vpu_ops iris_vpu35_ops = {
> @@ -283,4 +279,5 @@ const struct vpu_ops iris_vpu35_ops = {
>   	.power_on_controller = iris_vpu35_vpu4x_power_on_controller,
>   	.program_bootup_registers = iris_vpu35_vpu4x_program_bootup_registers,
>   	.calc_freq = iris_vpu3x_vpu4x_calculate_frequency,
> +	.set_hwmode = iris_vpu_set_hwmode,
>   };
> diff --git a/drivers/media/platform/qcom/iris/iris_vpu4x.c b/drivers/media/platform/qcom/iris/iris_vpu4x.c
> index a8db02ce5c5ec583c4027166b34ce51d3d683b4e..02e100a4045fced33d7a3545b632cc5f0955233f 100644
> --- a/drivers/media/platform/qcom/iris/iris_vpu4x.c
> +++ b/drivers/media/platform/qcom/iris/iris_vpu4x.c
> @@ -252,21 +252,10 @@ static int iris_vpu4x_power_on_hardware(struct iris_core *core)
>   		ret = iris_vpu4x_power_on_apv(core);
>   		if (ret)
>   			goto disable_hw_clocks;
> -
> -		iris_vpu4x_ahb_sync_reset_apv(core);
>   	}
> 
> -	iris_vpu4x_ahb_sync_reset_hardware(core);
> -
> -	ret = iris_vpu4x_genpd_set_hwmode(core, true, efuse_value);
> -	if (ret)
> -		goto disable_apv_power_domain;
> -
>   	return 0;
> 
> -disable_apv_power_domain:
> -	if (!(efuse_value & DISABLE_VIDEO_APV_BIT))
> -		iris_vpu4x_power_off_apv(core);
>   disable_hw_clocks:
>   	iris_vpu4x_disable_hardware_clocks(core, efuse_value);
>   disable_vpp1_power_domain:
> @@ -359,6 +348,18 @@ static void iris_vpu4x_power_off_hardware(struct iris_core *core)
>   	iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN]);
>   }
> 
> +static int iris_vpu4x_set_hwmode(struct iris_core *core)
> +{
> +	u32 efuse_value = readl(core->reg_base + WRAPPER_EFUSE_MONITOR);
> +
> +	if (!(efuse_value & DISABLE_VIDEO_APV_BIT))
> +		iris_vpu4x_ahb_sync_reset_apv(core);
> +
> +	iris_vpu4x_ahb_sync_reset_hardware(core);
> +
> +	return iris_vpu4x_genpd_set_hwmode(core, true, efuse_value);
I'd like to see something in the commit log about the efuse value. What 
is it, why does it appear etc.

Because just to be difficult you are not doing a 1:1 switch to hw_mode 
here, you're also introducing contingent logic.

---
bod

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

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-26 12:25 [PATCH 0/7] media: iris: add support for kaanapali platform Vikash Garodia
2026-01-26 12:25 ` [PATCH 1/7] media: dt-bindings: qcom-kaanapali-iris: Add kaanapali video codec binding Vikash Garodia
2026-01-26 13:46   ` Rob Herring (Arm)
2026-01-27 15:09   ` Dmitry Baryshkov
2026-02-17 13:43     ` Vikash Garodia
2026-02-17 14:36       ` Dmitry Baryshkov
2026-02-17 15:34         ` Vikash Garodia
2026-02-17 16:15           ` Dmitry Baryshkov
2026-02-17 18:09             ` Vikash Garodia
2026-02-17 18:35               ` Dmitry Baryshkov
2026-02-17 17:05           ` Krzysztof Kozlowski
2026-01-26 12:25 ` [PATCH 2/7] of: factor out of_map_id() code Vikash Garodia
2026-02-02 14:52   ` Bryan O'Donoghue
2026-02-03 10:13     ` Vijayanand Jitta
2026-02-04  1:11       ` Dmitry Baryshkov
2026-02-05  8:09         ` Vijayanand Jitta
2026-02-05 14:53           ` Dmitry Baryshkov
2026-01-26 12:25 ` [PATCH 3/7] of/iommu: add multi-map support Vikash Garodia
2026-01-27 11:45   ` Dmitry Baryshkov
2026-01-27 13:51     ` Nicolas Dufresne
2026-01-27 14:20     ` Robin Murphy
2026-02-02 10:56       ` Vijayanand Jitta
2026-02-17 13:08       ` Vikash Garodia
2026-03-03 18:50         ` Vikash Garodia
2026-02-02 14:57   ` Bryan O'Donoghue
2026-02-03 10:52     ` Vijayanand Jitta
2026-01-26 12:25 ` [PATCH 4/7] media: iris: Switch to hardware mode after firmware boot Vikash Garodia
2026-02-02 15:09   ` Bryan O'Donoghue [this message]
2026-02-17 14:11     ` Vikash Garodia
2026-01-26 12:25 ` [PATCH 5/7] media: iris: add context bank devices using iommu-map Vikash Garodia
2026-01-27 14:49   ` Robin Murphy
2026-02-02 12:00     ` Vikash Garodia
2026-02-17 13:15     ` Vikash Garodia
2026-01-26 12:25 ` [PATCH 6/7] media: iris: add helper to select context bank device Vikash Garodia
2026-01-26 12:25 ` [PATCH 7/7] media: iris: Add platform data for kaanapali Vikash Garodia
2026-01-26 13:38 ` [PATCH 0/7] media: iris: add support for kaanapali platform Dmitry Baryshkov
2026-01-27 11:26   ` Vikash Garodia
2026-01-27 11:52     ` Dmitry Baryshkov
2026-01-27 15:10       ` Nicolas Dufresne
2026-01-27 15:59         ` Vikash Garodia
2026-01-27 16:58           ` Nicolas Dufresne
2026-01-27 16:11       ` Vikash Garodia
2026-01-27 16:49         ` Dmitry Baryshkov

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=dd36c365-cffb-4fac-bf11-40e4896cbab5@kernel.org \
    --to=bod@kernel.org \
    --cc=abhinav.kumar@linux.dev \
    --cc=bryan.odonoghue@linaro.org \
    --cc=busanna.reddy@oss.qualcomm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dikshita.agarwal@oss.qualcomm.com \
    --cc=hverkuil+cisco@kernel.org \
    --cc=hverkuil@kernel.org \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=krzk+dt@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=robh@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=saravanak@kernel.org \
    --cc=stefan.schmidt@linaro.org \
    --cc=vikash.garodia@oss.qualcomm.com \
    --cc=will@kernel.org \
    /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