From: sashiko-bot@kernel.org
To: "Junhui Liu" <junhui.liu@pigmoral.tech>
Cc: linux-sunxi@lists.linux.dev, linux-clk@vger.kernel.org,
conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v3 6/8] clk: sunxi-ng: a733: Add mod clocks support
Date: Sat, 05 Sep 2026 16:48:54 +0000 [thread overview]
Message-ID: <20260905164855.57E751F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260905-a733-clk-v3-6-50f238f39c78@pigmoral.tech>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Incorrect configuration of `dram0_clk` and `mbus_clk` using `ccu_mp` results in undefined behavior (register wiping) and silent failure to latch hardware rate changes.
--
commit a122063531b2fdc98cf1753dabf17b8cdf9be8ae
Author: Junhui Liu <junhui.liu@pigmoral.tech>
clk: sunxi-ng: a733: Add mod clocks support
This patch adds module clocks found in the Allwinner A733 SoC, including
video, storage, interfaces, and others. The implementation accounts for
register offset changes compared to the A523 SoC and introduces new modules.
> diff --git a/drivers/clk/sunxi-ng/ccu-sun60i-a733.c b/drivers/clk/sunxi-ng/ccu-sun60i-a733.c
> index 3a25c349f11ba..e590b211be853 100644
> --- a/drivers/clk/sunxi-ng/ccu-sun60i-a733.c
> +++ b/drivers/clk/sunxi-ng/ccu-sun60i-a733.c
[ ... ]
> @@ -492,6 +499,913 @@ static SUNXI_CCU_MP_DATA_WITH_MUX_GATE_FEAT(mbus_clk, "mbus", mbus_parents, 0x58
> CLK_IS_CRITICAL,
> CCU_FEATURE_UPDATE_BIT);
>
> +/**************************************************************************
> + * mod clocks *
> + **************************************************************************/
[ ... ]
> +static SUNXI_CCU_MP_DATA_WITH_MUX_GATE_FEAT(dram0_clk, "dram0", dram_parents, 0xc00,
> + 0, 4, /* M */
> + 0, 0, /* no P */
> + 24, 3, /* mux */
> + BIT(31), /* gate */
> + CLK_IS_CRITICAL,
> + CCU_FEATURE_UPDATE_BIT);
[Severity: High]
Does configuring dram0_clk (and similarly mbus_clk, visible in the context
above) using SUNXI_CCU_MP_DATA_WITH_MUX_GATE_FEAT with a 0-width P divider
result in undefined behavior?
When a frequency change is requested for clocks mapped to ccu_mp,
ccu_mp_set_rate() evaluates:
GENMASK(cmp->p.width + cmp->p.shift - 1, cmp->p.shift)
With a 0-width P divider, this becomes GENMASK(-1, 0), which expands to
a shift by BITS_PER_LONG. On ARM64 systems, this undefined behavior typically
clears the entire clock register (erasing the critical gate and mux), which
can immediately crash the system.
Additionally, the macro passes the CCU_FEATURE_UPDATE_BIT flag. However,
ccu_mp_set_rate() does not implement this feature flag (unlike ccu_div.c).
Will this cause rate changes to silently fail to latch in the hardware?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260905-a733-clk-v3-0-50f238f39c78@pigmoral.tech?part=6
next prev parent reply other threads:[~2026-09-05 16:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 16:45 [PATCH v3 0/8] clk: sunxi-ng: Add support for Allwinner A733 CCU and PRCM Junhui Liu
2026-09-04 16:45 ` [PATCH v3 1/8] dt-bindings: clk: sun60i-a733-ccu: Add Allwinner A733 support Junhui Liu
2026-09-09 7:17 ` Krzysztof Kozlowski
2026-09-04 16:45 ` [PATCH v3 2/8] clk: sunxi-ng: sdm: Add dual patterns support Junhui Liu
2026-09-04 16:45 ` [PATCH v3 3/8] clk: sunxi-ng: a733: Add PRCM CCU Junhui Liu
2026-09-04 16:45 ` [PATCH v3 4/8] clk: sunxi-ng: a733: Add PLL clocks support Junhui Liu
2026-09-04 16:45 ` [PATCH v3 5/8] clk: sunxi-ng: a733: Add bus " Junhui Liu
2026-09-05 16:48 ` sashiko-bot
2026-09-04 16:45 ` [PATCH v3 6/8] clk: sunxi-ng: a733: Add mod " Junhui Liu
2026-09-05 16:48 ` sashiko-bot [this message]
2026-09-04 16:45 ` [PATCH v3 7/8] clk: sunxi-ng: a733: Add bus clock gates Junhui Liu
2026-09-04 16:45 ` [PATCH v3 8/8] clk: sunxi-ng: a733: Add reset lines Junhui Liu
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=20260905164855.57E751F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=junhui.liu@pigmoral.tech \
--cc=linux-clk@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--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