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

Draft
funkzy wants to merge 1 commit into
aurora-silicon:mainfrom
funkzy:pr/dcp-irqhpd-firmware
Draft

funkzy wants to merge 1 commit into
aurora-silicon:mainfrom
funkzy:pr/dcp-irqhpd-firmware

Conversation

@funkzy

@funkzy funkzy commented Nov 22, 2026

Copy link
Copy Markdown

Replaces #2604

#2604 power cycled the CRTC when a Type-C sink raised IRQ_HPD again within 30 s of a mode replay, at most twice per connection. That answered the repeated request rather than its cause: on the alt-mode path a connected sink's IRQ_HPD was answered by applying the active mode again, which firmware 27 leaves as it is when the timing is unchanged, and the request never reached the firmware's DPTX port, the only part that can read the sink's link status. This PR passes the request to the DPTX port instead, as the driver already does for a USB4 tunnel and for the T6030 external processors. It has no timing window, power-cycle budget or power-cycle accounting. The T6020 tunnel-count fix that #2604's last head carried is offered on its own (branch rr/dcp-tunnel-cycle-count), as it does not depend on this change.

This PR stays a draft until the A/B under Still to run has been done.

Problem

On the Mac Studio (M5 Ultra, J775D), a DisplayPort monitor on a USB-C port can come up with a signal and no picture, after boot or after a replug: 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 ends in dcp_retrain_oob(), and the hotplug worker applies the active mode again. On firmware 27 a mode set with an unchanged timing leaves the link as it is, so the screen stays blank until userspace sets another mode.

Why this shape

A sink raises IRQ_HPD with HPD held high to ask the source to read its status: a link that lost lock, a display behind a branch device that changed, an HDCP, MCCS or test request. The source reads the sink's status over AUX and acts on it. In this driver only the firmware's DPTX port has AUX, and the driver already hands it the request in two places: dcp_external_sink_irq() for the T6030 external processors and dcp_tb_event_work() for a USB4 tunnel. The alt-mode path was the one copy that answered with a mode replay, a stand-in that works only where a same-mode set retrains the link. The narrower alternatives each key on something other than the sink's status: a firmware-27 gate on a power cycle, or #2604's repeat-within-30-s heuristic with a budget of two. Here the one existing mechanism serves all three paths, so whether the link is trained again follows from the sink's own status rather than from a timing rule in the driver, and an IRQ_HPD for HDCP or MCCS never blanks the display. If the firmware cannot take the request, the link is connected anew, as the T6030 path already did. No AP-side training report singles out the blank link: the DPTX link faults at boot (22) also come on boots that train cleanly, the mode set reports the link up in both, and the one lane-count warning at boot is on the HDMI pipe, not the DisplayPort one.

Change

One commit in drivers/gpu/drm/apple. dcp_external_sink_irq() becomes dcp_dptx_sink_irq() and serves every connected DPTX link, not only the T6030 external processors. The alt-mode IRQ_HPD of a connected Type-C sink calls it instead of dcp_retrain_oob(). H17P pipes keep applying the mode again; a sink the firmware disconnected (dcp_dptx_recover_irq()) and a running relink (dcp_typec_sink_relink()) are unchanged. The apple-dcp transaction selftest stubs the helper and gains a case: a connected sink's IRQ_HPD reaches it once, with no replay. The case fails on the previous routing.

Which machines: every DCP pipe behind a Type-C port except H17P, on every firmware, with no version check. The firmware call is the one the T6030 and USB4-tunnel paths already make.

Testing

On the J775D (Mac Studio, M5 Ultra), on this PR's own base: integration/aurora 110861f plus #1973, which the J775D's desktop needs for its GPU node, and nothing else. Kit pr2604-6 is that base with this PR at 8945af3; kit pr2604-6b is the same base without it. One read-only one-shot boot of each through the 27.0 firmware stub with Aura main 4a6a093d3faa, default command line, a dead-man armed at each boot and the temperature guard running (peak 51.7 C). Both booted to the desktop on HDMI with no DCP crash or recovery and the same failed units (iwd.service and systemd-networkd-persistent-storage.service, as on every read-only test boot). ALARM has no SELinux, so there is no AVC count. Kernel error lines: 7 on this PR's boot, 10 on the base's, with none only in this PR's boot; the base's extra three are Type-C USB start-up errors (usb 3-1, usb 5-1). That boot pair had the DisplayPort monitor on a USB-C port this tree routes to no display coprocessor. A second pair of the same kits then ran with the monitor on the routed port and someone watching it. That pair used the same stub, Aura, command line, dead-man and temperature guard (peak 48.4 C). The own kit then ran once more so the screen could be watched; that boot reached 47.8 C.

  • With this PR (two boots): link training at boot reported errors. The sink raised IRQ_HPD once, at 11.2 and 11.9 s, and it was passed to the firmware. The firmware dropped the sink, the existing relink connected it again, and the mode was set with the link up at 14.1 and 15.0 s. No further IRQ_HPD came, up to 466 s in the first boot. In the watched boot the screen showed a signal with no picture at first, then the desktop. After a cable replug the picture was back in about 5 s.
  • Without it: link training at boot reported errors. The sink's two IRQ_HPDs, at 11.3 and 30.4 s, got the mode replay, and the firmware left the link as it was. The desktop still appeared on its own at about 42 s, and a replug brought the picture back in 5 to 6 s. This boot did not reproduce the stuck blank screen, which comes on some boots and not others.
  • Both: HDMI kept its desktop, no DCP crash or recovery, the same failed units, and the same kernel error lines apart from Type-C USB start-up errors on the base.

So the new path runs as intended when the sink asks, with no regression. A comparison against a base that stays blank has not been made yet; it is listed under Still to run.

Upstream host tests: 461 of 461 on the base and with #1973 and this PR, no result differs. KUnit, with drm/apple's and drm/asahi's suites built in: 732 of 733 cases in 111 suites with and without this PR, the same per case (one skip needs CONFIG_UCLAMP_TASK). The apple-dcp transaction selftest's new case passes on this head and fails with the previous routing restored. checkpatch --strict: clean.

Still to run

  • The deciding A/B: several watched boots of pr2604-6 and of pr2604-6b with the DisplayPort monitor on the routed USB-C port, until the base shows the stuck blank screen (IRQ_HPD repeating about every 19 s) and the PR arm is seen not to. One base boot so far did not reproduce it. If the PR arm is ever stuck blank while its IRQ_HPDs are passed to the firmware, this approach does not hold.
  • No sink that raises IRQ_HPD while its link is good (a dock, an HDCP monitor) was available: with this version it should cause no blank at all.
  • Macs on older DCP firmware (12.3 to 26.6) and other firmware 27 machines with a Type-C display: not tested; rows from their owners welcome (a boot, a replug, and a dock or HDCP monitor if available).
Full description

A connected Type-C sink's IRQ_HPD now goes to dcp_dptx_sink_irq(), which passes it to the firmware's DPTX port (dptxport_sink_irq()) when the port's service is up and the link connected. With no link up it does nothing, since the next connect reads the display anyway. If the firmware refuses the request, the link is disconnected and connected again, which makes the firmware train it and read the display again; that fallback is the T6030 path's, unchanged.

The USB4 tunnel path (dcp_tb_event_work()) already passes IRQ_HPD to the same call; this change does not touch it. The T6030 path keeps its call and fallback; only the helper's name and its external_native check change, the check moving to the caller, which already made it.

Not carried over from #2604: dcp_retrain_sink_irq(), the DCP_HOTPLUG_SINK_IRQ hotplug reason, DCP_SINK_IRQ_WINDOW_MS, DCP_SINK_IRQ_POWER_CYCLES and the power-cycle accounting. The T6020 tunnel-count fix to 8800ffe is offered separately.

Unchanged:

  • a sink the firmware disconnected: dcp_dptx_recover_irq() (e19eb21);
  • a running relink: it connects the sink anew (dcp_typec_sink_relink(), 5afc29b and a907f77);
  • H17P pipes (890572d).
#2604's IRQ_HPD boots (extra evidence: our integration test kit on integration/aurora e0ee46a, not this PR's own row)

These boots of #2604 (11-20) ran before our dead-man and temperature guard were in use; every boot of this PR ran under both.

  • Before: after boot and after a cable replug, the monitor showed a signal and no picture; IRQ_HPD came every 19 s (15 in 280 s); a mode change (1920x1080@75, then back to @60) brought the picture and stopped the requests.
  • First boot with this change: link training at boot reported errors. The sink's first IRQ_HPD, at 10.7 s, got the replay, and the firmware left the link as it was. Its second, 19.1 s later, power cycled the CRTC: the link was trained again and up at 32.2 s, and no further IRQ_HPD came up to 72 s, when the check ended.
  • Second boot: the link recovered through the relink before an IRQ_HPD reached the replay, and a cable replug trained cleanly, with the desktop back on the monitor a few seconds after the plug.
  • Third boot, this head (no firmware check): link training at boot reported errors. The first IRQ_HPD, at 10.4 s, got the replay; the second, 19.0 s later, power cycled the CRTC (1 of 2), and the link was up at 31.9 s. No further IRQ_HPD came up to 123 s. Failed units: iwd.service and systemd-networkd-persistent-storage.service, as in the control boot; the kernel's error and warning lines are the same set as in the first boot. Nobody watched the DisplayPort monitor in this boot.
  • HDMI kept its desktop throughout, and neither DCP crashed or recovered.
  • An earlier form of 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, which power cycled on the first IRQ_HPD, ran on integration/aurora at e0ee46a: the desktop showed on DisplayPort 3.5 s after the first mode set, no IRQ_HPD came in the next 680 s, and two replugs trained cleanly.
  • checkpatch --strict: clean. The appledrm build has no new warning. Upstream host tests: 451 of 451, the apple-dcp suite included.
  • Kernel log and units: compared line by line with a boot of the same kernel base without the change (no DisplayPort monitor attached), after removing timestamps and numbers: the added error lines are the DisplayPort link faults at boot and, in the second boot, one display-coprocessor log line during the relink. The boot journals list the same failed units in all three boots.

Thanks to Ryan Murray and dj for their reviews of #2604, which led here.

  • Clean-room: no Apple code, strings, firmware, RE output or tuning values
  • No chip/board/firmware-version gate where a hardware property can decide
  • Works on the default kernel command line; no hacks, delays or lab-only paths
  • Safety limits come from the machine, not from constants in code
  • Hardware safety rules followed for every test boot
  • Third-party commits unchanged; reporters and testers credited
  • Commits: human Signed-off-by only; no co-author or Assisted-by trailers
  • Tested on the affected hardware; no regression

Assisted-by: LLM (Claude:Opus 5.5)

…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. If the
firmware cannot take the request, the display link is connected 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() and gains
a case: a connected sink's IRQ_HPD reaches it once, with no replay. The
case fails on the previous routing.

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

Copy link
Copy Markdown

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)

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.

2 participants