Skip to content

PCI: apple: reset an endpoint that does not train (J616s SD reader flake) - #1069

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
conn/pcie-sd-link-retry
Nov 7, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
conn/pcie-sd-link-retry

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Problem

On the M4 Pro MacBook Pro (J616s) the SD reader (GL9755 behind pcie0 root port 1) is missing in about one boot in seven. The boot log shows pci@1,0 link didn't come up and the reader stays absent until the next reboot. In the J616s journal, 9 of the last 60 boots (fleet17, all warm reboots) had the error, and the reader was missing in exactly those boots. The M1 Pro, with the same reader, had 0 of 60.

Cause

On a good boot the link is already up about 100 ms after the first PERST# release. On a bad boot the endpoint is detected but sends no training sets, and the root port's LTSSM parks in Polling.Compliance (DesignWare PORT_DEBUG0 state 0x3). Neither the LTSSM start the driver already issues nor a Retrain Link from the root port (tried with setpci on a failed boot) brings it out.

Fix

When a conventional port with a single PERST# line does not report link-up within link_up_timeout, the driver now:

  1. stops the LTSSM;
  2. asserts PERST# again;
  3. releases it with the same timings as the first bring-up: Tperst of at least 100 us, then 100 ms before configuration (the ADT t-refclk-to-perst / perst-to-config values agree);
  4. starts the LTSSM again.

It does this at most twice. The intermediate failure is logged at info level, with the LTSSM state. Only a port that still doesn't train warns, as before. The completion is re-armed before the reset, so a link-up that arrives during the reset isn't lost. Tunneled ports keep their existing retry.

Testing (J616s, 11-07)

  • Before: fleet17, 9/60 boots without the reader. The restore boot right after the test loop hit it again; one more reboot brought the reader back.
  • After: 7.3.0-aurora-sdlink1 (fleet17 + this change), 25 one-shot reboots, reader present in 25/25. The first attempt failed in 4 of them (boots 10, 20, 21, 25). Each time the log shows link down after 500ms (LTSSM 0x3), resetting the endpoint, then link up after 15ms.
  • Recovered boots: sdhci-pci bound and mmc0 present, SELinux enforcing, 0 AVC, 0 failed units. The boot-log err/warn lines are the same 4 as on fleet17.
  • Build checks: W=1 shows 0 warnings in pcie-apple.o on integration 68db611b (fleet17 config) and on the fleet17 tree; checkpatch --strict is clean.
  • Not tested here: other Apple PCIe hosts. Their behaviour only changes when a port already fails to train.

🤖 Generated with Claude Code

On the M4 Pro MacBook Pro (J616s) the SD reader behind root port 1 is
missing after about one boot in seven: "pci@1,0 link didn't come up".
The endpoint is detected but sends no training sets after the first
PERST# release, and the LTSSM parks in Polling.Compliance (DesignWare
PORT_DEBUG0 state 0x3). Starting the LTSSM or a Retrain Link from the
root port does not bring it out; the reader stays absent until the next
boot.

When a conventional port with a single PERST# line does not report
link-up within link_up_timeout, stop the LTSSM, assert PERST# again and
release it with the timings of the first bring-up (Tperst of at least
100 us, 100 ms before configuration), then start the LTSSM once more.
Do this at most twice. The intermediate failure is logged at info level
with the LTSSM state; only a port that still does not train warns, as
before. Tunneled ports keep their existing retry.

On the J616s, the reader was absent in 9 of 60 boots before. With this
change it was present in 25 of 25 boots; the first training attempt
failed in 4 of them, and each time the link came up 15 ms after the
first reset retry.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
@RyanTheTide
RyanTheTide merged commit 068dfce into integration/aurora Nov 7, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the conn/pcie-sd-link-retry branch November 7, 2026 03:26
RyanTheTide added a commit that referenced this pull request Nov 7, 2026
Brings aurora-wip up to integration/aurora 068dfce: pcie-apple endpoint
reset retry (#1069) and the
tools/aurora-sep PKGBUILD checksum fix
(#1068).

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
RyanTheTide added a commit that referenced this pull request Nov 7, 2026
…61107b

aurora-wip <- integration/aurora 068dfce (#1068, #1069). Clean merge, W=1 pcie-apple.o 0 warnings on the merged tree, CI host-tests/rust-build/source pass. Merge train (MTR).
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.

1 participant