Re: [PATCH v3 4/9] media: iris: migrate firmware loading to qcom_mdt_pas_load() and qcom_pas_prepare_and_auth_reset()
From: Vishnu Reddy
Date: Fri Nov 27 2026 - 00:46:16 EST
On 11/16/2026 9:51 PM, Mukesh Ojha wrote:
> iris_load_fw_to_memory() calls qcom_mdt_load(), which bundles
> metadata initialization, memory setup, and segment loading into a
> single API that does not expose a PAS context. iris_fw_load()
> calls qcom_pas_auth_and_reset() for TrustZone authentication,
> which is the intended behaviour. However, a new
> qcom_mdt_pas_load() has recently been introduced that works with
> a PAS context and can handle everything qcom_mdt_load() provides,
> along with additional functionality such as shmbridge creation
> and retrieving memory from the shmbridge buffer when the same
> remote processor needs to run while Linux runs at EL2.
>
> Embed a struct qcom_pas_context directly in struct iris_core and
> initialize it with qcom_pas_context_init() inside
> iris_load_fw_to_memory() on each call. Replace qcom_mdt_load()
> with qcom_mdt_pas_load() and replace qcom_pas_auth_and_reset()
> with qcom_pas_prepare_and_auth_reset(). The
> iris_detect_firmware() scan retains a separate memremap window
> after qcom_mdt_pas_load() completes, since it needs to read back
> the loaded image data.
>
> Signed-off-by: Mukesh Ojha <mukesh.ojha@xxxxxxxxxxxxxxxx>
> ---
> drivers/media/platform/qcom/iris/iris_core.h | 2 ++
> .../media/platform/qcom/iris/iris_firmware.c | 27 +++++++++----------
> 2 files changed, 15 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/iris/iris_core.h b/drivers/media/platform/qcom/iris/iris_core.h
> index 3e4cf652bf39..ac73bda072f8 100644
> --- a/drivers/media/platform/qcom/iris/iris_core.h
> +++ b/drivers/media/platform/qcom/iris/iris_core.h
> @@ -9,6 +9,7 @@
> #include <linux/types.h>
> #include <linux/dma-mapping.h>
> #include <linux/pm_domain.h>
> +#include <linux/firmware/qcom/qcom_pas.h>
> #include <media/v4l2-device.h>
>
> #include "iris_hfi_common.h"
> @@ -129,6 +130,7 @@ struct iris_core {
> struct platform_inst_fw_cap inst_fw_caps_dec[INST_FW_CAP_MAX];
> struct platform_inst_fw_cap inst_fw_caps_enc[INST_FW_CAP_MAX];
> struct dma_iova_state *iova_state;
> + struct qcom_pas_context pas_ctx;
> };
>
> int iris_core_init(struct iris_core *core);
> diff --git a/drivers/media/platform/qcom/iris/iris_firmware.c b/drivers/media/platform/qcom/iris/iris_firmware.c
> index 21f57d37da18..b701a7f43514 100644
> --- a/drivers/media/platform/qcom/iris/iris_firmware.c
> +++ b/drivers/media/platform/qcom/iris/iris_firmware.c
> @@ -201,21 +201,20 @@ static int iris_load_fw_to_memory(struct iris_core *core)
> goto err_release_fw;
> }
>
> - mem_virt = memremap(mem_phys, res_size, MEMREMAP_WC);
> - if (!mem_virt) {
> - ret = -ENOMEM;
> - goto err_release_fw;
> - }
> -
> - memset(mem_virt, 0, res_size);
> -
> - ret = qcom_mdt_load(dev, firmware, fw_name,
> - IRIS_PAS_ID, mem_virt, mem_phys, res_size, NULL);
> + qcom_pas_context_init(&core->pas_ctx, dev, IRIS_PAS_ID, mem_phys,
> + res_size);
> +
> + ret = qcom_mdt_pas_load(&core->pas_ctx, firmware, fw_name, NULL);
> + if (!ret) {
> + mem_virt = memremap(mem_phys, res_size, MEMREMAP_WC);
> + if (!mem_virt) {
> + ret = -ENOMEM;
> + goto err_release_fw;
> + }
>
> - if (!ret)
> iris_detect_firmware(core, fw_name, mem_virt, res_size, desc);
> -
> - memunmap(mem_virt);
> + memunmap(mem_virt);
> + }
> err_release_fw:
> release_firmware(firmware);
>
> @@ -233,7 +232,7 @@ int iris_fw_load(struct iris_core *core)
> return ret;
> }
>
> - ret = qcom_pas_auth_and_reset(IRIS_PAS_ID);
> + ret = qcom_pas_prepare_and_auth_reset(&core->pas_ctx);
> if (ret) {
> dev_err(core->dev, "auth and reset failed: %d\n", ret);
> return ret;
Please address sashiko comments in the next revision, as they are only minor.
With that,
Reviewed-by: Vishnu Reddy <busanna.reddy@xxxxxxxxxxxxxxxx>
JFYI, depending on which series lands first, either I'll rebase accordingly,
or this series can be rebased on top of:
https://lore.kernel.org/all/20261125-glymur-v12-2-5c34dfd73fc2@xxxxxxxxxxxxxxxx