Skip to content

drm/apple, usb: Type-C route and USB4 link-recovery follow-ups (#3040, #3109 reviews) - #3540

Open
RyanTheTide wants to merge 2 commits into
mainfrom
fix/typec-route-link-followups-20261129
Open

RyanTheTide wants to merge 2 commits into
mainfrom
fix/typec-route-link-followups-20261129

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

What: Follow-ups from the reviews of #3040 and #3109. Routes with disabled suppliers stay refused. The OF changeset bookkeeping is released after permanent route disables, and repeated disables are skipped before allocation. The active USB4 PIPE backend is modelled before host shutdown, and the Type-C shutdown comment is corrected. Automatic USB4 link-lost recovery gets a per-port rate limit of three port cycles per minute, which domain rebuilds and briefly seen peers do not refill. The consecutive budget still refills on discovery.

Tested: Build and host tests only, no Mac row yet. Rebased onto main 8973cea, keeping main's revert-before-destroy ordering in the route-supplier test. The three touched arm64 objects build. Topology KUnit passes 8/8. ATCPHY host checks pass 39 and reject 66/66 mutations, including main's newer control. The link-lost checks pass and both negative controls are rejected. Strict checkpatch is clean on both commits.

Risk: two-way · USB-C/USB4 display routes and link recovery on every Mac with ATC ports.

Not yet: a row at head on one USB4 Mac (J616s or J713): DP-alt plug/unplug plus a flapping-peer recovery check. A regression Mac is also owed. It merges cleanly with #3530, which touches the same test file.

Evidence

Source item: M2MINI-USBC-FULL.md:178 (#3040 review nits of 11-24 17:17, #3109 review nit 2).

Release the OF changeset bookkeeping after permanent route disables and
skip repeated disables before allocation. Cover both node reference
balance and repeated refusal in the topology KUnit suite. The installed
properties remain owned by OF.

Model the active USB4 PIPE backend before host shutdown and exercise mux
disconnect on each supported PHY sequence. Correct the Type-C shutdown
comment to describe PIPE parking and mux ownership.

Keep discovery-based refill of the consecutive link-lost budget, but bound
automatic recovery with a separate per-port rate limiter: three cycles per
one-minute window. Domain reconstruction and a briefly discovered peer
must not refill that limit.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
An idempotent disable can return NULL when another refusal already
disabled the route. Keep that distinct from an available supplier: the
route must still be skipped. Cover a repeated supplier refusal in KUnit.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide
RyanTheTide requested review from a team and DjDeveloperr as code owners November 28, 2026 13:39

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: FINISH, then merge at 3130666e

Blockers:

  1. Hosted CI at 3130666e (21 jobs: kunit, apple-build, host-tests, pr-text, readiness, KUnit suites) is currently QUEUED; wait for green CI.
  2. Missing exact-head hardware rows (J616s or J713 USB4 DP-alt plug/unplug + flapping-peer recovery check plus one regression Mac; noted as queued in Not yet:).

Checked: no Apple material, no AI attribution, human DCO Signed-off-by on both commits, no chip/board/firmware gates, no new parameters, full diff (+104/-15 across dcp-fabric.c, dcp-fabric-topology-test.c, drivers/thunderbolt/apple.c, drivers/usb/typec/tipd/core.c, tools/asahi/atc-usb3-tests.py) verified, dcp_typec_routes_disable_nodes() skips allocation when already disabled and dcp_typec_routes_disable_free() releases changeset bookkeeping without leaking device_node krefs (proved by topology_route_disable_cleanup_test), dcp_typec_route_skip() returns cs ?: ERR_PTR(-ENODEV) so concurrent disables still skip the route, apple_cio.link_lost_limit (3 cycles per 60 * HZ) survives domain rebuilds and brief peer discoveries, atc-usb3-tests.py covers T8103/T8122/T8132 PIPE parking and mux disconnect with 2 new mutations (39 checks + 66/66 mutations killed), 8/8 topology KUnit + arm64 object builds + checkpatch --strict clean, PR body has Tested: and Risk: two-way, branch is MERGEABLE against main.

Evidence
  • drivers/gpu/drm/apple/dcp-fabric.c & dcp-fabric-topology-test.c (3130666ed1):
    • dcp_typec_routes_disable_nodes() checks route ? !of_device_is_available(route) : !dcp_typec_routes_available(routes) before kzalloc_obj(*cs).
    • dcp_typec_routes_disable_free() calls of_changeset_destroy(cs); kfree(cs); on non-ERR/non-NULL changesets; topology_route_disable_cleanup_test() checks kref_read(&route_np->kobj.kref) stays unchanged and repeated disables keep the exact status property pointer.
  • drivers/thunderbolt/apple.c (b08e1731ec): initializes acio->link_lost_limit in apple_cio_probe() with APPLE_CIO_LINK_LOST_INTERVAL (60 * HZ) / APPLE_CIO_LINK_LOST_CYCLES (3) and gates automatic link-lost restarts with __ratelimit(&acio->link_lost_limit) before incrementing link_lost_cycles or setting link_lost_restart.
  • drivers/usb/typec/tipd/core.c & tools/asahi/atc-usb3-tests.py: updates shutdown ordering comment and extends host tests to T8122 + usb4-stop-skips-pipe-park / cio-mux-disconnect-keeps-lanes mutations.
  • Code is clean; ready to approve and merge once CI is green and the queued hardware rows pass at 3130666e.

@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) area:usb Area from CODEOWNERS (bot) blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Merge readiness at 3130666e: ready to merge

Check Detail
CI at head ok 20 checks passed
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok comment at 3130666e
Conflicts ok none
PR text ok Risk: two-way · USB-C/USB4 display routes and link recovery on every Mac with ATC ports.

Areas: area:display, area:gpu, area:usb
Merge: gh pr merge 3540 --merge (Owners and Core through the bypass: add --admin).

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: MERGE at 3130666ed186

Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.

Checked: no Apple material, no AI attribution, human DCO Signed-off-by on both commits, no chip/board/firmware gates, no new parameters, full diff (+104/-15 across dcp-fabric.c, dcp-fabric-topology-test.c, drivers/thunderbolt/apple.c, drivers/usb/typec/tipd/core.c, tools/asahi/atc-usb3-tests.py) verified, dcp_typec_routes_disable_nodes() skips allocation when already disabled and dcp_typec_routes_disable_free() releases changeset bookkeeping without leaking device_node krefs (proved by topology_route_disable_cleanup_test), dcp_typec_route_skip() returns cs ?: ERR_PTR(-ENODEV) so concurrent disables still skip the route, apple_cio.link_lost_limit (3 cycles per 60 * HZ) survives domain rebuilds and brief peer discoveries, atc-usb3-tests.py covers T8103/T8122/T8132 PIPE parking and mux disconnect with 2 new mutations (39 checks + 66/66 mutations killed), 8/8 topology KUnit + arm64 object builds + checkpatch --strict clean, PR body has Tested: and Risk: two-way, branch is MERGEABLE against main.

Follow-ups (not blocking): queued CI; J616s/J713 USB4 DP-alt + flapping-peer row

@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Dec 1, 2026

@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.

Correct. The changeset is now freed in every caller. Destroying an applied changeset leaves its properties in the live tree, and the new KUnit case checks that, with refs unchanged. A repeated refusal returns before allocating. The link-lost rate limit can't be refilled by discovery.

Small optional nit: __ratelimit() prints "callbacks suppressed" when the window ends. ratelimit_set_flags(&acio->link_lost_limit, RATELIMIT_MSG_ON_RELEASE) after init keeps that quiet next to your own warning.

Left before merge: the cancelled KUnit jobs (I re-ran them), and the rows. This touches shared Type-C/USB4 code, so it needs two generations: DP-alt plug/unplug plus a flapping-peer check. I've queued J773g and J714s.

@github-actions github-actions Bot removed ci-failing A check failed at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 2, 2026
@DjDeveloperr

DjDeveloperr commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

J773g (M4 mini, T8132, 27.2) 3130666ed186 PASS — regression row only (7.3.0-j773g-comp5 on main b47fc630, boot_id=3a101384-2cfc-4aa6-835b-6d4f9a3692b5): DP-3 (3840x2160) DP-alt active at boot on USB-C Back Right (0x0f010100/0x546005e3), 5/5 software DRM off->detect cycles (not physical Type-C unplug) restored connected/enabled/On 3840x2160 (max 6 ms), USB 3-1 (05e3:0f01) 3/3 deauth/auth OK; initial s2idle pass was 0/3 (/dev/rtc0 lacks wakeup) and /dev/rtc1 rerun completed 3/3 s2idle cycles with 05e3:0f01 re-enumerated 3-1 -> 2-1 (POST_SLEEP_USB_MATCH=0, xHCI usb2/usb3 root-hub bus renumbering on resume); flapping-peer USB4 link-lost check did not run; 0 route-supplier/USB4/tipd/PIPE/link-recovery errors, 0 WARN/Oops/DART faults, 0 failed units.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-hw-row No hardware row at the PR head (bot) ready-to-merge Meets the merge policy: merge it (bot) labels Dec 2, 2026

This branch has not been deployed

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

Labels

area:display Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) area:usb Area from CODEOWNERS (bot) blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants