From: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
Vikash Garodia <vikash.garodia@oss.qualcomm.com>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Bryan O'Donoghue <bod@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>
Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Subject: Re: [PATCH v9 01/19] Revert "media: iris: Add Gen2 firmware autodetect and fallback"
Date: Wed, 23 Sep 2026 11:46:49 +0530 [thread overview]
Message-ID: <023d4410-a730-a5e5-ea84-474e957d7a5b@oss.qualcomm.com> (raw)
In-Reply-To: <20260731-iris-ar50lt-v9-1-d71a782001c0@oss.qualcomm.com>
On 7/31/2026 5:18 AM, Dmitry Baryshkov wrote:
> The commit 412a2e5955e0 ("media: iris: Add Gen2 firmware autodetect and
> fallback") added support for detecting the firmware HFI interface based
> on the firmware contents, but it has issues with the MDT split files and
> with synchronisation / locking. Revert the commit, it will be replaced
> by the better version.
>
> Fixes: 412a2e5955e0 ("media: iris: Add Gen2 firmware autodetect and fallback")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
> drivers/media/platform/qcom/iris/iris_firmware.c | 119 +++------------------
> .../platform/qcom/iris/iris_platform_common.h | 6 +-
> .../media/platform/qcom/iris/iris_platform_vpu2.c | 11 +-
> .../media/platform/qcom/iris/iris_platform_vpu3x.c | 10 +-
> drivers/media/platform/qcom/iris/iris_probe.c | 4 +
> drivers/media/platform/qcom/iris/iris_vidc.c | 3 -
> 6 files changed, 33 insertions(+), 120 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/iris/iris_firmware.c b/drivers/media/platform/qcom/iris/iris_firmware.c
> index 965384fdd339..1a476146d758 100644
> --- a/drivers/media/platform/qcom/iris/iris_firmware.c
> +++ b/drivers/media/platform/qcom/iris/iris_firmware.c
> @@ -16,109 +16,20 @@
>
> #define MAX_FIRMWARE_NAME_SIZE 128
>
> -/* Detect Gen2 firmware by scanning the blob for:
> - * QC_IMAGE_VERSION_STRING=<version>
> - * and then checking:
> - * - version starts with "vfw", OR
> - * - version matches "video-firmware.N.M" with N >= 2
> - */
> -
> -static bool iris_detect_gen2_from_fwdata(const u8 *data, size_t size)
> -{
> - static const char *marker = "QC_IMAGE_VERSION_STRING=";
> - const size_t mlen = strlen(marker);
> - static const char *vfw = "vfw";
> - const size_t vfwlen = strlen(vfw);
> - static const char *vf = "video-firmware.";
> - const size_t vflen = strlen(vf);
> -
> - for (size_t i = 0; i + mlen < size; i++) {
> - const char *found;
> -
> - if (memcmp(data + i, marker, mlen))
> - continue;
> -
> - found = data + i + mlen;
> - size -= i + mlen;
> -
> - /* vfw => Gen2 */
> - if (size > vfwlen && !memcmp(found, vfw, vfwlen))
> - return true;
> -
> - if (size < vflen ||
> - memcmp(found, vf, vflen))
> - return false;
> -
> - found += vflen;
> - size -= vflen;
> -
> - /*
> - * video-firmware.1.x is Gen1.
> - * video-firmware.2.x and video-firmware.10.x are Gen2.
> - */
> - return size >= 2 &&
> - (*found >= '2' || (*found == '1' && found[1] != '.'));
> - }
> -
> - return false;
> -}
> -
> -static const struct firmware *iris_detect_firmware(struct iris_core *core,
> - const char **fw_name)
> -{
> - const struct firmware *firmware;
> - bool has_both_gens;
> - int ret;
> -
> - *fw_name = NULL;
> - if (core->iris_platform_data->firmware_desc_gen2)
> - core->iris_firmware_desc = core->iris_platform_data->firmware_desc_gen2;
> - else if (core->iris_platform_data->firmware_desc_gen1)
> - core->iris_firmware_desc = core->iris_platform_data->firmware_desc_gen1;
> - else
> - return ERR_PTR(-EINVAL);
> -
> - has_both_gens = core->iris_platform_data->firmware_desc_gen2 &&
> - core->iris_platform_data->firmware_desc_gen1;
> -
> - ret = of_property_read_string_index(dev_of_node(core->dev), "firmware-name", 0, fw_name);
> - if (ret) {
> - *fw_name = core->iris_firmware_desc->fwname;
> - ret = request_firmware(&firmware, *fw_name, core->dev);
> - if (ret && has_both_gens) {
> - core->iris_firmware_desc = core->iris_platform_data->firmware_desc_gen1;
> - *fw_name = core->iris_firmware_desc->fwname;
> - ret = request_firmware(&firmware, *fw_name, core->dev);
> - }
> -
> - return ret ? ERR_PTR(ret) : firmware;
> - }
> -
> - ret = request_firmware(&firmware, *fw_name, core->dev);
> - if (ret)
> - return ERR_PTR(ret);
> -
> - if (has_both_gens &&
> - !iris_detect_gen2_from_fwdata((const u8 *)firmware->data, firmware->size)) {
> - dev_info(core->dev, "Gen1 FW detected in %s\n", *fw_name);
> - core->iris_firmware_desc = core->iris_platform_data->firmware_desc_gen1;
> - }
> -
> - return firmware;
> -}
> -
> -static int iris_load_fw_to_memory(struct iris_core *core)
> +static int iris_load_fw_to_memory(struct iris_core *core, const char *fw_name)
> {
> const struct firmware *firmware = NULL;
> struct device *dev = core->dev;
> struct resource res;
> phys_addr_t mem_phys;
> - const char *fw_name;
> size_t res_size;
> ssize_t fw_size;
> void *mem_virt;
> int ret;
>
> + if (strlen(fw_name) >= MAX_FIRMWARE_NAME_SIZE - 4)
> + return -EINVAL;
> +
> ret = of_reserved_mem_region_to_resource(dev->of_node, 0, &res);
> if (ret)
> return ret;
> @@ -126,11 +37,9 @@ static int iris_load_fw_to_memory(struct iris_core *core)
> mem_phys = res.start;
> res_size = resource_size(&res);
>
> - firmware = iris_detect_firmware(core, &fw_name);
> - if (IS_ERR(firmware))
> - return PTR_ERR(firmware);
> -
> - core->iris_firmware_data = core->iris_firmware_desc->firmware_data;
> + ret = request_firmware(&firmware, fw_name, dev);
> + if (ret)
> + return ret;
>
> fw_size = qcom_mdt_get_size(firmware);
> if (fw_size < 0 || res_size < (size_t)fw_size) {
> @@ -157,12 +66,18 @@ static int iris_load_fw_to_memory(struct iris_core *core)
> int iris_fw_load(struct iris_core *core)
> {
> const struct tz_cp_config *cp_config;
> + const char *fwpath = NULL;
> int i, ret;
>
> - ret = iris_load_fw_to_memory(core);
> + ret = of_property_read_string_index(core->dev->of_node, "firmware-name", 0,
> + &fwpath);
> + if (ret)
> + fwpath = core->iris_firmware_desc->fwname;
> +
> + ret = iris_load_fw_to_memory(core, fwpath);
> if (ret) {
> - dev_err(core->dev, "firmware download failed %d\n", ret);
> - return ret;
> + dev_err(core->dev, "firmware download failed\n");
> + return -ENOMEM;
> }
>
> ret = qcom_scm_pas_auth_and_reset(IRIS_PAS_ID);
> @@ -184,7 +99,7 @@ int iris_fw_load(struct iris_core *core)
> }
> }
>
> - return 0;
> + return ret;
> }
>
> int iris_fw_unload(struct iris_core *core)
> diff --git a/drivers/media/platform/qcom/iris/iris_platform_common.h b/drivers/media/platform/qcom/iris/iris_platform_common.h
> index 974809509146..a9453d539fc2 100644
> --- a/drivers/media/platform/qcom/iris/iris_platform_common.h
> +++ b/drivers/media/platform/qcom/iris/iris_platform_common.h
> @@ -292,7 +292,11 @@ struct iris_firmware_desc {
> };
>
> struct iris_platform_data {
> - const struct iris_firmware_desc *firmware_desc_gen1, *firmware_desc_gen2;
> + /*
> + * XXX: replace with gen1 / gen2 pointers once we have platforms
> + * supporting both firmware kinds.
> + */
> + const struct iris_firmware_desc *firmware_desc;
>
> const struct vpu_ops *vpu_ops;
> const struct icc_info *icc_tbl;
> diff --git a/drivers/media/platform/qcom/iris/iris_platform_vpu2.c b/drivers/media/platform/qcom/iris/iris_platform_vpu2.c
> index bbdbf21961d7..fa5bb143158d 100644
> --- a/drivers/media/platform/qcom/iris/iris_platform_vpu2.c
> +++ b/drivers/media/platform/qcom/iris/iris_platform_vpu2.c
> @@ -29,12 +29,6 @@ static const struct iris_firmware_desc iris_vpu20_p1_gen1_desc = {
> .fwname = "qcom/vpu/vpu20_p1.mbn",
> };
>
> -static const struct iris_firmware_desc iris_vpu20_p1_gen2_s6_desc = {
> - .firmware_data = &iris_hfi_gen2_data,
> - .get_vpu_buffer_size = iris_vpu33_buf_size,
> - .fwname = "qcom/vpu/vpu20_p1_gen2_s6.mbn",
> -};
> -
> static const struct iris_firmware_desc iris_vpu20_p4_gen1_desc = {
> .firmware_data = &iris_hfi_gen1_data,
> .get_vpu_buffer_size = iris_vpu_buf_size,
> @@ -106,8 +100,7 @@ const struct iris_platform_data milos_data = {
> };
>
> const struct iris_platform_data sc7280_data = {
> - .firmware_desc_gen1 = &iris_vpu20_p1_gen1_desc,
> - .firmware_desc_gen2 = &iris_vpu20_p1_gen2_s6_desc,
> + .firmware_desc = &iris_vpu20_p1_gen1_desc,
> .vpu_ops = &iris_vpu2_ops,
> .icc_tbl = iris_icc_info_vpu2,
> .icc_tbl_size = ARRAY_SIZE(iris_icc_info_vpu2),
> @@ -136,7 +129,7 @@ const struct iris_platform_data sc7280_data = {
> };
>
> const struct iris_platform_data sm8250_data = {
> - .firmware_desc_gen1 = &iris_vpu20_p4_gen1_desc,
> + .firmware_desc = &iris_vpu20_p4_gen1_desc,
> .vpu_ops = &iris_vpu2_ops,
> .icc_tbl = iris_icc_info_vpu2,
> .icc_tbl_size = ARRAY_SIZE(iris_icc_info_vpu2),
> diff --git a/drivers/media/platform/qcom/iris/iris_platform_vpu3x.c b/drivers/media/platform/qcom/iris/iris_platform_vpu3x.c
> index 74626b35d9cb..2c63adbc5579 100644
> --- a/drivers/media/platform/qcom/iris/iris_platform_vpu3x.c
> +++ b/drivers/media/platform/qcom/iris/iris_platform_vpu3x.c
> @@ -90,7 +90,7 @@ static const struct tz_cp_config tz_cp_config_vpu3[] = {
> * - inst_caps to platform_inst_cap_qcs8300
> */
> const struct iris_platform_data qcs8300_data = {
> - .firmware_desc_gen2 = &iris_vpu30_p4_s6_gen2_desc,
> + .firmware_desc = &iris_vpu30_p4_s6_gen2_desc,
> .vpu_ops = &iris_vpu3_ops,
> .icc_tbl = iris_icc_info_vpu3x,
> .icc_tbl_size = ARRAY_SIZE(iris_icc_info_vpu3x),
> @@ -119,7 +119,7 @@ const struct iris_platform_data qcs8300_data = {
> };
>
> const struct iris_platform_data sm8550_data = {
> - .firmware_desc_gen2 = &iris_vpu30_p4_gen2_desc,
> + .firmware_desc = &iris_vpu30_p4_gen2_desc,
> .vpu_ops = &iris_vpu3_ops,
> .icc_tbl = iris_icc_info_vpu3x,
> .icc_tbl_size = ARRAY_SIZE(iris_icc_info_vpu3x),
> @@ -154,7 +154,7 @@ const struct iris_platform_data sm8550_data = {
> * - controller_rst_tbl to sm8650_controller_reset_table
> */
> const struct iris_platform_data sm8650_data = {
> - .firmware_desc_gen2 = &iris_vpu33_p4_gen2_desc,
> + .firmware_desc = &iris_vpu33_p4_gen2_desc,
> .vpu_ops = &iris_vpu33_ops,
> .icc_tbl = iris_icc_info_vpu3x,
> .icc_tbl_size = ARRAY_SIZE(iris_icc_info_vpu3x),
> @@ -185,7 +185,7 @@ const struct iris_platform_data sm8650_data = {
> };
>
> const struct iris_platform_data sm8750_data = {
> - .firmware_desc_gen2 = &iris_vpu35_p4_gen2_desc,
> + .firmware_desc = &iris_vpu35_p4_gen2_desc,
> .vpu_ops = &iris_vpu35_ops,
> .icc_tbl = iris_icc_info_vpu3x,
> .icc_tbl_size = ARRAY_SIZE(iris_icc_info_vpu3x),
> @@ -220,7 +220,7 @@ const struct iris_platform_data sm8750_data = {
> * - different num_vpp_pipe
> */
> const struct iris_platform_data x1p42100_data = {
> - .firmware_desc_gen2 = &iris_vpu30_p1_gen2_desc,
> + .firmware_desc = &iris_vpu30_p1_gen2_desc,
> .vpu_ops = &iris_vpu3_ops,
> .icc_tbl = iris_icc_info_vpu3x,
> .icc_tbl_size = ARRAY_SIZE(iris_icc_info_vpu3x),
> diff --git a/drivers/media/platform/qcom/iris/iris_probe.c b/drivers/media/platform/qcom/iris/iris_probe.c
> index 5db6398433a4..81cccb756b94 100644
> --- a/drivers/media/platform/qcom/iris/iris_probe.c
> +++ b/drivers/media/platform/qcom/iris/iris_probe.c
> @@ -253,6 +253,8 @@ static int iris_probe(struct platform_device *pdev)
> return core->irq;
>
> core->iris_platform_data = of_device_get_match_data(core->dev);
> + core->iris_firmware_desc = core->iris_platform_data->firmware_desc;
> + core->iris_firmware_data = core->iris_firmware_desc->firmware_data;
>
> core->ubwc_cfg = qcom_ubwc_config_get_data();
> if (IS_ERR(core->ubwc_cfg))
> @@ -271,6 +273,8 @@ static int iris_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> + iris_session_init_caps(core);
> +
> ret = v4l2_device_register(dev, &core->v4l2_dev);
> if (ret)
> return ret;
> diff --git a/drivers/media/platform/qcom/iris/iris_vidc.c b/drivers/media/platform/qcom/iris/iris_vidc.c
> index fcbc60016bee..1c052ca235be 100644
> --- a/drivers/media/platform/qcom/iris/iris_vidc.c
> +++ b/drivers/media/platform/qcom/iris/iris_vidc.c
> @@ -9,7 +9,6 @@
> #include <media/v4l2-mem2mem.h>
> #include <media/videobuf2-dma-contig.h>
>
> -#include "iris_ctrls.h"
> #include "iris_vidc.h"
> #include "iris_instance.h"
> #include "iris_vdec.h"
> @@ -197,8 +196,6 @@ int iris_open(struct file *filp)
> goto fail_m2m_release;
> }
>
> - iris_session_init_caps(core);
> -
> if (inst->domain == DECODER)
> ret = iris_vdec_inst_init(inst);
> else if (inst->domain == ENCODER)
Reviewed-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
next prev parent reply other threads:[~2026-09-23 6:16 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 23:48 [PATCH v9 00/19] media: iris: Add AR50LT core support and enable Agatti platform Dmitry Baryshkov
2026-07-30 23:48 ` [PATCH v9 01/19] Revert "media: iris: Add Gen2 firmware autodetect and fallback" Dmitry Baryshkov
2026-07-31 8:31 ` Bryan O'Donoghue
2026-09-23 6:16 ` Vishnu Reddy [this message]
2026-07-30 23:48 ` [PATCH v9 02/19] media: iris: Add Gen2 firmware autodetect and fallback Dmitry Baryshkov
2026-09-24 3:58 ` Vishnu Reddy
2026-09-24 12:36 ` Bryan O'Donoghue
2026-07-30 23:48 ` [PATCH v9 03/19] media: iris: Skip UBWC configuration when not supported Dmitry Baryshkov
2026-07-30 23:48 ` [PATCH v9 04/19] media: iris: drop IRIS_FMT_foo enumeration Dmitry Baryshkov
2026-07-30 23:48 ` [PATCH v9 05/19] media: iris: Filter UBWC raw formats based on hardware capabilities Dmitry Baryshkov
2026-07-30 23:48 ` [PATCH v9 06/19] media: iris: Introduce set_preset_register as a vpu_op Dmitry Baryshkov
2026-07-30 23:48 ` [PATCH v9 07/19] media: iris: Introduce interrupt_init " Dmitry Baryshkov
2026-07-30 23:48 ` [PATCH v9 08/19] media: iris: add vpu op hook to disable ARP buffer Dmitry Baryshkov
2026-07-30 23:48 ` [PATCH v9 09/19] media: iris: Add platform data field for watchdog interrupt mask Dmitry Baryshkov
2026-07-30 23:48 ` [PATCH v9 10/19] media: iris: Add platform flag for instantaneous bandwidth voting Dmitry Baryshkov
2026-07-30 23:48 ` [PATCH v9 11/19] media: iris: skip PIPE if it is not supported by the platform Dmitry Baryshkov
2026-07-30 23:48 ` [PATCH v9 12/19] media: iris: Add framework support for AR50_LITE video core Dmitry Baryshkov
2026-07-30 23:48 ` [PATCH v9 13/19] media: iris: add minimal GET_PROPERTY implementation Dmitry Baryshkov
2026-07-30 23:48 ` [PATCH v9 14/19] media: iris: update buffer requirements based on received info Dmitry Baryshkov
2026-07-30 23:53 ` [PATCH v9 15/19] media: iris: implement support for the Agatti platform Dmitry Baryshkov
2026-07-30 23:54 ` [PATCH v9 16/19] media: iris: Introduce buffer size calculations for AR50LT Dmitry Baryshkov
2026-07-30 23:54 ` [PATCH v9 17/19] media: iris: add Gen2 firmware support on the Agatti platform Dmitry Baryshkov
2026-07-30 23:54 ` [PATCH v9 18/19] media: venus: skip QCM2290 if Iris driver is enabled Dmitry Baryshkov
2026-07-30 23:54 ` [PATCH v9 19/19] media: iris: constify inst_fw_cap_sm8250_dec Dmitry Baryshkov
2026-07-31 5:27 ` [PATCH v9 00/19] media: iris: Add AR50LT core support and enable Agatti platform Vikash Garodia
2026-07-31 12:30 ` Dmitry Baryshkov
2026-09-17 10:48 ` Vikash Garodia
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=023d4410-a730-a5e5-ea84-474e957d7a5b@oss.qualcomm.com \
--to=busanna.reddy@oss.qualcomm.com \
--cc=abhinav.kumar@linux.dev \
--cc=andersson@kernel.org \
--cc=bod@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dikshita.agarwal@oss.qualcomm.com \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@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=vikash.garodia@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
all inboxes | Powered by JetHome®