Skip to content

PCI: apple: t6050: write the gen5 shadow tunables into the 32 GT/s bank - #2270

Closed
RyanTheTide wants to merge 1 commit into
integration/aurorafrom
isw/t6050-shadow-sel
Closed

RyanTheTide wants to merge 1 commit into
integration/aurorafrom
isw/t6050-shadow-sel

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1379.

apple_pcie_t6050_port_configure() picks each rate's shadow bank in GEN3_RELATED.RATE_SHADOW_SEL (bits 25:24) before it writes that rate's tunables. The table it used, { 0, BIT(24), 0 }, selected bank 0 again for apple,pcie-rc-gen5-shadow-tunables. The gen5 values overwrote the gen3 ones, and since the link trains at 8 GT/s, the bank in use ran with gen5's values.

Change. The loop writes FIELD_PREP(RC_T6050_RATE_SHADOW_SEL, i), so the gen3, gen4 and gen5 lists go to banks 0, 1 and 2. That is DesignWare's encoding: pcie-qcom-common.c writes speed - PCIE_SPEED_8_0GT into the same field. It also matches the J716s boot-loader trace cited in the issue (gen3 = 0, gen4 = 1, gen5 = 2). The field is left at 2, as the boot loader leaves it. Nothing else in the driver reads or depends on the field.

Reach. Every T6050 board whose DT carries the shadow tunables (J714s, K116s) runs this function at port configure, adopt and restart. No other SoC uses it.

Evidence.

  • checkpatch --strict: no code findings (only the no-tree commit-id warning and the trailer form).
  • Build: compiles with the fleet release config on 0abc2f3: 0 warnings, 0 errors. In the disassembly of apple_pcie_t6050_port_configure(), the third select now writes 2 (orr #0x2000000 after the field clear). Before, it wrote 0 again.
  • Hardware: not run, as we have no T6050 machine. A useful row from anyone with a J714s or K116s: lspci -vv -s <N1 root port> LnkSta and dmesg | grep -iE 'aer|pcie' before and after, plus a few minutes of Wi-Fi ping and throughput. The link should still train at 8 GT/s x1, with no new AER errors.

Reported by @RINNECODER in #1379, including the fix.

Assisted-by: LLM (Claude:Opus 5.5)

apple_pcie_t6050_port_configure() selects a rate's shadow bank in
GEN3_RELATED.RATE_SHADOW_SEL (bits 25:24) before it writes that rate's
tunables. The table it used, { 0, BIT(24), 0 }, selected bank 0 again
for the gen5 tunables. They overwrote the gen3 values, and the link
trains at 8 GT/s, so the bank in use ended up with gen5's values.

The field is DesignWare's: 0 selects the 8 GT/s bank, 1 the 16 GT/s
bank, 2 the 32 GT/s bank. pcie-qcom-common.c uses the same encoding
(speed - PCIE_SPEED_8_0GT). The J716s boot loader trace in the report
shows gen3 = 0, gen4 = 1, gen5 = 2, with the field left at 2.

Write the loop index into the field with FIELD_PREP(), which gives 0, 1
and 2 for the three tunable lists. The field is left at 2 as the boot
loader leaves it, and no other code here depends on its value.

Every T6050 board with these tunables in its DT is affected (J714s,
K116s). Nothing else uses this function.

Fixes: 847c749 ("PCI: apple: Add the T6050 port reset, enable, configure and train sequences")
Reported-by: RINNECODER <[email protected]>
Closes: #1379
Signed-off-by: Ryan Murray <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Blockers: 1.

  1. Commit 11ef087 ends with Co-Authored-By: Claude Opus 5.5 <[email protected]>. Commits must carry human identity only. Drop that trailer and keep Signed-off-by and Reported-by. The Assisted-by: line in the PR body already covers it. Push the corrected commit on a new branch.

The fix itself is correct. RC_T6050_RATE_SHADOW_SEL is GENMASK(25, 24) (drivers/pci/controller/pcie-apple.c:245), and the old { 0, BIT(24), 0 } table wrote bank 0 twice, so the gen5 list landed on top of the gen3 bank that the 8 GT/s link actually uses. FIELD_PREP(..., i) at :2323 gives 0, 1 and 2, which is DesignWare's encoding. Nothing after the loop (:2327-2340) reads GEN3_RELATED, so leaving the field at 2 is harmless. The base has not fixed this: integration/aurora still has the old table at :2312.

  1. The failed host-tests check is not this change. The job hit the 20-minute limit while pinning toolchains and never ran the tests. Re-run it once the commit is updated.

Even so, this changes the equalisation values on the only link the N1 uses, on every T6050 board with these tunables, and nobody has run it yet.

HW row: J714s or K116s, a kernel from this head, cold boot and one s2idle.

  • lspci -vv on the N1 root port shows LnkSta 8GT/s x1, with the same result before and after.
  • No new AER or pcie lines in dmesg.
  • Wi-Fi: 10 minutes of iperf3 with throughput no worse than the base, and 0 link retrains.
  • 0 AVC, 0 failed units, no new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Replaced by #2794: the same changes with the commit trailers fixed, on the current integration/aurora.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

t6050: gen5 PCIe shadow tunables are written into the gen3 bank (shadow_sel)

1 participant