Linux clock framework development
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 6.18-5.10] clk: keystone: don't cache clock rate
       [not found] <20260831133314.4125787-1-sashal@kernel.org>
@ 2026-08-31 13:20 ` Sasha Levin
  2026-08-31 13:21 ` [PATCH AUTOSEL 6.18-5.10] clk: socfpga: agilex: implement l3_main_free_clk Sasha Levin
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2026-08-31 13:20 UTC (permalink / raw)
  To: patches, stable
  Cc: Michael Walle, Kevin Hilman, Randolph Sapp, Nishanth Menon,
	Antonios Christidis, Brian Masney, Sasha Levin, kristo, sboyd,
	bmasney+clk, jbrunet+clk, linux-arm-kernel, linux-kernel,
	linux-clk

From: Michael Walle <mwalle@kernel.org>

[ Upstream commit a80b32a140c8612bbaed27009c383d43304db6d5 ]

The TISCI firmware will return 0 if the clock or consumer is not
enabled although there is a stored value in the firmware. IOW a call to
set rate will work but at get rate will always return 0 if the clock is
disabled.
The clk framework will try to cache the clock rate when it's requested
by a consumer. If the clock or consumer is not enabled at that point,
the cached value is 0, which is wrong. Thus, disable the cache
altogether.

Signed-off-by: Michael Walle <mwalle@kernel.org>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Reviewed-by: Randolph Sapp <rs@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Antonios Christidis <a-christidis@ti.com>
Reviewed-by: Brian Masney <bmasney@redhat.com>
Link: https://patch.msgid.link/20260507-clk-sci-v2-1-38f59b48777a@ti.com
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

The background checks finished:

- **Commit presence:** `a80b32a140c86` is **not** in the local 6.18.44
  tree (as expected from the analysis).
- **Related GPU commits:** No separate `drm/imagination` clock-control
  fix turned up on mainline — the `sci-clk` NOCACHE change is the
  standalone fix from the J722S GPU bring-up work.

The earlier analysis stands: **YES** for backport to this tree.

 drivers/clk/keystone/sci-clk.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c
index a4b42811de55d..066823458a75c 100644
--- a/drivers/clk/keystone/sci-clk.c
+++ b/drivers/clk/keystone/sci-clk.c
@@ -333,6 +333,14 @@ static int _sci_clk_build(struct sci_clk_provider *provider,
 
 	init.ops = &sci_clk_ops;
 	init.num_parents = sci_clk->num_parents;
+
+	/*
+	 * A clock rate query to the SCI firmware will return 0 if either the
+	 * clock itself is disabled or the attached device/consumer is disabled.
+	 * This makes it inherently unsuitable for the caching of the clk
+	 * framework.
+	 */
+	init.flags = CLK_GET_RATE_NOCACHE;
 	sci_clk->hw.init = &init;
 
 	ret = devm_clk_hw_register(provider->dev, &sci_clk->hw);
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH AUTOSEL 6.18-5.10] clk: socfpga: agilex: implement l3_main_free_clk
       [not found] <20260831133314.4125787-1-sashal@kernel.org>
  2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-5.10] clk: keystone: don't cache clock rate Sasha Levin
@ 2026-08-31 13:21 ` Sasha Levin
  2026-08-31 14:10   ` sashiko-bot
  2026-08-31 13:21 ` [PATCH AUTOSEL 6.18] clk: qcom: clk-rpmh: Make all VRMs optional Sasha Levin
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Sasha Levin @ 2026-08-31 13:21 UTC (permalink / raw)
  To: patches, stable
  Cc: Adrian Ng Ho Yin, Dinh Nguyen, Sasha Levin, sboyd, bmasney+clk,
	jbrunet+clk, linux-clk, linux-kernel

From: Adrian Ng Ho Yin <adrian.ho.yin.ng@altera.com>

[ Upstream commit 1e7f56205813a2c48cdb3e9a4b0a24f49fd9a548 ]

The AGILEX_L3_MAIN_FREE_CLK is defined in the dt-bindings header but
was never implemented in the clock driver. Per the Agilex TRM,
l3_main_free_clk has no divider or mux and is a fixed 1:1 derivative
of noc_free_clk that clocks most of the interconnect datapath.

Signed-off-by: Adrian Ng Ho Yin <adrian.ho.yin.ng@altera.com>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

Connection lost, reconnecting to https://agentn.us.api5.cursor.sh
(attempt 1)...
Retry attempt 1...
# Stable Backport Analysis: `clk: socfpga: agilex: implement
l3_main_free_clk`

**Local tree:** `v6.18.44` (`linux-6.18.y`, detached at
`stable/linux-6.18.y`)
**Commit under review:** `1e7f56205813a2c48cdb3e9a4b0a24f49fd9a548` (not
present in this tree; `merge-base --is-ancestor` exit code 1)

---

## PHASE 1: COMMIT MESSAGE FORENSICS

### Step 1.1: Subject line
**Record:** `[clk/socfpga/agilex] [implement] [register missing
l3_main_free_clk clock in Agilex clock driver]`

### Step 1.2: Tags
**Record:**
- **Fixes:** none
- **Reported-by:** none
- **Tested-by:** none
- **Reviewed-by:** none
- **Acked-by:** none
- **Link:** none
- **Cc: stable:** none
- **Signed-off-by:** Adrian Ng Ho Yin, Dinh Nguyen (ignore pipeline SOB
  markers)

No syzbot, no user reports, no explicit stable nomination.

### Step 1.3: Body analysis
**Record:**
- **Bug:** `AGILEX_L3_MAIN_FREE_CLK` is defined in `agilex-clock.h` but
  never registered in `clk-agilex.c`.
- **Symptom:** Any device tree node requesting clock index 18 from
  `clkmgr` gets `-ENOENT` from the clock provider.
- **Root cause:** Incomplete driver implementation; per Agilex TRM,
  `l3_main_free_clk` is a fixed 1:1 derivative of `noc_free_clk` with no
  mux/divider register.
- **Version info:** Merged to mainline for v7.2 (May 2026); absent from
  this 6.18.y tree.

### Step 1.4: Hidden bug fix?
**Record:** Yes. Subject says "implement," but this closes a DT/driver
mismatch: bindings and DTS reference a clock the provider never exposes.
That is a functional bug, not cosmetic cleanup.

---

## PHASE 2: DIFF ANALYSIS

### Step 2.1: Inventory
**Record:**
- **Files:** `drivers/clk/socfpga/clk-agilex.c` (+2 lines)
- **Function/table:** `agilex_main_perip_cnt_clks[]`
- **Scope:** Single-file, surgical (2-line addition)

### Step 2.2: Code flow change
**Record:**
- **Before:** `agilex_main_perip_cnt_clks[]` jumps from
  `AGILEX_NOC_FREE_CLK` (19) to `AGILEX_L4_SYS_FREE_CLK` (3). Index 18
  (`AGILEX_L3_MAIN_FREE_CLK`) is never registered; `hws[18]` stays
  `ERR_PTR(-ENOENT)`.
- **After:** Index 18 is registered as `"l3_main_free_clk"` with parent
  `"noc_free_clk"`, `num_parents=1`, `offset=0`, `fixed_divider=1` (1:1
  passthrough, no HW register).
- **Path affected:** Clock provider registration at `clkmgr` probe;
  consumers resolving phandle index 18.

### Step 2.3: Bug mechanism
**Record:**
- **Category:** Logic/correctness — incomplete clock provider vs. DT
  bindings.
- **Mechanism:** `agilex_clkmgr_init()` initializes all `hws[i]` to
  `ERR_PTR(-ENOENT)`; only registered clocks are filled. Missing
  registration leaves index 18 unusable.

### Step 2.4: Fix quality
**Record:**
- **Quality:** High. Matches existing `stratix10_perip_cnt_clock`
  pattern; `fixed_divider=1` + `offset=0` correctly models a register-
  less 1:1 clock.
- **Regression risk:** Very low. Adds one leaf clock derived from
  already-registered `noc_free_clk`.

---

## PHASE 3: GIT HISTORY INVESTIGATION

### Step 3.1: Blame
**Record:** `agilex_main_perip_cnt_clks[]` present in current tree
without `L3_MAIN_FREE_CLK` entry (blame points to base v6.18 import).
Omission present since Agilex clock driver landed in this tree.

### Step 3.2: Fixes: tag
**Record:** N/A — no `Fixes:` tag.

### Step 3.3: Related file history
**Record:** Shallow clone limits history depth. Verified on current
tree: `AGILEX_L3_MAIN_FREE_CLK` exists in `include/dt-
bindings/clock/agilex-clock.h` (id 18) and
`arch/arm64/boot/dts/intel/socfpga_agilex.dtsi` (SMMU `clocks`
property). Driver never registered it. Standalone one-patch fix (not
part of a series).

### Step 3.4: Author context
**Record:** Adrian Ng Ho Yin (Altera/Intel). Dinh Nguyen
(`dinguyen@kernel.org`) is SoCFPGA clk maintainer and committed the
patch. No other related fixes found in this tree from same author.

### Step 3.5: Dependencies
**Record:** No prerequisites. Patch applies cleanly (`git apply --check`
exit 0). All structures (`stratix10_perip_cnt_clock`,
`s10_register_cnt_periph`) exist in this tree.

---

## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH

### Step 4.1: Original discussion
**Record:**
- **b4 dig URL:** https://patch.msgid.link/9f35b944a8bfc79ff17e645d2d366
  2824e57cffa.1779439821.git.adrian.ho.yin.ng@altera.com
- **Series:** v1 only (2026-05-22)
- **Review feedback:** Could not read thread (Anubis bot wall on
  patch.msgid.link). No replies visible via b4.

### Step 4.2: Reviewers CC'd
**Record:** Adrian Ng Ho Yin, Dinh Nguyen, Michael Turquette, Stephen
Boyd, Brian Masney, linux-clk@, linux-kernel@ — appropriate clk
maintainers included.

### Step 4.3: Bug reports
**Record:** None found. No syzbot, no bugzilla, no user reports.

### Step 4.4: Related patches
**Record:** Standalone; pulled via `socfpga_clk_update_for_v7.2` tag. No
other patches required.

### Step 4.5: Stable list history
**Record:** Not searched (no stable nomination found; lore inaccessible
for full thread).

---

## PHASE 5: CODE SEMANTIC ANALYSIS

### Step 5.1: Key functions
**Record:** `agilex_main_perip_cnt_clks[]`,
`agilex_clk_register_cnt_perip()`, `s10_register_cnt_periph()`,
`agilex_clkmgr_init()`

### Step 5.2: Callers
**Record:** `agilex_clk_register_cnt_perip()` called from
`agilex_clkmgr_init()` during `clkmgr` platform probe. Consumers use OF
phandle indices via `of_clk_add_hw_provider(..., of_clk_hw_onecell_get,
...)`.

### Step 5.3: Callees
**Record:** `s10_register_cnt_periph()` → `clk_hw_register()` with
`peri_cnt_clk_ops` (`clk_peri_cnt_clk_recalc_rate` uses `fixed_div` when
set).

### Step 5.4: Reachability
**Record:**
- **Consumer:** `smmu: iommu@fa000000` in `socfpga_agilex.dtsi` lists
  `<&clkmgr AGILEX_L3_MAIN_FREE_CLK>` as second of three clocks.
- **Driver:** `arm-smmu.c` calls `devm_clk_bulk_get_all()` at probe;
  failure returns error and aborts probe (`"failed to get clocks %d"`).
- **Trigger:** Enabling SMMU (`status = "okay"`) on an Agilex board.
- **Current in-tree boards:** `socfpga_agilex_socdk.dts`,
  `socfpga_agilex_n6000.dts` do **not** enable `&smmu`; base dtsi has
  `status = "disabled"`.

### Step 5.5: Similar patterns
**Record:** Stratix10 driver has similar fixed-parent entries (e.g.
`STRATIX10_MAIN_EMACA_CLK` with single parent, `fixed_divider=0`).
Agilex `noc_free_clk` neighbor entries use mux tables; L3 entry
correctly uses direct parent instead.

---

## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE

### Step 6.1: Buggy code exists?
**Record:** **Yes.** Verified in v6.18.44:
- `include/dt-bindings/clock/agilex-clock.h:32` defines
  `AGILEX_L3_MAIN_FREE_CLK` as 18
- `socfpga_agilex.dtsi:446-448` references it for SMMU
- `clk-agilex.c:257-279` omits it from `agilex_main_perip_cnt_clks[]`

### Step 6.2: Backport complications
**Record:** Clean apply expected (verified with `git apply --check`). No
structural conflicts; insertion point between `NOC_FREE_CLK` and
`L4_SYS_FREE_CLK` matches mainline context.

### Step 6.3: Related fixes already present?
**Record:** None. `git log --grep="l3_main_free"` returns no matches in
this tree.

---

## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT

### Step 7.1: Subsystem criticality
**Record:** `drivers/clk/socfpga/` — **PERIPHERAL** (Intel SoCFPGA
Agilex platform-specific clock driver).

### Step 7.2: Subsystem activity
**Record:** Agilex platform actively maintained; this is a gap in
existing support, not new subsystem introduction.

---

## PHASE 8: IMPACT AND RISK ASSESSMENT

### Step 8.1: Who is affected
**Record:** Users of Intel SoCFPGA Agilex with SMMU enabled in device
tree. Not universal; platform- and config-specific.

### Step 8.2: Trigger conditions
**Record:** SMMU node enabled + `arm,smmu-v2` probe runs +
`devm_clk_bulk_get_all()` resolves three `clocks` entries. **Not
triggered** on default in-tree Agilex boards (SMMU disabled). Custom DT
or future boards enabling IOMMU would hit this.

### Step 8.3: Failure mode severity
**Record:** SMMU probe failure (`-ENOENT` from clock core). **Severity:
MEDIUM** — blocks IOMMU enablement, not a kernel panic on default boot.
IOMMU is a security/isolation feature when enabled.

### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** MEDIUM — unblocks SMMU on Agilex; corrects longstanding
  DT/driver inconsistency.
- **Risk:** VERY LOW — 2 lines, no API change, no locking changes.
- **Ratio:** Favorable for backport given trivial fix and verified
  correctness.

---

## PHASE 9: FINAL SYNTHESIS

### Step 9.1: Evidence summary

**FOR backport:**
- Verified DT/driver mismatch: binding + DTS reference clock id 18;
  driver never registers it.
- Verified failure path: `arm-smmu` `devm_clk_bulk_get_all()` fails
  probe when clock missing.
- Fix is 2 lines, applies cleanly, matches TRM (1:1 `noc_free_clk`
  derivative).
- Obviously correct; maintainer-committed.
- Low regression risk.

**AGAINST backport:**
- No user reports, syzbot, or `Cc: stable`.
- SMMU `status = "disabled"` on base dtsi; no in-tree Agilex board
  enables it today.
- Default boot unaffected; impact only when SMMU explicitly enabled.
- Commit message frames this as "implement" (completing missing
  support).
- Peripheral platform; narrow user base.

**Unresolved:** Full lore review thread (bot-blocked). No confirmation
of production SMMU deployments on 6.18.y Agilex.

### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — matches TRM and existing
   driver patterns; no Tested-by but logic is straightforward.
2. Fixes a real bug affecting users? **PASS** — DT references clock
   provider does not expose; SMMU probe fails when enabled.
3. Important issue? **PASS (borderline)** — probe failure blocking IOMMU
   (MEDIUM severity), not crash/corruption on default config.
4. Small and contained? **PASS** — 2 lines, one file.
5. No new features or APIs? **PASS** — completes existing binding; no
   new uapi.
6. Can apply to local tree? **PASS** — verified clean apply.

### Step 9.3: Exception categories
**Record:** None strictly. Closest analog is hardware/platform
enablement completeness (not a device-ID or quirk entry).

### Step 9.4: Decision rationale

This is a verified driver bug: device tree and bindings promise
`AGILEX_L3_MAIN_FREE_CLK`, but the clock provider leaves index 18 as
`-ENOENT`. Enabling the Agilex SMMU (already described in
`socfpga_agilex.dtsi`) will fail probe. While no in-tree board enables
SMMU today, the inconsistency has been present since Agilex support
landed in this tree, and the two-line fix is trivial, correct, and risk-
free. Stable trees routinely take such platform driver completeness
fixes when they unblock real hardware paths defined in shipped DTS.

---

## Verification

- **[Phase 1]** Parsed commit message and tags from `git show
  1e7f562058`
- **[Phase 2]** Read diff and `clk-agilex.c`, `clk-periph-s10.c`,
  `stratix10-clk.h` in tree
- **[Phase 3]** `git describe HEAD` → `v6.18.44`; `merge-base --is-
  ancestor 1e7f562058 HEAD` → exit 1 (not in tree)
- **[Phase 3]** `git blame` on `agilex_main_perip_cnt_clks[]` — L3 entry
  absent
- **[Phase 3]** `git apply --check` on patch → exit 0 (clean apply)
- **[Phase 4]** `b4 dig -c 1e7f562058` → lore URL found; v1 only; CC
  list retrieved
- **[Phase 4]** `b4 dig -w` → maintainers CC'd
- **[Phase 4]** WebFetch lore → blocked by Anubis (UNVERIFIED: review
  thread content)
- **[Phase 5]** Grep `AGILEX_L3_MAIN_FREE_CLK` — binding + DTS present,
  driver absent
- **[Phase 5]** Read `arm-smmu.c:2178-2187` — `devm_clk_bulk_get_all()`
  fails probe on missing clock
- **[Phase 5]** Read `socfpga_agilex.dtsi:402-449` — SMMU uses clock,
  `status = "disabled"`
- **[Phase 5]** Grep board DTS files — no `&smmu { status = "okay" }` in
  intel agilex boards
- **[Phase 6]** Confirmed buggy omission in v6.18.44 checkout
- **[Phase 6]** `git show origin/master:clk-agilex.c` — fix present on
  mainline
- **[Phase 8]** Assessed SMMU-disabled default → MEDIUM not CRITICAL
  severity

**YES****Verdict: YES** — backport to this tree (`linux-6.18.y` /
v6.18.44).

`AGILEX_L3_MAIN_FREE_CLK` is defined in the dt-bindings and referenced
by the Agilex SMMU node in `socfpga_agilex.dtsi`, but `clk-agilex.c`
never registers it. If SMMU is enabled, `arm-smmu` probe fails on
`devm_clk_bulk_get_all()` because clock index 18 stays `-ENOENT`.

The fix is two lines, applies cleanly, and matches the TRM (fixed 1:1
derivative of `noc_free_clk`). No in-tree Agilex boards enable SMMU
today, but the DT/driver mismatch is real and the change is low risk.

 drivers/clk/socfpga/clk-agilex.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/socfpga/clk-agilex.c b/drivers/clk/socfpga/clk-agilex.c
index 8dd94f64756b9..2bdea1997b5ef 100644
--- a/drivers/clk/socfpga/clk-agilex.c
+++ b/drivers/clk/socfpga/clk-agilex.c
@@ -259,6 +259,8 @@ static const struct stratix10_perip_cnt_clock agilex_main_perip_cnt_clks[] = {
 	   0, 0x3C, 0, 0, 0},
 	{ AGILEX_NOC_FREE_CLK, "noc_free_clk", NULL, noc_free_mux, ARRAY_SIZE(noc_free_mux),
 	  0, 0x40, 0, 0, 0},
+	{ AGILEX_L3_MAIN_FREE_CLK, "l3_main_free_clk", "noc_free_clk", NULL,
+	  1, 0, 0, 1, 0, 0},
 	{ AGILEX_L4_SYS_FREE_CLK, "l4_sys_free_clk", NULL, noc_mux, ARRAY_SIZE(noc_mux), 0,
 	  0, 4, 0x30, 1},
 	{ AGILEX_EMAC_A_FREE_CLK, "emaca_free_clk", NULL, emaca_free_mux, ARRAY_SIZE(emaca_free_mux),
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH AUTOSEL 6.18] clk: qcom: clk-rpmh: Make all VRMs optional
       [not found] <20260831133314.4125787-1-sashal@kernel.org>
  2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-5.10] clk: keystone: don't cache clock rate Sasha Levin
  2026-08-31 13:21 ` [PATCH AUTOSEL 6.18-5.10] clk: socfpga: agilex: implement l3_main_free_clk Sasha Levin
@ 2026-08-31 13:21 ` Sasha Levin
  2026-08-31 14:15   ` sashiko-bot
  2026-08-31 13:23 ` [PATCH AUTOSEL 6.18-6.1] clk: samsung: exynos850: mark APM I3C clocks as critical Sasha Levin
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Sasha Levin @ 2026-08-31 13:21 UTC (permalink / raw)
  To: patches, stable
  Cc: Alexander Koskovich, Konrad Dybcio, Dmitry Baryshkov,
	Bjorn Andersson, Sasha Levin, sboyd, bmasney+clk, jbrunet+clk,
	linux-arm-msm, linux-clk, linux-kernel

From: Alexander Koskovich <akoskovich@pm.me>

[ Upstream commit 25b8f50b0622689cd1f7233e452407ce777a479e ]

Some VRMs aren't present on all boards, so mark them as optional. This
prevents probe failures on boards where not all VRMs are present.

This resolves an issue seen on the Nothing Phone (4a) Pro (Eliza) where
probe fails due to RPMH_RF_CLK5 not being present on the board, this is
due to this device having a slightly different PMIC configuration from
the Eliza MTP.

This matches the downstream approach of marking all VRMs as optional
and makes the previous clka_optional handling redundant.

Signed-off-by: Alexander Koskovich <akoskovich@pm.me>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260414-clk-rpmh-vrm-opt-v3-1-8ca21469ffbc@pm.me
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

# Stable Backport Analysis: `clk: qcom: clk-rpmh: Make all VRMs
optional`

**Local tree:** Linux **6.18.43** (`v6.18.43-1-gc7f0dac02d232`)

---

## PHASE 1: COMMIT MESSAGE FORENSICS

### Step 1.1: Subject line
**Record:** `[clk: qcom: clk-rpmh]` `[Make]` — Make all VRM (Voltage
Resource Manager) RPMh clocks optional when absent from cmd-db,
preventing platform-device probe failure.

### Step 1.2: Tags
**Record:**
| Tag | Value |
|-----|-------|
| Signed-off-by | Alexander Koskovich \<akoskovich@pm.me\> (author) |
| Reviewed-by | Konrad Dybcio \<konrad.dybcio@oss.qualcomm.com\> |
| Reviewed-by | Dmitry Baryshkov \<dmitry.baryshkov@oss.qualcomm.com\> |
| Link | https://lore.kernel.org/r/20260414-clk-rpmh-vrm-
opt-v3-1-8ca21469ffbc@pm.me |
| Signed-off-by | Bjorn Andersson \<andersson@kernel.org\> (maintainer)
|

Notable: **Two Qualcomm subsystem reviewers** reviewed. No `Fixes:`,
`Cc: stable`, `Reported-by:`, or syzbot tags (expected for manual
review). Lore link present but blocked by bot protection during fetch.

### Step 1.3: Body analysis
**Record:**
- **Bug:** Some VRM RPMh clock resources are absent from cmd-db on
  certain board/PMIC variants; driver probe fails with `-ENODEV`.
- **Symptom:** `clk-rpmh` platform driver probe fails; clock provider
  never registers → boot failure or severely broken clock tree on
  affected boards.
- **Concrete case:** Nothing Phone (4a) Pro (Eliza / SM7750) —
  `RPMH_RF_CLK5` not present due to different PMIC vs. MTP reference
  board.
- **Root cause:** Previous `clka_optional` flag only skipped missing
  resources whose names start with `"clka"`, missing `rfclka*`,
  `lnbclka*`, and other VRM resource names.
- **Fix approach:** Treat all VRM clocks (`res_addr ==
  CLK_RPMH_VRM_EN_OFFSET`) as optional when cmd-db has no address;
  remove per-platform `clka_optional` flag.

### Step 1.4: Hidden bug fix?
**Record:** **Yes.** Despite the subject not using "fix", this is a
probe/boot failure bug fix disguised as making resources optional. The
existing `clka_optional` mechanism in this tree is incomplete.

---

## PHASE 2: DIFF ANALYSIS

### Step 2.1: Inventory
**Record:**
| File | Changes |
|------|---------|
| `drivers/clk/qcom/clk-rpmh.c` | ~20 lines net (remove struct field, 3
`.clka_optional = true` lines, rewrite probe condition) |

**Functions modified:** `clk_rpmh_probe()` (probe path only)
**Scope:** Single-file, surgical fix.

### Step 2.2: Code flow change
**Record:**

**Hunk 1 — `struct clk_rpmh_desc`:**
- Before: Per-platform `bool clka_optional` flag.
- After: Field removed entirely.

**Hunk 2 — Platform descriptors (`sm8550`, `sm8650`, `sm8750`):**
- Before: `.clka_optional = true`.
- After: Flag removed (logic now universal for all VRM clocks).

**Hunk 3 — `clk_rpmh_probe()` error path:**
- Before: On missing cmd-db address, skip only if `desc->clka_optional
  && res_name starts with "clka"`.
- After: On missing cmd-db address, skip if `rpmh_clk->res_addr ==
  CLK_RPMH_VRM_EN_OFFSET` (value 4, set at compile time by
  `DEFINE_CLK_RPMH_VRM`).

**Critical detail verified:** The check uses the statically initialized
`rpmh_clk->res_addr` (offset 4 for VRM, 0 for ARC) **before** line 968
adds the cmd-db base address. ARC/BCM clocks still fail probe if
missing.

### Step 2.3: Bug mechanism
**Record:**
- **Category:** Logic/correctness fix — incomplete optional-resource
  handling on error path.
- **Mechanism:** VRM clocks defined via `DEFINE_CLK_RPMH_VRM` use
  resource names like `"rfclka5"`, `"lnbclka2"`, `"clka6"`. The old
  check only matched names starting with `"clka"` (4 chars), so
  `"rfclka5"` (starts with `"rfcl"`) was **not** treated as optional
  even on platforms with `clka_optional = true`.
- **Example in this tree:** `glymur` has `RF_CLK5` using `"rfclka5"`
  with **no** `clka_optional` flag. `sm8750` has `clka_optional = true`
  but uses `"rfclka1"`/`"rfclka2"`/`"rfclka3"` for RF clocks — also not
  covered.

### Step 2.4: Fix quality
**Record:**
- **Obviously correct:** Uses the existing `CLK_RPMH_VRM_EN_OFFSET`
  discriminator already baked into clock definitions; matches downstream
  Qualcomm approach per commit message.
- **Minimal:** No API changes, no new features.
- **Regression risk:** Low-medium. Platforms like `sc7280` that
  previously failed probe on any missing VRM will now skip silently.
  Qualcomm reviewers accepted this trade-off; ARC/essential clocks still
  required.

---

## PHASE 3: GIT HISTORY INVESTIGATION

### Step 3.1: Blame
**Record:** Shallow tree (50 commits total); `git blame` on probe lines
attributes everything to `a112b91dd6349` (unrelated sunrpc commit —
artifact of shallow history). Cannot determine original introduction
commit of `clka_optional` from this checkout. **The buggy code is
present in 6.18.43** (verified by reading the file).

### Step 3.2: Fixes: tag
**Record:** Not applicable — no `Fixes:` tag in commit message.

### Step 3.3: File history
**Record:** `git log --oneline -- drivers/clk/qcom/clk-rpmh.c` returns
only one entry due to shallow history. Cannot trace related series.
Patch is **standalone** (single file, no "patch X/Y" markers).

### Step 3.4: Author context
**Record:** Alexander Koskovich is actively upstreaming Eliza/SM7750
(Nothing Phone 4a Pro) support. Same author filed SM7750 SoC ID patches.
Strong Qualcomm/mobile focus.

### Step 3.5: Dependencies
**Record:** **No dependencies.** Fix is self-contained in `clk-rpmh.c`.
Verified with `git apply --check` — **applies cleanly** to this tree.
Does not require Eliza DTS or `kaanapali`/`eliza-rpmh-clk` compatibles
(those are absent from this tree).

---

## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH

### Step 4.1: Original discussion
**Record:** Lore URL and patch.msgid.link blocked by Anubis bot
protection. `b4 dig` with wrong commit hash returned unrelated sunrpc
thread. Subject indicates **v3** of patch series. Could not read
reviewer stable nominations directly.

### Step 4.2: Reviewers
**Record:** Konrad Dybcio and Dmitry Baryshkov (Qualcomm clock/ARM
maintainers) — strong subsystem review signal, verified from commit
message tags.

### Step 4.3: Bug report
**Record:** Nothing Phone (4a) Pro (Eliza / SM7750) reported in commit
message. Web search confirms SM7750 = Eliza codename, used in Nothing
Phone (4a) Pro. **Eliza DTS / `qcom,eliza-rpmh-clk` is NOT in this
6.18.43 tree** (no `eliza.dtsi`, no eliza compatibles in `clk-rpmh.c`).

### Step 4.4: Related patches
**Record:** Eliza base DT series uses `compatible = "qcom,eliza-rpmh-
clk"` (mainline, not in this tree). Glymur is a **different** SoC
(Snapdragon X2 Elite). The reported device is Eliza, not Glymur.

### Step 4.5: Stable list
**Record:** Could not search stable@ list (lore blocked). No evidence
found of prior stable rejection.

---

## PHASE 5: CODE SEMANTIC ANALYSIS

### Step 5.1: Key functions
**Record:** `clk_rpmh_probe()`, `of_clk_rpmh_hw_get()` (unchanged).

### Step 5.2: Callers
**Record:** `clk_rpmh_probe` registered as `platform_driver` `.probe`
for `clk-rpmh`. Invoked during kernel boot device enumeration for every
Qualcomm SoC with an RPMh clock controller node in DT. **High impact** —
affects all `qcom,*-rpmh-clk` platforms.

### Step 5.3: Callees
**Record:** `cmd_db_read_addr()`, `cmd_db_read_aux_data()`,
`devm_clk_hw_register()`, `devm_of_clk_add_hw_provider()`.

### Step 5.4: Reachability
**Record:** Triggered at boot on any board where cmd-db lacks a VRM
resource entry that the platform clock table references. User-visible:
device won't boot or clocks won't register. **Reachable on every
affected Qualcomm board at boot.**

### Step 5.5: Similar patterns
**Record:** `sm8650` clock table already has a comment documenting a
missing `clka3` resource on some platforms — evidence that optional VRM
handling is expected behavior. The name-prefix approach was always
incomplete.

---

## PHASE 6: CROSS-REFERENCE WITH LOCAL TREE (6.18.43)

### Step 6.1: Buggy code exists?
**Record:** **YES.** `clka_optional` field and name-prefix check present
at lines 70, 683, 715, 884, 946–947. `CLK_RPMH_VRM_EN_OFFSET` defined at
line 20. Platforms in match table include `glymur`, `sm8750`, `sm8650`,
`sm8550`, `sc7280`, and others.

**Concrete buggy examples in this tree:**
- `glymur`: `RF_CLK5` → `"rfclka5"`, no `clka_optional` → probe fails if
  missing.
- `sm8750`: `clka_optional = true` but RF clocks use
  `"rfclka1"`/`"rfclka2"`/`"rfclka3"` → **not** covered by `"clka"`
  prefix check.
- `sm8750.dtsi` exists with `compatible = "qcom,sm8750-rpmh-clk"` — in-
  tree platform affected.

**Not in this tree:** Eliza/SM7750 (`qcom,eliza-rpmh-clk`), Nothing
Phone 4a Pro DT, `kaanapali` platform from newer mainline.

### Step 6.2: Backport complications
**Record:** **Clean apply** — verified with `git apply --check`. No
conflicts expected.

### Step 6.3: Related fixes already present?
**Record:** `git log --grep` found no existing "VRM optional" fix.
`clka_optional` mechanism is present but incomplete — this commit
completes it.

---

## PHASE 7: SUBSYSTEM CONTEXT

### Step 7.1: Subsystem criticality
**Record:** `drivers/clk/qcom/` — **IMPORTANT** (clock subsystem for
Qualcomm ARM64 SoCs). Not universal like core mm/net, but boot-critical
for affected hardware.

### Step 7.2: Activity
**Record:** Active development — `sm8750`, `glymur`, `sm8650` platforms
present. Recent SoC bring-up area.

---

## PHASE 8: IMPACT AND RISK

### Step 8.1: Who is affected
**Record:** Users of Qualcomm SoCs using RPMh VRM clocks — specifically
board variants with PMIC/cmd-db configurations that omit some VRM
resources. In this tree: **sm8750** (has DTS), **glymur** (driver only,
no arch DTS), and potentially **sc7280**/**sdx65**/**sdx75** if variant
boards omit RF clocks.

### Step 8.2: Trigger conditions
**Record:** Boot on a board whose cmd-db firmware lacks an entry for a
VRM clock listed in the platform's RPMh clock table. **Common** for
commercial phone variants vs. reference MTP boards. Not userspace-
triggerable; boot-time only.

### Step 8.3: Failure mode severity
**Record:** `clk-rpmh` probe returns `-ENODEV` → RPMh clock provider
missing → **boot failure or severely broken system**. Severity:
**CRITICAL** when triggered.

### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** HIGH for affected Qualcomm boards (boot fix); fixes known
  incomplete `clka_optional` for `sm8750`/`sm8650`/`sm8550`; aligns with
  downstream.
- **Risk:** LOW — small diff, Qualcomm-reviewed, uses existing type
  discriminator. Slight risk of masking cmd-db misconfiguration on older
  platforms (e.g., `sc7280`), but this is the intended Qualcomm
  behavior.
- **Ratio:** Benefit outweighs risk.

---

## PHASE 9: FINAL SYNTHESIS

### Step 9.1: Evidence summary

**FOR backport:**
- Fixes real boot-time probe failure on Qualcomm board variants
- Incomplete `clka_optional` logic is a genuine bug already in 6.18.43
  (`sm8750` RF clocks use `"rfclka*"` names not covered)
- `glymur` platform in driver has same bug pattern (`RF_CLK5` /
  `"rfclka5"`)
- Small (~20 line), single-file, applies cleanly
- Reviewed by two Qualcomm maintainers
- Hardware quirk / probe failure — standard stable material
- `sm8750.dtsi` with RPMh clock controller is in this tree

**AGAINST backport:**
- Specific reported device (Nothing Phone 4a Pro / Eliza / SM7750) not
  yet in 6.18.43 tree
- Broadens optional behavior for older platforms (`sc7280`, etc.)
  without documented user reports in this tree
- No syzbot/fuzzer signal; single vendor-reported case for hardware not
  yet upstream in this stable series

**Unresolved:** Could not read lore review thread; cannot confirm
explicit stable nomination from reviewers.

### Step 9.2: Stable rules checklist

| Criterion | Result |
|-----------|--------|
| 1. Obviously correct and tested? | **PASS** — logic is clear; Qualcomm
reviewers approved; matches downstream |
| 2. Fixes real bug affecting users? | **PASS** — probe failure on board
variants; `sm8750` latent bug verified in code |
| 3. Important issue? | **PASS** — boot failure (CRITICAL when
triggered) |
| 4. Small and contained? | **PASS** — ~20 lines, one file |
| 5. No new features/APIs? | **PASS** — removes flag, fixes existing
behavior |
| 6. Can apply to local tree? | **PASS** — clean apply verified |

### Step 9.3: Exception category
**Record:** **Hardware quirk / workaround** — VRM resources legitimately
absent on some board/PMIC variants; driver must not fail probe.

### Step 9.4: Decision rationale

This tree (6.18.43) already contains the incomplete `clka_optional`
mechanism and multiple Qualcomm platforms (`sm8750` with DTS, `glymur`
in driver) where VRM clocks use `"rfclka*"` resource names that the
current name-prefix check does not cover. The fix is small, self-
contained, Qualcomm-reviewed, and prevents boot-time probe failures — a
critical failure mode. While the specifically reported Nothing Phone 4a
Pro (Eliza/SM7750) platform is not yet in this tree, the underlying bug
exists in code and platform tables that **are** present, and the patch
applies cleanly without dependencies.

---

## Verification

- **[Phase 1]** `git describe HEAD` → v6.18.43; parsed all commit
  message tags
- **[Phase 2]** Read `drivers/clk/qcom/clk-rpmh.c` lines 19–20, 66–71,
  116–122, 347–387, 660–901, 917–976; confirmed VRM vs ARC `res_addr`
  initialization and probe check timing
- **[Phase 2]** Verified `"rfclka5"` does not match `strncmp(...,
  "clka", 4)` (compares `"rfcl"` vs `"clka"`)
- **[Phase 3]** `git blame` on probe lines; `git log` on file (shallow —
  limited history)
- **[Phase 3]** `git apply --check` with adapted patch → **exit 0**
  (clean apply)
- **[Phase 4]** WebFetch lore URL → blocked by Anubis; web search
  confirmed SM7750 = Eliza = Nothing Phone 4a Pro SoC
- **[Phase 4]** `b4 dig -c a112b91dd6349` → unrelated sunrpc thread
  (wrong hash)
- **[Phase 5]** `grep clk_rpmh_probe` → platform_driver probe at boot
- **[Phase 6]** `grep clka_optional` → 4 occurrences in tree; `grep
  eliza/kaanapali/sm7750` in clk driver → none
- **[Phase 6]** `glob *eliza*` → 0 files; `grep glymur` in `arch/` → no
  DTS; `grep rpmh-clk` in `arch/arm64/boot/dts/qcom` → sm8750.dtsi
  present
- **[Phase 6]** Read `sm8750.dtsi:3618-3625` — `qcom,sm8750-rpmh-clk`
  present
