From: sashiko-bot@kernel.org
To: "Chaoyi Chen" <kernel@airkyi.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v5 3/3] drm/rockchip: dsi: Relax the lane rate margin requirements
Date: Mon, 14 Sep 2026 01:43:47 +0000 [thread overview]
Message-ID: <20260914014347.B75131F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260914013331.108-4-kernel@airkyi.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] 32-bit integer overflow in PHY pixel clock calculation limits maximum pixel clock to 429.49 MHz.
--
commit 979a891d8dcf3f71d29e5487fb6d05be64459b38
Author: Chaoyi Chen <chaoyi.chen@rock-chips.com>
drm/rockchip: dsi: Relax the lane rate margin requirements
This commit relaxes the lane rate margin requirements for the rockchip
dw-mipi-dsi driver to accommodate platforms with a 1Gbps lane rate limit.
It updates the bandwidth calculations to use an 11% overhead instead of 25%.
> diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
> index aab3353945de5..76607eac470a3 100644
> --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
[ ... ]
> @@ -600,7 +600,7 @@ dw_mipi_dsi_get_lane_mbps(void *priv_data, const struct drm_display_mode *mode,
>
> /* for external phy only a the mipi_dphy_config is necessary */
> if (dsi->phy) {
> - phy_mipi_dphy_get_default_config(mode->clock * 1000 * 10 / 8,
> + phy_mipi_dphy_get_default_config((u32)mode->clock * 1000 * 10 / 9,
[Severity: High]
This isn't a bug introduced by this patch, but does this calculation still
overflow for pixel clocks greater than 429.49 MHz?
The original code overflowed at 214 MHz due to signed 32-bit math. While the
addition of the (u32) cast prevents the signed overflow, the arithmetic
(u32)mode->clock * 1000 * 10 still evaluates within 32-bit bounds before
being promoted to the 64-bit unsigned long parameter of
phy_mipi_dphy_get_default_config() in dw_mipi_dsi_get_lane_mbps().
For a MIPI DSI panel with a high pixel clock, such as 450 MHz, the
calculation evaluates to 4,500,000,000. This exceeds U32_MAX and wraps
around, configuring the PHY with a drastically lower clock frequency and
resulting in link training failures.
Could this be resolved by casting to u64 or using mul_u32_u32() to ensure
the intermediate multiplication doesn't overflow?
> bpp, lanes,
> &dsi->phy_opts.mipi_dphy);
> dsi->lane_mbps = target_mbps;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260914013331.108-1-kernel@airkyi.com?part=3
next prev parent reply other threads:[~2026-09-14 1:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 1:33 [PATCH v5 0/3] DSI Controller improvements for Rockchip platforms Chaoyi Chen
2026-09-14 1:33 ` [PATCH v5 1/3] drm/rockchip: dsi: Add maximum per lane bit rate calculation Chaoyi Chen
2026-09-14 1:33 ` [PATCH v5 2/3] drm/rockchip: dsi: Add dphy_get_timing support for multiple PHY types Chaoyi Chen
2026-09-14 1:33 ` [PATCH v5 3/3] drm/rockchip: dsi: Relax the lane rate margin requirements Chaoyi Chen
2026-09-14 1:43 ` sashiko-bot [this message]
2026-09-15 13:36 ` [PATCH v5 0/3] DSI Controller improvements for Rockchip platforms Heiko Stübner
2026-09-16 1:54 ` Chaoyi Chen
2026-09-15 16:39 ` (subset) " Heiko Stuebner
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=20260914014347.B75131F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@airkyi.com \
--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