From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1118429838; Mon, 31 Aug 2026 13:35:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788183328; cv=none; b=mnMozp2yLhF5VijO9J2XELB6sE6R3bDo4UbqCv6b67cCfpZvM14tuqA5O3LWL42K/+G30miVSnFqPXl2OVHOLkbSEmSj7cQ5+6ShWmDKWM8A688GVfGpXe1tlD6tAIUHOSj0OSHoiYDfFuim/EyarKKmR1Qw8n2rvsE9noAgQmI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788183328; c=relaxed/simple; bh=B9DS2UBG8dIttkZoZjCyb72gu+7Z/Gmxfi//iVxzgco=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sNqvGDugi5DvSC+gxEKGgEnClB5EuE7VnXwWYd9yFP7PPrNnh49RSwkVhuewPvvegZ2dMUqDWGefbaJUQGZWJbvBe/aBrU9YELUayA429w0hSO+KLi+9o4QTJgeLue1nhQyRq9EsoZawEN6XFPNnmItYxUBkM4BD+HX3HvaduK4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nZaRlN1S; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nZaRlN1S" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 163A91F00A3E; Mon, 31 Aug 2026 13:35:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788183325; bh=u0/7PmwLFGCWT0l5gWR6utF05dVExmVJaDDDNrmyqMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nZaRlN1SsTJyDDQKkAGqyKI2R23fNclq6K8VcsRLWjlFHL94MTIE4Kd7F6zCT3X3M uqXrwyhotoDMoiF4AmwsJuUskx2npALIp2KSfH3ISia36wBqsIpmT1GdiJ5FauZmSO moe64VMBqS1Zmwa7r4YAxydZ7LD5G2rEW6COhtQHNDuyqi+gl+QVdCryXHQM1ff5/w kbwv3DGJcoeGdto0gOWUKKm/CCvy3yRk3ZUv6tobKRATLJfWMXDeXMpLDtIl2NvJ3x weLM6amWaePN1dbQ5scxZr3yfMJNgpOZN8LOphiCS6+NDpdkdAJZZdQK4MByx9Ocvg 4wvNhyYm32xjA== From: Sasha Levin To: patches@lists.linux.dev, stable@vger.kernel.org Cc: Alexander Koskovich , Konrad Dybcio , Dmitry Baryshkov , Bjorn Andersson , Sasha Levin , sboyd@kernel.org, bmasney+clk@redhat.com, jbrunet+clk@baylibre.com, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH AUTOSEL 6.18] clk: qcom: clk-rpmh: Make all VRMs optional Date: Mon, 31 Aug 2026 09:21:49 -0400 Message-ID: <20260831133314.4125787-81-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260831133314.4125787-1-sashal@kernel.org> References: <20260831133314.4125787-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.18.48 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Alexander Koskovich [ 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 Reviewed-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20260414-clk-rpmh-vrm-opt-v3-1-8ca21469ffbc@pm.me Signed-off-by: Bjorn Andersson Signed-off-by: Sasha Levin --- 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 \ (author) | | Reviewed-by | Konrad Dybcio \ | | Reviewed-by | Dmitry Baryshkov \ | | Link | https://lore.kernel.org/r/20260414-clk-rpmh-vrm- opt-v3-1-8ca21469ffbc@pm.me | | Signed-off-by | Bjorn Andersson \ (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