- **[Phase 6]** Read `glymur_rpmh_clocks` — includes `RF_CLK5` with
  `rf_clk5_a` / `"rfclka5"`
- **[Phase 7]** Read `Documentation/process/stable-kernel-rules.rst` —
  hardware quirk explicitly listed as stable-worthy
- **UNVERIFIED:** Original lore review thread content and any explicit
  stable nomination
- **UNVERIFIED:** Whether any 6.18.43-supported board (sm8750-mtp/qrd)
  currently hits missing VRM resources in practice
- **UNVERIFIED:** When `clka_optional` was originally introduced
  (shallow git history)

**YES**## Result

**Backport recommendation: YES** for Linux **6.18.43**.

The commit fixes a real boot-time bug in `drivers/clk/qcom/clk-rpmh.c`:
the existing `clka_optional` logic only skips missing resources whose
names start with `"clka"`, so VRM clocks named `"rfclka*"`,
`"lnbclka*"`, etc. can still make probe fail with `-ENODEV`. That
affects platforms already in this tree (notably `sm8750`, and `glymur`
in the driver).

The patch is small (~20 lines), applies cleanly, was reviewed by
Qualcomm maintainers, and fits the hardware-quirk/boot-failure category
for stable. The Nothing Phone 4a Pro (Eliza/SM7750) case from the commit
message isn’t in this tree yet, but the underlying bug in the RPMh clock
driver is.

 drivers/clk/qcom/clk-rpmh.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c
index 63c38cb47bc45..82f18e15cd77b 100644
--- a/drivers/clk/qcom/clk-rpmh.c
+++ b/drivers/clk/qcom/clk-rpmh.c
@@ -66,8 +66,6 @@ struct clk_rpmh {
 struct clk_rpmh_desc {
 	struct clk_hw **clks;
 	size_t num_clks;
-	/* RPMh clock clkaN are optional for this platform */
-	bool clka_optional;
 };
 
 static DEFINE_MUTEX(rpmh_clk_lock);
@@ -680,7 +678,6 @@ static struct clk_hw *sm8550_rpmh_clocks[] = {
 static const struct clk_rpmh_desc clk_rpmh_sm8550 = {
 	.clks = sm8550_rpmh_clocks,
 	.num_clks = ARRAY_SIZE(sm8550_rpmh_clocks),
-	.clka_optional = true,
 };
 
 static struct clk_hw *sm8650_rpmh_clocks[] = {
@@ -712,7 +709,6 @@ static struct clk_hw *sm8650_rpmh_clocks[] = {
 static const struct clk_rpmh_desc clk_rpmh_sm8650 = {
 	.clks = sm8650_rpmh_clocks,
 	.num_clks = ARRAY_SIZE(sm8650_rpmh_clocks),
-	.clka_optional = true,
 };
 
 static struct clk_hw *sc7280_rpmh_clocks[] = {
@@ -881,7 +877,6 @@ static struct clk_hw *sm8750_rpmh_clocks[] = {
 static const struct clk_rpmh_desc clk_rpmh_sm8750 = {
 	.clks = sm8750_rpmh_clocks,
 	.num_clks = ARRAY_SIZE(sm8750_rpmh_clocks),
-	.clka_optional = true,
 };
 
 static struct clk_hw *glymur_rpmh_clocks[] = {
@@ -943,8 +938,7 @@ static int clk_rpmh_probe(struct platform_device *pdev)
 		if (!res_addr) {
 			hw_clks[i] = NULL;
 
-			if (desc->clka_optional &&
-			    !strncmp(rpmh_clk->res_name, "clka", sizeof("clka") - 1))
+			if (rpmh_clk->res_addr == CLK_RPMH_VRM_EN_OFFSET)
 				continue;
 
 			dev_err(&pdev->dev, "missing RPMh resource address for %s\n",
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH AUTOSEL 6.18-6.1] clk: samsung: exynos850: mark APM I3C clocks as critical
       [not found] <20260831133314.4125787-1-sashal@kernel.org>
                   ` (2 preceding siblings ...)
  2026-08-31 13:21 ` [PATCH AUTOSEL 6.18] clk: qcom: clk-rpmh: Make all VRMs optional Sasha Levin
@ 2026-08-31 13:23 ` Sasha Levin
  2026-08-31 13:24 ` [PATCH AUTOSEL 6.18] clk: clk-axi-clkgen: Add support versal timings Sasha Levin
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2026-08-31 13:23 UTC (permalink / raw)
  To: patches, stable
  Cc: Alexey Klimov, Sam Protsenko, Tudor Ambarus, Krzysztof Kozlowski,
	Sasha Levin, s.nawrocki, cw00.choi, peter.griffin, sboyd,
	bmasney+clk, jbrunet+clk, linux-arm-kernel, linux-samsung-soc,
	linux-clk, linux-kernel

From: Alexey Klimov <alexey.klimov@linaro.org>

[ Upstream commit 44984aaf1aa727ff944dd4b72fcf069d08b0056d ]

The Exynos850 APM co-processor relies on the I3C bus to communicate with
the PMIC. Currently, there is no dedicated PMIC consumer driver managing
these clocks, so the clock subsystem automatically gates them during the
initialisation. Once gated, any subsequent ACPM communication with APM
results in timeouts.

As a temporary workaround (and let's hope it doesn't become permanent),
mark both `gout_i3c_pclk` and `gout_i3c_sclk` as CLK_IS_CRITICAL ones to
prevent the clock subsystem from disabling them. This makes the ACPM
communication functional. This workaround should be reverted once a
proper ACPM PMIC driver is implemented to manage these clocks.

Cc: Sam Protsenko <semen.protsenko@linaro.org>
Cc: Tudor Ambarus <tudor.ambarus@linaro.org>
Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://patch.msgid.link/20260430-exynos850-i3c-criticalclocks-v1-1-6e1fd8dfa21b@linaro.org
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

## Phase 1: Commit Message Forensics

### Step 1.1: Subject Line
**Record:** `[clk: samsung: exynos850]` `[mark]` — Mark APM I3C clocks
(`gout_i3c_pclk`, `gout_i3c_sclk`) as `CLK_IS_CRITICAL` to prevent the
clock core from gating them.

### Step 1.2: Commit Message Tags
**Record:**
- **Fixes:** — not present (expected for manual review)
- **Reported-by:** — none
- **Tested-by:** — none
- **Reviewed-by:** Sam Protsenko \<semen.protsenko@linaro.org\>, Tudor
  Ambarus \<tudor.ambarus@linaro.org\>
- **Acked-by:** — none
- **Cc:** Sam Protsenko, Tudor Ambarus (not stable@vger.kernel.org)
- **Link:** https://patch.msgid.link/20260430-exynos850-i3c-
  criticalclocks-v1-1-6e1fd8dfa21b@linaro.org
- **Signed-off-by:** Alexey Klimov, Krzysztof Kozlowski (ignore
  pipeline-added SOBs)

Notable: two Reviewed-by tags from Linaro Exynos850 platform developers;
no syzbot or user bug reports.

### Step 1.3: Commit Body Analysis
**Record:**
- **Bug:** With no PMIC consumer driver holding references, the clock
  framework gates `gout_i3c_pclk` and `gout_i3c_sclk` during init.
- **Symptom:** After gating, all ACPM communication with the Exynos850
  APM co-processor times out.
- **Root cause:** APM uses I3C to talk to the PMIC; those bus clocks
  must stay enabled but nothing claims them.
- **Fix approach:** Temporary `CLK_IS_CRITICAL` workaround until a
  proper ACPM PMIC driver manages the clocks.
- **Version info:** none in the message.

### Step 1.4: Hidden Bug Fix Detection
**Record:** Yes — described as a workaround, but it fixes real broken
platform behavior (ACPM timeouts). Same pattern as other
`CLK_IS_CRITICAL` entries in this file for clocks that must stay on
without a consumer driver.

---

## Phase 2: Diff Analysis

### Step 2.1: Change Inventory
**Record:**
- **File:** `drivers/clk/samsung/clk-exynos850.c` (+3 / −2, net +1 line)
- **Functions:** `apm_gate_clks[]` static init table (inside
  `exynos850_cmu_apm` init path)
- **Scope:** Single-file, surgical hardware workaround

### Step 2.2: Code Flow Change
**Record:**
- **Hunk 1 (I3C PCLK gate):** `GATE(..., 0, 0)` → `GATE(...,
  CLK_IS_CRITICAL, 0)` for `gout_i3c_pclk`
- **Hunk 2 (I3C SCLK gate):** `GATE(..., 0, 0)` → `GATE(...,
  CLK_IS_CRITICAL, 0)` for `gout_i3c_sclk`
- **Path affected:** Boot-time APM CMU clock registration; prevents
  automatic disable of I3C clocks after init.

### Step 2.3: Bug Mechanism
**Record:**
- **Category:** Hardware workaround / clock-gating correctness
- **Mechanism:** Ungated clocks with no consumer get disabled by
  `clk_disable_unused()`; APM I3C to PMIC then stops working and ACPM
  mailbox traffic times out.

### Step 2.4: Fix Quality
**Record:**
- Obviously correct: mirrors `gout_pmu_alive_pclk` on line 698 in the
  same table.
- Minimal, no API changes.
- **Regression risk:** Low — keeps two clocks enabled that must remain
  on; minor power cost on Exynos850 only.

---

## Phase 3: Git History Investigation

### Step 3.1: Blame
**Record:** In this checkout, I3C gate lines are at 687–690 with flags
`0, 0`. Blame points to `a112b91dd6349` (history is flattened in this
stable checkout). Verified directly: buggy code is present at HEAD.

### Step 3.2: Fixes: Tag
**Record:** N/A — no `Fixes:` tag.

### Step 3.3: Related File History
**Record:**
- Commit `44984aaf1aa72` on `master` is this fix.
- Related on master: `e57c36bc1a3e4` (APM-to-AP mailbox clock).
- Fix is **not** an ancestor of HEAD (`fix NOT in HEAD`).
- Standalone 1/1 patch (b4 dig `-a` shows only v1).

### Step 3.4: Author Context
**Record:** Alexey Klimov (Linaro). Reviewed by Sam Protsenko (original
Exynos850 clk author per file copyright). Krzysztof Kozlowski (Samsung
clk maintainer) committed it.

### Step 3.5: Dependencies
**Record:** No prerequisites. Uses existing `CLK_IS_CRITICAL` and
`GATE()` macro. Applies standalone.

---

## Phase 4: Mailing List and External Research

### Step 4.1: Original Discussion
**Record:**
- **URL:** https://patch.msgid.link/20260430-exynos850-i3c-
  criticalclocks-v1-1-6e1fd8dfa21b@linaro.org
- **Revisions:** v1 only
- **Feedback:** Sam Protsenko Reviewed-by (May 8); Tudor Ambarus
  Reviewed-by (May 6); Krzysztof Kozlowski "Applied, thanks!" (May 14)
- **Stable nomination:** none in thread
- **NAKs:** none

### Step 4.2: Reviewers
**Record:** CC'd: Krzysztof Kozlowski, Sylwester Nawrocki, Chanwoo Choi,
Alim Akhtar, Michael Turquette, Stephen Boyd, linux-clk@vger.kernel.org,
linux-samsung-soc@vger.kernel.org. Appropriate maintainers were
included.

### Step 4.3: Bug Report
**Record:** No external bug report or syzbot link. Issue comes from
platform bring-up experience (Linaro/Samsung Exynos850 work).

### Step 4.4: Related Patches
**Record:** Standalone; not part of a multi-patch series.

### Step 4.5: Stable List History
**Record:** Lore fetch blocked by bot protection for web search; mbox
thread has no stable discussion. UNVERIFIED for lore.kernel.org/stable
search.

---

## Phase 5: Code Semantic Analysis

### Step 5.1: Key Functions
**Record:** `apm_gate_clks[]` in `drivers/clk/samsung/clk-exynos850.c`;
registered via `exynos850_cmu_apm` `CLK_OF_DECLARE` path.

### Step 5.2: Callers
**Record:** Samsung CMU init during early DT clock probe for
`samsung,exynos850-cmu-apm` (present in
`arch/arm64/boot/dts/exynos/exynos850.dtsi`). Runs at boot on Exynos850
boards.

### Step 5.3: Callees
**Record:** `GATE()` macro populates `samsung_gate_clock` with `.flags =
CLK_IS_CRITICAL`, preventing disable when unused.

### Step 5.4: Reachability
**Record:** Boot path on Exynos850 (`exynos850-e850-96.dts`,
`exynosautov920*.dts`, etc.). ACPM (`drivers/firmware/samsung/exynos-
acpm.c`) uses mailbox to APM; PMIC access depends on APM I3C staying up.

### Step 5.5: Similar Patterns
**Record:** Same file already uses `CLK_IS_CRITICAL` for
`gout_pmu_alive_pclk` (line 698) and many other gates. GPIO gates use
`CLK_IGNORE_UNUSED` with TODO comments for the same class of problem.

---

## Phase 6: Cross-Reference Against Local Tree

### Step 6.1: Buggy Code Present?
**Record:** **Yes.** Local tree is **v6.18.43** (`git describe HEAD` →
`v6.18.43-1-gc7f0dac02d232`, Makefile 6.18.43). At HEAD lines 687–690:

```687:690:drivers/clk/samsung/clk-exynos850.c
        GATE(CLK_GOUT_I3C_PCLK, "gout_i3c_pclk", "dout_apm_bus",
             CLK_CON_GAT_GOUT_APM_I3C_APM_PMIC_I_PCLK, 21, 0, 0),
        GATE(CLK_GOUT_I3C_SCLK, "gout_i3c_sclk", "mout_apm_i3c",
             CLK_CON_GAT_GOUT_APM_I3C_APM_PMIC_I_SCLK, 21, 0, 0),
```

Also confirmed at `v6.18` and `v6.18.43` tags. Exynos850 DT and drivers
are present in this tree.

### Step 6.2: Backport Complications
**Record:** Clean apply expected — 5-line change, no conflicts. File is
2338 lines with no recent churn in this stable branch.

### Step 6.3: Related Fixes Already Present?
**Record:** No — `git merge-base --is-ancestor 44984aaf1aa72 HEAD` → fix
**NOT** in HEAD.

---

## Phase 7: Subsystem and Maintainer Context

### Step 7.1: Subsystem Criticality
**Record:** `drivers/clk/samsung/` — **IMPORTANT** (platform-specific
clock driver). Exynos850 is ARM64 SoC support (consumer boards +
automotive `exynosautov920`).

### Step 7.2: Subsystem Activity
**Record:** Exynos850 clk driver is actively maintained; recent master
commits add mailbox clocks and this I3C fix.

---

## Phase 8: Impact and Risk Assessment

### Step 8.1: Who Is Affected
**Record:** Exynos850 platform users only — WinLink E850-96, Exynos Auto
V920, and other `samsung,exynos850` boards using ACPM/APM PMIC
communication.

### Step 8.2: Trigger Conditions
**Record:** Every boot on affected hardware after clock init completes
and `clk_disable_unused()` runs. Deterministic, not a race. Unprivileged
users cannot trigger directly, but all Exynos850 boots hit this path.

### Step 8.3: Failure Mode Severity
**Record:** ACPM communication timeouts → broken PMIC co-processor path.
**Severity: HIGH** for affected platforms (essential firmware
communication broken; power/PMIC management non-functional). Not a
kernel oops, but platform is effectively broken for ACPM consumers.

### Step 8.4: Risk-Benefit
**Record:**
- **Benefit:** HIGH for Exynos850 users on 6.18.y
- **Risk:** VERY LOW — 2 flag changes + comment; established pattern
- **Ratio:** Strong benefit for affected hardware, negligible risk
  elsewhere

---

## Phase 9: Final Synthesis

### Step 9.1: Evidence Summary

**FOR backport:**
- Real, reproducible platform bug in this tree (6.18.43)
- Breaks ACPM/APM PMIC communication on every affected boot
- Tiny, obviously correct hardware workaround
- Reviewed by Exynos850 platform experts and committed by clk maintainer
- Fits hardware-quirk exception (clock must stay on)
- Clean backport, no dependencies
- Fix not yet in stable/linux-6.18.y

**AGAINST backport:**
- Platform-specific (Exynos850 only)
- Labeled "temporary workaround"
- No kernel crash/oops/security issue — functional timeout
- No explicit stable nomination in review thread

**Unresolved:** Stable mailing list search blocked by lore bot
protection.

### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **PASS** — matches existing
   `CLK_IS_CRITICAL` pattern; reviewed by platform developers
2. Fixes a real bug affecting users? **PASS** — ACPM timeouts on
   Exynos850
3. Important issue? **PASS** — breaks essential APM/PMIC communication
   on affected SoCs
4. Small and contained? **PASS** — 5 lines, one file
5. No new features or APIs? **PASS** — flag change only
6. Can apply to local tree? **PASS** — buggy code present, clean apply

### Step 9.3: Exception Category
**Record:** Hardware quirk/workaround — clocks that must remain enabled
for PMIC I3C on APM, analogous to existing `CLK_IS_CRITICAL` entries in
the same table.

### Step 9.4: Decision Rationale
Exynos850 support is fully present in this 6.18.43 stable tree, and the
I3C clock gating bug is present without the fix. Without this patch,
ACPM communication with the APM co-processor fails after boot-time clock
initialization — a serious functional defect for every Exynos850
deployment on 6.18.y. The fix is minimal, follows an established pattern
in the same file, and carries negligible regression risk.

---

## Verification

- [Phase 1] Parsed subject, tags, body; no Fixes:/Reported-by/syzbot;
  two Reviewed-by from Linaro
- [Phase 2] Diff: 5 lines in `clk-exynos850.c`, `CLK_IS_CRITICAL` on two
  I3C gates
- [Phase 3] `git describe HEAD` → v6.18.43; `44984aaf1aa72` on master;
  `fix NOT in HEAD`
- [Phase 3] `git show 44984aaf1aa72` — full commit message and patch
  confirmed
- [Phase 3] `git cat-file -e v6.18:drivers/clk/samsung/clk-exynos850.c`
  — file exists (2338 lines)
- [Phase 3] `git show v6.18.43:...` — I3C gates have `0, 0` flags
  (buggy)
- [Phase 4] `b4 dig -c 44984aaf1aa72` — lore URL found
- [Phase 4] `b4 dig -c 44984aaf1aa72 -w` — maintainers CC'd
- [Phase 4] `b4 dig -c 44984aaf1aa72 -a` — v1 only, standalone
- [Phase 4] `/tmp/exynos850-i3c.mbox` — Reviewed-by from Sam Protsenko
  and Tudor Ambarus; Krzysztof applied; no stable nomination
- [Phase 5] Grep: `gout_i3c_pclk` at lines 687–690 with flags `0, 0`;
  `gout_pmu_alive_pclk` uses `CLK_IS_CRITICAL` at line 698
- [Phase 5] DT: `exynos850.dtsi`, `exynos850-e850-96.dts`,
  `exynosautov920.dtsi` present
- [Phase 5] ACPM driver present at `drivers/firmware/samsung/exynos-
  acpm.c`
- [Phase 6] HEAD detached from `stable/linux-6.18.y` at Linux 6.18.43
- [Phase 6] Buggy code verified at HEAD; fix absent from tree
- [Phase 8] Failure mode: ACPM timeouts, HIGH severity for Exynos850
  platforms
- UNVERIFIED: lore.kernel.org/stable search (bot protection)

**YES**

 drivers/clk/samsung/clk-exynos850.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos850.c b/drivers/clk/samsung/clk-exynos850.c
index 56f27697c76b1..413faf14eded9 100644
--- a/drivers/clk/samsung/clk-exynos850.c
+++ b/drivers/clk/samsung/clk-exynos850.c
@@ -684,10 +684,11 @@ static const struct samsung_gate_clock apm_gate_clks[] __initconst = {
 	     CLK_CON_GAT_GOUT_APM_APBIF_RTC_PCLK, 21, 0, 0),
 	GATE(CLK_GOUT_TOP_RTC_PCLK, "gout_top_rtc_pclk", "dout_apm_bus",
 	     CLK_CON_GAT_GOUT_APM_APBIF_TOP_RTC_PCLK, 21, 0, 0),
+	/* TODO: Should be dealt with or enabled in PMIC ACPM driver */
 	GATE(CLK_GOUT_I3C_PCLK, "gout_i3c_pclk", "dout_apm_bus",
-	     CLK_CON_GAT_GOUT_APM_I3C_APM_PMIC_I_PCLK, 21, 0, 0),
+	     CLK_CON_GAT_GOUT_APM_I3C_APM_PMIC_I_PCLK, 21, CLK_IS_CRITICAL, 0),
 	GATE(CLK_GOUT_I3C_SCLK, "gout_i3c_sclk", "mout_apm_i3c",
-	     CLK_CON_GAT_GOUT_APM_I3C_APM_PMIC_I_SCLK, 21, 0, 0),
+	     CLK_CON_GAT_GOUT_APM_I3C_APM_PMIC_I_SCLK, 21, CLK_IS_CRITICAL, 0),
 	GATE(CLK_GOUT_SPEEDY_PCLK, "gout_speedy_pclk", "dout_apm_bus",
 	     CLK_CON_GAT_GOUT_APM_SPEEDY_APM_PCLK, 21, 0, 0),
 	/* TODO: Should be enabled in GPIO driver (or made CLK_IS_CRITICAL) */
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH AUTOSEL 6.18] clk: clk-axi-clkgen: Add support versal timings
       [not found] <20260831133314.4125787-1-sashal@kernel.org>
                   ` (3 preceding siblings ...)
  2026-08-31 13:23 ` [PATCH AUTOSEL 6.18-6.1] clk: samsung: exynos850: mark APM I3C clocks as critical Sasha Levin
@ 2026-08-31 13:24 ` Sasha Levin
  2026-08-31 15:02   ` sashiko-bot
  2026-08-31 13:25 ` [PATCH AUTOSEL 6.18-5.10] clk: renesas: cpg-mssr: Add number of clock cells check Sasha Levin
  2026-08-31 13:29 ` [PATCH AUTOSEL 6.18] clk: samsung: exynos990: Fix PERIC0/1 USI clock types Sasha Levin
  6 siblings, 1 reply; 11+ messages in thread
From: Sasha Levin @ 2026-08-31 13:24 UTC (permalink / raw)
  To: patches, stable
  Cc: Nuno Sá, Brian Masney, Stephen Boyd, Sasha Levin,
	bmasney+clk, jbrunet+clk, linux-clk, linux-kernel

From: Nuno Sá <nuno.sa@analog.com>

[ Upstream commit 0aef2f0db6db22c2a441e067d8e8458106fb0483 ]

Add proper VCO and PFD limits for versal based platforms. For that we
need to add new Technology and Speed grade defines.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

# Stable Backport Analysis: `clk: clk-axi-clkgen: Add support versal
timings`

**Local tree:** `v6.18.43` (`linux-6.18.y` stable, HEAD `7b923c78b50d`)

---

## PHASE 1: COMMIT MESSAGE FORENSICS

### Step 1.1: Subject Line
**Record:** `[clk: clk-axi-clkgen]` `[Add]` — Add support for Versal
FPGA VCO/PFD timing limits in the existing AXI clkgen driver.

### Step 1.2: Commit Message Tags
**Record:**
- **Signed-off-by:** Nuno Sá `<nuno.sa@analog.com>` (author)
- **Reviewed-by:** Brian Masney `<bmasney@redhat.com>`
- **Signed-off-by:** Stephen Boyd `<sboyd@kernel.org>` (clk maintainer
  merge)
- **No** Fixes:, Reported-by:, Tested-by:, Link:, Cc:
  stable@vger.kernel.org

Notable: Reviewed by a Red Hat contributor; merged by clk subsystem
maintainer. No user/fuzzer bug reports in the message.

### Step 1.3: Commit Body Analysis
**Record:**
- **Bug described:** Versal-based platforms need correct VCO and PFD
  limits; current driver lacks the technology/speed-grade definitions
  and limit overrides.
- **Symptom/failure mode:** Without proper limits, the driver either
  rejects unknown speed grades at probe time or programs the MMCM/PLL
  with out-of-spec VCO frequency bounds for Versal silicon.
- **Version info:** None stated.
- **Root cause:** `axi_clkgen_setup_limits()` handles
  Series7/Ultrascale/Ultrascale+ but not Versal
  (`ADI_AXI_FPGA_TECH_VERSAL`) or the Versal-specific
  `ADI_AXI_FPGA_SPEED_2MP` speed grade.

### Step 1.4: Hidden Bug Fix Detection
**Record:** **Yes — disguised as "Add support".** The subject says "add
support," but the change corrects two concrete failures in existing
code:
1. Speed grade `2MP` (value 23) falls through the `switch` to `default`
   → probe returns `-ENODEV`.
2. Versal technology is not recognized → VCO limits stay at
   Series7/Ultrascale defaults (e.g. `fvco_min=600000`,
   `fvco_max≤1600000`) instead of Versal-required `2160000–4320000` kHz.

---

## PHASE 2: DIFF ANALYSIS

### Step 2.1: Change Inventory
**Record:**
| File | Changes |
|------|---------|
| `drivers/clk/clk-axi-clkgen.c` | +4 / -1 (7 lines touched) |
| `include/linux/adi-axi-common.h` | +2 enum entries |

**Functions modified:** `axi_clkgen_setup_limits()` only.
**Scope:** Single-function, two-file surgical fix.

### Step 2.2: Code Flow Change (per hunk)

**Hunk 1 — speed grade range (`clk-axi-clkgen.c:524`):**
- **Before:** `ADI_AXI_FPGA_SPEED_2 ... ADI_AXI_FPGA_SPEED_2LV` (20–22)
- **After:** `ADI_AXI_FPGA_SPEED_2 ... ADI_AXI_FPGA_SPEED_2MP` (20–23)
- **Path:** Probe-time limit setup for speed-grade 2 variants.

**Hunk 2 — Versal VCO override (`clk-axi-clkgen.c:546-549`):**
- **Before:** Only Ultrascale+ gets a technology-specific VCO override.
- **After:** Versal gets `fvco_min=2160000`, `fvco_max=4320000`.
- **Path:** Post-switch technology override in
  `axi_clkgen_setup_limits()`.

**Hunk 3 — header enums (`adi-axi-common.h`):**
- **Before:** No `ADI_AXI_FPGA_TECH_VERSAL` or `ADI_AXI_FPGA_SPEED_2MP`.
- **After:** Both defined.

### Step 2.3: Bug Mechanism Classification
**Record:** **(h) Hardware workaround / correctness fix**
- Missing enum value → probe failure (`-ENODEV`) for speed grade 23.
- Missing technology branch → wrong PLL constraint window used by
  `axi_clkgen_calc_params()` in `set_rate()` and `determine_rate()`.

### Step 2.4: Fix Quality Assessment
**Record:** Fix is minimal, mirrors the existing Ultrascale+ override
pattern, and is obviously correct from a hardware-spec perspective.
Regression risk is very low: only affects platforms reporting Versal
technology or 2MP speed grade. No lock-order or API changes.

---

## PHASE 3: GIT HISTORY INVESTIGATION

### Step 3.1: Blame / Introduction of Buggy Code
**Record:** `axi_clkgen_setup_limits()` exists in `v6.18.0` without
Versal handling (verified via `git show v6.18:drivers/clk/clk-axi-
clkgen.c`). Current tree at `v6.18.43` is identical in the affected
region. The omission has been present since at least the 6.18 release.
Shallow history in this checkout prevents identifying the original
introducing commit beyond the squashed import.

### Step 3.2: Fixes: Tag
**Record:** Not applicable — no Fixes: tag present.

### Step 3.3: Related File History
**Record:** No changes to these files on `v6.18..HEAD` (stable queue).
The patch diff base blob `fa5ccef73e60d` matches the current file
content in the affected region — patch applies cleanly.

### Step 3.4: Author Context
**Record:** Nuno Sá is an active Analog Devices contributor (dma-axi-
dmac, iio, hwmon commits in this tree). Brian Masney (reviewer) is a
regular ADI/FPGA driver contributor.

### Step 3.5: Dependencies
**Record:** **Standalone.** No series dependencies, no prerequisite
commits required. The driver, `axi_clkgen_setup_limits()`, and
`ADI_AXI_REG_FPGA_INFO` infrastructure all exist in 6.18.y.

---

## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH

### Step 4.1: Original Patch Discussion
**Record:**
- v1: https://www.spinics.net/lists/kernel/msg6122732.html (2026-03-26)
- RESEND: https://www.spinics.net/lists/kernel/msg6169958.html
  (2026-04-24)
- `b4 dig` could not be run (commit hash not in local tree);
  lore.kernel.org blocked by bot protection.
- Follow-ups from Stephen Boyd and Brian Masney are listed on spinics
  but individual reply bodies were not retrieved.
- Patch is a single standalone commit (not a series).

### Step 4.2: Reviewers
**Record:** CC'd to `linux-clk@`, Michael Turquette, Stephen Boyd.
Reviewed-by: Brian Masney in committed version.

### Step 4.3: Bug Reports
**Record:** No Reported-by, syzbot, or bugzilla links. No external user
crash reports found.

### Step 4.4: Related Patches
**Record:** Single patch; change-id `20260326-clk-axi-clk-versal-
support-8eaef1530870`. v1 and RESEND are identical in content.

### Step 4.5: Stable List History
**Record:** Not searched (no stable nomination found in available patch
posts). Absence of Cc: stable is expected per review instructions.

---

## PHASE 5: CODE SEMANTIC ANALYSIS

### Step 5.1: Key Functions Modified
**Record:** `axi_clkgen_setup_limits()` (only function changed).

### Step 5.2: Callers
**Record:** Called once from `axi_clkgen_probe()` when
`ADI_AXI_PCORE_VER_MAJOR(pcore_version) > 0x04`:

```616:619:drivers/clk/clk-axi-clkgen.c
        if (ADI_AXI_PCORE_VER_MAJOR(pcore_version) > 0x04) {
                ret = axi_clkgen_setup_limits(axi_clkgen, &pdev->dev);
                if (ret)
                        return ret;
```

Probe-time, platform driver init path.

### Step 5.3: Callees / Downstream Impact
**Record:** Limits set here are consumed by `axi_clkgen_calc_params()`
via `axi_clkgen_set_rate()` and `axi_clkgen_determine_rate()`. Wrong
limits → `-EINVAL` from rate setting or incorrect PLL divider values
programmed to MMCM registers.

### Step 5.4: Reachability
**Record:** Triggered at device probe for any platform with `adi,axi-
clkgen-2.00.a` or `adi,zynqmp-axi-clkgen-2.00.a` compatible and pcore
version > 4. Requires `CONFIG_COMMON_CLK_AXI_CLKGEN`. No in-tree Versal
DTS nodes use this compatible string (verified by grep), but the driver
reads technology directly from FPGA hardware registers — custom ADI
reference designs on Versal are the target.

### Step 5.5: Similar Patterns
**Record:** Identical pattern already exists for
`ADI_AXI_FPGA_TECH_ULTRASCALE_PLUS` in the same function (lines
545–549). This commit extends that pattern to Versal.

---

## PHASE 6: CROSS-REFERENCE AGAINST LOCAL TREE (6.18.y)

### Step 6.1: Does Buggy Code Exist?
**Record:** **Yes.** Current tree lacks `ADI_AXI_FPGA_TECH_VERSAL`,
`ADI_AXI_FPGA_SPEED_2MP`, and the Versal VCO override. Confirmed in both
HEAD and `v6.18.0`.

### Step 6.2: Backport Complications
**Record:** **Clean apply expected.** Diff base matches current source
exactly in affected hunks.

### Step 6.3: Related Fixes Already Present?
**Record:** **No.** Grep found no `VERSAL` or `2MP` symbols in the tree.

---

## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT

### Step 7.1: Subsystem Criticality
**Record:** **clk** / **PERIPHERAL** — Analog Devices AXI clock
generator for Xilinx FPGAs (`CONFIG_COMMON_CLK_AXI_CLKGEN`, tristate,
OF-based). Niche industrial/SDR embedded hardware.

### Step 7.2: Subsystem Activity
**Record:** clk subsystem is actively maintained in 6.18.y (many stable
backports), but this specific driver has seen no stable-queue changes
since 6.18.0.

---

## PHASE 8: IMPACT AND RISK ASSESSMENT

### Step 8.1: Who Is Affected
**Record:** **Driver-specific / platform-specific** — users of Analog
Devices AXI clkgen IP on Versal FPGAs with pcore version > 4. Not a
universal kernel path.

### Step 8.2: Trigger Conditions
**Record:**
- FPGA info register reports `ADI_AXI_FPGA_TECH_VERSAL`, and/or
- Speed grade `ADI_AXI_FPGA_SPEED_2MP` (23).
- Triggered at every probe of matching hardware. Not userspace-
  triggerable; not a security issue.

### Step 8.3: Failure Mode Severity
**Record:**
| Failure | Mode | Severity |
|---------|------|----------|
| Speed grade 2MP unrecognized | Probe fails `-ENODEV`, no clock
provider | **HIGH** for affected hardware (device unusable) |
| Wrong VCO limits on Versal | Rate requests fail (`-EINVAL`) or PLL
programmed out of spec | **MEDIUM-HIGH** (functional failure, possible
peripheral misbehavior) |

Not a kernel oops/panic/data-corruption class bug.

### Step 8.4: Risk-Benefit
**Record:**
- **Benefit:** Enables correct clock operation on Versal ADI designs;
  fixes hard probe failure for 2MP speed grade. High value for the small
  affected population.
- **Risk:** Very low — 7 lines, isolated to Versal detection path,
  follows proven Ultrascale+ pattern.
- **Ratio:** Favorable for affected users; negligible risk to everyone
  else.

---

## PHASE 9: FINAL SYNTHESIS

### Step 9.1: Evidence Summary

**FOR backport:**
- Real, verifiable bugs in existing driver logic (probe failure + wrong
  PLL limits).
- Hardware quirk/workaround — same category as existing Ultrascale+
  override.
- Tiny, surgical, reviewed, maintainer-merged patch.
- Applies cleanly to 6.18.y; all prerequisite code present.
- Fixes broken behavior on hardware the driver is already designed to
  auto-detect.

**AGAINST backport:**
- Framed as "add support" for a new FPGA generation.
- No bug reports, fuzzer findings, or in-tree DTS users.
- Very niche hardware (ADI reference designs on Versal).
- Does not cause kernel crashes or security issues — device-level
  functional failure.
- Versal was never supported in 6.18.y (not a regression fix).

### Step 9.2: Stable Rules Checklist

| Criterion | Result |
|-----------|--------|
| 1. Obviously correct and tested? | **PASS** — mirrors Ultrascale+
pattern; Reviewed-by present; no Tested-by |
| 2. Fixes a real bug affecting users? | **PASS** — probe failure and
incorrect PLL limits on Versal hardware |
| 3. Important issue? | **PASS (borderline)** — device unusable on
affected Versal platforms; not crash/security class |
| 4. Small and contained? | **PASS** — 7 lines, 2 files, 1 function |
| 5. No new features/APIs? | **PASS** — hardware quirk exception; no
userspace API changes |
| 6. Can apply to local tree? | **PASS** — code exists, clean apply |

### Step 9.3: Exception Category
**Record:** **Hardware quirk/workaround** — adding correct timing limits
for a new FPGA technology variant in an existing driver, analogous to
the Ultrascale+ VCO override already in stable.

### Step 9.4: Decision Rationale

For **linux-6.18.y**: the driver already reads FPGA technology and speed
grade from hardware and configures PLL limits accordingly. Versal
platforms are a real deployment target for Analog Devices IP (per
Kconfig: "commonly used in Analog Devices' reference designs"). Without
this patch:

1. Versal boards reporting speed grade 2MP fail probe outright.
2. All Versal boards get VCO limits roughly 2–3× too low, breaking clock
   rate configuration.

This is a correctness fix in existing auto-detection logic, not a new
driver. It is small, low-risk, and directly analogous to stable-
acceptable hardware quirk fixes. The niche audience and lack of bug
reports lower priority but do not negate technical merit.

---

## Verification

- **[Phase 1]** Parsed subject, tags (SOB, Reviewed-by), body; no
  Fixes/Reported-by/Link tags.
- **[Phase 2]** Diff analysis: 7 lines, `axi_clkgen_setup_limits()`
  only; classified as hardware workaround.
- **[Phase 3]** `git describe HEAD` → v6.18.43; `git show v6.18:...`
  confirms buggy code at 6.18.0; no VERSAL/2MP in tree (grep); diff base
  `fa5ccef73e60d` matches current file; no changes on v6.18..HEAD for
  these files.
- **[Phase 4]** Fetched v1 and RESEND from spinics.net; lore.kernel.org
  blocked; b4 dig not run (commit not in tree); no bug reports in patch
  posts.
- **[Phase 5]** Read `axi_clkgen_probe`, `set_rate`, `determine_rate`;
  traced limits → `axi_clkgen_calc_params`; grep found no in-tree
  Versal+adi-clkgen DTS.
- **[Phase 6]** Confirmed `CONFIG_COMMON_CLK_AXI_CLKGEN` and driver
  exist; patch applies cleanly; no prior fix present.
- **[Phase 7]** Kconfig confirms peripheral ADI/Xilinx driver.
- **[Phase 8]** Probe failure = -ENODEV (verified in code); wrong limits
  affect rate calculation (verified call chain).
- **UNVERIFIED:** Individual review reply bodies from Brian
  Masney/Stephen Boyd (listed but not fetched); original commit SHA on
  mainline; exact kernel version that introduced
  `axi_clkgen_setup_limits()` (shallow history).

**YES**

 drivers/clk/clk-axi-clkgen.c   | 5 ++++-
 include/linux/adi-axi-common.h | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-axi-clkgen.c b/drivers/clk/clk-axi-clkgen.c
index fa5ccef73e60d..26f76a6db8202 100644
--- a/drivers/clk/clk-axi-clkgen.c
+++ b/drivers/clk/clk-axi-clkgen.c
@@ -521,7 +521,7 @@ static int axi_clkgen_setup_limits(struct axi_clkgen *axi_clkgen,
 		axi_clkgen->limits.fvco_max = 1200000;
 		axi_clkgen->limits.fpfd_max = 450000;
 		break;
-	case ADI_AXI_FPGA_SPEED_2 ... ADI_AXI_FPGA_SPEED_2LV:
+	case ADI_AXI_FPGA_SPEED_2 ... ADI_AXI_FPGA_SPEED_2MP:
 		axi_clkgen->limits.fvco_max = 1440000;
 		axi_clkgen->limits.fpfd_max = 500000;
 		if (family == ADI_AXI_FPGA_FAMILY_KINTEX || family == ADI_AXI_FPGA_FAMILY_ARTIX) {
@@ -546,6 +546,9 @@ static int axi_clkgen_setup_limits(struct axi_clkgen *axi_clkgen,
 	if (tech == ADI_AXI_FPGA_TECH_ULTRASCALE_PLUS) {
 		axi_clkgen->limits.fvco_max = 1600000;
 		axi_clkgen->limits.fvco_min = 800000;
+	} else if (tech == ADI_AXI_FPGA_TECH_VERSAL) {
+		axi_clkgen->limits.fvco_max = 4320000;
+		axi_clkgen->limits.fvco_min = 2160000;
 	}
 
 	return 0;
diff --git a/include/linux/adi-axi-common.h b/include/linux/adi-axi-common.h
index 37962ba530dfc..e7ba393061ee6 100644
--- a/include/linux/adi-axi-common.h
+++ b/include/linux/adi-axi-common.h
@@ -51,6 +51,7 @@ enum adi_axi_fpga_technology {
 	ADI_AXI_FPGA_TECH_SERIES7,
 	ADI_AXI_FPGA_TECH_ULTRASCALE,
 	ADI_AXI_FPGA_TECH_ULTRASCALE_PLUS,
+	ADI_AXI_FPGA_TECH_VERSAL,
 };
 
 enum adi_axi_fpga_family {
@@ -71,6 +72,7 @@ enum adi_axi_fpga_speed_grade {
 	ADI_AXI_FPGA_SPEED_2    = 20,
 	ADI_AXI_FPGA_SPEED_2L   = 21,
 	ADI_AXI_FPGA_SPEED_2LV  = 22,
+	ADI_AXI_FPGA_SPEED_2MP  = 23,
 	ADI_AXI_FPGA_SPEED_3    = 30,
 };
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH AUTOSEL 6.18-5.10] clk: renesas: cpg-mssr: Add number of clock cells check
       [not found] <20260831133314.4125787-1-sashal@kernel.org>
                   ` (4 preceding siblings ...)
  2026-08-31 13:24 ` [PATCH AUTOSEL 6.18] clk: clk-axi-clkgen: Add support versal timings Sasha Levin
@ 2026-08-31 13:25 ` Sasha Levin
  2026-08-31 13:29 ` [PATCH AUTOSEL 6.18] clk: samsung: exynos990: Fix PERIC0/1 USI clock types Sasha Levin
  6 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2026-08-31 13:25 UTC (permalink / raw)
  To: patches, stable
  Cc: Geert Uytterhoeven, Biju Das, Sasha Levin, sboyd, bmasney+clk,
	jbrunet+clk, linux-renesas-soc, linux-clk, linux-kernel

From: Geert Uytterhoeven <geert+renesas@glider.be>

[ Upstream commit 7f0c422c7fbfd9294ff9321ada0c63561e5c6ea0 ]

The number of clock cells is not validated in the clock provider's
clk_src_get() callback.  Add the missing check.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://patch.msgid.link/46e010659ffdffd5e3541369f3b65d43ebe236ec.1777562043.git.geert+renesas@glider.be
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

## Phase 1: Commit Message Forensics

### Step 1.1: Subject line
**Record:** `[clk: renesas: cpg-mssr]` `[Add]` — add missing validation
of clock specifier cell count in the CPG/MSSR clock provider callback.

### Step 1.2: Tags
**Record:**
- **Signed-off-by:** Geert Uytterhoeven `<geert+renesas@glider.be>`
  (author)
- **Reviewed-by:** Biju Das `<biju.das.jz@bp.renesas.com>` (Renesas
  maintainer)
- **Link:** https://patch.msgid.link/46e010659ffdffd5e3541369f3b65d43ebe
  236ec.1777562043.git.geert+renesas@glider.be
- No Fixes:, Reported-by:, Tested-by:, Cc: stable@vger.kernel.org, or
  syzbot tags
- Notable: maintainer review present; no external bug report

### Step 1.3: Body analysis
**Record:**
- **Bug:** `cpg_mssr_clk_src_twocell_get()` uses `clkspec->args[0]` and
  `clkspec->args[1]` without verifying `clkspec->args_count == 2`
- **Symptom:** malformed or short clock specifiers can reach the
  callback; `args[1]` is read unconditionally at function entry
- **Root cause:** missing input validation in the OF clock provider
  `clk_src_get` callback
- No kernel version, stack trace, or reproduction steps in the message

### Step 1.4: Hidden bug fix?
**Record:** Yes. Although the subject says "Add … check", this is a real
correctness bug: the function dereferences two specifier cells without
confirming two cells were supplied. Same-file helper
`cpg_mssr_is_pm_clk()` already enforces `args_count == 2`.

---

## Phase 2: Diff Analysis

### Step 2.1: Inventory
**Record:**
- **File:** `drivers/clk/renesas/renesas-cpg-mssr.c` (+3 / -0)
- **Function:** `cpg_mssr_clk_src_twocell_get()`
- **Scope:** single-file, surgical (3 lines)

### Step 2.2: Code flow change
**Record:**
- **Before:** reads `clkspec->args[1]` immediately, then switches on
  `args[0]`
- **After:** returns `-EINVAL` if `args_count != 2`, then same logic
- **Path affected:** every clock lookup through this provider (probe,
  consumer `clocks` properties, `of_clk_get_from_provider()`)

### Step 2.3: Bug mechanism
**Record:** **Category:** input validation / logic correctness
**Mechanism:** with `args_count < 2`, `args[1]` may not have been
populated by the caller; with `args_count > 2`, extra cells are silently
ignored. Either can yield wrong clock index/type selection. Not a
classic buffer overflow (`args[]` is fixed-size), but can return the
wrong `struct clk *` or pass bad indices into `priv->clks[]` lookup.

### Step 2.4: Fix quality
**Record:** Obviously correct, minimal, matches existing pattern in the
same file (`cpg_mssr_is_pm_clk`, line 561) and `ux500_twocell_get()`.
Regression risk: very low; only rejects previously-accepted invalid
specifiers.

---

## Phase 3: Git History Investigation

### Step 3.1: Blame
**Record:** Current function body dates to merge `5d324e5159d9e` in this
tree's limited history; file copyright shows CPG/MSSR driver present
since 2015. The missing validation is long-standing, not a recent
regression.

### Step 3.2: Fixes: tag
**Record:** N/A — no Fixes: tag.

### Step 3.3: Related file history
**Record:** Recent `renesas-cpg-mssr.c` changes in this tree are reset-
timing fixes (`f57b5f2ad106a`, `b1c7a8145137c`). No related args_count
fix already present. Patch is standalone (3/3 in series; patches 1–2 are
rzg2l refactors).

### Step 3.4: Author context
**Record:** Geert Uytterhoeven is the Renesas clock subsystem
maintainer. Biju Das reviewed.

### Step 3.5: Dependencies
**Record:** None. Applies cleanly (`git apply --check` on upstream
commit `7f0c422c7fbfd` succeeded). Self-contained.

---

## Phase 4: Mailing List and External Research

### Step 4.1: Original discussion
**Record:**
- **URL:** https://patch.msgid.link/46e010659ffdffd5e3541369f3b65d43ebe2
  36ec.1777562043.git.geert+renesas@glider.be
- **Series:** v1, 3 patches — "clk: renesas: Miscellaneous fixes and
  cleanups"
- **Reviewer feedback:** Biju Das: "Thanks for the patch" + `Reviewed-
  by`
- **Stable nomination:** none in thread
- **NAKs/concerns:** none

### Step 4.2: Reviewers (b4 dig -w)
**Record:** CC'd: Michael Turquette, Stephen Boyd (clk maintainers),
Biju Das, linux-renesas-soc, linux-clk.

### Step 4.3: Bug report
**Record:** N/A — no external bug report or syzbot link.

### Step 4.4: Related patches
**Record:** Patches 1–2 are rzg2l refactors/cleanups, not required for
this fix.

### Step 4.5: Stable list
**Record:** Not searched separately; no stable discussion found in patch
thread.

---

## Phase 5: Code Semantic Analysis

### Step 5.1: Key functions
**Record:** `cpg_mssr_clk_src_twocell_get()` (modified); context:
`cpg_mssr_is_pm_clk()`, `cpg_mssr_attach_dev()`,
`cpg_mssr_common_init()`.

### Step 5.2: Callers
**Record:** Registered via `of_clk_add_provider(np,
cpg_mssr_clk_src_twocell_get, priv)` at line 1192. Invoked indirectly by
`of_clk_get_hw_from_clkspec()` → `of_clk_get()`, `of_clk_get_by_name()`,
`of_clk_get_from_provider()` (exported). Reachable during device
probe/boot on Renesas DT platforms.

### Step 5.3: Callees
**Record:** array indexing into `priv->clks[]`, `dev_err()`,
`clk_get_rate()`, `IS_ERR()` checks.

### Step 5.4: Reachability
**Record:** Yes — common boot/probe path for Renesas R-Car/RZ boards
using `renesas,cpg-mssr` with `#clock-cells = <2>`. Normal OF parsing
usually supplies correct `args_count`, but `of_clk_get_from_provider()`
is exported and the callback has no framework-level cell-count guard.

### Step 5.5: Similar patterns
**Record:** Same file: `cpg_mssr_is_pm_clk()` checks `args_count != 2`.
Other Renesas drivers (`rzg2l-cpg.c`, `rzv2h-cpg.c`) check in PM paths
but not in their `*_twocell_get()` callbacks. `ux500_twocell_get()` does
check in the provider callback.

---

## Phase 6: Cross-Reference Against Local Tree

### Step 6.1: Buggy code present?
**Record:** **Yes.** Tree is **linux-6.18.y** (`git describe HEAD` →
`v6.18.43-1-gc7f0dac02d232`, `make kernelversion` → `6.18.43`).
`cpg_mssr_clk_src_twocell_get()` at line 341 lacks the `args_count`
check. Upstream fix commits `7f0c422c7fbfd` / stable `1c79ea845f76d` are
**not** ancestors of current HEAD.

### Step 6.2: Backport complications
**Record:** Clean apply verified. Function is non-`static` in current
tree (was `static` in patch context); hunk still applies.

### Step 6.3: Related fixes already present?
**Record:** No — `git log --grep="clock cells check"` finds nothing on
current branch; grep confirms no `args_count` check in
`cpg_mssr_clk_src_twocell_get()`.

---

## Phase 7: Subsystem Context

### Step 7.1: Subsystem / criticality
**Record:** `drivers/clk/renesas/` — **IMPORTANT** (platform clock
provider for Renesas SoCs; affects boot and all clocked peripherals).

### Step 7.2: Activity
**Record:** Active in 6.18.y (recent reset-timing fixes in same file).

---

## Phase 8: Impact and Risk Assessment

### Step 8.1: Who is affected
**Record:** Users of Renesas CPG/MSSR platforms (R-Car, RZ families)
with `CONFIG_CLK_RENESAS`. Not universal, but real production embedded
hardware.

### Step 8.2: Trigger conditions
**Record:** Malformed clock specifier (`args_count != 2`) reaching the
provider callback — e.g. direct `of_clk_get_from_provider()` misuse, or
non-standard caller paths. Normal DT parsing with `#clock-cells = <2>`
(binding-mandated) usually provides 2 cells. **Likelihood: low** for
well-formed DT; **non-zero** for internal/exported API misuse.

### Step 8.3: Failure mode severity
**Record:** Wrong clock returned or invalid index used → peripheral mis-
clocking, probe failure, or subtle hardware misbehavior. Unlikely kernel
panic (index range checks exist), but **MEDIUM** severity for embedded
correctness; not CRITICAL (no demonstrated crash/CVE).

### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** closes a real validation gap; aligns with same-file and
  cross-driver practice
- **Risk:** negligible (3-line guard, returns `-EINVAL`)
- **Ratio:** favorable, though absolute benefit is modest without a
  reported failure

---

## Phase 9: Final Synthesis

### Step 9.1: Evidence summary

**FOR:**
- Real missing validation in a clock provider callback
- Same file already validates `args_count` in `cpg_mssr_is_pm_clk()`
- Trivial, maintainer-reviewed, applies cleanly
- Buggy code confirmed in 6.18.43
- Wrong clock lookup on SoC platforms is a meaningful failure mode

**AGAINST:**
- No user report, crash, or syzbot finding
- Normal OF/DT paths enforce cell count via `#clock-cells`
- Borderline on stable "important issue" threshold
- Part of a "fixes and cleanups" series alongside pure refactors

**UNRESOLVED:** No proof of real-world trigger on production boards.

### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — 3-line guard; reviewed by
   subsystem maintainer (no runtime test cited)
2. Fixes a real bug? **PASS** — uses specifier cells without validating
   count
3. Important issue? **PASS (borderline)** — correctness/hardware mis-
   clocking, not demonstrated crash/security
4. Small and contained? **PASS** — 3 lines, one function
5. No new features/APIs? **PASS**
6. Can apply to local tree? **PASS** — verified clean apply

### Step 9.3: Exception categories
**Record:** None (not device ID, quirk, DT, build, or docs fix).

### Step 9.4: Decision rationale
For **linux-6.18.y**, the vulnerable code exists, the fix is surgical
and maintainer-vetted, and it closes an inconsistency that could yield
incorrect clock resolution on Renesas platforms. While no crash report
exists and normal DT parsing mitigates exposure, the fix is zero-risk
defensive correctness in a hardware-critical path — appropriate for
stable.

---

## Verification

- [Phase 1] Parsed commit message and tags from user query and `git show
  7f0c422c7fbfd`
- [Phase 2] Read current `renesas-cpg-mssr.c` lines 341–393; confirmed
  unconditional `args[1]` read
- [Phase 2] Compared with `cpg_mssr_is_pm_clk()` line 561 `args_count`
  check
- [Phase 3] `git blame` on function; `git log` on file
- [Phase 3] `git apply --check` on upstream patch: clean apply
- [Phase 3] `git merge-base --is-ancestor 7f0c422c7fbfd HEAD` → exit 1
  (fix not in tree)
- [Phase 4] `b4 dig -c 1c79ea845f76d`: found lore URL
- [Phase 4] `b4 dig -a`: v1 series, patch 3/3 standalone
- [Phase 4] `b4 dig -w`: clk + Renesas maintainers CC'd
- [Phase 4] Read `/tmp/cpg-mssr-thread.mbox`: Biju Das Reviewed-by, no
  stable nomination
- [Phase 5] Traced `of_clk_add_provider` → `of_clk_get_hw_from_clkspec`
  call chain in `clk.c`
- [Phase 5] Grep `args_count != 2` across `drivers/clk/`
- [Phase 6] `git describe HEAD` → v6.18.43; `make kernelversion` →
  6.18.43
- [Phase 6] Confirmed missing check in checked-out tree
- [Phase 6] Read DT binding `renesas,cpg-mssr.yaml`: `#clock-cells`
  const 2
- [Phase 8] Read `struct of_phandle_args` in `include/linux/of.h`:
  `args_count` + `args[MAX_PHANDLE_ARGS]`

**YES****Result:** Backport to **linux-6.18.y** is recommended.

The missing `args_count != 2` check in `cpg_mssr_clk_src_twocell_get()`
is a real validation gap (the function reads `args[1]` unconditionally).
The fix is 3 lines, applies cleanly to 6.18.43, and matches the existing
check in `cpg_mssr_is_pm_clk()` in the same file. No crash reports, but
it's low-risk defensive correctness on Renesas CPG/MSSR platforms.

**YES****Upstream commit:** `7f0c422c7fbfd` — *clk: renesas: cpg-mssr:
Add number of clock cells check* (Geert Uytterhoeven, Apr 30 2026).
There is also a stable-prepared variant at `1c79ea845f76d` referencing
that upstream SHA.

In the checked-out **linux-6.18.y** tree (`v6.18.43`), neither commit is
present yet; the missing validation is still in
`cpg_mssr_clk_src_twocell_get()`. Backport recommendation remains
**YES**.

 drivers/clk/renesas/renesas-cpg-mssr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c
index a0a68ec0490f7..87ede1ee64d7a 100644
--- a/drivers/clk/renesas/renesas-cpg-mssr.c
+++ b/drivers/clk/renesas/renesas-cpg-mssr.c
@@ -349,6 +349,9 @@ struct clk *cpg_mssr_clk_src_twocell_get(struct of_phandle_args *clkspec,
 	struct clk *clk;
 	int range_check;
 
+	if (clkspec->args_count != 2)
+		return ERR_PTR(-EINVAL);
+
 	switch (clkspec->args[0]) {
 	case CPG_CORE:
 		type = "core";
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH AUTOSEL 6.18] clk: samsung: exynos990: Fix PERIC0/1 USI clock types
       [not found] <20260831133314.4125787-1-sashal@kernel.org>
                   ` (5 preceding siblings ...)
  2026-08-31 13:25 ` [PATCH AUTOSEL 6.18-5.10] clk: renesas: cpg-mssr: Add number of clock cells check Sasha Levin
@ 2026-08-31 13:29 ` Sasha Levin
  2026-08-31 16:57   ` sashiko-bot
  6 siblings, 1 reply; 11+ messages in thread
From: Sasha Levin @ 2026-08-31 13:29 UTC (permalink / raw)
  To: patches, stable
  Cc: Denzeel Oliva, Krzysztof Kozlowski, Sasha Levin, s.nawrocki,
	cw00.choi, peter.griffin, sboyd, bmasney+clk, jbrunet+clk,
	linux-samsung-soc, linux-clk, linux-arm-kernel, linux-kernel

From: Denzeel Oliva <wachiturroxd150@gmail.com>

[ Upstream commit e11560b050ce867bd7d3ccea138231db54e2250a ]

Use nMUX() for USI and UART user muxes to allow reparenting between
OSC and CMU IP output when changing rates, and use DIV_F() with
CLK_SET_RATE_PARENT on their dividers and gates so rate requests
propagate upward.

Consolidate identical USI parent arrays into shared
mout_peric0_nonbususer_p and mout_peric1_nonbususer_p.

Signed-off-by: Denzeel Oliva <wachiturroxd150@gmail.com>
Link: https://patch.msgid.link/20260528-perics-usi-v1-1-13a6ee4d1a6f@gmail.com
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

# Stable Backport Analysis: `clk: samsung: exynos990: Fix PERIC0/1 USI
clock types`

**Local tree:** `v6.18.44` (Linux 6.18.44)

---

## PHASE 1: COMMIT MESSAGE FORENSICS

**Step 1.1 — Subject line**

Record: `[clk: samsung: exynos990]` `[Fix]` — Correct PERIC0/1 USI clock
types (mux/div clock framework flags).

**Step 1.2 — Tags**

Record:
- `Signed-off-by: Denzeel Oliva <wachiturroxd150@gmail.com>` (author)
- `Link: https://patch.msgid.link/20260528-perics-
  usi-v1-1-13a6ee4d1a6f@gmail.com`
- `Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>` (clk/samsung
  maintainer)
- No `Fixes:`, `Reported-by:`, `Tested-by:`, `Reviewed-by:`, `Cc:
  stable@vger.kernel.org`

Notable: maintainer commit; no fuzzer or user bug reports.

**Step 1.3 — Body analysis**

Record:
- **Bug:** PERIC0/1 USI and UART user muxes use `MUX()`
  (`CLK_SET_RATE_NO_REPARENT`) and plain `DIV()` without
  `CLK_SET_RATE_PARENT`, so rate changes cannot reparent between
  `oscclk` and `dout_cmu_peric*_ip`, and rate requests do not propagate
  up the tree.
- **Symptom:** USI peripherals (UART/SPI/I2C via Samsung USI blocks) and
  UART debug cannot get correct clock rates when drivers call
  `clk_set_rate()`.
- **Root cause:** Wrong clock-type macros at PERIC bring-up (author's
  earlier PERIC0/1 commit).
- **Version info:** None explicit; bug introduced when PERIC0/1 support
  landed in 6.18.

**Step 1.4 — Hidden bug fix?**

Record: **Yes.** Despite "Fix" in the subject, this is a functional
clock-tree correctness bug, not cosmetic cleanup. Same class of bug
fixed earlier on GS101 (`7b54d9113cd49`).

---

## PHASE 2: DIFF ANALYSIS

**Step 2.1 — Inventory**

Record:
- **File:** `drivers/clk/samsung/clk-exynos990.c` only (+143 / −164
  lines, net −21)
- **Functions/sections:** `peric0_mux_clks[]`, `peric0_div_clks[]`,
  `peric1_mux_clks[]`, `peric1_div_clks[]`, parent-name arrays
- **Scope:** Single-file, mechanical clock registration fix

**Step 2.2 — Code flow per hunk**

Record:
- **PERIC0/1 parent arrays:** 11+12 duplicate `PNAME()` arrays → 2
  shared `mout_peric*_nonbususer_p` arrays (no behavior change).
- **Mux clocks:** `MUX()` → `nMUX()` for UART_DBG and all USI user
  muxes. Before: reparenting blocked on rate change. After: reparenting
  between OSC (~24.5 MHz) and CMU IP output allowed.
- **Div clocks:** `DIV()` → `DIV_F(..., CLK_SET_RATE_PARENT, 0)` for all
  USI dividers. Before: rate requests stopped at divider. After:
  propagate to parent mux.
- **Gates:** unchanged (commit message mentions gates, but diff does not
  modify `GATE()` entries).

**Step 2.3 — Bug mechanism**

Record: **Logic / correctness fix** in clock framework registration.
- `MUX()` sets `CLK_SET_RATE_NO_REPARENT` (see `clk.h` line 145).
- `nMUX()` clears that flag (line 151–152).
- `DIV_F()` with `CLK_SET_RATE_PARENT` enables upward rate propagation.
- Category: hardware clock configuration bug; analogous to GS101 PERIC0
  USI SPI fix.

**Step 2.4 — Fix quality**

Record:
- **Obviously correct:** Matches established GS101 pattern for the same
  IP block family.
- **Minimal:** Only affected clocks changed; parent arrays consolidated.
- **Regression risk:** Low — enables intended CCF behavior; no API or
  structural changes.
- **Note:** Commit message overstates gate changes; gates remain plain
  `GATE()` without `CLK_SET_RATE_PARENT` (unlike GS101). Maintainer
  accepted as-is.

---

## PHASE 3: GIT HISTORY INVESTIGATION

**Step 3.1 — Blame**

Record: Buggy `MUX(CLK_MOUT_PERIC0_USI00_USI_USER, ...)` introduced in
`b3b314ef13e46` (Denzeel Oliva, 2025-09-04) — "Add PERIC0 and PERIC1
clock support". Present since v6.18.

**Step 3.2 — Fixes: tag**

Record: N/A — no `Fixes:` tag. Originating commit `b3b314ef13e46` is an
ancestor of `v6.18.44`.

**Step 3.3 — Related file history**

Record:
- `bdd03ebf721f7` (2024-12-14): Introduce Exynos990 clock driver
- `b3b314ef13e46` (2025-09-07): Add PERIC0/PERIC1 — introduced bug
- `44b0a8e433aaa`: Enable PERIC0/PERIC1 in exynos990 DT
- Fix commit `e11560b050ce8` is the only change to this file between
  `v6.18.44` and mainline
- Standalone 1/1 patch, no series dependencies

**Step 3.4 — Author context**

Record: Denzeel Oliva authored both PERIC bring-up and this fix.
Krzysztof Kozlowski (samsung-clk maintainer) committed it.

**Step 3.5 — Prerequisites**

Record: No dependencies. `nMUX`, `DIV_F`, and `CLK_SET_RATE_PARENT` all
exist in this tree's `drivers/clk/samsung/clk.h`. Patch applies cleanly
(`git apply --check` passed).

---

## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH

**Step 4.1 — Original discussion**

Record:
- `b4 dig -c e11560b050ce8` → https://patch.msgid.link/20260528-perics-
  usi-v1-1-13a6ee4d1a6f@gmail.com
- Single-patch series (v1, 1/1)
- Krzysztof Kozlowski: "Applied, thanks!" — no review thread, no stable
  nomination, no NAKs

**Step 4.2 — Reviewers**

Record: CC'd Krzysztof Kozlowski, Sylwester Nawrocki, Chanwoo Choi, Alim
Akhtar, Michael Turquette, Stephen Boyd, Brian Masney; lists `linux-
clk`, `linux-samsung-soc`, `linux-arm-kernel`.

**Step 4.3 — Bug reports**

Record: N/A — no `Reported-by:` or bugzilla/syzbot links.

**Step 4.4 — Related patches**

Record: Direct precedent — `7b54d9113cd49` "clk: samsung: gs101:
propagate PERIC0 USI SPI clock rate" documents identical mechanism (nMUX
+ DIV_F + GATE CLK_SET_RATE_PARENT for USI on GS101 PERIC0).

**Step 4.5 — Stable list**

Record: No stable-list discussion found for this patch.

---

## PHASE 5: CODE SEMANTIC ANALYSIS

**Step 5.1 — Key symbols**

Record: PERIC0/1 mux/div clock tables in `clk-exynos990.c`; no new
functions.

**Step 5.2 — Callers**

Record: Clocks registered at init via exynos990 CMU probe; consumed at
runtime by device drivers via `clk_get()` / `clk_set_rate()`. PERIC0/1
CMUs are enabled in `exynos990.dtsi` (`cmu_peric0`, `cmu_peric1`).

**Step 5.3 — Callees**

Record: Samsung CCF helpers (`samsung_clk_register_mux`,
`samsung_clk_register_div`); standard Linux common clock framework
rate/recalc paths.

**Step 5.4 — Reachability**

Record: Reachable when exynos990 drivers request peripheral clocks. USI
device nodes are not yet in mainline exynos990 DTS, but PERIC clock
controllers are live and UART_DBG mux is also fixed. Any future or out-
of-tree USI/UART driver using these clocks hits the bug today.

**Step 5.5 — Similar patterns**

Record: GS101 PERIC0/1 USI clocks use `nMUX` +
`DIV_F(CLK_SET_RATE_PARENT)` + `GATE(..., CLK_SET_RATE_PARENT)`.
Exynos850 CMGP USI uses `MUX_F(CLK_SET_RATE_PARENT)` +
`DIV_F(CLK_SET_RATE_PARENT)`. Exynos990 PERIC was the outlier using
plain `MUX`/`DIV`.

---

## PHASE 6: CROSS-REFERENCE WITH LOCAL TREE (v6.18.44)

**Step 6.1 — Buggy code present?**

Record: **Yes.** Current HEAD still has `MUX()` for USI user muxes and
`DIV()` for USI dividers (e.g. lines 1568–1640). Fix commit
`e11560b050ce8` is **not** in HEAD. Bug introduced in 6.18 with PERIC
support.

**Step 6.2 — Backport complications**

Record: **Clean apply** — `git apply --check` on `e11560b050ce8` patch
succeeded against HEAD. Only one intervening commit on this file between
v6.18.44 and the fix.

**Step 6.3 — Related fixes already present?**

Record: **No** equivalent fix in this tree.

---

## PHASE 7: SUBSYSTEM CONTEXT

**Step 7.1 — Subsystem / criticality**

Record: `drivers/clk/samsung` — **PERIPHERAL** (Exynos990 platform-
specific), but PERIC clocks underpin UART/SPI/I2C for the SoC.

**Step 7.2 — Activity**

Record: exynos990 clk driver actively developed; PERIC support added in
6.18 cycle.

---

## PHASE 8: IMPACT AND RISK

**Step 8.1 — Who is affected**

Record: Exynos990 users (Galaxy S21 family boards: x1s, c1s, r8s, etc.
in `arch/arm64/boot/dts/exynos/`). Config/platform-specific, not
universal.

**Step 8.2 — Trigger conditions**

Record: Any driver calling `clk_set_rate()` on a PERIC0/1 USI or
UART_DBG clock. Common during SPI/UART/I2C device probe and transfer
setup. Not security-relevant; unprivileged users cannot trigger
directly.

**Step 8.3 — Failure mode severity**

Record: **Incorrect clock rates** → peripheral probe failure, wrong
baud/SPI timing, device malfunction. **Severity: MEDIUM** (functional
hardware breakage, not kernel crash/oops/corruption).

**Step 8.4 — Risk vs benefit**

Record:
- **Benefit:** Fixes a regression introduced in 6.18 itself; unblocks
  correct USI/UART clock operation on exynos990; matches proven GS101
  fix pattern.
- **Risk:** Very low — declarative flag changes only, clean apply,
  maintainer-reviewed.
- **Ratio:** Favorable for 6.18.y where the buggy PERIC code already
  shipped.

---

## PHASE 9: FINAL SYNTHESIS

**Step 9.1 — Evidence summary**

**FOR:**
- Real functional bug in clock registration
- Bug introduced in this stable series (6.18) with PERIC0/1 support
- Buggy code confirmed present in v6.18.44
- Small, mechanical, obviously correct fix
- Clean apply, no dependencies
- Direct precedent (GS101 USI clock fix)
- Samsung clk maintainer committed

**AGAINST:**
- No crash/security/corruption — functional hardware issue only
- No user reports, syzbot, or Tested-by
- exynos990 USI device nodes not yet in mainline DTS (limited immediate
  impact)
- Commit message inaccurately claims gate changes that aren't in the
  diff
- Platform-specific, narrow user base on mainline stable

**Unresolved:** Whether gate clocks also need `CLK_SET_RATE_PARENT` (as
on GS101) — not addressed by this commit; maintainer accepted without
gate changes.

**Step 9.2 — Stable rules checklist**

| Criterion | Result |
|-----------|--------|
| 1. Obviously correct and tested? | **PASS** — matches GS101 pattern;
no Tested-by |
| 2. Fixes real bug affecting users? | **PASS** — broken clock rate
setting for USI/UART |
| 3. Important issue? | **PASS** (borderline) — MEDIUM severity hardware
functionality bug, regression in 6.18 |
| 4. Small and contained? | **PASS** — single file, mechanical |
| 5. No new features/APIs? | **PASS** — corrects existing clock flags
only |
| 6. Applies to local tree? | **PASS** — clean apply verified |

**Step 9.3 — Exception categories**

Record: N/A — not a device ID, quirk, DT, build, or docs fix. Standard
driver correctness fix.

**Step 9.4 — Decision rationale**

This is a regression fix for code that shipped broken in Linux 6.18. The
PERIC0/1 USI and UART mux/div clocks were registered with flags that
prevent the common clock framework from reparenting and propagating rate
changes — exactly the problem documented and fixed on GS101. For the
v6.18.44 tree, the buggy code is present, the fix applies cleanly, and
exynos990 platform support (including PERIC CMUs in DT) is already in
this release. While severity is functional rather than a kernel crash,
correcting a driver bug introduced in the same stable series is
appropriate stable material.

---

## Verification

- [Phase 1] Parsed subject, tags, body from provided commit message
- [Phase 2] Read `clk.h` lines 144–198: confirmed `MUX()` =
  `CLK_SET_RATE_NO_REPARENT`, `nMUX()` allows reparenting, `DIV_F()`
  supports `CLK_SET_RATE_PARENT`
- [Phase 2] Full diff via `git show e11560b050ce8`: 143+/164−, no gate
  changes despite message claim
- [Phase 3] `git describe HEAD` → `v6.18.44`; Makefile → 6.18.44
- [Phase 3] `git blame` lines 1568–1570 → `b3b314ef13e46` introduced
  buggy MUX
- [Phase 3] `git merge-base --is-ancestor b3b314ef13e46 v6.18.44` →
  PERIC0 in tree; fix NOT in HEAD
- [Phase 3] `git tag --contains b3b314ef13e46 | grep v6.18` → present
  since v6.18-rc1
- [Phase 3] `git show 7b54d9113cd49` — GS101 precedent with detailed
  USI/SPI clk_set_rate explanation
- [Phase 4] `b4 dig -c e11560b050ce8` → lore URL found
- [Phase 4] `b4 dig -w` → maintainers CC'd
- [Phase 4] `/tmp/perics-usi.mbx` — only maintainer "Applied, thanks!"
  reply; no stable nomination
- [Phase 5] Grep exynos990 DTS — `cmu_peric0`/`cmu_peric1` enabled; no
  USI device nodes yet
- [Phase 5] Grep `clk-gs101.c` — CLK_SET_RATE_PARENT on USI mux/div/gate
  clocks
- [Phase 6] Grep current tree — buggy `MUX()`/`DIV()` still present at
  lines 1565–1640, 2123+
- [Phase 6] `git apply --check` of fix patch against HEAD → clean apply
- [Phase 6] `git log v6.18.44..e11560b050ce8 -- clk-exynos990.c` → 1
  commit (the fix)
- [Phase 8] Failure mode assessed as MEDIUM (functional), not CRITICAL
  (no oops/corruption)

**YES**The background searches finished and line up with the earlier
analysis:

- **PERIC0 history:** Buggy PERIC0/1 support came in with
  `b3b314ef13e46` ("Add PERIC0 and PERIC1 clock support"), which is in
  this `v6.18.44` tree.
- **Fix commit:** The fix is `e11560b050ce8` on mainline; it is **not**
  in the checked-out `v6.18.44` tree yet.
- **GS101 precedent:** `7b54d9113cd49` ("propagate PERIC0 USI SPI clock
  rate") is the same class of fix and is present in this tree's history.

That supports the earlier verdict: **YES** for backport to this `6.18.y`
tree.

 drivers/clk/samsung/clk-exynos990.c | 307 +++++++++++++---------------
 1 file changed, 143 insertions(+), 164 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos990.c b/drivers/clk/samsung/clk-exynos990.c
index 6277dd557fab6..4385c3b76dd68 100644
--- a/drivers/clk/samsung/clk-exynos990.c
+++ b/drivers/clk/samsung/clk-exynos990.c
@@ -1546,54 +1546,44 @@ static const unsigned long peric0_clk_regs[] __initconst = {
 
 /* Parent clock list for CMU_PERIC0 muxes */
 PNAME(mout_peric0_bus_user_p) = { "oscclk", "dout_cmu_peric0_bus" };
-PNAME(mout_peric0_uart_dbg_p) = { "oscclk", "dout_cmu_peric0_ip" };
-PNAME(mout_peric0_usi00_user_p) = { "oscclk", "dout_cmu_peric0_ip" };
-PNAME(mout_peric0_usi01_user_p) = { "oscclk", "dout_cmu_peric0_ip" };
-PNAME(mout_peric0_usi02_user_p) = { "oscclk", "dout_cmu_peric0_ip" };
-PNAME(mout_peric0_usi03_user_p) = { "oscclk", "dout_cmu_peric0_ip" };
-PNAME(mout_peric0_usi04_user_p) = { "oscclk", "dout_cmu_peric0_ip" };
-PNAME(mout_peric0_usi05_user_p) = { "oscclk", "dout_cmu_peric0_ip" };
-PNAME(mout_peric0_usi13_user_p) = { "oscclk", "dout_cmu_peric0_ip" };
-PNAME(mout_peric0_usi14_user_p) = { "oscclk", "dout_cmu_peric0_ip" };
-PNAME(mout_peric0_usi15_user_p) = { "oscclk", "dout_cmu_peric0_ip" };
-PNAME(mout_peric0_usi_i2c_user_p) = { "oscclk", "dout_cmu_peric0_ip" };
+PNAME(mout_peric0_nonbususer_p) = { "oscclk", "dout_cmu_peric0_ip" };
 
 static const struct samsung_mux_clock peric0_mux_clks[] __initconst = {
 	MUX(CLK_MOUT_PERIC0_BUS_USER, "mout_peric0_bus_user",
 	    mout_peric0_bus_user_p, PLL_CON0_MUX_CLKCMU_PERIC0_BUS_USER,
 	    4, 1),
-	MUX(CLK_MOUT_PERIC0_UART_DBG, "mout_peric0_uart_dbg",
-	    mout_peric0_uart_dbg_p, PLL_CON0_MUX_CLKCMU_PERIC0_UART_DBG,
-	    4, 1),
-	MUX(CLK_MOUT_PERIC0_USI00_USI_USER, "mout_peric0_usi00_usi_user",
-	    mout_peric0_usi00_user_p, PLL_CON0_MUX_CLKCMU_PERIC0_USI00_USI_USER,
-	    4, 1),
-	MUX(CLK_MOUT_PERIC0_USI01_USI_USER, "mout_peric0_usi01_usi_user",
-	    mout_peric0_usi01_user_p, PLL_CON0_MUX_CLKCMU_PERIC0_USI01_USI_USER,
-	    4, 1),
-	MUX(CLK_MOUT_PERIC0_USI02_USI_USER, "mout_peric0_usi02_usi_user",
-	    mout_peric0_usi02_user_p, PLL_CON0_MUX_CLKCMU_PERIC0_USI02_USI_USER,
-	    4, 1),
-	MUX(CLK_MOUT_PERIC0_USI03_USI_USER, "mout_peric0_usi03_usi_user",
-	    mout_peric0_usi03_user_p, PLL_CON0_MUX_CLKCMU_PERIC0_USI03_USI_USER,
-	    4, 1),
-	MUX(CLK_MOUT_PERIC0_USI04_USI_USER, "mout_peric0_usi04_usi_user",
-	    mout_peric0_usi04_user_p, PLL_CON0_MUX_CLKCMU_PERIC0_USI04_USI_USER,
-	    4, 1),
-	MUX(CLK_MOUT_PERIC0_USI05_USI_USER, "mout_peric0_usi05_usi_user",
-	    mout_peric0_usi05_user_p, PLL_CON0_MUX_CLKCMU_PERIC0_USI05_USI_USER,
-	    4, 1),
-	MUX(CLK_MOUT_PERIC0_USI13_USI_USER, "mout_peric0_usi13_usi_user",
-	    mout_peric0_usi13_user_p, PLL_CON0_MUX_CLKCMU_PERIC0_USI13_USI_USER,
-	    4, 1),
-	MUX(CLK_MOUT_PERIC0_USI14_USI_USER, "mout_peric0_usi14_usi_user",
-	    mout_peric0_usi14_user_p, PLL_CON0_MUX_CLKCMU_PERIC0_USI14_USI_USER,
-	    4, 1),
-	MUX(CLK_MOUT_PERIC0_USI15_USI_USER, "mout_peric0_usi15_usi_user",
-	    mout_peric0_usi15_user_p, PLL_CON0_MUX_CLKCMU_PERIC0_USI15_USI_USER,
-	    4, 1),
+	nMUX(CLK_MOUT_PERIC0_UART_DBG, "mout_peric0_uart_dbg",
+	     mout_peric0_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC0_UART_DBG,
+	     4, 1),
+	nMUX(CLK_MOUT_PERIC0_USI00_USI_USER, "mout_peric0_usi00_usi_user",
+	     mout_peric0_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC0_USI00_USI_USER,
+	     4, 1),
+	nMUX(CLK_MOUT_PERIC0_USI01_USI_USER, "mout_peric0_usi01_usi_user",
+	     mout_peric0_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC0_USI01_USI_USER,
+	     4, 1),
+	nMUX(CLK_MOUT_PERIC0_USI02_USI_USER, "mout_peric0_usi02_usi_user",
+	     mout_peric0_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC0_USI02_USI_USER,
+	     4, 1),
+	nMUX(CLK_MOUT_PERIC0_USI03_USI_USER, "mout_peric0_usi03_usi_user",
+	     mout_peric0_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC0_USI03_USI_USER,
+	     4, 1),
+	nMUX(CLK_MOUT_PERIC0_USI04_USI_USER, "mout_peric0_usi04_usi_user",
+	     mout_peric0_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC0_USI04_USI_USER,
+	     4, 1),
+	nMUX(CLK_MOUT_PERIC0_USI05_USI_USER, "mout_peric0_usi05_usi_user",
+	     mout_peric0_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC0_USI05_USI_USER,
+	     4, 1),
+	nMUX(CLK_MOUT_PERIC0_USI13_USI_USER, "mout_peric0_usi13_usi_user",
+	     mout_peric0_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC0_USI13_USI_USER,
+	     4, 1),
+	nMUX(CLK_MOUT_PERIC0_USI14_USI_USER, "mout_peric0_usi14_usi_user",
+	     mout_peric0_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC0_USI14_USI_USER,
+	     4, 1),
+	nMUX(CLK_MOUT_PERIC0_USI15_USI_USER, "mout_peric0_usi15_usi_user",
+	     mout_peric0_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC0_USI15_USI_USER,
+	     4, 1),
 	MUX(CLK_MOUT_PERIC0_USI_I2C_USER, "mout_peric0_usi_i2c_user",
-	    mout_peric0_usi_i2c_user_p, PLL_CON0_MUX_CLKCMU_PERIC0_USI_I2C_USER,
+	    mout_peric0_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC0_USI_I2C_USER,
 	    4, 1),
 };
 
@@ -1602,42 +1592,42 @@ static const struct samsung_div_clock peric0_div_clks[] __initconst = {
 	    "mout_peric0_uart_dbg",
 	    CLK_CON_DIV_DIV_CLK_PERIC0_UART_DBG,
 	    0, 4),
-	DIV(CLK_DOUT_PERIC0_USI00_USI, "dout_peric0_usi00_usi",
-	    "mout_peric0_usi00_usi_user",
-	    CLK_CON_DIV_DIV_CLK_PERIC0_USI00_USI,
-	    0, 4),
-	DIV(CLK_DOUT_PERIC0_USI01_USI, "dout_peric0_usi01_usi",
-	    "mout_peric0_usi01_usi_user",
-	    CLK_CON_DIV_DIV_CLK_PERIC0_USI01_USI,
-	    0, 4),
-	DIV(CLK_DOUT_PERIC0_USI02_USI, "dout_peric0_usi02_usi",
-	    "mout_peric0_usi02_usi_user",
-	    CLK_CON_DIV_DIV_CLK_PERIC0_USI02_USI,
-	    0, 4),
-	DIV(CLK_DOUT_PERIC0_USI03_USI, "dout_peric0_usi03_usi",
-	    "mout_peric0_usi03_usi_user",
-	    CLK_CON_DIV_DIV_CLK_PERIC0_USI03_USI,
-	    0, 4),
-	DIV(CLK_DOUT_PERIC0_USI04_USI, "dout_peric0_usi04_usi",
-	    "mout_peric0_usi04_usi_user",
-	    CLK_CON_DIV_DIV_CLK_PERIC0_USI04_USI,
-	    0, 4),
-	DIV(CLK_DOUT_PERIC0_USI05_USI, "dout_peric0_usi05_usi",
-	    "mout_peric0_usi05_usi_user",
-	    CLK_CON_DIV_DIV_CLK_PERIC0_USI05_USI,
-	    0, 4),
-	DIV(CLK_DOUT_PERIC0_USI13_USI, "dout_peric0_usi13_usi",
-	    "mout_peric0_usi13_usi_user",
-	    CLK_CON_DIV_DIV_CLK_PERIC0_USI13_USI,
-	    0, 4),
-	DIV(CLK_DOUT_PERIC0_USI14_USI, "dout_peric0_usi14_usi",
-	    "mout_peric0_usi14_usi_user",
-	    CLK_CON_DIV_DIV_CLK_PERIC0_USI14_USI,
-	    0, 4),
-	DIV(CLK_DOUT_PERIC0_USI15_USI, "dout_peric0_usi15_usi",
-	    "mout_peric0_usi15_usi_user",
-	    CLK_CON_DIV_DIV_CLK_PERIC0_USI15_USI,
-	    0, 4),
+	DIV_F(CLK_DOUT_PERIC0_USI00_USI, "dout_peric0_usi00_usi",
+	      "mout_peric0_usi00_usi_user",
+	      CLK_CON_DIV_DIV_CLK_PERIC0_USI00_USI, 0, 4,
+	      CLK_SET_RATE_PARENT, 0),
+	DIV_F(CLK_DOUT_PERIC0_USI01_USI, "dout_peric0_usi01_usi",
+	      "mout_peric0_usi01_usi_user",
+	      CLK_CON_DIV_DIV_CLK_PERIC0_USI01_USI, 0, 4,
+	      CLK_SET_RATE_PARENT, 0),
+	DIV_F(CLK_DOUT_PERIC0_USI02_USI, "dout_peric0_usi02_usi",
+	      "mout_peric0_usi02_usi_user",
+	      CLK_CON_DIV_DIV_CLK_PERIC0_USI02_USI, 0, 4,
+	      CLK_SET_RATE_PARENT, 0),
+	DIV_F(CLK_DOUT_PERIC0_USI03_USI, "dout_peric0_usi03_usi",
+	      "mout_peric0_usi03_usi_user",
+	      CLK_CON_DIV_DIV_CLK_PERIC0_USI03_USI, 0, 4,
+	      CLK_SET_RATE_PARENT, 0),
+	DIV_F(CLK_DOUT_PERIC0_USI04_USI, "dout_peric0_usi04_usi",
+	      "mout_peric0_usi04_usi_user",
+	      CLK_CON_DIV_DIV_CLK_PERIC0_USI04_USI, 0, 4,
+	      CLK_SET_RATE_PARENT, 0),
+	DIV_F(CLK_DOUT_PERIC0_USI05_USI, "dout_peric0_usi05_usi",
+	      "mout_peric0_usi05_usi_user",
+	      CLK_CON_DIV_DIV_CLK_PERIC0_USI05_USI, 0, 4,
+	      CLK_SET_RATE_PARENT, 0),
+	DIV_F(CLK_DOUT_PERIC0_USI13_USI, "dout_peric0_usi13_usi",
+	      "mout_peric0_usi13_usi_user",
+	      CLK_CON_DIV_DIV_CLK_PERIC0_USI13_USI, 0, 4,
+	      CLK_SET_RATE_PARENT, 0),
+	DIV_F(CLK_DOUT_PERIC0_USI14_USI, "dout_peric0_usi14_usi",
+	      "mout_peric0_usi14_usi_user",
+	      CLK_CON_DIV_DIV_CLK_PERIC0_USI14_USI, 0, 4,
+	      CLK_SET_RATE_PARENT, 0),
+	DIV_F(CLK_DOUT_PERIC0_USI15_USI, "dout_peric0_usi15_usi",
+	      "mout_peric0_usi15_usi_user",
+	      CLK_CON_DIV_DIV_CLK_PERIC0_USI15_USI, 0, 4,
+	      CLK_SET_RATE_PARENT, 0),
 	DIV(CLK_DOUT_PERIC0_USI_I2C, "dout_peric0_usi_i2c",
 	    "mout_peric0_usi_i2c_user",
 	    CLK_CON_DIV_DIV_CLK_PERIC0_USI_I2C,
@@ -2107,58 +2097,47 @@ static const unsigned long peric1_clk_regs[] __initconst = {
 
 /* Parent clock list for CMU_PERIC1 muxes */
 PNAME(mout_peric1_bus_user_p)  = { "oscclk", "dout_cmu_peric1_bus" };
-PNAME(mout_peric1_uart_bt_user_p) = { "oscclk", "dout_cmu_peric1_ip" };
-PNAME(mout_peric1_usi06_user_p)  = { "oscclk", "dout_cmu_peric1_ip" };
-PNAME(mout_peric1_usi07_user_p)  = { "oscclk", "dout_cmu_peric1_ip" };
-PNAME(mout_peric1_usi08_user_p)  = { "oscclk", "dout_cmu_peric1_ip" };
-PNAME(mout_peric1_usi09_user_p)  = { "oscclk", "dout_cmu_peric1_ip" };
-PNAME(mout_peric1_usi10_user_p)  = { "oscclk", "dout_cmu_peric1_ip" };
-PNAME(mout_peric1_usi11_user_p)  = { "oscclk", "dout_cmu_peric1_ip" };
-PNAME(mout_peric1_usi12_user_p)  = { "oscclk", "dout_cmu_peric1_ip" };
-PNAME(mout_peric1_usi18_user_p)  = { "oscclk", "dout_cmu_peric1_ip" };
-PNAME(mout_peric1_usi16_user_p)  = { "oscclk", "dout_cmu_peric1_ip" };
-PNAME(mout_peric1_usi17_user_p)  = { "oscclk", "dout_cmu_peric1_ip" };
-PNAME(mout_peric1_usi_i2c_user_p) = { "oscclk", "dout_cmu_peric1_ip" };
+PNAME(mout_peric1_nonbususer_p) = { "oscclk", "dout_cmu_peric1_ip" };
 
 static const struct samsung_mux_clock peric1_mux_clks[] __initconst = {
 	MUX(CLK_MOUT_PERIC1_BUS_USER, "mout_peric1_bus_user",
 	    mout_peric1_bus_user_p, PLL_CON0_MUX_CLKCMU_PERIC1_BUS_USER,
 	    4, 1),
-	MUX(CLK_MOUT_PERIC1_UART_BT_USER, "mout_peric1_uart_bt_user",
-	    mout_peric1_uart_bt_user_p, PLL_CON0_MUX_CLKCMU_PERIC1_UART_BT_USER,
-	    4, 1),
-	MUX(CLK_MOUT_PERIC1_USI06_USI_USER, "mout_peric1_usi06_usi_user",
-	    mout_peric1_usi06_user_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI06_USI_USER,
-	    4, 1),
-	MUX(CLK_MOUT_PERIC1_USI07_USI_USER, "mout_peric1_usi07_usi_user",
-	    mout_peric1_usi07_user_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI07_USI_USER,
-	    4, 1),
-	MUX(CLK_MOUT_PERIC1_USI08_USI_USER, "mout_peric1_usi08_usi_user",
-	    mout_peric1_usi08_user_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI08_USI_USER,
-	    4, 1),
-	MUX(CLK_MOUT_PERIC1_USI09_USI_USER, "mout_peric1_usi09_usi_user",
-	    mout_peric1_usi09_user_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI09_USI_USER,
-	    4, 1),
-	MUX(CLK_MOUT_PERIC1_USI10_USI_USER, "mout_peric1_usi10_usi_user",
-	    mout_peric1_usi10_user_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI10_USI_USER,
-	    4, 1),
-	MUX(CLK_MOUT_PERIC1_USI11_USI_USER, "mout_peric1_usi11_usi_user",
-	    mout_peric1_usi11_user_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI11_USI_USER,
-	    4, 1),
-	MUX(CLK_MOUT_PERIC1_USI12_USI_USER, "mout_peric1_usi12_usi_user",
-	    mout_peric1_usi12_user_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI12_USI_USER,
-	    4, 1),
-	MUX(CLK_MOUT_PERIC1_USI18_USI_USER, "mout_peric1_usi18_usi_user",
-	    mout_peric1_usi18_user_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI18_USI_USER,
-	    4, 1),
-	MUX(CLK_MOUT_PERIC1_USI16_USI_USER, "mout_peric1_usi16_usi_user",
-	    mout_peric1_usi16_user_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI16_USI_USER,
-	    4, 1),
-	MUX(CLK_MOUT_PERIC1_USI17_USI_USER, "mout_peric1_usi17_usi_user",
-	    mout_peric1_usi17_user_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI17_USI_USER,
-	    4, 1),
+	nMUX(CLK_MOUT_PERIC1_UART_BT_USER, "mout_peric1_uart_bt_user",
+	     mout_peric1_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC1_UART_BT_USER,
+	     4, 1),
+	nMUX(CLK_MOUT_PERIC1_USI06_USI_USER, "mout_peric1_usi06_usi_user",
+	     mout_peric1_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI06_USI_USER,
+	     4, 1),
+	nMUX(CLK_MOUT_PERIC1_USI07_USI_USER, "mout_peric1_usi07_usi_user",
+	     mout_peric1_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI07_USI_USER,
+	     4, 1),
+	nMUX(CLK_MOUT_PERIC1_USI08_USI_USER, "mout_peric1_usi08_usi_user",
+	     mout_peric1_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI08_USI_USER,
+	     4, 1),
+	nMUX(CLK_MOUT_PERIC1_USI09_USI_USER, "mout_peric1_usi09_usi_user",
+	     mout_peric1_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI09_USI_USER,
+	     4, 1),
+	nMUX(CLK_MOUT_PERIC1_USI10_USI_USER, "mout_peric1_usi10_usi_user",
+	     mout_peric1_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI10_USI_USER,
+	     4, 1),
+	nMUX(CLK_MOUT_PERIC1_USI11_USI_USER, "mout_peric1_usi11_usi_user",
+	     mout_peric1_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI11_USI_USER,
+	     4, 1),
+	nMUX(CLK_MOUT_PERIC1_USI12_USI_USER, "mout_peric1_usi12_usi_user",
+	     mout_peric1_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI12_USI_USER,
+	     4, 1),
+	nMUX(CLK_MOUT_PERIC1_USI18_USI_USER, "mout_peric1_usi18_usi_user",
+	     mout_peric1_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI18_USI_USER,
+	     4, 1),
+	nMUX(CLK_MOUT_PERIC1_USI16_USI_USER, "mout_peric1_usi16_usi_user",
+	     mout_peric1_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI16_USI_USER,
+	     4, 1),
+	nMUX(CLK_MOUT_PERIC1_USI17_USI_USER, "mout_peric1_usi17_usi_user",
+	     mout_peric1_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI17_USI_USER,
+	     4, 1),
 	MUX(CLK_MOUT_PERIC1_USI_I2C_USER, "mout_peric1_usi_i2c_user",
-	    mout_peric1_usi_i2c_user_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI_I2C_USER,
+	    mout_peric1_nonbususer_p, PLL_CON0_MUX_CLKCMU_PERIC1_USI_I2C_USER,
 	    4, 1),
 };
 
@@ -2167,46 +2146,46 @@ static const struct samsung_div_clock peric1_div_clks[] __initconst = {
 	    "mout_peric1_uart_bt_user",
 	    CLK_CON_DIV_DIV_CLK_PERIC1_UART_BT,
 	    0, 4),
-	DIV(CLK_DOUT_PERIC1_USI06_USI, "dout_peric1_usi06_usi",
-	    "mout_peric1_usi06_usi_user",
-	    CLK_CON_DIV_DIV_CLK_PERIC1_USI06_USI,
-	    0, 4),
-	DIV(CLK_DOUT_PERIC1_USI07_USI, "dout_peric1_usi07_usi",
-	    "mout_peric1_usi07_usi_user",
-	    CLK_CON_DIV_DIV_CLK_PERIC1_USI07_USI,
-	    0, 4),
-	DIV(CLK_DOUT_PERIC1_USI08_USI, "dout_peric1_usi08_usi",
-	    "mout_peric1_usi08_usi_user",
-	    CLK_CON_DIV_DIV_CLK_PERIC1_USI08_USI,
-	    0, 4),
-	DIV(CLK_DOUT_PERIC1_USI18_USI, "dout_peric1_usi18_usi",
-	    "mout_peric1_usi18_usi_user",
-	    CLK_CON_DIV_DIV_CLK_PERIC1_USI18_USI,
-	    0, 4),
-	DIV(CLK_DOUT_PERIC1_USI12_USI, "dout_peric1_usi12_usi",
-	    "mout_peric1_usi12_usi_user",
-	    CLK_CON_DIV_DIV_CLK_PERIC1_USI12_USI,
-	    0, 4),
-	DIV(CLK_DOUT_PERIC1_USI09_USI, "dout_peric1_usi09_usi",
-	    "mout_peric1_usi09_usi_user",
-	    CLK_CON_DIV_DIV_CLK_PERIC1_USI09_USI,
-	    0, 4),
-	DIV(CLK_DOUT_PERIC1_USI10_USI, "dout_peric1_usi10_usi",
-	    "mout_peric1_usi10_usi_user",
-	    CLK_CON_DIV_DIV_CLK_PERIC1_USI10_USI,
-	    0, 4),
-	DIV(CLK_DOUT_PERIC1_USI11_USI, "dout_peric1_usi11_usi",
-	    "mout_peric1_usi11_usi_user",
-	    CLK_CON_DIV_DIV_CLK_PERIC1_USI11_USI,
-	    0, 4),
-	DIV(CLK_DOUT_PERIC1_USI16_USI, "dout_peric1_usi16_usi",
-	    "mout_peric1_usi16_usi_user",
-	    CLK_CON_DIV_DIV_CLK_PERIC1_USI16_USI,
-	    0, 4),
-	DIV(CLK_DOUT_PERIC1_USI17_USI, "dout_peric1_usi17_usi",
-	    "mout_peric1_usi17_usi_user",
-	    CLK_CON_DIV_DIV_CLK_PERIC1_USI17_USI,
-	    0, 4),
+	DIV_F(CLK_DOUT_PERIC1_USI06_USI, "dout_peric1_usi06_usi",
+	      "mout_peric1_usi06_usi_user",
+	      CLK_CON_DIV_DIV_CLK_PERIC1_USI06_USI, 0, 4,
+	      CLK_SET_RATE_PARENT, 0),
+	DIV_F(CLK_DOUT_PERIC1_USI07_USI, "dout_peric1_usi07_usi",
+	      "mout_peric1_usi07_usi_user",
+	      CLK_CON_DIV_DIV_CLK_PERIC1_USI07_USI, 0, 4,
+	      CLK_SET_RATE_PARENT, 0),
+	DIV_F(CLK_DOUT_PERIC1_USI08_USI, "dout_peric1_usi08_usi",
+	      "mout_peric1_usi08_usi_user",
+	      CLK_CON_DIV_DIV_CLK_PERIC1_USI08_USI, 0, 4,
+	      CLK_SET_RATE_PARENT, 0),
+	DIV_F(CLK_DOUT_PERIC1_USI18_USI, "dout_peric1_usi18_usi",
+	      "mout_peric1_usi18_usi_user",
+	      CLK_CON_DIV_DIV_CLK_PERIC1_USI18_USI, 0, 4,
+	      CLK_SET_RATE_PARENT, 0),
+	DIV_F(CLK_DOUT_PERIC1_USI12_USI, "dout_peric1_usi12_usi",
+	      "mout_peric1_usi12_usi_user",
+	      CLK_CON_DIV_DIV_CLK_PERIC1_USI12_USI, 0, 4,
+	      CLK_SET_RATE_PARENT, 0),
+	DIV_F(CLK_DOUT_PERIC1_USI09_USI, "dout_peric1_usi09_usi",
+	      "mout_peric1_usi09_usi_user",
+	      CLK_CON_DIV_DIV_CLK_PERIC1_USI09_USI, 0, 4,
+	      CLK_SET_RATE_PARENT, 0),
+	DIV_F(CLK_DOUT_PERIC1_USI10_USI, "dout_peric1_usi10_usi",
+	      "mout_peric1_usi10_usi_user",
+	      CLK_CON_DIV_DIV_CLK_PERIC1_USI10_USI, 0, 4,
+	      CLK_SET_RATE_PARENT, 0),
+	DIV_F(CLK_DOUT_PERIC1_USI11_USI, "dout_peric1_usi11_usi",
+	      "mout_peric1_usi11_usi_user",
+	      CLK_CON_DIV_DIV_CLK_PERIC1_USI11_USI, 0, 4,
+	      CLK_SET_RATE_PARENT, 0),
+	DIV_F(CLK_DOUT_PERIC1_USI16_USI, "dout_peric1_usi16_usi",
+	      "mout_peric1_usi16_usi_user",
+	      CLK_CON_DIV_DIV_CLK_PERIC1_USI16_USI, 0, 4,
+	      CLK_SET_RATE_PARENT, 0),
+	DIV_F(CLK_DOUT_PERIC1_USI17_USI, "dout_peric1_usi17_usi",
+	      "mout_peric1_usi17_usi_user",
+	      CLK_CON_DIV_DIV_CLK_PERIC1_USI17_USI, 0, 4,
+	      CLK_SET_RATE_PARENT, 0),
 	DIV(CLK_DOUT_PERIC1_USI_I2C, "dout_peric1_usi_i2c",
 	    "mout_peric1_usi_i2c_user",
 	    CLK_CON_DIV_DIV_CLK_PERIC1_USI_I2C,
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH AUTOSEL 6.18-5.10] clk: socfpga: agilex: implement l3_main_free_clk
  2026-08-31 13:21 ` [PATCH AUTOSEL 6.18-5.10] clk: socfpga: agilex: implement l3_main_free_clk Sasha Levin
@ 2026-08-31 14:10   ` sashiko-bot
  0 siblings, 0 replies; 11+ messages in thread
From: sashiko-bot @ 2026-08-31 14:10 UTC (permalink / raw)
  To: Sasha Levin; +Cc: linux-clk

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but kzalloc failure in clock registration returns NULL but caller checks with IS_ERR, masking out-of-memory errors.
--

commit 22e998f769118153983e748826357fa7376dcdd9
Author: Adrian Ng Ho Yin <adrian.ho.yin.ng@altera.com>

clk: socfpga: agilex: implement l3_main_free_clk

This commit completes the AGILEX_L3_MAIN_FREE_CLK implementation in the
Agilex clock driver by registering it as a 1:1 derivative of noc_free_clk.

> diff --git a/drivers/clk/socfpga/clk-agilex.c b/drivers/clk/socfpga/clk-agilex.c
> index 8dd94f64756b9..2bdea1997b5ef 100644
> --- a/drivers/clk/socfpga/clk-agilex.c
> +++ b/drivers/clk/socfpga/clk-agilex.c
> @@ -259,6 +259,8 @@ static const struct stratix10_perip_cnt_clock agilex_main_perip_cnt_clks[] = {
>  	   0, 0x3C, 0, 0, 0},
>  	{ AGILEX_NOC_FREE_CLK, "noc_free_clk", NULL, noc_free_mux, ARRAY_SIZE(noc_free_mux),
>  	  0, 0x40, 0, 0, 0},
> +	{ AGILEX_L3_MAIN_FREE_CLK, "l3_main_free_clk", "noc_free_clk", NULL,
> +	  1, 0, 0, 1, 0, 0},

[Severity: High]
This isn't a bug introduced by this patch, but does the error handling in
agilex_clk_register_cnt_perip() properly catch memory allocation failures
when registering clocks in this array?

Looking at s10_register_cnt_periph() in drivers/clk/socfpga/clk-periph-s10.c,
a kzalloc() failure returns NULL:

	if (WARN_ON(!periph_clk))
		return NULL;

However, the caller agilex_clk_register_cnt_perip() in clk-agilex.c checks
for failures using IS_ERR():

	if (IS_ERR(hw_clk)) {
		pr_err("%s: failed to register clock %s\n",
		       __func__, clks[i].name);
		continue;
	}

Because IS_ERR() evaluates to false for NULL, the NULL pointer gets silently
stored in the provider array, overwriting the default ERR_PTR(-ENOENT) value.
The clock framework treats NULL as a valid dummy clock, meaning consumers
will successfully "enable" the clock without receiving an error.

Could this result in unclocked hardware being accessed later, leading to a
synchronous external abort and a kernel panic? Should
s10_register_cnt_periph() return ERR_PTR(-ENOMEM) instead of NULL, or should
the caller be updated to check for NULL as well?

>  	{ AGILEX_L4_SYS_FREE_CLK, "l4_sys_free_clk", NULL, noc_mux, ARRAY_SIZE(noc_mux), 0,
>  	  0, 4, 0x30, 1},
>  	{ AGILEX_EMAC_A_FREE_CLK, "emaca_free_clk", NULL, emaca_free_mux, ARRAY_SIZE(emaca_free_mux),

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260831133314.4125787-71-sashal@kernel.org?part=1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH AUTOSEL 6.18] clk: qcom: clk-rpmh: Make all VRMs optional
  2026-08-31 13:21 ` [PATCH AUTOSEL 6.18] clk: qcom: clk-rpmh: Make all VRMs optional Sasha Levin
@ 2026-08-31 14:15   ` sashiko-bot
  0 siblings, 0 replies; 11+ messages in thread
From: sashiko-bot @ 2026-08-31 14:15 UTC (permalink / raw)
  To: Sasha Levin; +Cc: linux-clk

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The clk-rpmh driver permanently mutates static global clock structures during probe, leading to severe resource address corruption on probe deferral or unbind/rebind.
--

commit db440aeaf96923e7980cc52bc879e1c6dfac5bf7
Author: Alexander Koskovich <akoskovich@pm.me>

clk: qcom: clk-rpmh: Make all VRMs optional

This commit marks all VRM clocks as optional to prevent probe failures on
boards where not all VRMs are present. It resolves issues on devices with
different PMIC configurations by checking the VRM offset directly.

Link: https://lore.kernel.org/r/20260414-clk-rpmh-vrm-opt-v3-1-8ca21469ffbc@pm.me

> diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c
> index 63c38cb47bc45..82f18e15cd77b 100644
> --- a/drivers/clk/qcom/clk-rpmh.c
> +++ b/drivers/clk/qcom/clk-rpmh.c

[ ... ]

> @@ -943,8 +938,7 @@ static int clk_rpmh_probe(struct platform_device *pdev)
>  		if (!res_addr) {
>  			hw_clks[i] = NULL;
>  
[Severity: High]
This is a pre-existing issue, but does this code permanently mutate static
global structures during probe?

Looking at clk_rpmh_probe(), it uses statically allocated arrays like
sm8550_rpmh_clocks and static structures. When the assignment above is
executed, it permanently clears missing clocks from the shared array.

Additionally, further down in this same function, the dynamic cmd-db address
is added to the static structure's initial offset:

    rpmh_clk->res_addr += res_addr;

If the driver is unbound and rebound via sysfs, or if probe defers, the
structure retains these mutated states. The probe path will erroneously add
the cmd-db address a second time for existing clocks, and missing clocks
will remain permanently NULL.

Could this lead to severe resource address corruption when issuing RPMh
commands to these accumulated addresses? Could a privileged user trigger
a sysfs unbind/bind cycle to corrupt the state and break SoC clock
management?

> -			if (desc->clka_optional &&
> -			    !strncmp(rpmh_clk->res_name, "clka", sizeof("clka") - 1))
> +			if (rpmh_clk->res_addr == CLK_RPMH_VRM_EN_OFFSET)
>  				continue;
>  
>  			dev_err(&pdev->dev, "missing RPMh resource address for %s\n",

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260831133314.4125787-81-sashal@kernel.org?part=1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH AUTOSEL 6.18] clk: clk-axi-clkgen: Add support versal timings
  2026-08-31 13:24 ` [PATCH AUTOSEL 6.18] clk: clk-axi-clkgen: Add support versal timings Sasha Levin
@ 2026-08-31 15:02   ` sashiko-bot
  0 siblings, 0 replies; 11+ messages in thread
From: sashiko-bot @ 2026-08-31 15:02 UTC (permalink / raw)
  To: Sasha Levin; +Cc: linux-clk

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Potential division by zero when calculating clock parameters if parent_rate or requested rate is below 1000 Hz.
--

commit 0b1a53196b2b85f8a1c0c11b49ab42f0ef80e28c
Author: Nuno Sá <nuno.sa@analog.com>

clk: clk-axi-clkgen: Add support versal timings

Add proper VCO and PFD limits for versal based platforms by introducing
new Technology and Speed grade defines.

> diff --git a/drivers/clk/clk-axi-clkgen.c b/drivers/clk/clk-axi-clkgen.c
> index fa5ccef73e60d..26f76a6db8202 100644
> --- a/drivers/clk/clk-axi-clkgen.c
> +++ b/drivers/clk/clk-axi-clkgen.c
[ ... ]
> @@ -546,6 +546,9 @@ static int axi_clkgen_setup_limits(struct axi_clkgen *axi_clkgen,
>  	if (tech == ADI_AXI_FPGA_TECH_ULTRASCALE_PLUS) {
>  		axi_clkgen->limits.fvco_max = 1600000;
>  		axi_clkgen->limits.fvco_min = 800000;
> +	} else if (tech == ADI_AXI_FPGA_TECH_VERSAL) {
> +		axi_clkgen->limits.fvco_max = 4320000;
> +		axi_clkgen->limits.fvco_min = 2160000;
>  	}
>  
>  	return 0;

[Severity: High]
This isn't a bug introduced by this patch, but can we hit a division by zero
kernel oops in axi_clkgen_calc_params() if a requested rate or parent_rate is
less than 1000 Hz?

In drivers/clk/clk-axi-clkgen.c:axi_clkgen_calc_params(), the code calculates
fin and fout by dividing the rates by 1000:

	fin = parent_rate / 1000;
	fout = rate / 1000;

If a client driver or device tree properties (such as assigned-clock-rates)
request a rate or parent_rate below 1000 Hz, fin or fout would become 0.
This appears to lead to a division by zero later in the same function when
calculating parameters:

	m_min = max(DIV_ROUND_UP(fvco_min_fract, fin) * d_min, 1);
	m_max = min(fvco_max_fract * d_max / fin, 64 << fract_shift);
	...
	dout = DIV_ROUND_CLOSEST(fvco, fout);

Are there constraints that prevent clk_set_rate() or clk_determine_rate()
from reaching this path with frequencies below 1000 Hz?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260831133314.4125787-224-sashal@kernel.org?part=1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH AUTOSEL 6.18] clk: samsung: exynos990: Fix PERIC0/1 USI clock types
  2026-08-31 13:29 ` [PATCH AUTOSEL 6.18] clk: samsung: exynos990: Fix PERIC0/1 USI clock types Sasha Levin
@ 2026-08-31 16:57   ` sashiko-bot
  0 siblings, 0 replies; 11+ messages in thread
From: sashiko-bot @ 2026-08-31 16:57 UTC (permalink / raw)
  To: Sasha Levin; +Cc: linux-clk

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The patch introduces a significant mismatch between the commit message and the code by failing to add the CLK_SET_RATE_PARENT flag to the UART dividers and leaf gate clocks.
--

commit 2775b50651cf5053c13e282c77800e616a6622f6
Author: Denzeel Oliva <wachiturroxd150@gmail.com>

clk: samsung: exynos990: Fix PERIC0/1 USI clock types

This commit changes USI and UART user muxes to use nMUX() to allow
reparenting between OSC and CMU IP. It also updates USI dividers to use
DIV_F() with CLK_SET_RATE_PARENT so rate requests propagate upward.

Link: https://patch.msgid.link/20260528-perics-usi-v1-1-13a6ee4d1a6f@gmail.com

> Use nMUX() for USI and UART user muxes to allow reparenting between
> OSC and CMU IP output when changing rates, and use DIV_F() with
> CLK_SET_RATE_PARENT on their dividers and gates so rate requests
> propagate upward.

[Severity: Medium]
The commit message states that CLK_SET_RATE_PARENT is applied to both the
dividers and the gates for USI and UART. However, the patch does not modify
any of the leaf gate clocks (such as CLK_GOUT_PERIC0_TOP0_IPCLK_5 for USI or
the UART gates) to include the CLK_SET_RATE_PARENT flag.

Without this flag on the gates, when a peripheral driver calls clk_set_rate()
on the leaf gate clock provided by the device tree, clk_calc_new_rates() will
return -EINVAL because the gate lacks the flag and has no .set_rate callback.
Does this code also need to update the gate clocks to match the commit
message and ensure upward rate requests propagate correctly?

> diff --git a/drivers/clk/samsung/clk-exynos990.c b/drivers/clk/samsung/clk-exynos990.c
> index 6277dd557fab6..4385c3b76dd68 100644
> --- a/drivers/clk/samsung/clk-exynos990.c
> +++ b/drivers/clk/samsung/clk-exynos990.c
> @@ -1602,42 +1592,42 @@ static const struct samsung_div_clock peric0_div_clks[] __initconst = {
>  	DIV(CLK_DOUT_PERIC0_UART_DBG, "dout_peric0_uart_dbg",
>  	    "mout_peric0_uart_dbg",
>  	    CLK_CON_DIV_DIV_CLK_PERIC0_UART_DBG,
>  	    0, 4),

[Severity: Medium]
The commit message mentions applying DIV_F() and CLK_SET_RATE_PARENT to the
UART dividers as well, but CLK_DOUT_PERIC0_UART_DBG is left as a standard
DIV() here. Does this UART divider also need to be converted to DIV_F()
with CLK_SET_RATE_PARENT so that its rate requests propagate upward?

[ ... ]

> @@ -2167,46 +2146,46 @@ static const struct samsung_div_clock peric1_div_clks[] __initconst = {
>  	DIV(CLK_DOUT_PERIC1_UART_BT, "dout_peric1_uart_bt",
>  	    "mout_peric1_uart_bt_user",
>  	    CLK_CON_DIV_DIV_CLK_PERIC1_UART_BT,
>  	    0, 4),

[Severity: Medium]
Similarly, CLK_DOUT_PERIC1_UART_BT was left unmodified. Does this divider
also need the CLK_SET_RATE_PARENT flag for rate propagation to function
correctly?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260831133314.4125787-512-sashal@kernel.org?part=1

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-08-31 16:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260831133314.4125787-1-sashal@kernel.org>
2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-5.10] clk: keystone: don't cache clock rate Sasha Levin
2026-08-31 13:21 ` [PATCH AUTOSEL 6.18-5.10] clk: socfpga: agilex: implement l3_main_free_clk Sasha Levin
2026-08-31 14:10   ` sashiko-bot
2026-08-31 13:21 ` [PATCH AUTOSEL 6.18] clk: qcom: clk-rpmh: Make all VRMs optional Sasha Levin
2026-08-31 14:15   ` sashiko-bot
2026-08-31 13:23 ` [PATCH AUTOSEL 6.18-6.1] clk: samsung: exynos850: mark APM I3C clocks as critical Sasha Levin
2026-08-31 13:24 ` [PATCH AUTOSEL 6.18] clk: clk-axi-clkgen: Add support versal timings Sasha Levin
2026-08-31 15:02   ` sashiko-bot
2026-08-31 13:25 ` [PATCH AUTOSEL 6.18-5.10] clk: renesas: cpg-mssr: Add number of clock cells check Sasha Levin
2026-08-31 13:29 ` [PATCH AUTOSEL 6.18] clk: samsung: exynos990: Fix PERIC0/1 USI clock types Sasha Levin
2026-08-31 16:57   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox