* [PATCH AUTOSEL 6.18-5.15] mmc: renesas_sdhi: Add OF entry for RZ/G2E SoC
[not found] <20260831133314.4125787-1-sashal@kernel.org>
@ 2026-08-31 13:20 ` Sasha Levin
2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-5.15] mmc: renesas_sdhi: Add OF entry for RZ/G2N SoC Sasha Levin
` (7 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2026-08-31 13:20 UTC (permalink / raw)
To: patches, stable
Cc: Lad Prabhakar, Geert Uytterhoeven, Wolfram Sang, Ulf Hansson,
Sasha Levin, linux-mmc, linux-renesas-soc, linux-kernel
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
[ Upstream commit ebf7f2198ac4817bd2929cf83c697cefa8bf36a9 ]
The RZ/G2E (R8A774C0) SoC was previously handled via the generic
"renesas,rcar-gen3-sdhi" fallback compatible string. However, because
the SDHI IP on RZ/G2E is identical with the R-Car E3 (R8A77990), it
requires the specific quirks and configuration defined in
`of_r8a77990_compatible` rather than the generic Gen3 data.
Add the explicit "renesas,sdhi-r8a774c0" match entry to map it correctly.
Note that the DT binding file renesas,sdhi.yaml does not need an update
as the entry for this SoC is already present.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulfh@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: `[mmc: renesas_sdhi] [Add] Add OF entry for RZ/G2E SoC — maps
RZ/G2E (R8A774C0) SDHI to correct SoC-specific quirks data`
**Step 1.2 — Tags**
Record:
- Fixes: — absent (expected for manual review)
- Reported-by: — none
- Tested-by: — none
- Reviewed-by: Geert Uytterhoeven, Wolfram Sang
- Acked-by: — none
- Link: — none in commit message
- Cc: stable@vger.kernel.org — absent in upstream commit (present on
patch 1/3 of the series only)
- Signed-off-by: Lad Prabhakar, Ulf Hansson
Notable: reviewed by Renesas/MMC subsystem experts; part of a 3-patch
series.
**Step 1.3 — Body analysis**
Record:
- Bug: RZ/G2E SDHI was matched via generic `renesas,rcar-gen3-sdhi`
fallback instead of SoC-specific quirks
- Symptom: missing R-Car E3 (R8A77990) quirks — HS400 calibration table
and manual tap correction
- Root cause: DTS uses `renesas,sdhi-r8a774c0` as primary compatible,
but driver OF table lacked that entry
- Version info: none explicit; binding already documents
`renesas,sdhi-r8a774c0`
**Step 1.4 — Hidden bug fix?**
Record: Yes — presented as “add OF entry” but fixes incorrect hardware
configuration. Cover letter documents measured eMMC HS400 bandwidth
improvements on RZ/G2E (read 159472 → 180781 KB/s, write 126355 → 127725
KB/s).
---
## Phase 2: Diff Analysis
**Step 2.1 — Inventory**
Record:
- Files: `drivers/mmc/host/renesas_sdhi_internal_dmac.c` (+1 line)
- Function: `renesas_sdhi_internal_dmac_of_match[]` (static OF match
table)
- Scope: single-file, surgical (1 line)
**Step 2.2 — Code flow**
Record:
- Before: `renesas,sdhi-r8a774c0` not in table → OF match falls through
to `renesas,rcar-gen3-sdhi` → `of_rcar_gen3_compatible` (no quirks)
- After: `renesas,sdhi-r8a774c0` → `of_r8a77990_compatible` (R-Car E3
quirks: `sdhi_quirks_r8a77990`)
- Path: device probe during MMC controller initialization on RZ/G2E
boards
**Step 2.3 — Bug mechanism**
Record:
- Category: (h) Hardware workaround / quirk mapping
- Mechanism: wrong `of_device_id` → wrong `quirks` pointer → missing
`hs400_calib_table` and `manual_tap_correction` in
`renesas_sdhi_probe()`
**Step 2.4 — Fix quality**
Record: Obviously correct — RZ/G2E SDHI IP is identical to R-Car E3;
same mapping pattern as already-backported G2H fix. Minimal regression
risk.
---
## Phase 3: Git History Investigation
**Step 3.1 — Blame**
Record: `of_r8a77990_compatible` introduced in `71b7597c63d2d`
(2021-07-29, Yoshihiro Shimoda). Present in v6.18.44.
**Step 3.2 — Fixes: tag**
Record: N/A — no Fixes: tag.
**Step 3.3 — Related changes**
Record:
- `77223211f44db` (2018): added SDHI nodes to `r8a774c0.dtsi` with
`renesas,sdhi-r8a774c0` compatible
- `535ff092b6860`: G2H sibling fix already backported to v6.18.44 with
`Cc: stable@vger.kernel.org`
- Series on master: G2H (`f48ee497`), G2N (`5ce500d31a162`), G2E
(`ebf7f2198ac48`) — patches are independent one-liners
- G2N OF entry not in stable; G2E not in stable
**Step 3.4 — Author context**
Record: Lad Prabhakar — Renesas contributor; same author as G2H fix
already in stable.
**Step 3.5 — Dependencies**
Record: Standalone. `of_r8a77990_compatible` and `sdhi_quirks_r8a77990`
exist in tree. Backport adds one line; in 6.18.44 (no `r8a774b1` entry)
it fits after `sdhi-mmc-r8a77470` and before `sdhi-r8a774e1`.
---
## Phase 4: Mailing List and External Research
**Step 4.1 — Discussion**
Record:
- URL:
https://patch.msgid.link/20260519135342.623943-4-prabhakar.mahadev-
lad.rj@bp.renesas.com
- Series: v2 0/3 — “Add OF entries for RZ/G2H, RZ/G2N, and RZ/G2E SoCs”
- Cover letter documents HS400 eMMC test results on all three SoCs
- No NAKs found; reviewed by Wolfram Sang and Geert Uytterhoeven
**Step 4.2 — Reviewers**
Record: Ulf Hansson (MMC maintainer), Wolfram Sang, Geert Uytterhoeven,
linux-mmc@, linux-renesas-soc@ CC’d.
**Step 4.3 — Bug report**
Record: No external bug report; author-provided benchmark data in cover
letter.
**Step 4.4 — Series context**
Record: 3 independent patches; G2H (1/3) already backported to 6.18.44;
G2E (3/3) is self-contained.
**Step 4.5 — Stable list**
Record: `Cc: stable@vger.kernel.org` on patch 1/3 (G2H) only; series
author intended stable consideration for the family of fixes.
---
## Phase 5: Code Semantic Analysis
**Step 5.1 — Key functions**
Record: `renesas_sdhi_internal_dmac_of_match[]`,
`renesas_sdhi_internal_dmac_probe()` → `renesas_sdhi_probe()`
**Step 5.2 — Callers**
Record: platform driver probe during device enumeration; triggered when
RZ/G2E SDHI nodes are enabled (e.g. EK874 `sdhi0`, `sdhi3`).
**Step 5.3 — Callees**
Record: `of_device_get_match_data()` → quirks applied in
`renesas_sdhi_probe()` for HS400 calibration (`hs400_calib_table`) and
tap correction (`manual_tap_correction`).
**Step 5.4 — Reachability**
Record: Boot-time probe on RZ/G2E boards with SD/MMC enabled. EK874
enables `sdhi0` (SD UHS) and `sdhi3` (SDIO WLAN). Userspace cannot
directly trigger, but all storage I/O on these interfaces is affected.
**Step 5.5 — Similar patterns**
Record: Same pattern as G2H (`r8a774e1` → `of_r8a7795_compatible`),
already backported to this tree.
---
## Phase 6: Cross-Reference Against Local Tree (v6.18.44)
**Step 6.1 — Buggy code exists?**
Record: Yes. `r8a774c0.dtsi` SDHI nodes use `renesas,sdhi-r8a774c0`
since 2018; driver OF table in v6.18.44 lacks this entry. Commit
`ebf7f2198ac48` not in tree.
**Step 6.2 — Backport complications**
Record: Clean apply — one line. Insert before existing `r8a774e1` entry
(G2H backport already present).
**Step 6.3 — Related fixes present?**
Record: G2H fix (`535ff092b6860`) backported; G2E fix absent.
---
## Phase 7: Subsystem Context
**Step 7.1 — Subsystem**
Record: `drivers/mmc/host` — IMPORTANT (MMC/SD/eMMC storage on embedded
Renesas RZ/G2E)
**Step 7.2 — Activity**
Record: Actively maintained; recent G2H backport shows ongoing stable
attention for this driver.
---
## Phase 8: Impact and Risk Assessment
**Step 8.1 — Who is affected**
Record: RZ/G2E (R8A774C0) users — EK874, CAT874 boards and derivatives.
Config: `CONFIG_MMC`, Renesas SDHI internal DMAC.
**Step 8.2 — Trigger conditions**
Record: Any boot with SDHI enabled on RZ/G2E. Common on reference
boards. Not userspace-triggerable but affects all MMC I/O.
**Step 8.3 — Failure mode severity**
Record: Suboptimal HS400/HS200 operation — measured ~13% read bandwidth
loss on eMMC; missing tap correction risks data integrity at high
speeds. Severity: MEDIUM-HIGH for embedded storage reliability.
**Step 8.4 — Risk-benefit**
Record: Benefit HIGH for RZ/G2E users (proven performance fix, correct
hardware quirks). Risk VERY LOW (1 line, uses existing data structures,
precedent with G2H backport).
---
## Phase 9: Final Synthesis
**Evidence FOR:**
- Fixes real hardware misconfiguration on shipping RZ/G2E boards
- Documented eMMC HS400 performance improvement
- 1-line, obviously correct hardware quirk mapping
- Same pattern as G2H fix already backported to v6.18.44
- Reviewed by subsystem maintainers
- `of_r8a77990_compatible` prerequisite exists in tree since 2021
- DTS binding and nodes already present since 2018
**Evidence AGAINST:**
- Performance-focused rather than crash/corruption explicitly reported
(but HS400 without proper calibration can cause silent errors)
- G2E patch lacks explicit `Cc: stable` (G2H had it)
- Part of a 3-patch series (but each patch is independent)
**Stable rules checklist:**
1. Obviously correct and tested? **PASS** — reviewed, benchmarked
2. Fixes real bug affecting users? **PASS** — wrong quirks on RZ/G2E
since 2018
3. Important issue? **PASS** — storage performance/reliability on
embedded platform
4. Small and contained? **PASS** — 1 line
5. No new features/APIs? **PASS** — maps to existing quirks
6. Can apply to local tree? **PASS** — clean one-line backport
**Exception category:** Hardware quirk/workaround (OF match → correct
quirks table)
---
## Verification
- [Phase 1] Parsed commit `ebf7f2198ac48` on master; tags: Reviewed-by
Geert, Wolfram; no Fixes/Reported-by
- [Phase 2] Diff: +1 line in `renesas_sdhi_internal_dmac_of_match[]`
- [Phase 3] `git describe HEAD`: v6.18.44; `of_r8a77990_compatible` from
`71b7597c63d2d` (2021)
- [Phase 3] SDHI DTS nodes since `77223211f44db` (2018); G2H backport
`535ff092b6860` in stable
- [Phase 3] `ebf7f2198ac48` not ancestor of HEAD (not in stable)
- [Phase 4] `b4 dig -c ebf7f2198ac48`: lore thread found; v2 3/3 series
- [Phase 4] Cover letter: HS400 benchmark data for RZ/G2E
- [Phase 4] `Cc: stable` only on patch 1/3 (G2H)
- [Phase 5] Verified `sdhi_quirks_r8a77990` has `hs400_calib_table` +
`manual_tap_correction`
- [Phase 5] EK874 DTS: `sdhi0` and `sdhi3` enabled
- [Phase 6] `r8a774c0` in driver OF table: absent; in DTS: present
- [Phase 6] Current stable OF table read at lines 279–295 confirms
missing `r8a774c0` entry
This commit should be backported to the v6.18.44 stable tree. It
corrects a long-standing hardware quirk mapping bug for RZ/G2E SDHI,
follows the same pattern as the already-backported G2H fix, and is a
minimal one-line change with demonstrated user impact.
**YES****Verdict: YES** — backport to v6.18.44.
This is a one-line OF match-table fix for RZ/G2E (R8A774C0) SDHI.
Without it, the driver falls back to generic Gen3 quirks instead of the
R-Car E3-specific ones (`of_r8a77990_compatible`), which hurts HS400
eMMC performance and tuning on boards like EK874.
It matches the G2H fix already in this stable tree (`535ff092b6860`), is
small and self-contained, and should apply cleanly as a single line
before the existing `r8a774e1` entry.
drivers/mmc/host/renesas_sdhi_internal_dmac.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
index 8bc1c3209edb0..6cca38e32b991 100644
--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
@@ -280,6 +280,7 @@ static const struct of_device_id renesas_sdhi_internal_dmac_of_match[] = {
{ .compatible = "renesas,sdhi-r7s9210", .data = &of_rza2_compatible, },
{ .compatible = "renesas,sdhi-mmc-r8a77470", .data = &of_rcar_gen3_compatible, },
{ .compatible = "renesas,sdhi-r8a774b1", .data = &of_r8a77965_compatible, },
+ { .compatible = "renesas,sdhi-r8a774c0", .data = &of_r8a77990_compatible, },
{ .compatible = "renesas,sdhi-r8a774e1", .data = &of_r8a7795_compatible, },
{ .compatible = "renesas,sdhi-r8a7795", .data = &of_r8a7795_compatible, },
{ .compatible = "renesas,sdhi-r8a77961", .data = &of_r8a77961_compatible, },
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH AUTOSEL 6.18-5.15] mmc: renesas_sdhi: Add OF entry for RZ/G2N SoC
[not found] <20260831133314.4125787-1-sashal@kernel.org>
2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-5.15] mmc: renesas_sdhi: Add OF entry for RZ/G2E SoC Sasha Levin
@ 2026-08-31 13:20 ` Sasha Levin
2026-08-31 13:21 ` [PATCH AUTOSEL 6.18-6.12] drm: rz-du: Ensure correct suspend/resume ordering with VSP Sasha Levin
` (6 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2026-08-31 13:20 UTC (permalink / raw)
To: patches, stable
Cc: Lad Prabhakar, Wolfram Sang, Geert Uytterhoeven, Ulf Hansson,
Sasha Levin, linux-mmc, linux-renesas-soc, linux-kernel
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
[ Upstream commit 5ce500d31a1625d8fe7ede950201b8df076bdd48 ]
The RZ/G2N (R8A774B1) SoC was previously handled via the generic
"renesas,rcar-gen3-sdhi" fallback compatible string. However, because
the SDHI IP on RZ/G2N is identical with the R-Car M3-N (R8A77965), it
requires the specific quirks and configuration defined in
`of_r8a77965_compatible` rather than the generic Gen3 data.
Add the explicit "renesas,sdhi-r8a774b1" match entry to map it correctly.
Note that the DT binding file renesas,sdhi.yaml does not need an update
as the entry for this SoC is already present.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: `mmc: renesas_sdhi: Add OF entry for RZ/G2N
SoC`
**Local tree:** `v6.18.44` (stable/linux-6.18.y)
**Upstream commit:** `5ce500d31a1625d8fe7ede950201b8df076bdd48`
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject Line
**Record:** `[mmc/renesas_sdhi]` `[Add]` — Add explicit OF device-tree
match entry for RZ/G2N (R8A774B1) SoC SDHI controller.
### Step 1.2: Tags
**Record:**
- **Signed-off-by:** Lad Prabhakar, Ulf Hansson (MMC maintainer)
- **Reviewed-by:** Wolfram Sang (Renesas SDHI maintainer), Geert
Uytterhoeven (Renesas DT maintainer)
- **No Fixes:** tag
- **No Reported-by:** tag
- **No Cc: stable** in the committed upstream message (present in
mailing-list submission for the series)
- **No Link:** tags
Notable: Both subsystem maintainers reviewed; this is patch 2/3 of a
series nominating all three RZ/G2 patches for stable.
### Step 1.3: Body Analysis
**Record:**
- **Bug:** RZ/G2N SDHI nodes use `"renesas,sdhi-r8a774b1"` as primary
compatible, but the driver lacked an explicit OF match entry. Matching
fell through to the generic `"renesas,rcar-gen3-sdhi"` fallback
(`of_rcar_gen3_compatible`), which has **no SoC-specific quirks**.
- **Symptom:** Missing `sdhi_quirks_r8a77965` (HS400 tap correction,
bad-tap avoidance, calibration table) that R-Car M3-N (R8A77965) — the
IP-identical counterpart — requires.
- **Root cause:** OF match table gap; hardware needs M3-N quirks, not
generic Gen3 data.
- **Version info:** RZ/G2N DTS SDHI nodes have existed since v5.5
(2019); bug present whenever quirk-based OF matching has been used.
### Step 1.4: Hidden Bug Fix?
**Record:** Yes. Despite "Add OF entry" wording, this is a **hardware
quirk/workaround fix**. Without it, HS400 eMMC operates with wrong (or
no) tap calibration. Series cover letter documents measured failures:
RZ/G2N read bandwidth 46,680 KB/s → 104,731 KB/s after fix, validated
with `mmc_test` 1000 iterations on HS400 eMMC.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
- **Files:** `drivers/mmc/host/renesas_sdhi_internal_dmac.c` (+1 line)
- **Functions modified:** None (data table only:
`renesas_sdhi_internal_dmac_of_match[]`)
- **Scope:** Single-file, surgical, 1-line addition
### Step 2.2: Code Flow Change
**Record:**
- **Before:** `"renesas,sdhi-r8a774b1"` not in OF table →
`of_device_get_match_data()` matches fallback `"renesas,rcar-
gen3-sdhi"` → `of_rcar_gen3_compatible` (`.quirks = NULL`).
- **After:** Primary compatible matches → `of_r8a77965_compatible` →
`sdhi_quirks_r8a77965` with `hs400_bad_taps`, `hs400_calib_table`,
`manual_tap_correction`.
- **Path affected:** Device probe / initialization for all RZ/G2N SDHI
instances (sdhi0–sdhi3).
### Step 2.3: Bug Mechanism
**Record:** **Category (h): Hardware workaround / logic correctness
fix.**
- `sdhi_quirks_r8a77965` enables HS400 tap correction in
`renesas_sdhi_core.c` (`manual_tap_correction`, `hs400_bad_taps`,
`hs400_calib_table` code paths).
- Without quirks, HS400 mode runs without proper tap tuning — degraded
performance and risk of unreliable eMMC transfers.
### Step 2.4: Fix Quality
**Record:** Obviously correct — maps RZ/G2N to already-existing, tested
M3-N quirks. Minimal diff, zero API changes. Regression risk: very low
(only affects r8a774b1 match; identical IP to r8a77965).
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:** OF match table introduced incrementally.
`of_r8a77965_compatible` added in `71b7597c63d2dd` (2021). RZ/G2N DTS
SDHI nodes added in `6317736729acb` (2019, v5.5). The explicit r8a774b1
OF entry was never added until this 2026 commit. Bug has been latent
since quirk-based OF matching was refactored.
### Step 3.2: Fixes: Tag
**Record:** N/A — no Fixes: tag. Original DTS commit `6317736729acb` is
in this tree.
### Step 3.3: Related Changes
**Record:**
- Part of v2 3-patch series: RZ/G2H, RZ/G2N, RZ/G2E (patches 1/3, 2/3,
3/3).
- **RZ/G2H sibling already backported** to this tree as `535ff092b6860`
(with `Cc: stable@vger.kernel.org`, Greg Kroah-Hartman SOB).
- RZ/G2N and RZ/G2E patches from the same series are **not yet** in
6.18.44.
- Standalone: no other patches required; only adds one table row
referencing existing data.
### Step 3.4: Author Context
**Record:** Lad Prabhakar — active Renesas contributor; same author as
RZ/G2H backport already in tree. Ulf Hansson (MMC maintainer) committed.
### Step 3.5: Dependencies
**Record:** No dependencies. `of_r8a77965_compatible` and
`sdhi_quirks_r8a77965` already exist in 6.18.44. `r8a774b1.dtsi` SDHI
nodes with `"renesas,sdhi-r8a774b1"` compatible present. Patch applies
cleanly (insert after r8a77470 line, before r8a774e1 which is already
present).
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original Discussion
**Record:** `b4 dig -c 5ce500d31a162` →
https://patch.msgid.link/20260519135342.623943-3-prabhakar.mahadev-
lad.rj@bp.renesas.com
Series v2 (0/3 + 3 patches). Latest revision applied to mainline. No
NAKs found.
### Step 4.2: Reviewers
**Record:** `b4 dig -w` — CC'd to linux-mmc, linux-renesas-soc, Wolfram
Sang, Ulf Hansson, Geert Uytterhoeven. Both Renesas and MMC maintainers
reviewed.
### Step 4.3: Bug Report
**Record:** No external bug report. Author-provided benchmark data in
cover letter (v2 0/3): RZ/G2N HS400 eMMC read 46,680 → 104,731 KB/s,
write 73,393 → 74,298 KB/s after fix, tested 1000 iterations with
`mmc_test`.
### Step 4.4: Series Context
**Record:** 3-patch series for RZ/G2H/G2N/G2E. Each patch is independent
(one line each). RZ/G2H already backported to this tree; RZ/G2N is
logically identical in nature.
### Step 4.5: Stable List History
**Record:** Individual patches in the series included `Cc:
stable@vger.kernel.org` in mailing-list submissions. RZ/G2H was
subsequently backported to 6.18.y, establishing precedent for this
series.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key Functions
**Record:** `renesas_sdhi_internal_dmac_of_match[]` (data), consumed by
`renesas_sdhi_internal_dmac_probe()`.
### Step 5.2: Callers
**Record:** OF core matches compatible at `platform_driver` probe time.
Affects every RZ/G2N board with SDHI enabled (HiHope RZ/G2N, Beacon
RZ/G2N Kit, etc.).
### Step 5.3: Callees
**Record:** `of_device_get_match_data()` → `quirks` pointer passed to
`renesas_sdhi_probe()` → used throughout `renesas_sdhi_core.c` for HS400
tuning.
### Step 5.4: Reachability
**Record:** Triggered at boot when SDHI platform devices probe on RZ/G2N
hardware. Common embedded/industrial path; affects eMMC rootfs on these
boards.
### Step 5.5: Similar Patterns
**Record:** Identical pattern to already-backported RZ/G2H fix
(`r8a774e1` → `of_r8a7795_compatible`) at line 282 in current tree. Same
series, same mechanism.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE (6.18.44)
### Step 6.1: Buggy Code Present?
**Record:** **Yes.** `r8a774b1.dtsi` has four SDHI nodes with
`"renesas,sdhi-r8a774b1"` primary compatible. Driver OF table lacks this
entry (verified: no `r8a774b1` in `renesas_sdhi_internal_dmac.c`). Falls
back to generic gen3 without quirks.
### Step 6.2: Backport Complications
**Record:** **Clean apply expected.** File structure matches upstream
diff context. RZ/G2H entry already inserted at same location; RZ/G2N
entry slots in alphabetically before r8a774e1.
### Step 6.3: Related Fixes Already Present?
**Record:** RZ/G2H fix (`535ff092b6860`) present. RZ/G2N fix **not**
present. No alternate fix for r8a774b1.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem Criticality
**Record:** `drivers/mmc/host` — IMPORTANT (block storage / eMMC).
Platform-specific (Renesas RZ/G2N arm64).
### Step 7.2: Subsystem Activity
**Record:** Actively maintained; recent Renesas SDHI OF entries added
(RZ/G2H, RZ/V2H, RZ/G2L family).
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who Is Affected
**Record:** RZ/G2N (R8A774B1) platform users — embedded/industrial
boards (HiHope, Beacon, etc.) using SDHI/eMMC.
### Step 8.2: Trigger Conditions
**Record:** Every boot with SDHI enabled on RZ/G2N. Not timing-
dependent; deterministic misconfiguration. Unprivileged users interact
via eMMC I/O on these systems.
### Step 8.3: Failure Mode Severity
**Record:** **HIGH** — HS400 eMMC runs without required tap calibration.
Cover letter shows ~2× read bandwidth loss; wrong tap settings risk
transfer errors/data corruption on eMMC. Not a kernel crash, but storage
reliability and performance are seriously impacted.
### Step 8.4: Risk-Benefit
**Record:**
- **Benefit:** HIGH for affected hardware — restores correct HS400
quirks, validated performance improvement.
- **Risk:** VERY LOW — 1-line table entry, maps to existing tested
quirks, identical pattern to already-backported RZ/G2H fix.
- **Ratio:** Strongly favors backport.
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence Summary
**FOR backport:**
- Fixes real hardware misconfiguration on RZ/G2N since v5.5
- Hardware quirk/workaround (explicit stable exception category)
- 1-line, surgical, reviewed by subsystem maintainers
- Tested on real hardware (mmc_test, 1000 iterations, HS400)
- Sibling RZ/G2H patch from same series already in 6.18.44
- Series nominated for stable on mailing list
- All prerequisites present in tree
**AGAINST backport:**
- No user crash report or CVE
- Platform-specific (not universal)
- RZ/G2E patch from same series also missing (incomplete series, but
each patch is independent)
**Unresolved:** None material to the decision.
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **PASS** — maps to existing M3-N
quirks; benchmarked on hardware.
2. Fixes a real bug affecting users? **PASS** — wrong SDHI quirks on
RZ/G2N boards.
3. Important issue? **PASS** — eMMC HS400 reliability/performance (HIGH
severity for affected platforms).
4. Small and contained? **PASS** — 1 line, 1 file.
5. No new features or APIs? **PASS** — existing quirks, new OF table row
only.
6. Can apply to local tree? **PASS** — prerequisites present, clean
apply expected.
### Step 9.3: Exception Category
**Record:** Hardware quirk/workaround — maps SoC to correct existing
quirks table entry. Same category as the already-backported RZ/G2H fix.
### Step 9.4: Decision Rationale
This commit fixes a long-standing gap where RZ/G2N SDHI hardware was
probed without the M3-N-specific HS400 tuning quirks it requires. The
bug exists in 6.18.44: DTS uses the specific compatible string, but the
driver lacks the matching OF entry. The identical RZ/G2H fix from the
same series is already in this stable tree, establishing clear
precedent. The fix is trivial, reviewed, tested, and addresses real eMMC
performance and reliability on RZ/G2N hardware.
---
## Verification
- **[Phase 1]** Parsed commit message and tags from `git show
5ce500d31a162`
- **[Phase 1]** Confirmed no Fixes:/Reported-by: in upstream commit
- **[Phase 2]** Verified diff: +1 line in
`renesas_sdhi_internal_dmac_of_match[]`
- **[Phase 2]** Read `of_r8a77965_compatible` and `sdhi_quirks_r8a77965`
at lines 204–248
- **[Phase 2]** Read `renesas_sdhi_internal_dmac_probe()` at lines
581–600 — quirks from OF match data
- **[Phase 2]** Read HS400 quirk usage in `renesas_sdhi_core.c` (lines
404, 555)
- **[Phase 3]** `git describe HEAD` → v6.18.44
- **[Phase 3]** `git blame` on OF match table — r8a774b1 entry absent
- **[Phase 3]** `git log -S "renesas,sdhi-r8a774b1"` on driver file →
empty (never added)
- **[Phase 3]** DTS added in `6317736729acb` (2019) — confirmed in tree
- **[Phase 3]** Quirks refactor `71b7597c63d2dd` — confirmed in tree
- **[Phase 3]** RZ/G2H backport `535ff092b6860` — confirmed in tree with
Cc: stable
- **[Phase 4]** `b4 dig -c 5ce500d31a162` → lore URL found
- **[Phase 4]** `b4 dig -m /tmp/rzg2n_thread.mbox` — cover letter with
benchmark data and Cc: stable
- **[Phase 4]** Reviewed-by Wolfram Sang and Geert Uytterhoeven
confirmed in thread
- **[Phase 5]** Grep `of_device_get_match_data` in probe path —
confirmed flow
- **[Phase 5]** Grep `r8a774b1` in driver — no matches (bug present)
- **[Phase 6]** `r8a774b1.dtsi` SDHI nodes use `"renesas,sdhi-r8a774b1"`
— confirmed at lines 2162+
- **[Phase 6]** `of_r8a77965_compatible` exists in 6.18.44 — confirmed
- **[Phase 6]** Commit NOT in current HEAD — `git log --grep="RZ/G2N"`
on driver returns only unrelated entries
- **[Phase 8]** Cover letter benchmarks: RZ/G2N read 46680→104731 KB/s —
from mbox
**YES**
drivers/mmc/host/renesas_sdhi_internal_dmac.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
index 6816d491b0bf0..8bc1c3209edb0 100644
--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
@@ -279,6 +279,7 @@ static const struct renesas_sdhi_of_data_with_quirks of_rza2_compatible = {
static const struct of_device_id renesas_sdhi_internal_dmac_of_match[] = {
{ .compatible = "renesas,sdhi-r7s9210", .data = &of_rza2_compatible, },
{ .compatible = "renesas,sdhi-mmc-r8a77470", .data = &of_rcar_gen3_compatible, },
+ { .compatible = "renesas,sdhi-r8a774b1", .data = &of_r8a77965_compatible, },
{ .compatible = "renesas,sdhi-r8a774e1", .data = &of_r8a7795_compatible, },
{ .compatible = "renesas,sdhi-r8a7795", .data = &of_r8a7795_compatible, },
{ .compatible = "renesas,sdhi-r8a77961", .data = &of_r8a77961_compatible, },
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH AUTOSEL 6.18-6.12] drm: rz-du: Ensure correct suspend/resume ordering with VSP
[not found] <20260831133314.4125787-1-sashal@kernel.org>
2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-5.15] mmc: renesas_sdhi: Add OF entry for RZ/G2E SoC Sasha Levin
2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-5.15] mmc: renesas_sdhi: Add OF entry for RZ/G2N SoC Sasha Levin
@ 2026-08-31 13:21 ` Sasha Levin
2026-08-31 13:21 ` [PATCH AUTOSEL 6.18] pinctrl: renesas: rzg2l: Add SR register cache for PM suspend/resume Sasha Levin
` (5 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2026-08-31 13:21 UTC (permalink / raw)
To: patches, stable
Cc: Tommaso Merciai, Laurent Pinchart, Biju Das, Sasha Levin,
maarten.lankhorst, mripard, tzimmermann, airlied, simona,
dri-devel, linux-renesas-soc, linux-kernel
From: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
[ Upstream commit c94e765abb051df62b9f7c27116ef9307216c868 ]
The VSP serves as an interface to memory and a compositor to the DU. It
therefore needs to be suspended after and resumed before the DU, to be
properly stopped and restarted in a controlled fashion driven by the DU
driver. This currently works by chance. Avoid relying on luck by
enforcing the correct suspend/resume ordering with device links.
Based on similar work done by Laurent Pinchart for R-Car DU.
commit db5be3a7d6bd ("drm: rcar-du: Ensure correct suspend/resume
ordering with VSP")
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Link: https://patch.msgid.link/20260330144651.817338-1-tommaso.merciai.xr@bp.renesas.com
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: `drm: rz-du: Ensure correct suspend/resume
ordering with VSP`
**Local tree:** Linux **6.18.43** (`git describe HEAD` → `v6.18.43`,
detached at `stable/linux-6.18.y`)
**Upstream commit:** `c94e765abb051` (on `all-next`, not yet in this
6.18.43 checkout)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject line
**Record:** `[drm: rz-du]` `[Ensure]` — enforce correct suspend/resume
ordering between RZ/G2L Display Unit (DU) and its VSP compositor via
device links.
### Step 1.2: Tags
**Record:**
| Tag | Value |
|-----|-------|
| Reviewed-by | Laurent Pinchart
\<laurent.pinchart+renesas@ideasonboard.com\> |
| Signed-off-by | Tommaso Merciai, Biju Das |
| Link | https://patch.msgid.link/20260330144651.817338-1-
tommaso.merciai.xr@bp.renesas.com |
| Fixes: | **None** (expected for manual review) |
| Cc: stable | **None** |
| Reported-by / Tested-by | **None** |
| syzbot | **None** |
Notable: reviewed by the R-Car/Renesas DRM expert who authored the
identical rcar-du fix. No user crash report or Tested-by.
### Step 1.3: Body analysis
**Record:**
- **Bug:** VSP must be suspended *after* DU and resumed *before* DU
because VSP is DU's memory interface/compositor. Current ordering
relies on luck (device-tree probe order).
- **Symptom:** Incorrect suspend/resume ordering can leave VSP stopped
while DU still uses it (or vice versa on resume) — undefined behavior
during power transitions.
- **Root cause:** No explicit consumer/supplier relationship between DU
and VSP platform devices.
- **Fix approach:** `device_link_add(DU, VSP, DL_FLAG_STATELESS)` plus
cleanup in `rzg2l_du_vsp_cleanup()`.
- **Reference:** Mirrors `db5be3a7d6bd` ("drm: rcar-du: Ensure correct
suspend/resume ordering with VSP").
### Step 1.4: Hidden bug fix?
**Record:** Yes. Despite "Ensure" wording rather than "fix", this is a
power-management correctness bug fix — a race/ordering hazard disguised
as hardening. Same pattern as a well-understood rcar-du bug fix.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
| File | Changes |
|------|---------|
| `rzg2l_du_vsp.c` | +16 lines |
| `rzg2l_du_vsp.h` | +2 lines (`struct device_link *link`) |
| **Total** | 18 lines, 2 files |
| **Functions** | `rzg2l_du_vsp_cleanup()`, `rzg2l_du_vsp_init()` |
| **Scope** | Single-subsystem, surgical |
### Step 2.2: Code flow per hunk
**Record:**
1. **Include `linux/device.h`** — needed for `device_link_add/del`.
2. **`rzg2l_du_vsp_cleanup()`** — Before: only `put_device(vsp->vsp)`.
After: also `device_link_del(vsp->link)` if set.
3. **`rzg2l_du_vsp_init()`** — Before: find VSP pdev, register cleanup,
call `vsp1_du_init()`. After: create stateless device link
`DU(consumer) → VSP(supplier)`; fail probe with `-EINVAL` if link
creation fails.
4. **`rzg2l_du_vsp.h`** — Add `struct device_link *link` to `struct
rzg2l_du_vsp`.
### Step 2.3: Bug mechanism
**Record:** **Category:** Power-management ordering / race condition.
- VSP (`vsp1_drv.c`) has `SYSTEM_SLEEP_PM_OPS`
(`vsp1_pm_suspend`/`vsp1_pm_resume`).
- When `vsp1->drm` is set (DU pipeline mode), VSP expects DU to
stop/restart it explicitly; it only does `pm_runtime_force_suspend`
during system sleep.
- Without a device link, kernel suspend/shutdown order depends on
ACPI/DT enumeration order — nondeterministic across platforms.
- `device_link_add(consumer, supplier)` reorders
`dpm_list`/`devices_kset` so consumer is always processed before
supplier on suspend/shutdown and after supplier on resume.
### Step 2.4: Fix quality
**Record:**
- **Obviously correct:** Yes — identical, proven pattern from rcar-du;
reviewed by subsystem maintainer.
- **Minimal:** Yes — 18 lines, no refactoring.
- **Regression risk:** Very low. Worst case: `device_link_add()` fails
at probe (logged, `-EINVAL`); no hot-path changes.
- **Red flags:** None.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:** `rzg2l_du_vsp_init()` and cleanup logic date to initial VSP
integration (file introduced with RZ/G2L DU driver). Buggy code (no
device link) has been present since VSP support was added. RZ/G2L DU
driver landed in `768e9e61b3b99` ("drm: renesas: Add RZ/G2L DU
Support"), confirmed ancestor of HEAD.
### Step 3.2: Fixes: tag
**Record:** N/A — no Fixes: tag.
### Step 3.3: Related file history
**Record:** Recent rz-du stable activity includes power-sequencing fixes
(e.g. `79f42487ed60d` — MIPI DSI reboot panic). No prior device_link fix
for rz-du in this tree. rcar-du sibling fix `db5be3a7d6bd` exists on
`all-next` but is **not** an ancestor of 6.18.43 HEAD.
### Step 3.4: Author commits
**Record:** Tommaso Merciai — Renesas contributor; no other rz-du
commits in this 6.18.43 tree. Biju Das is rz-du maintainer (signed off).
### Step 3.5: Dependencies
**Record:** **Standalone.** Single patch (v1→v2 only added Reviewed-by
tag and rcar-du commit reference). No prerequisite commits. Applies
cleanly (`git apply --check` passed).
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original discussion
**Record:**
- `b4 dig -c c94e765abb051` → https://patch.msgid.link/20260330144651.81
7338-1-tommaso.merciai.xr@bp.renesas.com
- Series: v1 (2026-03-24) → v2 (2026-03-30, committed version)
- Maintainer response: "Applied to drm-misc-next" (Biju Das)
- **No stable nomination, no NAKs**
### Step 4.2: Reviewers
**Record:** CC'd to `dri-devel`, `linux-renesas-soc`, Laurent Pinchart,
Maarten Lankhorst, David Airlie, Thomas Zimmermann, etc. Reviewed-by
from Laurent Pinchart (subsystem expert).
### Step 4.3: Bug report
**Record:** No external bug report, stack trace, or syzbot link. Issue
identified by code analysis ("works by chance").
### Step 4.4: Series context
**Record:** Standalone 1-patch series. rcar-du counterpart is separate
but parallel.
### Step 4.5: Stable list
**Record:** No stable@vger.kernel.org discussion found for this specific
patch.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** `rzg2l_du_vsp_init()`, `rzg2l_du_vsp_cleanup()`,
`rzg2l_du_vsps_init()` (caller).
### Step 5.2: Callers
**Record:** `rzg2l_du_vsps_init()` → called from
`rzg2l_du_modeset_init()` during DU probe. Runs once per VSP referenced
in DT `renesas,vsps` property. Init path only — not a hot path.
### Step 5.3: Callees
**Record:** `of_find_device_by_node()`, `drmm_add_action_or_reset()`,
`device_link_add()`, `vsp1_du_init()`, `device_link_del()`,
`put_device()`.
### Step 5.4: Reachability
**Record:** Triggered at boot on RZ/G2L platforms with
`CONFIG_DRM_RZG2L_DU` + `CONFIG_VIDEO_RENESAS_VSP1`. Power-transition
bugs manifest on suspend/resume/reboot/shutdown — common embedded
operations.
### Step 5.5: Similar patterns
**Record:** Identical fix in `rcar_du_vsp.c` (`db5be3a7d6bd` on all-
next). rcar-du also uses `device_link_add` for CMM ordering in
`rcar_du_kms.c` (already in 6.18.43). Established Renesas DRM pattern.
---
## PHASE 6: CROSS-REFERENCE WITH LOCAL TREE (6.18.43)
### Step 6.1: Buggy code present?
**Record:** **Yes.** Current `rzg2l_du_vsp.c` lacks
`device_link_add/del` and `vsp->link` field. VSP integration has been
present since RZ/G2L DU driver merge (`768e9e61b3b99` is ancestor of
HEAD).
### Step 6.2: Backport complications
**Record:** **Clean apply** — `git apply --check` on commit diff
succeeded with no conflicts.
### Step 6.3: Related fixes already present?
**Record:** No equivalent device_link fix for rz-du in 6.18.43. Related
rz-du power fix `79f42487ed60d` (MIPI DSI reboot panic) is already in
stable — shows this subsystem's power-sequencing bugs are stable-worthy.
---
## PHASE 7: SUBSYSTEM CONTEXT
### Step 7.1: Subsystem criticality
**Record:** `drivers/gpu/drm/renesas/rz-du/` — **PERIPHERAL** (Renesas
RZ/G2L embedded SoCs only). Critical for affected hardware users; not
universal.
### Step 7.2: Activity
**Record:** Actively maintained in 6.18.y (MIPI DSI fixes, resolution
updates, encoder fixes in 2025–2026).
---
## PHASE 8: IMPACT AND RISK
### Step 8.1: Who is affected
**Record:** Users of RZ/G2L/RZ/V2L SoCs with DU+VSP display pipeline
(`CONFIG_DRM_RZG2L_DU`, `ARCH_RZG2L`). Driver-specific, not config-
universal.
### Step 8.2: Trigger conditions
**Record:** System suspend (S3), resume, reboot/shutdown. DU has
`.shutdown` handler (`drm_atomic_helper_shutdown`); VSP has system-sleep
PM ops. Ordering nondeterminism depends on DT/ACPI device enumeration —
"works by chance" today.
**Note:** rz-du lacks explicit `DEFINE_SIMPLE_DEV_PM_OPS` suspend/resume
(unlike rcar-du). This limits the immediate S3 benefit until DU PM is
added, but device links still affect shutdown ordering and will enforce
correct ordering once PM is added. Maintainers merged this on mainline
knowing rz-du has no PM ops yet.
### Step 8.3: Failure mode severity
**Record:** When wrong order triggers: VSP suspended while DU still
active → undefined behavior, possible oops/corruption/display failure.
**Severity: HIGH** when triggered; **likelihood: LOW–MEDIUM** (depends
on DT order). Prior rz-du reboot panic stable backport confirms real-
world power-transition failures in this driver.
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** MEDIUM-HIGH for RZ/G2L embedded users; prevents
nondeterministic suspend/shutdown ordering bugs.
- **Risk:** VERY LOW — 18-line, proven pattern, probe-time only.
- **Ratio:** Favorable.
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence summary
**FOR backport:**
- Real PM ordering bug in production code path (VSP system-sleep PM + DU
dependency)
- Small, surgical, obviously correct fix mirroring accepted rcar-du
pattern
- Reviewed by Laurent Pinchart (Renesas DRM expert)
- Buggy code confirmed present in 6.18.43; patch applies cleanly
- Prior stable backport of rz-du power-sequencing bug (`79f42487ed60d`)
- VSP driver explicitly documents DU must control VSP during pipeline
suspend
**AGAINST backport:**
- No user-reported crash or Tested-by for rz-du specifically
- rz-du lacks system-sleep PM ops (unlike rcar-du), reducing immediate
S3 suspend benefit
- Peripheral driver — limited user base
- Theoretical "works by chance" rather than demonstrated failure
**Unresolved:** No runtime test evidence for rz-du specifically; exact
failure rate on RZ/G2L boards unverified.
### Step 9.2: Stable rules checklist
| Criterion | Result |
|-----------|--------|
| 1. Obviously correct and tested? | **PASS** — correct by inspection;
reviewed by maintainer; rcar-du analogue tested |
| 2. Fixes real bug? | **PASS** — PM ordering hazard in DU+VSP pipeline
|
| 3. Important issue? | **PASS** — potential crash/corruption on
suspend/resume/reboot (HIGH severity, moderate likelihood) |
| 4. Small and contained? | **PASS** — 18 lines, 2 files |
| 5. No new features/APIs? | **PASS** — internal device link only |
| 6. Applies to local tree? | **PASS** — clean apply, code and driver
present |
### Step 9.3: Exception categories
**Record:** N/A — standard bug fix, not device-ID/quirk/DT/build/doc
exception.
### Step 9.4: Decision rationale
This commit fixes a real power-management ordering defect in the RZ/G2L
DU driver that has been present since VSP support was added to 6.18.y.
The fix is minimal, follows an identical accepted rcar-du pattern, is
reviewed by the subsystem expert, and applies cleanly to 6.18.43. While
rz-du currently lacks explicit system-sleep PM callbacks (a separate
gap), the device link still enforces correct shutdown ordering (DU has a
`.shutdown` handler) and ensures correct suspend/resume ordering for the
VSP's system-sleep PM path. The risk is negligible and consistent with
prior stable backports of rz-du power-sequencing fixes.
---
## Verification
- **[Phase 1]** Parsed commit message and tags from user-provided diff
and `git show c94e765abb051`
- **[Phase 2]** Diff analysis: 18 lines across 2 files; adds
`device_link_add/del` in init/cleanup
- **[Phase 3]** `git describe HEAD` → v6.18.43; `git blame` on
`rzg2l_du_vsp.c:292-325` → original VSP init code; `git merge-base
--is-ancestor 768e9e61b3b99 HEAD` → rz-du driver in tree;
`db5be3a7d6bd` not ancestor of HEAD
- **[Phase 3]** `git apply --check` on commit diff → applies cleanly
- **[Phase 4]** `b4 dig -c c94e765abb051` → lore URL; `b4 dig -a` →
v1/v2 only; `b4 dig -w` → maintainers CC'd; mbox grep → Reviewed-by
Laurent Pinchart, "Applied to drm-misc-next", no stable nomination
- **[Phase 5]** `grep rzg2l_du_vsp_init` → called from
`rzg2l_du_vsps_init()` in `rzg2l_du_kms.c`; verified VSP PM ops in
`vsp1_drv.c:625-701`
- **[Phase 6]** Read current `rzg2l_du_vsp.c` — no device_link present;
`grep device_link` in rz-du → no matches
- **[Phase 6]** `git show all-next:rzg2l_du_drv.c | rg pm` → no PM ops
on all-next either (fix merged without DU PM)
- **[Phase 6]** Confirmed `79f42487ed60d` in tree as prior rz-du power
stable backport
- **[Phase 7]** Driver is `CONFIG_DRM_RZG2L_DU`, `ARCH_RZG2L` —
peripheral/embedded
- **[Phase 8]** Verified rz-du has `.shutdown` but no `.pm`
suspend/resume in `rzg2l_du_drv.c`; rcar-du has PM ops for comparison
**YES**The analysis is complete for **Linux 6.18.43**
(`stable/linux-6.18.y`).
**Commit:** `c94e765abb051` — `drm: rz-du: Ensure correct suspend/resume
ordering with VSP`
**Verdict: YES** — backport to this tree.
**Summary:** The RZ/G2L DU driver in 6.18.43 uses a VSP compositor
without an explicit device link, so suspend/resume/shutdown ordering
depends on DT probe order. The patch adds the same small
`device_link_add()` pattern already used for rcar-du (~18 lines, applies
cleanly). Reviewed by Laurent Pinchart; low risk and consistent with
prior stable rz-du power-sequencing fixes.
**Caveat:** rz-du still lacks system-sleep PM callbacks (unlike rcar-
du), so the main immediate benefit is shutdown ordering and future-
proofing when PM is added — but the underlying ordering bug is real on
RZ/G2L hardware with VSP.
drivers/gpu/drm/renesas/rz-du/rzg2l_du_vsp.c | 16 ++++++++++++++++
drivers/gpu/drm/renesas/rz-du/rzg2l_du_vsp.h | 2 ++
2 files changed, 18 insertions(+)
diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_vsp.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_vsp.c
index 040d4e4aff000..ab49604d69acf 100644
--- a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_vsp.c
+++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_vsp.c
@@ -20,6 +20,7 @@
#include <drm/drm_vblank.h>
#include <linux/bitops.h>
+#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
@@ -293,6 +294,9 @@ static void rzg2l_du_vsp_cleanup(struct drm_device *dev, void *res)
{
struct rzg2l_du_vsp *vsp = res;
+ if (vsp->link)
+ device_link_del(vsp->link);
+
put_device(vsp->vsp);
}
@@ -317,6 +321,18 @@ int rzg2l_du_vsp_init(struct rzg2l_du_vsp *vsp, struct device_node *np,
if (ret < 0)
return ret;
+ /*
+ * Enforce suspend/resume ordering between the DU (consumer) and the
+ * VSP (supplier). The DU will be suspended before and resume after the
+ * VSP.
+ */
+ vsp->link = device_link_add(rcdu->dev, vsp->vsp, DL_FLAG_STATELESS);
+ if (!vsp->link) {
+ dev_err(rcdu->dev, "Failed to create device link to VSP %s\n",
+ dev_name(vsp->vsp));
+ return -EINVAL;
+ }
+
ret = vsp1_du_init(vsp->vsp);
if (ret < 0)
return ret;
diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_vsp.h b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_vsp.h
index 322eb80dcbaff..a22aaf0843ed7 100644
--- a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_vsp.h
+++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_vsp.h
@@ -15,6 +15,7 @@
#include <linux/scatterlist.h>
struct device;
+struct device_link;
struct drm_framebuffer;
struct rzg2l_du_device;
struct rzg2l_du_format_info;
@@ -29,6 +30,7 @@ struct rzg2l_du_vsp_plane {
struct rzg2l_du_vsp {
unsigned int index;
struct device *vsp;
+ struct device_link *link;
struct rzg2l_du_device *dev;
};
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH AUTOSEL 6.18] pinctrl: renesas: rzg2l: Add SR register cache for PM suspend/resume
[not found] <20260831133314.4125787-1-sashal@kernel.org>
` (2 preceding siblings ...)
2026-08-31 13:21 ` [PATCH AUTOSEL 6.18-6.12] drm: rz-du: Ensure correct suspend/resume ordering with VSP Sasha Levin
@ 2026-08-31 13:21 ` Sasha Levin
2026-08-31 13:23 ` [PATCH AUTOSEL 6.18] drm: renesas: rzg2l_mipi_dsi: Fix deassert/assert of CMN_RSTB signal Sasha Levin
` (4 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2026-08-31 13:21 UTC (permalink / raw)
To: patches, stable
Cc: Lad Prabhakar, Geert Uytterhoeven, Sasha Levin, linusw,
linux-renesas-soc, linux-gpio, linux-kernel
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
[ Upstream commit 29df31ae3e8a0152dd8e8c2376816aad2f233473 ]
Include the SR (Slew Rate) register in the PM suspend/resume register
cache.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/20260413182456.811543-3-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: pinctrl: renesas: rzg2l: Add SR register
cache for PM suspend/resume
**Local tree:** `v6.18.43` / `6.18.43`
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Parse the subject line
**Record:** `[pinctrl: renesas: rzg2l]` `[add]` — Include the SR (Slew
Rate) register in the PM suspend/resume register cache.
### Step 1.2: Parse all commit message tags
**Record:**
- **Signed-off-by:** Lad Prabhakar `<prabhakar.mahadev-
lad.rj@bp.renesas.com>` (author)
- **Reviewed-by:** Geert Uytterhoeven `<geert+renesas@glider.be>`
(Renesas subsystem maintainer)
- **Link:**
https://patch.msgid.link/20260413182456.811543-3-prabhakar.mahadev-
lad.rj@bp.renesas.com
- **Signed-off-by:** Geert Uytterhoeven (maintainer tree SOB)
- No Fixes:, Reported-by:, Tested-by:, Cc: stable, or syzbot tags on
this individual commit
- Notable: Part of v2 2/5 series; patch 1/5 (SMT fix) in the same series
has extensive Tested-by lines from CIP and embedded testers
### Step 1.3: Analyze commit body text
**Record:**
- **Bug described:** SR registers were omitted from the PM
suspend/resume register cache.
- **Symptom/failure mode:** After suspend-to-RAM and resume, slew-rate
hardware settings are not saved/restored. Pins keep whatever SR values
the hardware has after resume, not the values configured before
suspend.
- **Version info:** None in commit message.
- **Root cause:** Incomplete PM register caching — SR was never added
when suspend/resume support was built out, unlike IOLH, IEN, PUPD, and
SMT.
### Step 1.4: Detect hidden bug fixes
**Record:** Yes — despite the "Add" wording, this completes an existing
suspend/resume implementation. It is the same class of bug as
`8d1c6b603327b` ("Fix SMT register cache handling"), which is already in
this tree. The cover letter explicitly frames the series as fixing PM
register caching issues.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory the changes
**Record:**
- **File:** `drivers/pinctrl/renesas/pinctrl-rzg2l.c` — ~35 insertions,
3 deletions
- **Functions modified:** `rzg2l_pinctrl_reg_cache_alloc()`,
`rzg2l_pinctrl_pm_setup_regs()`,
`rzg2l_pinctrl_pm_setup_dedicated_regs()`
- **Struct modified:** `rzg2l_pinctrl_reg_cache` — adds `u32 *sr[2]`
- **Scope:** Single-file, surgical fix mirroring existing SMT/IEN/IOLH
patterns
### Step 2.2: Code flow change per hunk
**Record:**
1. **Struct/cache alloc:** Adds `sr[2]` banked arrays for both main and
dedicated pin caches, matching SMT layout.
2. **`rzg2l_pinctrl_pm_setup_regs()`:** On suspend, reads SR register(s)
into cache; on resume, writes them back. Uses `has_sr = !!(caps &
PIN_CFG_SR)` and handles split 32-bit banks when `pincnt >= 4`.
3. **`rzg2l_pinctrl_pm_setup_dedicated_regs()`:** Same SR save/restore
for dedicated pins.
**Before → After:** SR registers were never touched during PM
transitions → SR is saved on suspend and restored on resume, consistent
with SMT/IEN/IOLH/PUPD.
### Step 2.3: Bug mechanism
**Record:**
- **Category:** Logic/correctness — incomplete hardware state
save/restore on suspend/resume path
- **Mechanism:** `rzg2l_pinctrl_suspend_noirq()` calls
`rzg2l_pinctrl_pm_setup_regs(pctrl, true)` and resume calls it with
`false`. SR-capable pins (many SD, Ethernet, QSPI, UART pins via
`PIN_CFG_SR`) lose their slew-rate configuration across S2RAM cycles.
### Step 2.4: Fix quality assessment
**Record:**
- **Quality:** High — follows the exact established pattern used for SMT
(including dual-bank handling for ports with ≥4 pins).
- **Regression risk:** Very low — only adds cache entries and
conditional read/write on existing PM paths.
- **Red flags:** None. No API changes, no locking changes.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame the changed lines
**Record:** Current `has_smt`/SMT cache block at lines 3056–3063 was
introduced by `8d1c6b603327b` (Apr 2026). SR handling is absent at the
same location — the omission predates the SMT fix and was never
addressed.
### Step 3.2: Follow Fixes: tag
**Record:** Not applicable — no Fixes: tag on this commit.
### Step 3.3: File history for related changes
**Record:** Recent related commits in this tree:
- `8d1c6b603327b` — Fix SMT register cache handling (patch 1/5,
**already in 6.18.43**)
- `c4cfa8ee77374` — Fix incorrect PUPD register offset for high pins
- `509d342d02fff` — Fix save/restore of {IOLH,IEN,PUPD,SMT} for variable
pincfg ports
- `dd6e519ba91e4` — Fix ISEL restore on resume
This commit is patch 2/5 of the "Fix PM register caching" v2 series.
Patches 3–5 (IOLH_RZV2H, NOD, dedicated PUPD) are separate and not
required for this SR fix.
### Step 3.4: Author's other commits
**Record:** Lad Prabhakar is an active Renesas contributor (RTC, PCI,
clk, mmc, pinctrl). The SMT fix from the same series (`8d1c6b603327b`)
is already in this tree, reviewed by Geert Uytterhoeven.
### Step 3.5: Prerequisites
**Record:**
- **Prerequisite present:** Patch 1/5 (SMT per-bank array `smt[2]`) is
already in 6.18.43.
- **Standalone:** This patch only adds SR caching; it does not depend on
patches 3–5.
- **Can apply cleanly:** Current tree matches the patch base (has
`smt[2]`, lacks `sr[2]`).
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original patch discussion
**Record:**
- **Series cover:** `v2_20260413_prabhakar_csengg_pinctrl_renesas_rzg2l_
fix_pm_register_caching.cover` — describes fixing PM register caching
including SR, SMT, IOLH, NOD, PUPD.
- **Lore URL:**
https://patch.msgid.link/20260413182456.811543-3-prabhakar.mahadev-
lad.rj@bp.renesas.com (direct fetch blocked by Anubis bot protection)
- **Series revisions:** v2; patch 2 updated per review to add dedicated
SR cache (v1→v2 note in mbox)
- **Stable nominations in thread:** Not found in available local mbox
content for this specific patch
- **NAKs/concerns:** None found in local mbox
### Step 4.2: Reviewers
**Record:** Geert Uytterhoeven (Renesas pinctrl maintainer) Reviewed-by
and Signed-off-by. Pavel Machek Reviewed-by on patch 2. Patch 1 has
extensive Tested-by from CIP and embedded community.
### Step 4.3: Bug report
**Record:** No external bug report or syzbot link. Bug identified by
code review during PM caching audit (cover letter: "addresses several
issues with the PM register caching implementation").
### Step 4.4: Related patches in series
**Record:** 5-patch series. Only patch 1 is in 6.18.43 so far. Patches
3–5 address separate register types (IOLH_RZV2H, NOD, dedicated PUPD)
and are independent of this SR fix.
### Step 4.5: Stable mailing list history
**Record:** Not searched (lore blocked). No stable-specific discussion
found in local mbox.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** `rzg2l_pinctrl_reg_cache_alloc()`,
`rzg2l_pinctrl_pm_setup_regs()`,
`rzg2l_pinctrl_pm_setup_dedicated_regs()`, called from
`rzg2l_pinctrl_suspend_noirq()` / `rzg2l_pinctrl_resume_noirq()`.
### Step 5.2: Callers
**Record:**
- `rzg2l_pinctrl_suspend_noirq()` — `NOIRQ_SYSTEM_SLEEP_PM_OPS` at line
3485
- `rzg2l_pinctrl_resume_noirq()` — same PM ops
- Triggered on every system suspend/resume on boards using this pinctrl
driver with PM enabled
### Step 5.3: Callees
**Record:** `RZG2L_PCTRL_REG_ACCESS32()` macro — `readl`/`writel` on
`SR(off)` register at offset `0x1400 + (off) * 8`. SR is also used in
normal pinconf get/set (`PIN_CONFIG_SLEW_RATE` at lines 1314–1318,
1472–1476).
### Step 5.4: Call chain / reachability
**Record:** Boot → platform probe → PM suspend (S2RAM) →
`rzg2l_pinctrl_suspend_noirq()` → `rzg2l_pinctrl_pm_setup_regs(true)` →
SR **not** cached (bug). Resume path similarly fails to restore SR.
Reachable on any Renesas RZ/G2L/V2H board using suspend.
### Step 5.5: Similar patterns
**Record:** SMT, IEN, IOLH, PUPD all use identical `has_*` + dual-bank
`RZG2L_PCTRL_REG_ACCESS32` pattern. SR was the missing sibling.
`PIN_CFG_SR` appears on 100+ pin definitions across RZ/G2L, RZ/V2H,
RZ/G3E SoC data in the same file.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE (6.18.43)
### Step 6.1: Does the buggy code exist?
**Record:** **Yes.** Suspend/resume is present
(`rzg2l_pinctrl_suspend_noirq` at line 3179). `PIN_CFG_SR` and `SR(off)`
exist. `rzg2l_pinctrl_reg_cache` has `smt[2]` but **no** `sr[2]`.
`rzg2l_pinctrl_pm_setup_regs()` handles SMT but not SR. Bug is live in
6.18.43.
### Step 6.2: Backport complications
**Record:** **Clean apply expected.** Tree already has patch 1/5 (SMT
per-bank fix). No conflicting changes. Single file, established pattern.
### Step 6.3: Related fixes already present
**Record:** SMT cache fix (`8d1c6b603327b`) is in tree. SR cache fix is
**not** present. No duplicate fix found.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem and criticality
**Record:** `drivers/pinctrl/renesas/` — **PERIPHERAL** (platform-
specific, Renesas RZ SoCs). Critical for embedded/industrial users (CIP,
RZ/V2H EVKs, RZ/G2L boards) but not universal.
### Step 7.2: Subsystem activity
**Record:** Actively maintained — multiple PM suspend/resume fixes
landed in 2026 for this driver in this tree.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who is affected
**Record:** Users of `CONFIG_PINCTRL_RZG2L` on Renesas RZ/G2L,
RZ/V2H(P), RZ/V2N, RZ/G3E SoCs who use system suspend (S2RAM). Platform-
specific, not universal.
### Step 8.2: Trigger conditions
**Record:** System suspend-to-RAM on affected hardware. Common on
embedded/industrial systems. Requires PM-enabled kernel and SR-
configured pins (very common — SD, Ethernet, QSPI, UART pins all use
`PIN_CFG_SR`). Unprivileged users can trigger via standard suspend
interfaces.
### Step 8.3: Failure mode severity
**Record:** Wrong slew-rate settings after resume → signal integrity
degradation on high-speed interfaces (SDIO, Ethernet, QSPI). Can cause
peripheral malfunction, data errors, or intermittent failures post-
resume. Not a kernel oops/panic, but real hardware misbehavior.
**Severity: MEDIUM-HIGH** for affected platforms.
### Step 8.4: Risk-benefit ratio
**Record:**
- **Benefit:** Restores correct pin electrical configuration after
suspend — prevents post-resume peripheral failures on widely deployed
embedded SoCs.
- **Risk:** Very low — ~35 lines, mirrors proven SMT pattern, reviewed
by maintainer.
- **Ratio:** Favorable for affected users; negligible risk to unaffected
configurations.
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence compilation
**FOR backporting:**
- Real suspend/resume bug — SR registers not saved/restored
- Same bug class as SMT fix already backported to 6.18.43
- Widely used register (`PIN_CFG_SR` on SD/Ethernet/QSPI/UART pins)
- Small, surgical, maintainer-reviewed fix
- Prerequisites (SMT per-bank cache) already in tree
- CIP/embedded community tested the series (patch 1)
**AGAINST backporting:**
- Platform-specific (Renesas RZ only)
- No crash/panic — functional/hardware correctness issue
- Commit message is terse; doesn't spell out user-visible symptoms
- Part of a 5-patch series (though this patch is self-contained)
**Unresolved:** Full lore thread review blocked by Anubis. No explicit
stable nomination found in local mbox.
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — mirrors SMT/IEN pattern;
series tested by CIP community on patch 1; maintainer reviewed.
2. Fixes a real bug affecting users? **PASS** — incomplete PM state
save/restore on suspend/resume.
3. Important issue? **PASS** — post-resume hardware misconfiguration on
high-speed peripherals (MEDIUM-HIGH severity for affected platforms).
4. Small and contained? **PASS** — ~35 lines, one file, three functions.
5. No new features or APIs? **PASS** — completes existing PM caching, no
userspace-visible changes.
6. Can apply to local tree? **PASS** — buggy code present, prerequisite
patch 1/5 already applied, clean apply expected.
### Step 9.3: Exception categories
**Record:** Not a device ID, quirk, DT, build, or docs fix. Standard bug
fix completing PM suspend/resume support.
### Step 9.4: Decision rationale
This commit fixes an omission in the Renesas RZ/G2L pinctrl driver's
suspend/resume register caching. The driver already saves and restores
SMT, IEN, IOLH, and PUPD registers, but SR (Slew Rate) was never
included. After S2RAM, pins on SDIO, Ethernet, QSPI, and other high-
speed interfaces can have incorrect electrical settings, causing
peripheral failures after resume.
The fix is minimal, follows an established in-driver pattern, was
reviewed by the subsystem maintainer, and its prerequisite (SMT per-bank
cache, patch 1/5) is already in 6.18.43. The same author and series
already had patch 1 backported to this tree, establishing that this
class of PM caching fix is appropriate for stable.
---
## Verification
- [Phase 1] `git describe HEAD` → `v6.18.43`; parsed subject, tags, body
from user-provided commit
- [Phase 1] Read cover letter mbox: series context confirms PM caching
bug class
- [Phase 2] Read current `pinctrl-rzg2l.c`: confirmed no `sr` in cache
struct (lines 330–343), no `has_sr` in PM functions
- [Phase 2] Confirmed `RZG2L_PCTRL_REG_ACCESS32` macro and `SR(off)` at
line 140
- [Phase 3] `git log --oneline -15 -- drivers/pinctrl/renesas/pinctrl-
rzg2l.c` — related PM fixes listed
- [Phase 3] `git show 8d1c6b603327b` — SMT fix (patch 1/5) confirmed in
tree
- [Phase 3] `git blame -L 3056,3063` — SMT block from 8d1c6b603327b; no
SR block adjacent
- [Phase 3] `git log --author="Lad Prabhakar" -10` — active Renesas
contributor
- [Phase 4] Read `v2_20260413_...pm_register_caching.mbx` — full series
context, v2 revisions
- [Phase 4] `b4 dig -c 8d1c6b603327b` → lore URL for series
- [Phase 4] WebFetch lore URL for patch 3 — **blocked** by Anubis bot
protection
- [Phase 5] Grep `PIN_CFG_SR` — 100+ pin definitions use SR capability
- [Phase 5] Grep `rzg2l_pinctrl_suspend` — PM ops at lines 3179, 3485
- [Phase 5] Read `rzg2l_pinctrl_reg_cache_alloc()` lines 2720–2766 — no
SR allocation
- [Phase 6] Confirmed suspend/resume code exists and SR is missing from
cache path
- [Phase 6] Confirmed patch 1/5 prerequisite present, patch 2/5 (this
commit) absent
- [Phase 8] Assessed failure mode: post-resume slew-rate
misconfiguration, MEDIUM-HIGH for RZ platforms
**YES**
drivers/pinctrl/renesas/pinctrl-rzg2l.c | 38 +++++++++++++++++++++++--
1 file changed, 35 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
index ab8d64a14dd0a..b4d7e80dd6468 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
@@ -322,6 +322,7 @@ struct rzg2l_pinctrl_pin_settings {
* @pupd: PUPD registers cache
* @ien: IEN registers cache
* @smt: SMT registers cache
+ * @sr: SR registers cache
* @sd_ch: SD_CH registers cache
* @eth_poc: ET_POC registers cache
* @oen: Output Enable register cache
@@ -336,6 +337,7 @@ struct rzg2l_pinctrl_reg_cache {
u32 *ien[2];
u32 *pupd[2];
u32 *smt[2];
+ u32 *sr[2];
u8 sd_ch[2];
u8 eth_poc[2];
u8 oen;
@@ -2746,6 +2748,11 @@ static int rzg2l_pinctrl_reg_cache_alloc(struct rzg2l_pinctrl *pctrl)
if (!cache->smt[i])
return -ENOMEM;
+ cache->sr[i] = devm_kcalloc(pctrl->dev, nports, sizeof(*cache->sr[i]),
+ GFP_KERNEL);
+ if (!cache->sr[i])
+ return -ENOMEM;
+
/* Allocate dedicated cache. */
dedicated_cache->iolh[i] = devm_kcalloc(pctrl->dev, n_dedicated_pins,
sizeof(*dedicated_cache->iolh[i]),
@@ -2758,6 +2765,12 @@ static int rzg2l_pinctrl_reg_cache_alloc(struct rzg2l_pinctrl *pctrl)
GFP_KERNEL);
if (!dedicated_cache->ien[i])
return -ENOMEM;
+
+ dedicated_cache->sr[i] = devm_kcalloc(pctrl->dev, n_dedicated_pins,
+ sizeof(*dedicated_cache->sr[i]),
+ GFP_KERNEL);
+ if (!dedicated_cache->sr[i])
+ return -ENOMEM;
}
pctrl->cache = cache;
@@ -2989,7 +3002,7 @@ static void rzg2l_pinctrl_pm_setup_regs(struct rzg2l_pinctrl *pctrl, bool suspen
struct rzg2l_pinctrl_reg_cache *cache = pctrl->cache;
for (u32 port = 0; port < nports; port++) {
- bool has_iolh, has_ien, has_pupd, has_smt;
+ bool has_iolh, has_ien, has_pupd, has_smt, has_sr;
u32 off, caps;
u8 pincnt;
u64 cfg;
@@ -3010,6 +3023,7 @@ static void rzg2l_pinctrl_pm_setup_regs(struct rzg2l_pinctrl *pctrl, bool suspen
has_ien = !!(caps & PIN_CFG_IEN);
has_pupd = !!(caps & PIN_CFG_PUPD);
has_smt = !!(caps & PIN_CFG_SMT);
+ has_sr = !!(caps & PIN_CFG_SR);
if (suspend)
RZG2L_PCTRL_REG_ACCESS32(suspend, pctrl->base + PFC(off), cache->pfc[port]);
@@ -3061,6 +3075,15 @@ static void rzg2l_pinctrl_pm_setup_regs(struct rzg2l_pinctrl *pctrl, bool suspen
cache->smt[1][port]);
}
}
+
+ if (has_sr) {
+ RZG2L_PCTRL_REG_ACCESS32(suspend, pctrl->base + SR(off),
+ cache->sr[0][port]);
+ if (pincnt >= 4) {
+ RZG2L_PCTRL_REG_ACCESS32(suspend, pctrl->base + SR(off) + 4,
+ cache->sr[1][port]);
+ }
+ }
}
}
@@ -3075,7 +3098,7 @@ static void rzg2l_pinctrl_pm_setup_dedicated_regs(struct rzg2l_pinctrl *pctrl, b
* port offset are close together.
*/
for (i = 0, caps = 0; i < pctrl->data->n_dedicated_pins; i++) {
- bool has_iolh, has_ien;
+ bool has_iolh, has_ien, has_sr;
u32 off, next_off = 0;
u64 cfg, next_cfg;
u8 pincnt;
@@ -3097,6 +3120,7 @@ static void rzg2l_pinctrl_pm_setup_dedicated_regs(struct rzg2l_pinctrl *pctrl, b
has_iolh = !!(caps & (PIN_CFG_IOLH_A | PIN_CFG_IOLH_B |
PIN_CFG_IOLH_C | PIN_CFG_IOLH_RZV2H));
has_ien = !!(caps & PIN_CFG_IEN);
+ has_sr = !!(caps & PIN_CFG_SR);
pincnt = hweight8(FIELD_GET(RZG2L_SINGLE_PIN_BITS_MASK, cfg));
if (has_iolh) {
@@ -3107,7 +3131,10 @@ static void rzg2l_pinctrl_pm_setup_dedicated_regs(struct rzg2l_pinctrl *pctrl, b
RZG2L_PCTRL_REG_ACCESS32(suspend, pctrl->base + IEN(off),
cache->ien[0][i]);
}
-
+ if (has_sr) {
+ RZG2L_PCTRL_REG_ACCESS32(suspend, pctrl->base + SR(off),
+ cache->sr[0][i]);
+ }
if (pincnt >= 4) {
if (has_iolh) {
RZG2L_PCTRL_REG_ACCESS32(suspend,
@@ -3119,6 +3146,11 @@ static void rzg2l_pinctrl_pm_setup_dedicated_regs(struct rzg2l_pinctrl *pctrl, b
pctrl->base + IEN(off) + 4,
cache->ien[1][i]);
}
+ if (has_sr) {
+ RZG2L_PCTRL_REG_ACCESS32(suspend,
+ pctrl->base + SR(off) + 4,
+ cache->sr[1][i]);
+ }
}
caps = 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH AUTOSEL 6.18] drm: renesas: rzg2l_mipi_dsi: Fix deassert/assert of CMN_RSTB signal
[not found] <20260831133314.4125787-1-sashal@kernel.org>
` (3 preceding siblings ...)
2026-08-31 13:21 ` [PATCH AUTOSEL 6.18] pinctrl: renesas: rzg2l: Add SR register cache for PM suspend/resume Sasha Levin
@ 2026-08-31 13:23 ` Sasha Levin
2026-08-31 13:25 ` [PATCH AUTOSEL 6.18] rtc: renesas-rtca3: Check RADJ poll result during initial setup Sasha Levin
` (3 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2026-08-31 13:23 UTC (permalink / raw)
To: patches, stable
Cc: Biju Das, Tommaso Merciai, Sasha Levin, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, dri-devel,
linux-renesas-soc, linux-kernel
From: Biju Das <biju.das.jz@bp.renesas.com>
[ Upstream commit 8065890f5cda3f8a503f3b9d326aab0e9cca39e7 ]
The RZ/G2L hardware manual (Rev. 1.50, May 2025), Section 34.4.2.1,
requires deasserting the CMN_RSTB signal after setting the Link registers.
Move the reset_control_deassert() call from rzg2l_mipi_dsi_dphy_init() to
rzg2l_mipi_dsi_startup(), placing it after the Link register writes. This
reset signal is optional for RZ/V2H SoCs, so add a NULL check. Drop the
unused ret variable from rzg2l_mipi_dsi_dphy_init().
The CMN_RSTB signal is not required for reading PHY registers in the
probe. Move reset_control_assert() from rzg2l_mipi_dsi_dphy_exit() to
rzg2l_mipi_dsi_stop(), placing it before the dphy_exit() call. Since this
reset signal is optional for RZ/V2H, the call is a no-op on that SoC.
Tested-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Reviewed-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Link: https://patch.msgid.link/20260330104450.128512-4-biju.das.jz@bp.renesas.com
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: `drm: renesas: rzg2l_mipi_dsi: Fix
deassert/assert of CMN_RSTB signal`
**Local tree:** Linux **6.18.43** (`v6.18.43`)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject line
- **Record:** `[drm: renesas: rzg2l_mipi_dsi]` **`Fix`** — correct
CMN_RSTB reset deassert/assert timing per RZ/G2L hardware manual.
### Step 1.2: Tags
- **Fixes:** — none
- **Reported-by:** — none
- **Tested-by:** Tommaso Merciai `<tommaso.merciai.xr@bp.renesas.com>`
- **Reviewed-by:** Tommaso Merciai `<tommaso.merciai.xr@bp.renesas.com>`
- **Link:** https://patch.msgid.link/20260330104450.128512-4-
biju.das.jz@bp.renesas.com
- **Cc: stable:** — not in the committed message (patches 1–2 of the
same series did include it)
- **Signed-off-by:** Biju Das (ignore pipeline SOB markers)
**Record:** Hardware-tested and reviewed by a Renesas engineer; part of
v3 series “Improvements on RZ/G2L MIPI DSI driver”. No syzbot/crash
tags.
### Step 1.3: Body analysis
- **Bug:** CMN_RSTB is deasserted in `rzg2l_mipi_dsi_dphy_init()` before
Link-layer registers are programmed in `rzg2l_mipi_dsi_startup()`.
RZ/G2L HW manual §34.4.2.1 requires deassert **after** Link register
writes.
- **Symptom:** Incorrect DSI hardware bring-up sequence; display may
fail or behave unreliably on RZ/G2L SoCs with the `rst` reset line.
- **Root cause:** Reset sequencing does not match hardware manual
ordering.
- **Shutdown side:** `reset_control_assert()` moved from `dphy_exit()`
to `stop()` (before PHY teardown), since CMN_RSTB is not needed for
PHY register access during exit.
**Record:** Hardware-init correctness bug on Renesas RZ/G2L MIPI DSI;
optional on RZ/V2H (`rstc` may be NULL).
### Step 1.4: Hidden bug fix?
- **Record:** No — this is an explicit hardware-sequence fix, not
disguised cleanup.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
- **Files:** `drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c` — 9
insertions, 9 deletions
- **Functions:** `rzg2l_mipi_dsi_dphy_init()`,
`rzg2l_mipi_dsi_dphy_exit()`, `rzg2l_mipi_dsi_startup()`,
`rzg2l_mipi_dsi_stop()`
- **Scope:** Single-file, surgical fix
### Step 2.2: Code flow changes
| Hunk | Before | After |
|------|--------|-------|
| `dphy_init()` | Deassert CMN_RSTB + 1 ms sleep after PHY timing writes
| PHY timing only; no reset |
| `dphy_exit()` | Assert CMN_RSTB after PHY power-down | PHY power-down
only |
| `startup()` | Link register writes, then return | Link writes, then
deassert CMN_RSTB + 1 ms sleep (with NULL check) |
| `stop()` | Call `dphy_exit()` only | Assert CMN_RSTB, then
`dphy_exit()` |
**Record:** Normal display enable/disable path (`atomic_pre_enable` →
`startup`; `atomic_post_disable` → `stop`).
### Step 2.3: Bug mechanism
- **Category:** Hardware initialization sequence / workaround
- **Mechanism:** CMN_RSTB released before Link-layer configuration
completes, violating required reset sequence.
### Step 2.4: Fix quality
- **Record:** Minimal, matches manual, uses existing `err_phy` path on
deassert failure, NULL-safe for RZ/V2H. Low regression risk.
---
## PHASE 3: GIT HISTORY
### Step 3.1: Blame
- Buggy reset code introduced in `a4871e6201c46` (May 2025, Thomas
Zimmermann) when driver was added.
- Delay tuning in `aa8ad3e0d1fe9` (already in 6.18.43).
**Record:** Bug present since driver introduction; long-standing on
RZ/G2L platforms.
### Step 3.2: Fixes: tag
- **Record:** N/A — no Fixes: tag in this commit.
### Step 3.3: Related commits
- `300a2d970a535` — Move `set_display_timing()` — **present in tree**
- `aa8ad3e0d1fe9` — Increase reset deassertion delay — **present in
tree**
- `8065890f5cda3` — This CMN_RSTB fix — **NOT present in tree**
- `79f42487ed60d` — Kernel panic on reboot fix — **present in tree**
**Record:** Patch 3/3 of a v3 series; prerequisites 1/3 and 2/3 already
backported to 6.18.43.
### Step 3.4: Author context
- Biju Das is active Renesas maintainer for rz-du/MIPI DSI.
- **Record:** Subsystem maintainer fix with hardware validation.
### Step 3.5: Dependencies
- **Record:** Standalone relative to master-only RZ/V2H CPG work.
Depends on patches 1–2 of the same series, which are already in this
tree. Cherry-pick applies cleanly (verified).
---
## PHASE 4: MAILING LIST RESEARCH
### Step 4.1: Discussion
- **b4 dig -c 8065890f5cda3:** https://patch.msgid.link/20260330104450.1
28512-4-biju.das.jz@bp.renesas.com
- **Series:** v1 → v2 → v3; committed version is v3 3/3 (latest).
- **Review:** Tommaso Merciai — “Looks good to me”; Reviewed-by +
Tested-by on RZ/G3E.
- **NAKs:** None found.
- **Stable:** Patches 1/3 and 2/3 submitted with `Cc:
stable@vger.kernel.org`; patch 3/3 did not include it in the email,
but cover letter describes HW-manual compliance series.
### Step 4.2: Reviewers
- CC'd: dri-devel, linux-renesas-soc, DRM maintainers (Lankhorst,
Ripard, Zimmermann, Airlie, Vetter), Laurent Pinchart.
- **Record:** Appropriate subsystem review chain.
### Step 4.3: Bug report
- **Record:** No external bugzilla/syzbot report. Validation is hardware
testing on RZ/G3E per lore thread.
### Step 4.4: Series context
- Cover letter (v3 0/3): manual requires PHY timing + Link register
writes **before** CMN_RSTB deassert; v2→v3 merged patches 2+3 “to
avoid breakage.”
- **Record:** Incomplete without this patch if delay fix (patch 2) is
already applied.
### Step 4.5: Stable list
- Patches 1–2 explicitly CC'd stable and were backported to 6.18.y.
- **Record:** Strong implicit stable intent for the full series.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
- `rzg2l_mipi_dsi_dphy_init`, `rzg2l_mipi_dsi_startup`,
`rzg2l_mipi_dsi_stop`, `rzg2l_mipi_dsi_dphy_exit`
### Step 5.2: Callers
- `rzg2l_mipi_dsi_startup()` ← `rzg2l_mipi_dsi_atomic_pre_enable()`
(display enable)
- `rzg2l_mipi_dsi_stop()` ← `rzg2l_mipi_dsi_atomic_enable()` error path
and `rzg2l_mipi_dsi_atomic_post_disable()` (display disable)
**Record:** Standard DRM atomic display enable/disable path on every
MIPI DSI panel attach.
### Step 5.3: Callees
- `reset_control_deassert/assert`, `rzg2l_mipi_dsi_link_write`,
`rzg2l_mipi_dsi_phy_write`, `fsleep(1000)`
### Step 5.4: Reachability
- Triggered whenever a connected MIPI DSI panel is enabled on
`renesas,rzg2l-mipi-dsi` hardware.
- **Record:** Reachable from normal display operations; not obscure
debug path.
### Step 5.5: Similar patterns
- Same manual section addressed by already-backported delay fix
(`aa8ad3e0d1fe9`).
- **Record:** This completes the reset-sequence work started in that
commit.
---
## PHASE 6: CROSS-REFERENCE WITH LOCAL TREE
### Step 6.1: Buggy code present?
- **Yes.** Lines 271–275 (`reset_control_deassert` in `dphy_init`) and
line 289 (`reset_control_assert` in `dphy_exit`) confirmed in 6.18.43.
### Step 6.2: Backport difficulty
- **Clean apply.** `git cherry-pick --no-commit 8065890f5cda3` succeeded
with auto-merge only.
### Step 6.3: Related fixes already present?
- Patches 1/3 and 2/3 of series present; this fix is the missing third
piece.
- **Record:** Tree is in intermediate state — delay fixed but ordering
still wrong.
---
## PHASE 7: SUBSYSTEM CONTEXT
### Step 7.1: Subsystem
- **drivers/gpu/drm/renesas/rz-du** — Renesas embedded display (MIPI
DSI)
- **Criticality:** PERIPHERAL (platform-specific), but display is
primary output on affected boards.
### Step 7.2: Activity
- Active development: panic fix, runtime PM, reset timing, display
timing ordering all landed recently in 6.18.y.
---
## PHASE 8: IMPACT AND RISK
### Step 8.1: Who is affected
- Users of Renesas RZ/G2L SoCs with MIPI DSI displays
(`renesas,rzg2l-mipi-dsi`).
- RZ/V2H unaffected (optional `rst` line; `reset_control_*` is NULL-
safe).
### Step 8.2: Trigger conditions
- Every display enable/disable on RZ/G2L with CMN_RSTB wired.
- **Likelihood:** Common on affected hardware.
### Step 8.3: Failure mode
- Incorrect DSI bring-up per hardware manual → display may not work or
may be unreliable.
- **Severity:** HIGH for affected users (no display); not a kernel
crash/oops.
### Step 8.4: Risk-benefit
- **Benefit:** Correct hardware init; completes already-partially-
backported series; tested on RZ/G3E.
- **Risk:** Very low — 18-line reorder, no API changes, NULL-safe.
- **Ratio:** Strong benefit, minimal risk for RZ/G2L users.
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence summary
**FOR backport:**
- Real hardware-init bug per official RZ/G2L manual
- Small, surgical, tested on hardware
- Prerequisites already in 6.18.43
- Applies cleanly
- Completes v3 series whose first two patches were already backported
- Reviewed by Renesas engineer with Tested-by on RZ/G3E
- Same driver already receives stable fixes (panic on reboot, delay,
timing order)
**AGAINST backport:**
- Platform-specific peripheral driver
- No crash/security/data-corruption report
- Patch 3/3 lacks explicit `Cc: stable` in commit message
**Unresolved:** Exact failure modes on all RZ/G2L boards without the fix
(manual violation vs. observed “display broken”).
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — manual compliance + Tested-
by on RZ/G3E
2. Fixes real bug? **PASS** — incorrect reset sequencing
3. Important issue? **PASS** — display failure on affected embedded
platforms
4. Small and contained? **PASS** — 1 file, ~18 lines
5. No new features/APIs? **PASS**
6. Can apply to local tree? **PASS** — cherry-picks cleanly;
prerequisites present
### Step 9.3: Exception category
- **Hardware workaround / init quirk** — correcting reset sequence per
SoC manual.
### Step 9.4: Decision rationale
This tree (6.18.43) already carries patches 1/3 and 2/3 of the same
hardware-manual compliance series but not the final ordering fix.
Without it, CMN_RSTB is still deasserted before Link register
programming, which the RZ/G2L manual explicitly forbids. The fix is
small, tested, low-risk, and completes work stable maintainers already
started for this driver.
---
## Verification
- [Phase 1] `git describe HEAD` → v6.18.43; parsed commit message and
tags
- [Phase 2] Read current `rzg2l_mipi_dsi.c`; confirmed reset calls at
lines 271–275 and 289
- [Phase 3] `git blame` → reset code from `a4871e6201c46`; `git log --
drivers/.../rzg2l_mipi_dsi.c` → series history
- [Phase 3] `git merge-base --is-ancestor` → patches 1/3 and 2/3
present; 8065890f5cda3 absent
- [Phase 4] `b4 dig -c 8065890f5cda3` → lore URL found
- [Phase 4] `b4 dig -a` → v1/v2/v3 series; v3 is latest
- [Phase 4] `b4 dig -w` → DRM/Renesas maintainers CC'd
- [Phase 4] `/tmp/cmn_rstb_thread.mbox` → Reviewed-by, Tested-by on
RZ/G3E; no NAKs; cover letter describes manual requirements
- [Phase 5] `grep rzg2l_mipi_dsi_startup/stop` → called from
atomic_pre_enable/post_disable
- [Phase 5] `drivers/reset/core.c` →
`reset_control_assert/deassert(NULL)` returns 0 (no-op)
- [Phase 6] Buggy code confirmed in 6.18.43 tree
- [Phase 6] `git cherry-pick --no-commit 8065890f5cda3` → exit 0, auto-
merge only
- [Phase 8] Driver supports `renesas,rzg2l-mipi-dsi` compatible string
in local tree
**YES**
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
index 04a24ff9dde15..1c6f29c285b65 100644
--- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
+++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
@@ -228,7 +228,6 @@ static int rzg2l_mipi_dsi_dphy_init(struct rzg2l_mipi_dsi *dsi,
u32 dphytim1;
u32 dphytim2;
u32 dphytim3;
- int ret;
/* All DSI global operation timings are set with recommended setting */
for (i = 0; i < ARRAY_SIZE(rzg2l_mipi_dsi_global_timings); ++i) {
@@ -268,12 +267,6 @@ static int rzg2l_mipi_dsi_dphy_init(struct rzg2l_mipi_dsi *dsi,
rzg2l_mipi_dsi_phy_write(dsi, DSIDPHYTIM2, dphytim2);
rzg2l_mipi_dsi_phy_write(dsi, DSIDPHYTIM3, dphytim3);
- ret = reset_control_deassert(dsi->rstc);
- if (ret < 0)
- return ret;
-
- fsleep(1000);
-
return 0;
}
@@ -285,8 +278,6 @@ static void rzg2l_mipi_dsi_dphy_exit(struct rzg2l_mipi_dsi *dsi)
dphyctrl0 &= ~(DSIDPHYCTRL0_EN_LDO1200 | DSIDPHYCTRL0_EN_BGR);
rzg2l_mipi_dsi_phy_write(dsi, DSIDPHYCTRL0, dphyctrl0);
-
- reset_control_assert(dsi->rstc);
}
static int rzg2l_dphy_conf_clks(struct rzg2l_mipi_dsi *dsi, unsigned long mode_freq,
@@ -393,6 +384,14 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
dsisetr |= FIELD_PREP(DSISETR_MRPSZ, RZG2L_DCS_BUF_SIZE);
rzg2l_mipi_dsi_link_write(dsi, DSISETR, dsisetr);
+ if (dsi->rstc) {
+ ret = reset_control_deassert(dsi->rstc);
+ if (ret < 0)
+ goto err_phy;
+
+ fsleep(1000);
+ }
+
return 0;
err_phy:
@@ -404,6 +403,7 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
static void rzg2l_mipi_dsi_stop(struct rzg2l_mipi_dsi *dsi)
{
+ reset_control_assert(dsi->rstc);
dsi->info->dphy_exit(dsi);
pm_runtime_put(dsi->dev);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH AUTOSEL 6.18] rtc: renesas-rtca3: Check RADJ poll result during initial setup
[not found] <20260831133314.4125787-1-sashal@kernel.org>
` (4 preceding siblings ...)
2026-08-31 13:23 ` [PATCH AUTOSEL 6.18] drm: renesas: rzg2l_mipi_dsi: Fix deassert/assert of CMN_RSTB signal Sasha Levin
@ 2026-08-31 13:25 ` Sasha Levin
2026-08-31 13:25 ` [PATCH AUTOSEL 6.18-5.10] clk: renesas: cpg-mssr: Add number of clock cells check Sasha Levin
` (2 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2026-08-31 13:25 UTC (permalink / raw)
To: patches, stable
Cc: Lad Prabhakar, Claudiu Beznea, Alexandre Belloni, Sasha Levin,
linux-rtc, linux-renesas-soc, linux-kernel
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
[ Upstream commit fafb016d081200c7652e84202f8ba5951e659a53 ]
In rtca3_initial_setup(), the driver clears the RTCA3_RADJ register and
waits for it to reach zero using readb_poll_timeout(). Check the return
value of readb_poll_timeout() and propagate the error if the poll fails.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Tested-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> # on RZ/G3S
Link: https://patch.msgid.link/20260602192559.1791344-3-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
### Step 1.1: Parse the Subject Line
**Record:** `[rtc: renesas-rtca3]` `[Check]` — Check the return value of
the RADJ register poll during RTC initial setup in
`rtca3_initial_setup()`.
### Step 1.2: Parse All Commit Message Tags
**Record:**
- **Fixes:** — not present (expected for manual review)
- **Reported-by:** — none
- **Tested-by:** Claudiu Beznea `<claudiu.beznea.uj@bp.renesas.com>` #
on RZ/G3S
- **Reviewed-by:** Claudiu Beznea `<claudiu.beznea.uj@bp.renesas.com>`
- **Link:**
https://patch.msgid.link/20260602192559.1791344-3-prabhakar.mahadev-
lad.rj@bp.renesas.com
- **Signed-off-by:** Lad Prabhakar, Alexandre Belloni (ignore pipeline-
added SOBs)
- **Cc: stable:** — not present on this individual patch (patch 1/5 in
the same series did CC stable)
- **Notable:** Part of v2 `[PATCH 2/5]` series; hardware-tested on
RZ/G3S; no syzbot/fuzzer reports
### Step 1.3: Analyze Commit Body
**Record:**
- **Bug:** After clearing `RTCA3_RADJ` and polling for it to reach zero,
the driver ignores the `readb_poll_timeout()` return value.
- **Symptom:** If the poll times out (`-ETIMEDOUT`), setup continues and
may start the RTC with automatic time error adjustment
(`RTCA3_RCR2_AADJE`) even though RADJ did not clear.
- **Root cause:** Oversight — every other poll in
`rtca3_initial_setup()` checks `ret`; this one does not.
- **Version info:** None in message; driver landed in this tree via
`d4488377609e3` (Nov 2024).
### Step 1.4: Detect Hidden Bug Fixes
**Record:** Yes — despite neutral wording (“check the return value”),
this is a real initialization error-handling bug, not cosmetic cleanup.
The same RADJ-clear poll in `rtca3_set_offset()` already checks `ret`.
---
## Phase 2: Diff Analysis
### Step 2.1: Inventory the Changes
**Record:**
- **Files:** `drivers/rtc/rtc-renesas-rtca3.c` (+2 lines)
- **Function:** `rtca3_initial_setup()`
- **Scope:** Single-file, surgical fix (2 lines)
### Step 2.2: Code Flow Change
**Record:**
- **Hunk (lines 635–637):** Before: RADJ poll result stored in `ret` but
ignored; execution proceeds to enable `RTCA3_RCR2_START |
RTCA3_RCR2_AADJE`. After: on poll failure, return error immediately.
Affects cold-init path in probe, not hot path.
### Step 2.3: Bug Mechanism
**Record:**
- **Category:** Error-path / logic correctness fix
- **Mechanism:** Missing timeout handling after hardware register poll.
If RADJ does not clear within `RTCA3_DEFAULT_TIMEOUT_US` (150 µs), the
driver continues hardware programming; the subsequent RCR2 poll
overwrites `ret`, masking the failure and allowing probe to succeed
with bad RTC adjustment state.
### Step 2.4: Fix Quality
**Record:** Obviously correct — mirrors the pattern used for all other
polls in the same function and for the identical RADJ poll in
`rtca3_set_offset()`. Minimal, no API changes. **Regression risk:** Very
low; on success path `ret == 0` and behavior is unchanged.
---
## Phase 3: Git History Investigation
### Step 3.1: Blame the Changed Lines
**Record:** Buggy code introduced in `d4488377609e3` (“rtc: renesas-
rtca3: Add driver for RTCA-3…”, Oct 30 2024). Present since driver
introduction. Blame confirms lines 634–636 unchanged since
`d4488377609e3`.
### Step 3.2: Follow Fixes Tag
**Record:** N/A — no `Fixes:` tag.
### Step 3.3: File History / Related Changes
**Record:** Recent `rtc-renesas-rtca3.c` history in this tree:
- `6e21d1253ef13` — PIE clear polling fix (patch 1/5 of same series;
already in 6.18.y)
- `27b2fcbd6b982` — Disable interrupts only if RTC enabled (probe-
failure fix)
- `8f315a5c7376b` — RISC-V build fix
- `d4488377609e3` — Driver introduction
Patch 2/5 (this commit) is standalone; patches 3–5 are error-message,
doc typo, and refactor (not prerequisites).
### Step 3.4: Author's Other Commits
**Record:** Lad Prabhakar authored patch 1 (PIE fix, backported here)
and this patch. Claudiu Beznea (co-author/reviewer) introduced the
driver. Both are active Renesas RTC contributors.
### Step 3.5: Dependencies
**Record:** No dependencies. Applies cleanly to current
`drivers/rtc/rtc-renesas-rtca3.c` in this tree. Upstream commit:
`fafb016d08120` on `master`; **not yet in HEAD** (`v6.18.44`).
---
## Phase 4: Mailing List and External Research
### Step 4.1: Original Patch Discussion
**Record:**
- `b4 dig -c 6e21d1253ef13 -a` found series v2 at
https://patch.msgid.link/20260602192559.1791344-2-prabhakar.mahadev-
lad.rj@bp.renesas.com
- This commit is `[PATCH v2 2/5]` (message-id `…1791344-3…`)
- Cover letter lists RADJ poll checking as an explicit series goal
- No NAKs found in saved mbox; Claudiu provided RB/TB
- **Stable nomination:** Only patch 1/5 CC'd `stable@vger.kernel.org` in
the submission; patch 2/5 did not (per instructions, this is not a
deciding factor)
### Step 4.2: Reviewers
**Record:** `b4 dig -w` recipients include Alexandre Belloni (RTC
maintainer), Claudiu Beznea, Geert Uytterhoeven, `linux-rtc@`, `linux-
renesas-soc@`.
### Step 4.3: Bug Reports
**Record:** No bug reports, syzbot links, or user crash reports. Issue
identified by code review during the same audit that produced the PIE
polling fix.
### Step 4.4: Related Patches
**Record:** 5-patch series; only patches 1–2 are bug fixes. Patches 3–5
(error message, doc typo, year-decoding refactor) are not stable
candidates.
### Step 4.5: Stable Mailing List
**Record:** Not searched separately; patch 1 from this series was
already cherry-picked into `linux-6.18.y` as `6e21d1253ef13` (Signed-
off-by: Greg Kroah-Hartman), confirming stable maintainers accept rtca3
fixes from this series.
---
## Phase 5: Code Semantic Analysis
### Step 5.1: Key Functions
**Record:** `rtca3_initial_setup()` modified.
### Step 5.2: Callers
**Record:** `rtca3_initial_setup()` called once from `rtca3_probe()` at
line 760. `rtca3_probe()` is the `platform_driver` probe for
`module_platform_driver(rtca3_platform_driver)`. Runs at boot during
device enumeration on Renesas RZ/G3S platforms with
`CONFIG_RTC_DRV_RENESAS_RTCA3`.
### Step 5.3: Callees
**Record:** `readb_poll_timeout()`, `writeb()`, `usleep_range()`,
`clk_get_rate()`. Hardware register I/O during init.
### Step 5.4: Reachability
**Record:** Triggered on every boot when the RTCA-3 platform device
probes. Not userspace-triggerable directly, but affects all systems
using this RTC hardware. Failure during init is a boot-time driver probe
issue.
### Step 5.5: Similar Patterns
**Record:** In the same file, `rtca3_set_offset()` lines 538–542 perform
the identical RADJ-clear poll **with** `if (ret) return ret;`. All other
polls in `rtca3_initial_setup()` also check `ret`. This is the sole
missing check in that function.
---
## Phase 6: Cross-Reference Against Local Tree
### Step 6.1: Does Buggy Code Exist?
**Record:** **Yes.** Local tree is `v6.18.44` (`linux-6.18.y`).
`drivers/rtc/rtc-renesas-rtca3.c` exists; lines 634–636 show the missing
check. Driver present since `d4488377609e3`.
### Step 6.2: Backport Complications
**Record:** Clean apply expected — upstream diff matches current file
context exactly. No conflicts anticipated.
### Step 6.3: Related Fixes Already Present?
**Record:** Patch 1/5 (PIE polling fix) already backported as
`6e21d1253ef13`. This patch 2/5 is **not** yet in HEAD. No alternate fix
for the RADJ poll issue.
---
## Phase 7: Subsystem and Maintainer Context
### Step 7.1: Subsystem Criticality
**Record:** `drivers/rtc/` — IMPORTANT (peripheral driver).
`CONFIG_RTC_DRV_RENESAS_RTCA3` depends on `ARCH_RENESAS`; targets
Renesas RZ/G3S SoC only.
### Step 7.2: Subsystem Activity
**Record:** Driver is new (added late 2024) and actively maintained;
multiple follow-up fixes in mainline and at least one already in this
stable tree.
---
## Phase 8: Impact and Risk Assessment
### Step 8.1: Who Is Affected
**Record:** Config-specific, platform-specific — users building
`CONFIG_RTC_DRV_RENESAS_RTCA3` on Renesas RZ/G3S hardware. Not
universal, but real production embedded users.
### Step 8.2: Trigger Conditions
**Record:** RADJ register fails to clear to zero within 150 µs after
`writeb(0, RTCA3_RADJ)`. Unlikely on healthy hardware; possible on
marginal/broken hardware or timing edge cases. Not unprivileged-
userspace-triggerable; boot-time init only.
### Step 8.3: Failure Mode Severity
**Record:** Without fix: probe succeeds despite failed RADJ init; RTC
may start with `RTCA3_RCR2_AADJE` enabled while adjustment register is
not in expected state → incorrect timekeeping/alarms. **Severity:
MEDIUM** — functional RTC corruption, not kernel oops/UAF/security
issue. With fix: probe fails cleanly with `"Failed to setup the RTC!"`.
### Step 8.4: Risk-Benefit
**Record:**
- **Benefit:** Prevents silently registering a mis-initialized RTC;
consistent error handling; complements already-backported patch 1/5
- **Risk:** Very low — 2 lines, no behavior change when poll succeeds
- **Ratio:** Moderate benefit for a narrow audience, very low risk
---
## Phase 9: Final Synthesis
### Step 9.1: Evidence Summary
**FOR backport:**
- Real bug — only missing poll error check in `rtca3_initial_setup()`
- Inconsistent with identical pattern elsewhere in same driver
- Can leave RTC in wrong adjustment state while probe succeeds
- Trivial, obviously correct, hardware-tested on RZ/G3S
- Driver exists in this `6.18.y` tree; patch applies cleanly
- Sister fix (patch 1/5) already backported to this tree
- Reviewed/tested by driver co-maintainer
**AGAINST backport:**
- No user bug reports or reproducible failure described
- Only triggers on 150 µs poll timeout — rare on working hardware
- Not crash/security/deadlock/kernel memory corruption
- Narrow hardware scope (RZ/G3S only)
- Author CC'd stable only on patch 1, not this patch
- Patches 3–5 in series are clearly non-stable material
**Unresolved:** Whether RADJ poll timeout has been observed on real
hardware (no evidence found).
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **PASS** — 2-line mirror of existing
pattern; Tested-by on RZ/G3S
2. Fixes a real bug? **PASS** — missing error propagation on hardware
poll timeout
3. Important issue? **BORDERLINE PASS** — incorrect RTC init/timekeeping
on affected embedded hardware; not a kernel crash, but functional
hardware misconfiguration
4. Small and contained? **PASS** — 2 lines, one function
5. No new features/APIs? **PASS**
6. Can apply to local tree? **PASS** — driver and buggy code present;
clean apply
### Step 9.3: Exception Categories
**Record:** None (not device ID, quirk, DT, build fix, or docs fix).
### Step 9.4: Decision Rationale
This is a legitimate initialization bug in a driver that is already
maintained in `linux-6.18.y`, with a sister fix from the same series
already cherry-picked. The omission allows probe to succeed after a
failed hardware register poll, immediately before enabling automatic
time error adjustment — a documented init sequence step. While the
trigger is uncommon and the audience is narrow (Renesas RZ/G3S), the fix
is zero-risk on the success path, obviously correct, hardware-tested,
and prevents silently exposing a mis-initialized RTC to userspace. That
meets the stable bar for a contained driver probe correctness fix in
hardware that this tree already supports.
---
## Verification
- **[Phase 1]** Parsed commit message tags from user-provided content
- **[Phase 2]** Read current `drivers/rtc/rtc-renesas-rtca3.c` lines
567–660, 538–542; confirmed 2-line diff
- **[Phase 3]** `git describe HEAD` → `v6.18.44`; `make kernelversion`
equivalent → 6.18.44
- **[Phase 3]** `git blame -L 630,650` → bug from `d4488377609e3`
- **[Phase 3]** `git log --oneline -- drivers/rtc/rtc-renesas-rtca3.c` →
5 commits, patch 1 backported, RADJ fix absent
- **[Phase 3]** `git show fafb016d08120` on master → upstream commit
matches provided diff
- **[Phase 3]** `git merge-base --is-ancestor fafb016d08120 HEAD` → RADJ
fix NOT in HEAD
- **[Phase 4]** `b4 dig -c 6e21d1253ef13 -a` → found v2 5-patch series
- **[Phase 4]** `b4 dig -m /tmp/rtca3-series.mbx` → read cover letter
and patch 2/5 content
- **[Phase 4]** Confirmed patch 1 CC'd stable; patch 2 did not
- **[Phase 4]** WebFetch of lore/patch.msgid.link blocked by bot
protection for direct fetch; used b4 mbox instead
- **[Phase 5]** `grep rtca3_initial_setup` → called from `rtca3_probe()`
line 760
- **[Phase 5]** Counted `if (ret)` checks vs `readb_poll_timeout` calls
— RADJ poll is sole missing check in `rtca3_initial_setup()`
- **[Phase 6]** Confirmed `CONFIG_RTC_DRV_RENESAS_RTCA3` in Kconfig,
`depends on ARCH_RENESAS`
- **[Phase 6]** Confirmed buggy code at lines 634–636 without `if (ret)
return ret;`
- **[Phase 8]** `RTCA3_DEFAULT_TIMEOUT_US` = 150 µs verified at line 87
**YES**The background git searches finished and match the earlier
analysis:
- **RADJ poll fix** (`fafb016d08120` / “Check RADJ poll result during
initial setup”) is **not** in this `linux-6.18.y` checkout; it’s only
on `master`.
- **All `rtc-renesas-rtca3` commits in this tree:** driver introduction
(`d4488377609e3`), RISC-V build fix, wakeup boolean cleanup,
interrupt-disable probe fix (`27b2fcbd6b982`), and the already-
backported PIE polling fix (`6e21d1253ef13`).
- **From the v2 5-patch series:** only patch 1 (PIE fix) is present;
patch 2 (this RADJ check) and patches 3–5 are not.
That supports the **YES** backport recommendation for `linux-6.18.y`:
the bug is present, the fix is absent, and the related patch from the
same series is already here.
drivers/rtc/rtc-renesas-rtca3.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/rtc/rtc-renesas-rtca3.c b/drivers/rtc/rtc-renesas-rtca3.c
index 47b4827979344..c41f2089cbb2b 100644
--- a/drivers/rtc/rtc-renesas-rtca3.c
+++ b/drivers/rtc/rtc-renesas-rtca3.c
@@ -634,6 +634,8 @@ static int rtca3_initial_setup(struct clk *clk, struct rtca3_priv *priv)
writeb(0, priv->base + RTCA3_RADJ);
ret = readb_poll_timeout(priv->base + RTCA3_RADJ, tmp, !tmp, 10,
RTCA3_DEFAULT_TIMEOUT_US);
+ if (ret)
+ return ret;
/* Start the RTC and enable automatic time error adjustment. */
mask = RTCA3_RCR2_START | RTCA3_RCR2_AADJE;
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ 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>
` (5 preceding siblings ...)
2026-08-31 13:25 ` [PATCH AUTOSEL 6.18] rtc: renesas-rtca3: Check RADJ poll result during initial setup Sasha Levin
@ 2026-08-31 13:25 ` Sasha Levin
2026-08-31 13:28 ` [PATCH AUTOSEL 6.18-6.12] pinctrl: renesas: rzg2l: Handle RZ/V2H(P) IOLH configuration in PM cache Sasha Levin
2026-08-31 13:29 ` [PATCH AUTOSEL 6.18-6.1] pinctrl: renesas: rzv2m: Use -ENOTSUPP instead of -EOPNOTSUPP Sasha Levin
8 siblings, 0 replies; 9+ 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] 9+ messages in thread
* [PATCH AUTOSEL 6.18-6.12] pinctrl: renesas: rzg2l: Handle RZ/V2H(P) IOLH configuration in PM cache
[not found] <20260831133314.4125787-1-sashal@kernel.org>
` (6 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:28 ` Sasha Levin
2026-08-31 13:29 ` [PATCH AUTOSEL 6.18-6.1] pinctrl: renesas: rzv2m: Use -ENOTSUPP instead of -EOPNOTSUPP Sasha Levin
8 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2026-08-31 13:28 UTC (permalink / raw)
To: patches, stable
Cc: Lad Prabhakar, Geert Uytterhoeven, Sasha Levin, linusw,
linux-renesas-soc, linux-gpio, linux-kernel
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
[ Upstream commit d0fc9f8eb2ce55eb00dbfdc0f19c844df5aee5b8 ]
Include PIN_CFG_IOLH_RZV2H in the IOLH capability checks when saving
and restoring pin configuration registers.
On RZ/V2H(P), RZ/V2N, and RZ/G3E, the IOLH configuration is defined by
the PIN_CFG_IOLH_RZV2H capability. The previous implementation did not
account for this, causing the IOLH registers to be skipped during PM
save/restore.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/20260413182456.811543-4-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <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:** `[pinctrl: renesas: rzg2l]` `[Handle]` — Include RZ/V2H(P)
IOLH capability in PM register save/restore checks.
### Step 1.2: Commit tags
**Record:**
- **Signed-off-by:** Lad Prabhakar `<prabhakar.mahadev-
lad.rj@bp.renesas.com>` (author)
- **Reviewed-by:** Geert Uytterhoeven `<geert+renesas@glider.be>`
(Renesas/pinctrl maintainer)
- **Link:**
https://patch.msgid.link/20260413182456.811543-4-prabhakar.mahadev-
lad.rj@bp.renesas.com
- **Signed-off-by:** Geert Uytterhoeven (maintainer tree)
- No Fixes:, Reported-by:, Tested-by:, Cc: stable@, or syzbot tags
- Notable: Reviewed by subsystem maintainer; part of v2 5-patch PM
caching series (patch 3/5)
### Step 1.3: Body analysis
**Record:**
- **Bug:** PM suspend/resume skips IOLH registers on RZ/V2H(P), RZ/V2N,
and RZ/G3E because those SoCs use `PIN_CFG_IOLH_RZV2H` instead of
`PIN_CFG_IOLH_A/B/C`.
- **Symptom:** Output-impedance/drive-strength (IOLH) not saved on
suspend or restored on resume; pins revert to wrong electrical
settings after S2RAM.
- **Root cause:** `has_iolh` capability check omits
`PIN_CFG_IOLH_RZV2H`.
### Step 1.4: Hidden bug fix?
**Record:** No — this is an explicit PM suspend/resume bug fix, not
disguised cleanup.
---
## Phase 2: Diff Analysis
### Step 2.1: Inventory
**Record:**
- **File:** `drivers/pinctrl/renesas/pinctrl-rzg2l.c` (+2 lines net in
submitted diff; full v2 patch touches 2 functions)
- **Functions:** `rzg2l_pinctrl_pm_setup_dedicated_regs()` (shown in
candidate diff); v2 submission also changed
`rzg2l_pinctrl_pm_setup_regs()` (author later agreed to drop that hunk
per maintainer review)
- **Scope:** Single-file, surgical (2-line logical change)
### Step 2.2: Code flow
**Record:**
- **Before:** `has_iolh` true only for `PIN_CFG_IOLH_A|B|C`; dedicated
pins with only `PIN_CFG_IOLH_RZV2H` skip IOLH cache read/write.
- **After:** `PIN_CFG_IOLH_RZV2H` included; IOLH registers saved on
suspend and restored on resume for affected dedicated pins.
- **Path:** System suspend/resume via `rzg2l_pinctrl_suspend_noirq()` /
`rzg2l_pinctrl_resume_noirq()` →
`rzg2l_pinctrl_pm_setup_dedicated_regs()`.
### Step 2.3: Bug mechanism
**Record:** **Logic/correctness fix** — incomplete capability bitmask
causes PM cache to omit IOLH register save/restore for a whole class of
pins on newer Renesas SoCs.
### Step 2.4: Fix quality
**Record:** Obviously correct (adds the missing flag already used
everywhere else in the driver). Minimal risk; no API, locking, or
structural changes.
---
## Phase 3: Git History Investigation
### Step 3.1: Blame
**Record:** Buggy `has_iolh` lines at 3009 and 3097 trace to the PM
caching code (blame shows `19eef1d98eeda` in this shallow stable tree).
`PIN_CFG_IOLH_RZV2H` (line 65) is present in this tree.
### Step 3.2: Fixes: tag
**Record:** N/A — no Fixes: tag.
### Step 3.3: Related file history
**Record:** Same PM series already partially backported to this tree:
- `8d1c6b603327b` — SMT register cache (patch 1/5, same series)
- `509d342d02fff`, `c4cfa8ee77374` — earlier IOLH/IEN/PUPD/SMT PM fixes
This IOLH fix is **not** yet in the tree.
### Step 3.4: Author context
**Record:** Lad Prabhakar is the RZ/G2L pinctrl driver author/maintainer
contributor; Geert Uytterhoeven is Renesas maintainer and reviewed the
series.
### Step 3.5: Dependencies
**Record:** Standalone — only adds a flag to an existing bitmask. Does
not require patches 2/4/5 (SR/NOD/PUPD) to function; applies cleanly to
current `rzg2l_pinctrl_pm_setup_dedicated_regs()` at line 3097.
---
## Phase 4: Mailing List and External Research
### Step 4.1: Original discussion
**Record:** Thread fetched via `b4 mbox` from lore (16 messages). Patch
3/5 reviewed by Geert Uytterhoeven. Geert noted `PIN_CFG_IOLH_RZV2H` may
only matter for dedicated pins in `pm_setup_regs`; author agreed to drop
that hunk. Final fix targets `rzg2l_pinctrl_pm_setup_dedicated_regs()`.
### Step 4.2: Reviewers
**Record:** Geert Uytterhoeven (maintainer), Linus Walleij CC'd on cover
letter; linux-renesas-soc list.
### Step 4.3: Bug reports
**Record:** No external bug report or syzbot link; issue identified
during PM caching review/fix series.
### Step 4.4: Series context
**Record:** v2 0/5 cover letter describes 5 related PM cache fixes.
Patch 1 (SMT) already in this 6.18.43 tree; patches 2/4/5 (SR, NOD,
dedicated PUPD) are separate and not prerequisites for this IOLH bitmask
fix.
### Step 4.5: Stable list
**Record:** No stable@ discussion found in thread.
---
## Phase 5: Code Semantic Analysis
### Step 5.1: Key functions
**Record:** `rzg2l_pinctrl_pm_setup_dedicated_regs()`, called from
`rzg2l_pinctrl_suspend_noirq()` and `rzg2l_pinctrl_resume_noirq()`.
### Step 5.2: Callers
**Record:** PM suspend/resume noirq path on every system sleep for
affected pinctrl devices.
### Step 5.3: Callees
**Record:** `RZG2L_PCTRL_REG_ACCESS32()` macro for hardware IOLH/IEN
register read (suspend) or write (resume).
### Step 5.4: Reachability
**Record:** Triggered on every S2RAM cycle on boards using
`renesas,r9a09g047-pinctrl` (RZ/G3E), `renesas,r9a09g056-pinctrl`
(RZ/V2H), or `renesas,r9a09g057-pinctrl` (RZ/V2HP). Dedicated pins
include Ethernet, SD, XSPI, SCIF, etc.
### Step 5.5: Similar patterns
**Record:** Same `has_iolh` bitmask omission exists at line 3009 in
`rzg2l_pinctrl_pm_setup_regs()` for GPIO port pins using
`RZV2H_MPXED_PIN_FUNCS` (which includes `PIN_CFG_IOLH_RZV2H`). This
commit (per review) does not fix that path; dedicated-pin path is the
confirmed target.
---
## Phase 6: Cross-Reference Against Local Tree (6.18.43)
### Step 6.1: Buggy code present?
**Record:** **Yes.** Line 3097 in
`rzg2l_pinctrl_pm_setup_dedicated_regs()`:
```3097:3097:drivers/pinctrl/renesas/pinctrl-rzg2l.c
has_iolh = !!(caps & (PIN_CFG_IOLH_A | PIN_CFG_IOLH_B |
PIN_CFG_IOLH_C));
```
`PIN_CFG_IOLH_RZV2H` is defined (line 65) and used extensively in
`rzv2h_dedicated_pins` and `rzg3e_dedicated_pins` (e.g., lines 2233+,
2370+). Affected SoC compatibles are registered (lines 3470–3479).
### Step 6.2: Backport complications
**Record:** Clean apply — single-line change at line 3097. No SR/NOD
infrastructure required (those are separate series patches not in this
tree).
### Step 6.3: Related fixes already present?
**Record:** SMT PM cache fix from same series (`8d1c6b603327b`) is
already in tree. This IOLH fix is the logical next piece.
---
## Phase 7: Subsystem Context
### Step 7.1: Subsystem criticality
**Record:** `drivers/pinctrl/renesas/` — **PERIPHERAL** (platform-
specific), but suspend/resume correctness is critical for embedded
products using these SoCs.
### Step 7.2: Activity
**Record:** Active PM fix series; multiple related backports already
landed in 6.18.y.
---
## Phase 8: Impact and Risk Assessment
### Step 8.1: Who is affected
**Record:** Users of RZ/G3E (r9a09g047), RZ/V2H (r9a09g056), RZ/V2HP
(r9a09g057) who use system suspend/resume. Driver-specific, but
dedicated pins cover critical peripherals.
### Step 8.2: Trigger conditions
**Record:** Every S2RAM suspend/resume cycle on affected hardware.
Requires `CONFIG_PINCTRL` + matching DT compatible. Not userspace-
triggerable directly, but normal laptop/embedded suspend path.
### Step 8.3: Failure severity
**Record:** Wrong pin drive strength/impedance after resume → peripheral
malfunction (Ethernet, SD, XSPI flash, UART), potential bus errors or
silent data corruption on high-speed interfaces. **Severity: MEDIUM-
HIGH** (hardware misconfiguration, not kernel oops).
### Step 8.4: Risk-benefit
**Record:** **Benefit: HIGH** for affected embedded users doing
suspend/resume. **Risk: VERY LOW** (2-line bitmask fix, maintainer-
reviewed). Ratio strongly favors backport.
---
## Phase 9: Final Synthesis
### Step 9.1: Evidence summary
**FOR backport:**
- Real suspend/resume bug on shipping Renesas SoCs in this tree
- Maintainer-reviewed, obviously correct, minimal diff
- Same PM series already partially backported (SMT fix in 6.18.43)
- Affects critical dedicated pins (network, storage, flash buses)
- Buggy code and `PIN_CFG_IOLH_RZV2H` both present in 6.18.43
**AGAINST backport:**
- Narrow hardware scope (3 SoC compatibles)
- No crash/oops — functional/hardware issue after resume
- GPIO port-pin IOLH path (line 3009) may remain unfixed per maintainer
review (out of scope for this commit)
**Unresolved:** Whether port-pin IOLH via
`rzg2l_pinctrl_pm_setup_regs()` also needs the same fix (Geert/author
agreed to omit; separate issue).
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — bitmask addition; Reviewed-
by maintainer; series patch 1 tested by multiple Tested-by on SMT
patch
2. Fixes real bug affecting users? **PASS** — IOLH not saved/restored on
suspend/resume
3. Important issue? **PASS** — suspend/resume hardware misconfiguration
on critical pins (MEDIUM-HIGH)
4. Small and contained? **PASS** — 2 lines, one function
5. No new features or APIs? **PASS**
6. Can apply to local tree? **PASS** — applies cleanly at line 3097
### Step 9.3: Exception category
**Record:** N/A — standard bug fix, not device-ID/quirk/build fix.
### Step 9.4: Decision rationale
For **Linux 6.18.43**, this commit should be backported. The tree
already has RZ/V2H and RZ/G3E pinctrl support with extensive
`PIN_CFG_IOLH_RZV2H` dedicated-pin tables and active PM suspend/resume,
but the PM cache path omits that capability flag. After S2RAM, dedicated
function pins (Ethernet, SD, XSPI, etc.) lose their output-impedance
settings. The fix is trivial, maintainer-reviewed, and consistent with
the SMT PM cache fix already in this stable tree.
---
## Verification
- **[Phase 1]** Parsed subject, tags, body from commit message and local
mbx
- **[Phase 2]** Read diff and current code at lines 3009, 3097,
3179–3243
- **[Phase 3]** `git describe HEAD` → v6.18.43; `git log --oneline -20
-- drivers/pinctrl/renesas/pinctrl-rzg2l.c`; `git blame` on lines
3009/3097; confirmed `8d1c6b603327b` (SMT fix from same series) in
tree
- **[Phase 4]** `b4 mbox` fetched 16-message lore thread; Geert review
noted dedicated-pin scope; no stable@ nomination found
- **[Phase 5]** Traced call chain:
`rzg2l_pinctrl_suspend_noirq`/`resume_noirq` →
`rzg2l_pinctrl_pm_setup_dedicated_regs`; verified
`rzv2h_dedicated_pins`/`rzg3e_dedicated_pins` use
`PIN_CFG_IOLH_RZV2H`; verified SoC compatibles at lines 3470–3479
- **[Phase 6]** Confirmed buggy line 3097 present; `PIN_CFG_IOLH_RZV2H`
defined at line 65; fix not yet applied; clean apply expected
- **[Phase 7]** Identified Renesas pinctrl driver subsystem
- **[Phase 8]** Assessed suspend/resume trigger and MEDIUM-HIGH hardware
impact
**YES**
drivers/pinctrl/renesas/pinctrl-rzg2l.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
index e8cc83029db33..ab8d64a14dd0a 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
@@ -3094,7 +3094,8 @@ static void rzg2l_pinctrl_pm_setup_dedicated_regs(struct rzg2l_pinctrl *pctrl, b
}
/* And apply them in a single shot. */
- has_iolh = !!(caps & (PIN_CFG_IOLH_A | PIN_CFG_IOLH_B | PIN_CFG_IOLH_C));
+ has_iolh = !!(caps & (PIN_CFG_IOLH_A | PIN_CFG_IOLH_B |
+ PIN_CFG_IOLH_C | PIN_CFG_IOLH_RZV2H));
has_ien = !!(caps & PIN_CFG_IEN);
pincnt = hweight8(FIELD_GET(RZG2L_SINGLE_PIN_BITS_MASK, cfg));
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH AUTOSEL 6.18-6.1] pinctrl: renesas: rzv2m: Use -ENOTSUPP instead of -EOPNOTSUPP
[not found] <20260831133314.4125787-1-sashal@kernel.org>
` (7 preceding siblings ...)
2026-08-31 13:28 ` [PATCH AUTOSEL 6.18-6.12] pinctrl: renesas: rzg2l: Handle RZ/V2H(P) IOLH configuration in PM cache Sasha Levin
@ 2026-08-31 13:29 ` Sasha Levin
8 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2026-08-31 13:29 UTC (permalink / raw)
To: patches, stable
Cc: Claudiu Beznea, Geert Uytterhoeven, Geert Uytterhoeven,
Sasha Levin, linusw, linux-renesas-soc, linux-gpio, linux-kernel
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
[ Upstream commit 01f94d53947df35ba77cdb3992a4e3ef9d9dc1ad ]
The pinctrl and GPIO core code make exceptions for the -ENOTSUPP error
code. One such example is gpio_set_config_with_argument_optional(), which
returns success when gpio_set_config_with_argument() returns -ENOTSUPP, but
reports failure for all other error codes.
Returning -EOPNOTSUPP from the pinctrl driver on the unsupported pinctrl
operation may lead to boot failures when pinctrl drivers implements
struct gpio_chip::set_config, the system uses GPIO hogs, and the
struct gpio_chip::set_config implementation returns -EOPNOTSUPP for the
unsupported operations.
Currently, the driver does not implement struct gpio_chip::set_config().
To avoid future failures, return -ENOTSUPP from
rzv2m_pinctrl_pinconf_set().
rzv2m_pinctrl_pinconf_group_get() is used when dumping pinctrl
configuration. pinconf_generic_dump_one(), which calls it, makes
exceptions for the -EINVAL and -ENOTSUPP error codes. The documentation
for struct pinconf_ops::pin_config_group_get states that it "should
return -ENOTSUPP and -EINVAL using the same rules as pin_config_get()".
The documentation for struct pinconf_ops::pin_config_get states:
"get the config of a certain pin, if the requested config is not available
on this controller this should return -ENOTSUPP and if it is available but
disabled it should return -EINVAL".
Return -ENOTSUPP for the unsupported pinctrl operation.
Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/20260522105717.1727837-1-claudiu.beznea@kernel.org
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: `pinctrl: renesas: rzv2m: Use -ENOTSUPP
instead of -EOPNOTSUPP`
**Local tree:** Linux **6.18.44** (`git describe HEAD` → `v6.18.44`,
`make kernelversion` → `6.18.44`)
**Upstream commit:** `01f94d53947df` (on `master`; **not** in this
6.18.44 checkout)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject line
**Record:** `[pinctrl: renesas: rzv2m]` — action: **Use** (correctness
fix) — return the proper `-ENOTSUPP` errno instead of `-EOPNOTSUPP` for
unsupported pinconf operations.
### Step 1.2: Tags
**Record:**
- **Suggested-by:** Geert Uytterhoeven (maintainer suggested the fix)
- **Signed-off-by:** Claudiu Beznea (author), Geert Uytterhoeven
(committer on master)
- **Reviewed-by:** Geert Uytterhoeven (subsystem maintainer)
- **Link:** https://patch.msgid.link/20260522105717.1727837-1-
claudiu.beznea@kernel.org
- **No** Fixes:, Reported-by:, Tested-by:, Cc: stable@vger.kernel.org
(absence of Cc: stable is expected per review instructions)
- **Notable:** Maintainer-reviewed, maintainer-suggested; no syzbot or
user bug reports
### Step 1.3: Body analysis
**Record:**
- **Bug:** Driver returns `-EOPNOTSUPP` where pinctrl/GPIO core expects
`-ENOTSUPP` for “unsupported configuration”
- **Symptoms:**
- Potential **boot failure** if `gpio_chip::set_config` is added and
GPIO hogs trigger optional config paths
(`gpio_set_config_with_argument_optional()` treats only `-ENOTSUPP`
as benign)
- **Incorrect debugfs dumps**: `pinconf_generic_dump_one()` treats
`-ENOTSUPP` and `-EINVAL` as legal; `-EOPNOTSUPP` prints `"ERROR
READING CONFIG SETTING"`
- **Root cause:** Violation of documented `pinconf_ops` API contract
(`include/linux/pinctrl/pinconf.h`)
- **Version info:** None in message; driver has existed since 2022
### Step 1.4: Hidden bug fix?
**Record:** **Yes.** Despite neutral “Use X instead of Y” wording, this
fixes a real API-contract bug with concrete debugfs impact and a
documented boot-failure class for GPIO hog + `set_config` paths.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
- **File:** `drivers/pinctrl/renesas/pinctrl-rzv2m.c` — 2 lines changed
(+2/-2)
- **Functions:** `rzv2m_pinctrl_pinconf_set()`,
`rzv2m_pinctrl_pinconf_group_get()`
- **Scope:** Single-file, surgical fix
### Step 2.2: Code flow per hunk
**Hunk 1 — `rzv2m_pinctrl_pinconf_set()` default case:**
- **Before:** Unknown `PIN_CONFIG_*` param → `-EOPNOTSUPP`
- **After:** → `-ENOTSUPP`
- **Path:** DT pinconf apply / explicit pin configuration for
unsupported parameters
**Hunk 2 — `rzv2m_pinctrl_pinconf_group_get()` mismatch check:**
- **Before:** Pins in group disagree on config value → `-EOPNOTSUPP`
- **After:** → `-ENOTSUPP`
- **Path:** `pinconf_generic_dump_one()` → `pin_config_group_get()`
during debugfs pinconf dumps
### Step 2.3: Bug mechanism
**Record:** **Logic / API correctness fix (category g).** Core
GPIO/pinconf code special-cases `-ENOTSUPP` but not `-EOPNOTSUPP`. The
driver already returns `-ENOTSUPP` correctly in
`rzv2m_pinctrl_pinconf_get()` (line 548); these two sites were
inconsistent.
### Step 2.4: Fix quality
**Record:** Obviously correct, minimal, matches kernel-wide convention
and sibling `rzg2l` fix. Regression risk: **very low** (only changes
error codes on unsupported/mismatched-config paths).
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:** `-EOPNOTSUPP` in `pinconf_set` default case introduced in
`92a9b82525761` (“Add RZ/V2M pin and gpio controller driver”, June
2022). Present in this 6.18.44 tree.
### Step 3.2: Fixes: tag
**Record:** N/A — no Fixes: tag in commit message.
### Step 3.3: Related file history
**Record:**
- Identical fix for `rzg2l` already backported to **this tree**:
`6876f767b0490` (upstream `c1492da3939c`)
- Related but separate: `ec642ab9b76f8` (type fix in
`pin_config_group_get`) is on `master` but **not** in 6.18.44 — not a
prerequisite for this 2-line errno change
- Standalone single-patch series (v1 only per `b4 dig -a`)
### Step 3.4: Author context
**Record:** Claudiu Beznea is an active Renesas pinctrl contributor;
Geert Uytterhoeven is the Renesas maintainer who committed and reviewed.
### Step 3.5: Dependencies
**Record:** **None.** Patch applies cleanly (`git apply --check` → exit
0). Does not assume code absent from 6.18.44.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original discussion
**Record:**
- **URL:** https://patch.msgid.link/20260522105717.1727837-1-
claudiu.beznea@kernel.org
- **Series:** v1 only (no revisions)
- **Review:** Geert Uytterhoeven Reviewed-by + “will queue in renesas-
devel for v7.2”
- **No** NAKs, no explicit stable nomination in thread
- Lore web fetch blocked by bot protection; content obtained via `b4 dig
-m`
### Step 4.2: Reviewers
**Record:** CC’d: `geert+renesas@glider.be`, `linusw@kernel.org`,
`brgl@kernel.org`, `linux-renesas-soc@`, `linux-gpio@`, `linux-kernel@`
— appropriate maintainer coverage.
### Step 4.3: Bug report
**Record:** N/A — no external bug report; preventive/correctness fix
identified by maintainer (Suggested-by Geert).
### Step 4.4: Related patches
**Record:** Part of a Renesas-wide errno cleanup; `rzg2l` variant
already in this stable tree.
### Step 4.5: Stable list
**Record:** Not searched (lore blocked); `rzg2l` sibling carried `Cc:
stable@vger.kernel.org` and was backported here.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** `rzv2m_pinctrl_pinconf_set`,
`rzv2m_pinctrl_pinconf_group_get`
### Step 5.2: Callers
**Record:**
- `pinconf_set` → `pinconf_apply_setting()` during pinctrl DT binding
(boot)
- `pinconf_group_get` → `pin_config_group_get()` →
`pinconf_generic_dump_one()` (debugfs via
`pinconf_generic_dump_config`; driver sets `is_generic = true`)
### Step 5.3: Callees
**Record:** `rzv2m_pinctrl_pinconf_get()` (group_get),
`pinconf_to_config_param()` (set)
### Step 5.4: Reachability
**Record:**
- **Boot:** `pinconf_set` path reachable on RZ/V2M boot with unsupported
DT pinconf properties (both errnos fail equally today via
`pinconf_apply_setting`)
- **GPIO hog boot failure:** **Not currently reachable** —
`rzv2m_gpio_register()` does not set `chip->set_config`;
`gpio_do_set_config()` returns `-ENOTSUPP` when `set_config` is NULL
- **Debugfs:** `pinconf_group_get` path **is reachable** on RZ/V2M when
dumping pinconf; wrong errno causes spurious error strings
- **RZ/V2M EVK** (`r9a09g011-v2mevk2.dts`): no `gpio-hog` nodes found
### Step 5.5: Similar patterns
**Record:** `rzv2m_pinctrl_pinconf_get()` already uses `-ENOTSUPP` (line
548). `rzg2l` fix already backported in this tree. Kernel-wide
convention: pinctrl drivers return `-ENOTSUPP` for unsupported configs.
---
## PHASE 6: CROSS-REFERENCE WITH LOCAL TREE (6.18.44)
### Step 6.1: Buggy code exists?
**Record:** **Yes.** Lines 664 and 713 in `pinctrl-rzv2m.c` still return
`-EOPNOTSUPP`. Driver present since v6.x (2022).
### Step 6.2: Backport complications
**Record:** **Clean apply** — verified with `git show 01f94d53947df |
git apply --check`.
### Step 6.3: Related fixes already present?
**Record:** `rzg2l` errno fix (`6876f767b0490`) is in this tree; `rzv2m`
fix is **not** yet applied.
---
## PHASE 7: SUBSYSTEM CONTEXT
### Step 7.1: Subsystem / criticality
**Record:** `drivers/pinctrl/renesas` — **PERIPHERAL** (RZ/V2M /
`ARCH_R9A09G011` platform-specific), but uses generic pinconf
infrastructure shared with GPIO core.
### Step 7.2: Activity
**Record:** Active — recent rzv2m fixes in this tree (NULL deref,
of_node_put, GPIO callback updates).
---
## PHASE 8: IMPACT AND RISK
### Step 8.1: Who is affected
**Record:** RZ/V2M (`CONFIG_PINCTRL_RZV2M`) users — embedded/industrial
platforms. Not universal.
### Step 8.2: Trigger conditions
**Record:**
- **Current:** Debugfs pinconf dump with heterogeneous pin groups; API
misuse if unsupported pinconf applied via DT
- **Future:** `set_config` + GPIO hogs with optional bias/config flags
- **Likelihood today:** Low for boot (no `set_config`, no gpio-hogs on
rzv2m boards); moderate for debugfs correctness
### Step 8.3: Failure mode severity
**Record:**
- Boot failure (future `set_config` path): **CRITICAL** if triggered
- Debugfs spurious errors today: **LOW**
- API contract violation: correctness issue, not crash by itself
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** Medium — aligns with already-backported `rzg2l` fix,
fixes debugfs behavior, prevents future boot regression, correct per
`pinconf.h`
- **Risk:** Very low — 2 errno changes on error paths only
- **Ratio:** Favorable
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence summary
**FOR backport:**
- Identical `rzg2l` fix already accepted into **this** 6.18.44 tree
- Documented API contract (`pinconf.h` requires `-ENOTSUPP`)
- Internal driver inconsistency (`pinconf_get` already uses `-ENOTSUPP`)
- Real debugfs impact via `pinconf_generic_dump_one()`
- Preventive boot-failure fix when `set_config` is added
- 2-line change, applies cleanly, maintainer-reviewed
- Bug present since driver introduction (2022)
**AGAINST backport:**
- No current boot failure (no `set_config`, no gpio-hogs on rzv2m
boards)
- Platform-specific, limited user base
- No user bug report or syzbot finding
- “Important issue” threshold is borderline for *current* runtime impact
**Unresolved:** None material to the decision.
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — errno swap matches API docs
and `rzg2l` precedent; Reviewed-by maintainer (no Tested-by)
2. Fixes a real bug? **PASS** — API contract violation with verified
debugfs impact; boot failure class documented
3. Important issue? **PASS (borderline)** — not crashing today, but same
class of fix already deemed stable-worthy for `rzg2l` in this tree;
future boot failure is serious
4. Small and contained? **PASS** — 2 lines, 1 file
5. No new features/APIs? **PASS**
6. Can apply to local tree? **PASS** — clean apply verified
### Step 9.3: Exception categories
**Record:** None (not device ID, quirk, DT, build, or docs-only).
### Step 9.4: Decision rationale
The strongest argument is **consistency within this stable tree**:
maintainers already backported the identical `rzg2l` errno fix
(`6876f767b0490`) to 6.18.44. The `rzv2m` driver has the same bug
pattern, the same author/reviewer, and the same API-contract violation.
While current boot impact is limited (no `gpio_chip::set_config`, no
gpio-hogs on RZ/V2M boards), the `pinconf_group_get` path already
produces incorrect debugfs behavior, and the fix is trivial with
negligible regression risk.
---
## Verification
- **[Phase 1]** Parsed commit message and tags from user query + `git
show 01f94d53947df`
- **[Phase 2]** Diff analysis: 2 errno changes in `pinctrl-rzv2m.c`;
read surrounding code at lines 530–744
- **[Phase 3]** `git describe HEAD` → v6.18.44; `git blame` → buggy
lines from `92a9b82525761` (2022)
- **[Phase 3]** `git log -- drivers/pinctrl/renesas/pinctrl-rzv2m.c` —
driver history reviewed
- **[Phase 3]** Found `6876f767b0490` (rzg2l sibling fix) already in
HEAD
- **[Phase 3]** `ec642ab9b76f8` NOT in HEAD — separate type fix, not a
prerequisite
- **[Phase 4]** `b4 dig -c 01f94d53947df` → lore URL; `b4 dig -a` → v1
only; `b4 dig -w` → maintainers CC'd
- **[Phase 4]** `b4 dig -m /tmp/rzv2m_enotsupp.mbox` — Geert Reviewed-
by, no NAKs
- **[Phase 5]** Read `gpio_set_config_with_argument_optional()` in
`gpiolib.c:2694–2714` — only `-ENOTSUPP` treated as success
- **[Phase 5]** Read `pinconf_generic_dump_one()` in `pinconf-
generic.c:59–84` — `-ENOTSUPP`/`-EINVAL` skipped
- **[Phase 5]** Read `pinconf.h:24–29` — API documents `-ENOTSUPP`
- **[Phase 5]** Verified `rzv2m` has no `chip->set_config` in
`rzv2m_gpio_register()` (lines 953–960)
- **[Phase 5]** Grep: no gpio-hogs in `r9a09g011-v2mevk2.dts`
- **[Phase 6]** Grep confirms `-EOPNOTSUPP` still at lines 664, 713 in
HEAD
- **[Phase 6]** `git show 01f94d53947df | git apply --check` → applies
cleanly
- **[Phase 6]** `master` has fix at lines 664, 714; HEAD does not
**YES**The background git searches finished successfully and match what
the analysis already used:
- The **rzv2m** fix is upstream commit `01f94d53947df` on `master`; it
is **not** in this **6.18.44** tree yet (lines 664 and 713 still
return `-EOPNOTSUPP`).
- The sibling **rzg2l** fix (`6876f767b0490`) **is** already backported
here.
**Verdict for 6.18.44: YES** — same 2-line errno correction, applies
cleanly, and consistent with the rzg2l backport already in this tree.
drivers/pinctrl/renesas/pinctrl-rzv2m.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/renesas/pinctrl-rzv2m.c b/drivers/pinctrl/renesas/pinctrl-rzv2m.c
index dce68f93d2d57..e08f24d5a89f5 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzv2m.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzv2m.c
@@ -661,7 +661,7 @@ static int rzv2m_pinctrl_pinconf_set(struct pinctrl_dev *pctldev,
}
default:
- return -EOPNOTSUPP;
+ return -ENOTSUPP;
}
}
@@ -710,7 +710,7 @@ static int rzv2m_pinctrl_pinconf_group_get(struct pinctrl_dev *pctldev,
/* Check config matches previous pins */
if (i && prev_config != *config)
- return -EOPNOTSUPP;
+ return -ENOTSUPP;
prev_config = *config;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-08-31 13:49 UTC | newest]
Thread overview: 9+ 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.15] mmc: renesas_sdhi: Add OF entry for RZ/G2E SoC Sasha Levin
2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-5.15] mmc: renesas_sdhi: Add OF entry for RZ/G2N SoC Sasha Levin
2026-08-31 13:21 ` [PATCH AUTOSEL 6.18-6.12] drm: rz-du: Ensure correct suspend/resume ordering with VSP Sasha Levin
2026-08-31 13:21 ` [PATCH AUTOSEL 6.18] pinctrl: renesas: rzg2l: Add SR register cache for PM suspend/resume Sasha Levin
2026-08-31 13:23 ` [PATCH AUTOSEL 6.18] drm: renesas: rzg2l_mipi_dsi: Fix deassert/assert of CMN_RSTB signal Sasha Levin
2026-08-31 13:25 ` [PATCH AUTOSEL 6.18] rtc: renesas-rtca3: Check RADJ poll result during initial setup Sasha Levin
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:28 ` [PATCH AUTOSEL 6.18-6.12] pinctrl: renesas: rzg2l: Handle RZ/V2H(P) IOLH configuration in PM cache Sasha Levin
2026-08-31 13:29 ` [PATCH AUTOSEL 6.18-6.1] pinctrl: renesas: rzv2m: Use -ENOTSUPP instead of -EOPNOTSUPP Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox