Skip to content

PCI: apple: T6050: follow the boot loader's link speed, so the J775D's 10 Gb Ethernet keeps 16 GT/s - #2759

Open
funkzy wants to merge 2 commits into
aurora-silicon:integration/aurorafrom
funkzy:track-c/t6050-adopt-target-speed
Open

funkzy wants to merge 2 commits into
aurora-silicon:integration/aurorafrom
funkzy:track-c/t6050-adopt-target-speed

Conversation

@funkzy

@funkzy funkzy commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The T6050 host fixes every link at 8 GT/s in two places:

  • apple_pcie_adopt_link() refuses a boot-trained link faster than 8 GT/s (-ENOLINK). The J775D's port 2 bridge sets no maximum-link-speed, and its RTL8127A supports 16 GT/s. Once the boot loader trains that port at 16 GT/s (aura#444), the Mac Studio would lose its only wired network.
  • apple_pcie_t6050_port_configure() writes 8 GT/s whenever Linux trains a port itself: the N1's root-port reset, a port the boot loader left down (the J714c's N1, the J714s and K116s SD reader), and the laptops' resume. The SD reader's ADT bridge gives 5 GT/s, so Linux and the boot loader target different speeds there.

Why this shape

Before this series the link-speed policy lived in three places that could disagree: Aura's fixed 8 GT/s target, Linux's fixed 8 GT/s ceiling on adoption, and Linux's fixed 8 GT/s in apple_pcie_t6050_port_configure(). Raising those constants, or adding an exception for the J775D or for port 2, would fix this NIC and leave the next port with a different speed wrong in a new way: the SD reader, which the ADT gives 5 GT/s.

Instead, the machine's own description, the ADT, is the one source. Aura applies it and publishes it as the standard max-link-speed on each root port node. Linux trains by that property, as the driver already does for the T8140, and on adoption accepts what the boot loader set. The change adds no board, port or chip check: the speed comes from the ADT and the root port's capability registers. Ports whose ADT gives 8 GT/s stay at 8 GT/s, port 2 gets 16 GT/s, and port 1 would get 5 GT/s.

The two sides depend on each other in one direction. This PR keeps today's behaviour under an older boot loader. An aura#444 boot loader under a kernel without this PR's first commit loses the J775D's wired network: the kernel refuses port 2's 16 GT/s link. So this PR lands first, and the aura#444 release waits until the shipped kernel has it.

Change

  1. Adopt up to the boot loader's target. The adoption ceiling is now the root port's own Target Link Speed (LNKCTL2). A link can't train above its root port's target, so every link adopted today (8 GT/s or less) is still adopted. A link above 8 GT/s that was refused before is now adopted wherever the boot loader left the target higher. Today that is only an aura#444 boot loader.
  2. Train at the DT's max-link-speed. port_configure() takes the target from the root port node's standard max-link-speed, as the T8140 path already does with of_pci_get_max_link_speed(). Without the property it stays at 8 GT/s, so nothing changes until the tree carries one. The boot loader fills the property in from the ADT (aura#444, its second commit). A speed above the root port's fastest is lowered to it, as the boot loader lowers its own target, so a hand-written property can't stop a retrain.

Both commits are safe with today's boot loader: it targets 8 GT/s and writes no max-link-speed, so behaviour is unchanged until the aura PR lands.

port target before target with both PRs
N1 (port 0) 8 GT/s 8 GT/s (ADT 3)
SD reader (port 1, Linux-trained on J714s/K116s) 8 GT/s 5 GT/s (ADT 1, child 2). The link speed is not expected to change: the GL9755 supports at most 5 GT/s, and on the J775D (with aura#163) it linked at 5 GT/s x1 under an 8 GT/s target.
J775D 10 Gb Ethernet (port 2) 8 GT/s the root port's fastest (published as 4, 16 GT/s)
USB-A controller (port 3) 8 GT/s 8 GT/s (ADT 3)

Testing

J775D (Mac Studio, M5 Ultra), on this PR's base (integration/aurora b8c5bb0) plus these two commits only. Three one-shot boots on 2026-11-21:

  • baseline: the base alone, with today's boot loader (Aura main 7d8e91f8);
  • this PR alone: the base plus these commits, with the same boot loader;
  • with both PRs: the same kernel, with the boot loader from aura#444 (Aura main plus its two commits).
port endpoint baseline this PR alone with both PRs
0 N1 Wi-Fi/Bluetooth 8 GT/s x1 8 GT/s x1 8 GT/s x1
2 RTL8127A 10 Gb Ethernet 8 GT/s x1 8 GT/s x1 16 GT/s x1
3 ASM3142 USB-A 8 GT/s x1 8 GT/s x1 8 GT/s x1
  • This PR alone behaves as the baseline: every root port targets 8 GT/s, the tree has no max-link-speed, all three ports are adopted, the N1's root-port reset retrains it at 8 GT/s x1, and r8169 linked at 1000/full with 0 errors and 20/20 pings. It has no kernel line the baseline lacks.
  • With both PRs, port 2 was adopted at 16 GT/s x1. Its root port shows equalization complete, its error status and the AER counters are clear, and r8169 linked at 1000/full on a gigabit switch with 0 errors and 20/20 pings, as on the baseline.
  • With both PRs, the boot loader published max-link-speed 3, 4 and 3 on ports 0, 2 and 3. The N1's root-port reset, which goes through port_configure(), retrained it at the published 8 GT/s x1 (target 8 GT/s).
  • Regression against the baseline boot, for both of the other boots: no new kernel line (dmesg's error, failure, warning and timeout lines compared with timestamps stripped), and no WARNING, BUG or Oops. The baseline had one line neither of them had, usb 3-1: device not accepting address 2, error -108, from the Type-C xHCIs' start-up teardown, which comes and goes between boots. The same two units failed on all three boots: systemd-networkd-persistent-storage.service (the test boots use a read-only root) and iwd.service. None has a desktop, because the J775D's GPU support (arm64: dts: apple: t6050-j775d: Give the Mac Studio (M5 Ultra) a working GPU, and its M and P core capacities (754/1024) to the scheduler #1973) isn't in this base yet. ALARM has no SELinux, so there are no AVC lines to report.
  • s2idle can't be shown on this base: integration/aurora doesn't yet keep adopted links across s2idle on the J775D (PCI: apple: keep adopted links across s2idle on every adopted host #2488 does). Tried anyway with both PRs: each of three RTC-armed attempts stopped before sleeping (apple_pcie_suspend_noirq returns -16). After each, port 2 was still at 16 GT/s x1, with AER at 0 and 10/10 pings.
  • checkpatch.pl --strict: clean on both commits. The kit built with 0 warnings.
Extra evidence from our daily test kit (not this PR's row)

On integration/aurora cc14570 plus about 20 open PRs, including #2488 and #2557, which change this file's s2idle handling, and an earlier revision of these commits (the same speed logic):

  • Commit 1 alone: 2 boots, port 2 at 16 GT/s x1, ports 0 and 3 at 8 GT/s x1.
  • Both commits: the N1's root-port reset retrained it at the published 8 GT/s x1.
  • 3 RTC-woken s2idle cycles, each asleep for 9.5-9.9 s. After each, port 2 was still at 16 GT/s x1 (adopted links are kept across s2idle, not retrained), the AER counters stayed 0, and 10/10 pings got through. This row depends on PCI: apple: keep adopted links across s2idle on every adopted host #2488 and PCI: apple: keep a boot-trained adopted link in D0 through suspend #2557. r8169 takes its own Ethernet link down and up around each sleep, and counted 1 transmit error and 3 drops while the carrier was down. That matches the 8 GT/s baseline, where one of seven soak rounds ended with the same one transmit error.
  • Kernel errors against the same kit without these commits: the new lines were all USB, usb 5-1: device descriptor read/all, error -108 on one boot, and usb 5-1: device not accepting address 2, error -108 plus two usb 3-1: device descriptor read/64, error -110 on the other. They come from the Type-C xHCIs being torn down and re-added in the first seconds, and the same lines are in 2 of the 7 soak boots of that kit without this change.

Still to run

  • Throughput at 10 Gb/s against a 10 GbE peer (the test switch port is gigabit).
  • J714s, K116s (owners): the SD reader should train at 5 GT/s x1, targeted at 5 GT/s, with both PRs in. With only this PR it should be unchanged. A row would be welcome: lspci -vv link status and target link speed of the reader's root port, cat /proc/device-tree/.../pci@1,0/max-link-speed | od -tu4 --endian=big, and dmesg | grep -iE 'aer|pcie'.
  • J714s, J716c, J714c (owners): the N1 should still be adopted, or trained, at 8 GT/s x1.

Assisted-by: LLM (Claude:Opus 5.5)

…5D's 10 Gb Ethernet keeps 16 GT/s

apple_pcie_adopt_link() refuses a boot-trained link faster than 8 GT/s
(-ENOLINK). The boot loader sets each GP port's Target Link Speed from
the port's ADT bridge: "maximum-link-speed" 3 (8 GT/s) on the N1 and the
USB-A controller, and nothing on the J775D's port 2, whose RTL8127A
supports 16 GT/s. Once the boot loader trains that port at 16 GT/s, the
fixed ceiling would refuse the J775D's only wired network.

Use the root port's own Target Link Speed (LNKCTL2) as the ceiling, so
a link is adopted at up to the speed the boot loader asked for. A link
does not train above its root port's target, so every link adopted
today (8 GT/s or less) still is.

Reach: the T6050 hosts with adopt_link. Only the check changes, and
nothing new is written. A link above 8 GT/s that was refused before is
now adopted wherever the boot loader left the target higher; today that
is only a boot loader with "pcie_t6050: train each GP port at the speed
its ADT bridge allows".

Tested on the J775D (Mac Studio, M5 Ultra), with the boot loader
setting the target from the ADT (aura: "pcie_t6050: train each GP port
at the speed its ADT bridge allows"), on two boots: port 2 was adopted
at 16 GT/s x1, and ports 0 and 3 at 8 GT/s x1 as before.

Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
…trained link targets the speed the ADT gives it

apple_pcie_t6050_port_configure() writes Target Link Speed 8 GT/s
whenever Linux trains a T6050 port itself: the N1's root-port reset, a
port the boot loader left down (the J714c's N1, the J714s and K116s SD
reader), and the laptops' resume. The boot loader trains its ports at
the speed the port's ADT bridge gives, so the two could differ: the SD
reader's bridge gives 5 GT/s ("maximum-link-speed" 1, its child's
"expected-link-speed" 2), and Linux targeted 8 GT/s.

Take the target from the root port node's "max-link-speed", which the
boot loader fills in from the ADT (aura: "pcie_t6050: publish each GP
port's link speed as max-link-speed"), as the T8140 path already does
with of_pci_get_max_link_speed(). Without the property the target stays
8 GT/s, so nothing changes until the tree carries it. A speed above the
root port's fastest is lowered to it, as the boot loader lowers its own
target, so a hand-written property cannot stop a retrain.

What each port gets with both changes: the N1 3 (8 GT/s, as before),
the J775D's 10 Gb Ethernet 4, the USB-A controller 3, the SD reader 2
(5 GT/s, where it was 8). The reader's link speed is not expected to
change: the GL9755 supports at most 5 GT/s, and on the J775D, with
aura#163 bringing the port up, it linked at 5 GT/s x1 under an 8 GT/s
target.

Tested on the J775D (Mac Studio, M5 Ultra): the N1's root-port reset
trains it again at the published 8 GT/s x1.

Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Reviewed together with aura#444. The two sides agree: Aura sets each root port's Target Link Speed from the ADT bridge and publishes the same value as max-link-speed, and this PR adopts up to that target and retrains at that property. There is no board or port check, and the value comes from DT, as on the T8140 path.

  • drivers/pci/controller/pcie-apple.c:2052-2055: using the root port's LNKCTL2 TLS as the adoption ceiling is correct (CLS and TLS share the encoding, and a link cannot train above its root port's target). Under today's boot loader the ceiling stays at 3, so nothing changes.
  • pcie-apple.c:2327, 2346-2353: of_pci_get_max_link_speed() in this tree does not range-check, but the code is still safe. A missing, zero or negative value falls back to 8 GT/s, and a value above LNKCAP2's fastest is lowered before BIT(speed) is tested.
  • The per-PR rows (baseline, this PR alone, both PRs) on the J775D at this base are what's needed. The release-ordering note in the description (this PR before any Aura release carrying aura#444) should go into the Aura release notes too.

No changes requested. The remaining rows are the owner rows you list: the J714s/K116s SD reader trained by Linux at 5 GT/s, and the N1 at 8 GT/s on J714s/J716c/J714c.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adversarial review at 408f43b0240c against the pre-PR checklist.

0 code/policy/attribution/CI blockers. Holding only for the remaining §5 hardware test rows on other T6050 machines before approval.

Verified

  • §1 (No model gating & chicken-and-egg): Zero board/chip/port gates. Speeds derive purely from root-port capability/control registers and the standard DT max-link-speed property, with an 8 GT/s fallback when absent so this PR lands safely ahead of aura#444 with zero behavior change under older Aura.
  • §2–§3 (Code correctness & safety):
    • ef2eb6b7aa59: PCI_EXP_LNKSTA_CLS and PCI_EXP_LNKCTL2_TLS share encoding; tls == 0 fails closed (-ENOLINK), an all-1s read fails on NLW/LT, and T6050 RP (0x100c106b) always has PCIe cap v2.
    • 408f43b0240c: of_pci_get_max_link_speed() returning < 0 or 0 safely falls back to PCI_EXP_LNKCTL2_TLS_8_0GT; masking LNKCAP2 with PCI_EXP_LNKCAP2_SLS (0xfe) bounds top = __fls(sls) to 1..=7, so clamping speed > top guarantees BIT(speed) has no shift UB and fits cleanly inside PCI_EXP_LNKCTL2_TLS; RC_T6050_DBI_RO_WR_EN is still cleared on error paths.
  • §4 (Clean-room & attribution): Clean. Both commits carry human author/committer (Jeff Queisser) + Signed-off-by: only, zero AI trailers in commits, Assisted-by: in PR body.
  • §6 (Naming) & CI: Clean; host-tests and kunit both passed on 408f43b0240c. J775D baseline / PR-alone / PR+aura#444 matrix and regression comparison are thorough.

Remaining §5 hardware rows needed for approval

J775D exercises commit 1's 16 GT/s adoption path, but its apple_pcie_t6050_port_configure() retrain (N1, port 0) only exercises max-link-speed = 3 (8 GT/s). Before merge/approval, please collect the remaining T6050 owner rows already listed in the PR:

  • J714s / K116s (port 1 SD reader): verify Linux-trained port_configure() targets and links at 5 GT/s x1 (max-link-speed = 2) with both PRs, and is unchanged with this PR alone (this exercises the non-8-GT/s path of commit 2).
  • J714s / J716c / J714c (port 0 N1): verify N1 continues to adopt/train at 8 GT/s x1.

Assisted-by: LLM (Gemini 4 Neon)

@funkzy

funkzy commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

@DjDeveloperr (J714s) and @erikwb (J716c), could you run the two rows this PR still needs on your machines? We only have the J775D. One boot at this head each is enough:

  • J714s, port 1 SD reader: with this PR and aura#444, lspci -vv shows the reader linked at 5 GT/s x1; with this PR alone, unchanged from today. This is the one port that publishes a speed other than 8 GT/s, so it's the row that exercises the second commit.
  • J714s or J716c, port 0 (Wi-Fi/Bluetooth): still links at 8 GT/s x1, with and without aura#444.

Assisted-by: LLM (Claude:Opus 5.5)

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.

3 participants