Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v4 09/16] media: iris: Add framework support for AR50_LITE video core
Date: Fri, 12 Jun 2026 09:54:07 +0000	[thread overview]
Message-ID: <20260612095407.D23311F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260612-iris-ar50lt-v4-9-0abfb74d5b3c@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The VPU clock frequency calculation ignores the actual stream frame rate and uses a hardcoded 30 FPS.
- [High] Calculation of VSP frequency causes severe 32-bit integer overflows on 32-bit architectures, leading to under-provisioned clocks.
--

commit 117c5206f4fac821d317f597cfe56c462e1556c1
Author: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>

media: iris: Add framework support for AR50_LITE video core

Add power sequence for ar5lt core.
Add register handling for ar50lt by hooking up vpu op with ar50lt
specific implemtation or resue from earlier generation wherever
feasible.

> diff --git a/drivers/media/platform/qcom/iris/iris_vpu_ar50lt.c b/drivers/media/platform/qcom/iris/iris_vpu_ar50lt.c
> new file mode 100644
> index 0000000000000..1af20b067c032
> --- /dev/null
> +++ b/drivers/media/platform/qcom/iris/iris_vpu_ar50lt.c
[ ... ]
> +static u64 iris_vpu_ar50lt_calc_freq(struct iris_inst *inst, size_t data_size)
> +{
> +	struct platform_inst_caps *caps = inst->core->iris_platform_data->inst_caps;
> +	struct v4l2_format *inp_f = inst->fmt_src;
> +	u32 mbs_per_second, mbpf, height, width;
> +	unsigned long vpp_freq, vsp_freq;
> +	u32 fps = DEFAULT_FPS;

[Severity: High]
Does this hardcode the frame rate to 30 FPS instead of using the actual
stream frame rate from the session (e.g., inst->frame_rate)? For
high-framerate streams, this might under-provision the VPU clocks and lead
to dropped frames or hardware stalls.

> +
> +	width = max(inp_f->fmt.pix_mp.width, inst->crop.width);
> +	height = max(inp_f->fmt.pix_mp.height, inst->crop.height);
> +
> +	mbpf = NUM_MBS_PER_FRAME(height, width);
> +	mbs_per_second = mbpf * fps;
> +
> +	vpp_freq = mbs_per_second * caps->mb_cycles_vpp;
> +
> +	/* 21 / 20 is overhead factor */
> +	vpp_freq += vpp_freq / 20;
> +	vsp_freq = mbs_per_second * caps->mb_cycles_vsp;
> +
> +	/* 10 / 7 is overhead factor */
> +	vsp_freq += ((fps * data_size * 8) * 10) / 7;

[Severity: High]
Can this calculation overflow on 32-bit architectures? Since size_t is 32-bit
on these platforms, the intermediate product could exceed the 32-bit unsigned
maximum before the division by 7, resulting in a wrap-around and an incorrectly
low requested clock frequency.

> +
> +	return max(vpp_freq, vsp_freq);
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260612-iris-ar50lt-v4-0-0abfb74d5b3c@oss.qualcomm.com?part=9

  reply	other threads:[~2026-06-12  9:54 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12  9:25 [PATCH v4 00/16] media: iris: Add AR50LT core support and enable Agatti platform Dmitry Baryshkov
2026-06-12  9:25 ` [PATCH v4 01/16] media: iris: Skip UBWC configuration when not supported Dmitry Baryshkov
2026-06-12  9:25 ` [PATCH v4 02/16] media: iris: Filter UBWC raw formats based on hardware capabilities Dmitry Baryshkov
2026-06-12  9:36   ` sashiko-bot
2026-06-12  9:25 ` [PATCH v4 03/16] media: iris: Introduce set_preset_register as a vpu_op Dmitry Baryshkov
2026-06-12  9:25 ` [PATCH v4 04/16] media: iris: Introduce interrupt_init " Dmitry Baryshkov
2026-06-12  9:25 ` [PATCH v4 05/16] media: iris: add vpu op hook to disable ARP buffer Dmitry Baryshkov
2026-06-12  9:25 ` [PATCH v4 06/16] media: iris: Add platform data field for watchdog interrupt mask Dmitry Baryshkov
2026-06-12  9:41   ` sashiko-bot
2026-06-12  9:25 ` [PATCH v4 07/16] media: iris: Add platform flag for instantaneous bandwidth voting Dmitry Baryshkov
2026-06-12  9:46   ` sashiko-bot
2026-06-12  9:25 ` [PATCH v4 08/16] media: iris: skip PIPE if it is not supported by the platform Dmitry Baryshkov
2026-06-12  9:25 ` [PATCH v4 09/16] media: iris: Add framework support for AR50_LITE video core Dmitry Baryshkov
2026-06-12  9:54   ` sashiko-bot [this message]
2026-06-12  9:25 ` [PATCH v4 10/16] media: iris: add minimal GET_PROPERTY implementation Dmitry Baryshkov
2026-06-12  9:56   ` sashiko-bot
2026-06-12  9:25 ` [PATCH v4 11/16] media: iris: update buffer requirements based on received info Dmitry Baryshkov
2026-06-12 10:08   ` sashiko-bot
2026-06-12  9:25 ` [PATCH v4 12/16] media: iris: implement support for the Agatti platform Dmitry Baryshkov
2026-06-12 10:25   ` sashiko-bot
2026-06-12  9:25 ` [PATCH v4 13/16] media: iris: Introduce buffer size calculations for AR50LT Dmitry Baryshkov
2026-06-12 10:22   ` sashiko-bot
2026-06-12  9:25 ` [PATCH v4 14/16] media: iris: add Gen2 firmware support on the Agatti platform Dmitry Baryshkov
2026-06-12 10:39   ` sashiko-bot
2026-06-12  9:25 ` [PATCH v4 15/16] media: venus: skip QCM2290 if Iris driver is enabled Dmitry Baryshkov
2026-06-12 10:33   ` sashiko-bot
2026-06-12  9:25 ` [PATCH v4 16/16] media: iris: constify inst_fw_cap_sm8250_dec 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=20260612095407.D23311F000E9@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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox