All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org,
	media-ci@linuxtv.org, conor+dt@kernel.org
Subject: Re: [PATCH v8 14/18] media: iris: implement support for the Agatti platform
Date: Thu, 30 Jul 2026 15:54:44 +0000	[thread overview]
Message-ID: <20260730155444.C30F01F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260730-iris-ar50lt-v8-14-6597c08cea6f@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [Critical] Mismatch between statically calculated vb2 buffer size and the firmware's requested buffer size causes a potential buffer overflow when the firmware writes to external buffers.
- [High] Querying buffer requirements for AR50Lt overwrites the DPB buffer count (fw_min_count) with the display output buffer count.
- [High] The AR50LT platform uses `iris_vpu2_calculate_frequency` but provides capability fields intended for `iris_vpu3x_vpu4x_calculate_frequency`, resulting in severely under-calculated clock scaling.
- [Medium] The hierarchical layer bitrates (LAYER0_BITRATE_H264 to LAYER5_BITRATE_H264) in `inst_fw_cap_gen1_ar50lt_enc` use the global `BITRATE_MAX` (160Mbps) instead of the AR50LT-specific limit.
--

--- Patch [14]: [PATCH v8 14/18] media: iris: implement support for the Agatti platform ---
commit 50e74e4ea9f26a2d05a3a8800b3cde717ea582a2
Author: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

media: iris: implement support for the Agatti platform

Port support for the AR50Lt video codec core (present for example on the
Agatti platform) to the Iris driver. Unlike more recent cores this
generation doesn't have the PIPE property (as it always has only one
pipe). Also, unlike newer platforms, buffer sizes are requested from the
firmware instead of being calculated by the driver.

> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen1.c b/drivers/media/platform/qcom/iris/iris_hfi_gen1.c
> index ca1545d28b531..020f55092737d 100644
> --- a/drivers/media/platform/qcom/iris/iris_hfi_gen1.c
> +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen1.c

[ ... ]

> +	{
> +		.cap_id = LAYER0_BITRATE_H264,
> +		.min = 1,
> +		.max = BITRATE_MAX,
> +		.step_or_mask = 1,
> +		.value = BITRATE_DEFAULT,
> +		.hfi_id = HFI_PROPERTY_CONFIG_VENC_TARGET_BITRATE,
> +		.flags = CAP_FLAG_OUTPUT_PORT | CAP_FLAG_INPUT_PORT |
> +			CAP_FLAG_DYNAMIC_ALLOWED,
> +		.set = iris_set_bitrate_gen1,
> +	},

[Severity: Medium]
Should these hierarchical layers use BITRATE_MAX_AR50LT instead of
BITRATE_MAX?

The base BITRATE capability uses BITRATE_MAX_AR50LT (100M), but the
hierarchical layers are using BITRATE_MAX (160M), which might allow
userspace to request a configuration that exceeds the platform's hardware
limits.

[ ... ]

> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
> index 99e82e5510abe..329a9ef2fdc5f 100644
> --- a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
> +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c

[ ... ]

> @@ -970,6 +970,13 @@ static int iris_hfi_gen1_set_bufsize(struct iris_inst *inst, u32 plane)
>  	struct hfi_buffer_size_actual bufsz;
>  	int ret;
>  
> +	if (inst->core->iris_firmware_data->query_buffer_requirements) {
> +		ret = inst->hfi_session_ops->session_get_property(inst,
> +								  HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS);
> +		if (ret)
> +			return ret;
> +	}
> +

[Severity: High]
Could querying buffer requirements here overwrite the DPB buffer count
with the display buffer count?

When this queries HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS,
iris_hfi_gen1_session_buffer_requirements() processes the requirement.
For BUF_OUTPUT (which maps to the display buffer in split mode), it sets:

    if (type == BUF_OUTPUT)
        inst->fw_min_count = req->count_actual;

Since iris_vpu_dpb_count() relies on inst->fw_min_count for the DPB
count, does this result in allocating the wrong number of DPB buffers?

[Severity: Critical]
Could this lead to a buffer overflow when the firmware writes to
the external buffers?

When the buffer requirements are queried,
iris_hfi_gen1_session_buffer_requirements() overwrites the internal tracker:

    inst->buffers[type].size = req->size;

This firmware-requested size is then sent back to the firmware. However,
when physical memory is prepared in iris_vb2_buf_prepare(), it validates the
size against the statically calculated iris_get_buffer_size():

    if (vb2_plane_size(vb, 0) < iris_get_buffer_size(inst, BUF_OUTPUT))
        return -EINVAL;

If the firmware requires a larger size than the static calculation, it
might write beyond the statically allocated vb2_buffer bounds.

[ ... ]

> diff --git a/drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c b/drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c
> new file mode 100644
> index 0000000000000..92f7e25465399
> --- /dev/null
> +++ b/drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c

[ ... ]

> +static struct platform_inst_caps platform_inst_cap_ar50lt = {
> +	.min_frame_width = 128,
> +	.max_frame_width = 1920,
> +	.min_frame_height = 128,
> +	.max_frame_height = 1920,
> +	.max_mbpf = (1920 * 1088) / 256,
> +	.mb_cycles_vpp = 440,
> +	.mb_cycles_fw = 733003,
> +	.mb_cycles_fw_vpp = 225975,
> +	.max_frame_rate = 120,
> +	.max_operating_rate = 120,
> +};

[Severity: High]
Does this platform need mb_cycles_vsp defined to scale the clock properly?

This struct provides mb_cycles_fw and mb_cycles_fw_vpp, which are used by
iris_vpu3x_vpu4x_calculate_frequency(). However, qcm2290_data assigns
iris_vpu_ar50lt_ops, which uses iris_vpu2_calculate_frequency():

    vsp_freq = mbs_per_second * caps->mb_cycles_vsp;

Since mb_cycles_vsp is omitted here, it defaults to 0. Will this cause the
calculated vsp_freq to be 0 and severely under-calculate the required clock
frequency?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260730-iris-ar50lt-v8-0-6597c08cea6f@oss.qualcomm.com?part=14

  reply	other threads:[~2026-07-30 15:54 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <J0r-fdDYeS3FyqabzR_0wiwxC-2onZeePkUSfv0NavGV8KB3Anc-j8yKHqfY2I3X4VAiZpRkYSIZLaTwuyhKMA==@protonmail.internalid>
2026-07-30 15:20 ` [PATCH v8 00/18] media: iris: Add AR50LT core support and enable Agatti platform Dmitry Baryshkov
2026-07-30 15:20   ` [PATCH v8 01/18] media: iris: Add Gen2 firmware autodetect and fallback Dmitry Baryshkov
2026-07-30 15:37     ` sashiko-bot
2026-07-30 20:02     ` Bryan O'Donoghue
2026-07-30 15:20   ` [PATCH v8 02/18] media: iris: Skip UBWC configuration when not supported Dmitry Baryshkov
2026-07-30 15:32     ` sashiko-bot
2026-07-30 23:24       ` Dmitry Baryshkov
2026-07-30 15:20   ` [PATCH v8 03/18] media: iris: drop IRIS_FMT_foo enumeration Dmitry Baryshkov
2026-07-30 15:20   ` [PATCH v8 04/18] media: iris: Filter UBWC raw formats based on hardware capabilities Dmitry Baryshkov
2026-07-30 15:20   ` [PATCH v8 05/18] media: iris: Introduce set_preset_register as a vpu_op Dmitry Baryshkov
2026-07-30 15:20   ` [PATCH v8 06/18] media: iris: Introduce interrupt_init " Dmitry Baryshkov
2026-07-30 15:20   ` [PATCH v8 07/18] media: iris: add vpu op hook to disable ARP buffer Dmitry Baryshkov
2026-07-30 15:41     ` sashiko-bot
2026-07-30 15:20   ` [PATCH v8 08/18] media: iris: Add platform data field for watchdog interrupt mask Dmitry Baryshkov
2026-07-30 15:32     ` sashiko-bot
2026-07-30 23:26       ` Dmitry Baryshkov
2026-07-30 15:20   ` [PATCH v8 09/18] media: iris: Add platform flag for instantaneous bandwidth voting Dmitry Baryshkov
2026-07-30 15:20   ` [PATCH v8 10/18] media: iris: skip PIPE if it is not supported by the platform Dmitry Baryshkov
2026-07-30 15:56     ` sashiko-bot
2026-07-30 15:20   ` [PATCH v8 11/18] media: iris: Add framework support for AR50_LITE video core Dmitry Baryshkov
2026-07-30 15:41     ` sashiko-bot
2026-07-30 15:20   ` [PATCH v8 12/18] media: iris: add minimal GET_PROPERTY implementation Dmitry Baryshkov
2026-07-30 15:39     ` sashiko-bot
2026-07-30 15:20   ` [PATCH v8 13/18] media: iris: update buffer requirements based on received info Dmitry Baryshkov
2026-07-30 15:52     ` sashiko-bot
2026-07-30 15:20   ` [PATCH v8 14/18] media: iris: implement support for the Agatti platform Dmitry Baryshkov
2026-07-30 15:54     ` sashiko-bot [this message]
2026-07-30 23:37       ` Dmitry Baryshkov
2026-07-30 15:20   ` [PATCH v8 15/18] media: iris: Introduce buffer size calculations for AR50LT Dmitry Baryshkov
2026-07-30 15:47     ` sashiko-bot
2026-07-30 23:40       ` Dmitry Baryshkov
2026-07-30 15:20   ` [PATCH v8 16/18] media: iris: add Gen2 firmware support on the Agatti platform Dmitry Baryshkov
2026-07-30 15:21   ` [PATCH v8 17/18] media: venus: skip QCM2290 if Iris driver is enabled Dmitry Baryshkov
2026-07-30 15:39     ` sashiko-bot
2026-07-30 15:21   ` [PATCH v8 18/18] media: iris: constify inst_fw_cap_sm8250_dec Dmitry Baryshkov
2026-07-30 20:09   ` [PATCH v8 00/18] media: iris: Add AR50LT core support and enable Agatti platform Bryan O'Donoghue

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=20260730155444.C30F01F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=media-ci@linuxtv.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.