From: sashiko-bot@kernel.org
To: "Neil Armstrong" <neil.armstrong@linaro.org>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
media-ci@linuxtv.org
Subject: Re: [PATCH 1/2] media: iris: add firmware loading in EL2
Date: Wed, 02 Dec 2026 10:08:07 +0000 [thread overview]
Message-ID: <sashiko-outbox-245388@kernel.org> (raw)
In-Reply-To: <20261202-topic-sm8650-el2-iris-v1-1-18a504583922@linaro.org>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] media: iris: double unregister of cb devices via
iris_deinit_cb_devs()
- [Medium] media: iris: wrong pointer checked on error path in
iris_init_cb_devs()
- [Medium] media: iris: unclocked MMIO write in iris_fw_unload_no_tz()
on PM error
--
commit d845ca11020d998847969f004d5e9f1153fc246c
Author: Stephan Gerhold <stephan.gerhold@linaro.org>
media: iris: add firmware loading in EL2
This commit adds support for loading video firmware on platforms running in
EL2 without TrustZone PAS support by using a dedicated video-firmware
context bank device and direct register resets.
> diff --git a/drivers/media/platform/qcom/iris/iris_firmware.c b/drivers/media/platform/qcom/iris/iris_firmware.c
> index 21f57d37da187..7c6278b7a8b68 100644
> --- a/drivers/media/platform/qcom/iris/iris_firmware.c
> +++ b/drivers/media/platform/qcom/iris/iris_firmware.c
[ ... ]
> @@ -171,6 +187,72 @@ static void iris_detect_firmware(struct iris_core *core, const char *fw_name,
> core->iris_firmware_desc = desc;
> }
>
[ ... ]
> +static int iris_fw_unload_no_tz(struct iris_core *core)
> +{
> + struct iommu_domain *domain = iommu_get_domain_for_dev(core->fw_dev);
> + struct iris_firmware_state *state = dev_get_drvdata(core->fw_dev);
> + size_t ret;
> +
> + writel(WRAPPER_XTSS_SW_RESET_BIT, core->reg_base + WRAPPER_TZ_XTSS_SW_RESET);
[Severity: Medium]
Can this writel() access unclocked VPU registers if runtime PM resume fails
during core deinitialization?
In iris_core_deinit(), iris_fw_unload() is called even when
pm_runtime_resume_and_get() returns an error:
drivers/media/platform/qcom/iris/iris_core.c:iris_core_deinit() {
...
ret = pm_runtime_resume_and_get(core->dev);
mutex_lock(&core->lock);
if (core->state != IRIS_CORE_DEINIT) {
iris_fw_unload(core);
if (!ret)
iris_vpu_power_off(core);
...
}
Unlike qcom_pas_shutdown(), iris_fw_unload_no_tz() performs a direct MMIO
write to WRAPPER_TZ_XTSS_SW_RESET, which will trigger a synchronous
external abort if the VPU power domain and clocks are still off.
[ ... ]
> diff --git a/drivers/media/platform/qcom/iris/iris_probe.c b/drivers/media/platform/qcom/iris/iris_probe.c
> index 3c6c170a3d75f..d03d19cb7edb2 100644
> --- a/drivers/media/platform/qcom/iris/iris_probe.c
> +++ b/drivers/media/platform/qcom/iris/iris_probe.c
> @@ -257,9 +258,17 @@ static int iris_init_cb_devs(struct iris_core *core)
>
> core->p_dev = dev;
>
> + dev = iris_create_cb_dev(core, "video-firmware");
> + if (IS_ERR(dev))
> + goto unreg_np_dev;
> +
> + core->fw_dev = dev;
> +
> return 0;
>
> unreg_np_dev:
> + if (core->fw_dev)
> + platform_device_unregister(to_platform_device(core->fw_dev));
> if (core->np_dev)
> platform_device_unregister(to_platform_device(core->np_dev));
> core->np_dev = NULL;
[Severity: Medium]
Should the unreg_np_dev error path check and clear core->p_dev instead of
core->fw_dev?
When iris_create_cb_dev(core, "video-firmware") fails, core->fw_dev is
still NULL while core->p_dev has already been registered and assigned, so
core->p_dev is left registered on failure.
> @@ -273,6 +282,8 @@ static void iris_deinit_cb_devs(struct iris_core *core)
> platform_device_unregister(to_platform_device(core->p_dev));
> if (core->np_dev)
> platform_device_unregister(to_platform_device(core->np_dev));
> + if (core->fw_dev)
> + platform_device_unregister(to_platform_device(core->fw_dev));
> }
>
> static int iris_register_video_device(struct iris_core *core, enum domain_type type)
> @@ -376,6 +387,8 @@ static void iris_remove(struct platform_device *pdev)
> v4l2_device_unregister(&core->v4l2_dev);
>
> iris_unreserve_iova_region(core->dev, core->iova_state);
> +
> + iris_deinit_cb_devs(core);
> }
>
> static void iris_sys_error_handler(struct work_struct *work)
> @@ -454,9 +467,13 @@ static int iris_probe(struct platform_device *pdev)
> if (ret)
> goto err_unresv_iova_region;
>
> + ret = iris_fw_init(core);
> + if (ret)
> + goto err_destroy_cb_devs;
> +
> ret = v4l2_device_register(dev, &core->v4l2_dev);
> if (ret)
> - goto err_unresv_iova_region;
> + goto err_destroy_cb_devs;
>
> ret = iris_register_video_device(core, DECODER);
> if (ret)
> @@ -491,6 +508,8 @@ static int iris_probe(struct platform_device *pdev)
> video_unregister_device(core->vdev_dec);
> err_v4l2_unreg:
> v4l2_device_unregister(&core->v4l2_dev);
> +err_destroy_cb_devs:
> + iris_deinit_cb_devs(core);
> err_unresv_iova_region:
> iris_unreserve_iova_region(dev, core->iova_state);
[Severity: High]
Won't calling iris_deinit_cb_devs() in iris_remove() and at
err_destroy_cb_devs unregister core->p_dev, core->np_dev, and core->fw_dev
twice?
iris_probe() registers a devm action for iris_core_put(), which invokes
iris_core_release() when the v4l2_dev refcount drops to zero:
drivers/media/platform/qcom/iris/iris_probe.c:iris_core_release() {
struct iris_core *core = container_of(v4l2_dev, struct iris_core, v4l2_dev);
iris_deinit_cb_devs(core);
mutex_destroy(&core->lock);
put_device(core->dev);
kfree(core);
}
Because iris_deinit_cb_devs() does not clear the device pointers, calling
it in iris_remove() or on the probe failure path unregisters and frees the
child platform devices, and iris_core_release() then calls
platform_device_unregister() on the freed pointers a second time.
Unregistering the context-bank devices in iris_remove() also destroys
core->p_dev and core->np_dev before open V4L2 sessions finish releasing
their DMA buffers on close.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202-topic-sm8650-el2-iris-v1-0-18a504583922@linaro.org?part=1
next prev parent reply other threads:[~2026-12-02 10:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 9:52 [PATCH 0/2] media: iris: add firmware loading from EL2 Neil Armstrong
2026-12-02 9:52 ` [PATCH 1/2] media: iris: add firmware loading in EL2 Neil Armstrong
2026-12-02 10:08 ` sashiko-bot [this message]
2026-12-02 9:52 ` [PATCH 2/2] arm64: dts: qcom: sm8650-valve-deckard: enable iris Neil Armstrong
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=sashiko-outbox-245388@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=media-ci@linuxtv.org \
--cc=neil.armstrong@linaro.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.