Skip to content

drm/apple: pass a Type-C sink's IRQ_HPD to the firmware's DPTX port, so a link the sink lost is trained again as a DP source does - #2879

Merged
RyanTheTide merged 1 commit into
aurora-silicon:mainfrom
funkzy:pr/dcp-irqhpd-firmware
Dec 1, 2026

Conversation

@funkzy

@funkzy funkzy commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

What: Pass a connected Type-C DisplayPort sink's IRQ_HPD to the firmware's DPTX port via dcp_dptx_sink_irq() instead of replaying the active mode (which does not retrain the link on firmware 27 when timing is unchanged, per our tests), replacing #2604.
Tested: J775D (Mac Studio, M5 Ultra) at a2876837de69 on bare main (859e8a29796c) under published Aura 7bf44a63 on 27.2 firmware: live USB-C DP IRQ_HPD passed silently at dev_dbg, the firmware accepted the hand-off and the link recovered to 1920x1080@75, 0 subsequent IRQ_HPD during 25 s wait, 0 DCP crashes/recoveries, 0 new failed units, 0 new kernel errors. apple-dcp selftest (--group quiesce): 21/21 pass (connected-irq-hpd-to-firmware and dcp-sink-irq-fallback).
Risk: Two-way door · affects every non-H17P DCP pipe behind a Type-C port when a connected sink raises IRQ_HPD; H17P keeps mode replay, and a firmware refusal falls back to disconnect + connect.
Not yet: M1/M2-generation and M4 USB-C DP rows confirming those firmwares accept call 8 on the alt-mode path without hitting the disconnect + connect fallback.

Details

Why this shape

  • Where it lived. A sink raises IRQ_HPD with HPD held high to ask the source to read its status over AUX (lost link lock, downstream branch change, HDCP, MCCS, or test request). Only the firmware's DPTX port has AUX, and the driver already passes IRQ_HPD to it in two places: dcp_external_sink_irq() for T6030 external processors and dcp_tb_event_work() for USB4 tunnels. The alt-mode path was the one copy that answered with dcp_retrain_oob() (a mode replay that only retrains where a same-mode set resets the link).
  • The narrower alternatives. A firmware-27 gate on a CRTC power cycle, or #2604's repeat-within-30-s heuristic with a power-cycle budget of two, each key on timing instead of the sink's own status and can blank a healthy display on non-link IRQ_HPD requests.
  • The one source used. Generalize dcp_external_sink_irq() to dcp_dptx_sink_irq() and use that same DPTX sink-IRQ call on all three paths. Whether the link retrains is left to the firmware's DPTX port once it has the sink's request; if the firmware cannot accept the request, dcp_dptx_sink_irq() logs at dev_info() and falls back to disconnect + connect, as the T6030 path already did.
  • Scope across boards. Applies to every non-H17P DCP pipe behind a Type-C port on every firmware with no chip, board, or firmware version gate; H17P keeps mode replay, and firmware-disconnected recovery (dcp_dptx_recover_irq()) and active relinks (dcp_typec_sink_relink()) are unchanged.

Change

One commit (a2876837de69) on main (859e8a29796c):

  • Rename dcp_external_sink_irq() to dcp_dptx_sink_irq() in drivers/gpu/drm/apple/dcp.{c,h} and call it for connected Type-C sinks in dcp-fabric.c instead of dcp_retrain_oob().
  • Log passed IRQ_HPD hand-offs at dev_dbg() so repeated sink requests do not spam the kernel log, while keeping dev_info() on the reconnect fallback path.
  • Extend tools/testing/selftests/drivers/gpu/apple-dcp/transaction.py with connected-irq-hpd-to-firmware (verifying one hand-off and no replay) and dcp-sink-irq-fallback (exercising production dcp_dptx_sink_irq() directly for pass-through, -EOPNOTSUPP reconnect fallback, disconnect-error stop, and early guards when unavailable or disconnected).
Evidence

Testing

Own-base row on J775D (Mac Studio, M5 Ultra): kit pr2879-2 (window pr2866-2879@20261126-0836) is bare main 859e8a29796c plus a2876837de69 (no other PRs carried), booted one-shot with a read-only root on the default J775D command line through the 27.2 stub under published Aura aura-main-7bf44a63 (7bf44a63), dead-man armed, temperature guard active:

  • Live IRQ_HPD recovery: at t = 11.779 s the USB-C DisplayPort monitor raised IRQ_HPD (sn201202x 1-08: DP partner raised IRQ_HPD). dcp_dptx_sink_irq() passed it silently at dev_dbg (no dev_info log spam, no reconnect fallback). After the hand-off, the link dropped and the driver relinked the Type-C sink (1/3) 81 ms later, bringing the DisplayPort monitor up cleanly at t = 14.671 s (1920x1080@75). Zero further IRQ_HPD events occurred during the subsequent 25 s wait.
  • HDMI and DCP stability: card0-HDMI-A-1 stayed connected and active (1920x1080) throughout; 0 DCP crashes or recoveries.
  • Regression check: 2 baseline read-only-root failed units (iwd.service, systemd-networkd-persistent-storage.service), 0 new. ALARM has no SELinux, so there is no AVC count. 8 kernel error lines, all baseline on main under 27.2 (speakers safety, 3 lines from 27.2 GPU firmware without #2866, hid-generic, 3 lines of DCP undeclared provider clock index 0); 0 new kernel errors.
  • Selftests: python3 tools/testing/selftests/drivers/gpu/apple-dcp/transaction.py --group quiesce: 21/21 pass, including connected-irq-hpd-to-firmware and dcp-sink-irq-fallback.

Thanks to Ryan Murray and dj for their reviews of #2604 and the earlier draft of this PR.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Review at 8945af3 (non-author, draft). No blocker in the code; the scope needs rows on more than the J775D, and one log point.

  • Using the one existing mechanism (the DPTX port's sink IRQ call, as the USB4 tunnel and T6030 paths do) instead of a mode replay is the right shape, and it removes drm/apple: train a Type-C display link again when the sink repeats IRQ_HPD, so a display that trained blank gets its picture #2604's timing window and power-cycle budget. H17P, a firmware-disconnected sink (dcp_dptx_recover_irq()) and a running relink are unchanged.
  • dcp_dptx_sink_irq() returns early with no service, an unavailable service or no link up, and falls back to disconnect + connect when the call fails, so a firmware that refuses the call still gets the link trained.
  • The new transaction case counts exactly one hand-off per IRQ_HPD and no replay; it fails on the old routing.
  • Merges cleanly on the current integration/aurora tip.

Points to consider:

  • Scope: this changes every non-H17P DCP pipe behind a Type-C port, including the M1/M2-generation and M4 pipes on their firmware, where the call has not been exercised on the alt-mode path. If any of those firmwares does not take call 8 on this port, every IRQ_HPD (HDCP, MCCS, a branch device change) becomes a disconnect + connect, i.e. a visible blank, where today it is a no-op replay. A row with a USB-C DP monitor on one M1/M2 Mac and one M4 Mac (IRQ_HPD logged as passed, not reconnected) would cover that; a transaction case for the fallback path would pin it too.
  • dev_info() on every IRQ_HPD: the sink here raised one about every 19 s, so a sink that keeps asking would fill the log. dev_dbg() for the passed case (keeping dev_info() for the reconnect fallback) or dev_info_ratelimited() would avoid that.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

@funkzy checking open drafts today. To come out of draft, this still needs:

  • A test run at the current head on a Mac with the hardware it touches, then mark it ready for review.

If it's no longer needed, say so here and we'll close it. Otherwise it stays open as a draft until these are done.

…so a link the sink lost is trained again as a DP source does

On the M5 Ultra Mac Studio (J775D), a DisplayPort monitor on a USB-C
port can come up with a signal and no picture: link training at boot
reports errors, the mode set completes with the link reported up, and
the sink then raises IRQ_HPD about every 19 s. Each request reached
dcp_retrain_oob(), which applies the active mode again. On firmware 27
a mode set of an unchanged timing leaves the link as it is, so the
display stayed blank until userspace set another mode.

A sink raises IRQ_HPD to ask the source to read its status: its link
lost lock, a display behind a branch device changed, or for HDCP, MCCS
or a test request. Only the firmware's DPTX port can read that status,
over AUX. The driver already passes the request to it for a T6030
external processor (dcp_external_sink_irq()) and for a USB4 tunnel
(dcp_tb_event_work()).

The connected Type-C path now does the same: dcp_external_sink_irq()
becomes dcp_dptx_sink_irq(), for every connected DPTX link, and the
alt-mode IRQ_HPD calls it instead of applying the mode again. Passing
the request logs at dev_dbg() so repeated sink requests do not fill the
kernel log; if the firmware cannot take the request, the driver logs at
dev_info() and connects the display link anew, as before for T6030.
H17P keeps applying the mode again; a sink the firmware disconnected
and a running relink are unchanged.

The apple-dcp transaction selftest stubs dcp_dptx_sink_irq() in the
route-set scenario (verifying a connected sink's IRQ_HPD reaches it
once, with no replay) and runs production dcp_dptx_sink_irq() directly
to verify pass-through, reconnect fallback on firmware error, stop on
disconnect error, and early return when disconnected or unavailable.

Signed-off-by: Jeff Queisser <[email protected]>
@funkzy
funkzy force-pushed the pr/dcp-irqhpd-firmware branch from 8945af3 to a287683 Compare November 26, 2026 17:12
@funkzy
funkzy marked this pull request as ready for review November 26, 2026 17:12
@funkzy
funkzy requested review from a team as code owners November 26, 2026 17:12
@funkzy
funkzy requested review from LiamRay11 and maralcbr November 26, 2026 17:12
@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Merge readiness at a2876837: not ready yet

Check Detail
CI at head ok 20 checks passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok in the PR body at a2876837
Conflicts ok none
PR text ok Risk: two-way · affects every non-H17P DCP pipe behind a Type-C port when a connected sink raises IRQHPD; H17P keeps mode replay, and a firmware refusal falls back to disconnect + connect.

Areas: area:display

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

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

Verdict at a2876837: code OK; merge after one more generation's row.

Checked

  • The alt-mode IRQ_HPD path now goes to the firmware's DPTX port (dcp_dptx_sink_irq()), like the T6030 external and USB4 tunnel paths already do, instead of replaying the mode.
  • A sink the firmware disconnected is recovered through dcp_dptx_recover_irq(). The H17P mode-replay branch was already there, so this adds no new gate.
  • 21/21 quiesce host tests (including the fallback case), CI 20/20, and your J775D (M5 Ultra) row.

Owed: this changes the shared path for every non-H17P USB-C DP pipe, and your "Not yet" lists M1/M2/M4. We'll post rows from our M2 (J473, USB-C to a monitor) and M4 Pro (J616s) at this head. If either firmware refuses the DPTX call, the disconnect + connect fallback shows up there. Then approve + merge.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merge-train review at a2876837: Verdict: merge after rows + CI. Checked: IRQ_HPD on a connected Type-C DPTX link now goes to the firmware's DPTX port (dptxport_sink_irq()) on every non-H17P path, instead of only on native external pipes, with dcp_retrain_oob() dropped for the connected-sink case. The failure path still connects the display anew, so a firmware that refuses the request degrades to the old full reconnect, and a disconnected sink still takes dcp_dptx_recover_irq(). The rename and the info->dbg log level change are fine. The behaviour changes on every Mac with Type-C DP, so I need rows on two families at this head: a monitor that raises IRQ_HPD without dropping HPD (input switch on the monitor, or an MST/branch dock with the downstream display unplugged and replugged). Check the picture comes back without a full reconnect and with no flip timeouts; one T8112/T8103 and one T60xx/T81x2 Mac. No blocking finding in the code.

@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 a287683 after hardware and CI

Checked connected IRQ_HPD routing to DPTX firmware and the reconnect fallback. The fixture covers success, fallback and disconnect failure. Keep two-family J473/J616s testing of IRQ_HPD while HPD stays high, including picture recovery and flip timeout checks.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging at a2876837de69 (B2 merge train, 12-01 merge bar). Approval at this head: aurora-silicon-review[bot]. Row: the hardware row at a287683 that the readiness check found (PR body or comment). CI: linux train L3 = main 429e7e1 + 28 approved PRs (candidate 45c2fa4b): Apple driver compile pass, Apple DTBs W=1 pass, planned KUnit dcp-fabric/dcp-topology/dcp-display/macsmc/spi-hid-apple/mt7932/asahi/sep pass; ave failed to build only because of #3153 (unused static helper under -Werror; #3153 held out) and passes with #3153 reverted from the candidate; host tests apple-dcp and apple-scaler-recovery pass. The rest of the hosted run is queued behind the backlog. Revert: git revert -m 1 <merge commit>.

@RyanTheTide
RyanTheTide merged commit 9cca203 into aurora-silicon:main Dec 1, 2026
29 of 42 checks passed
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) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants