Repository navigation
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
Conversation
…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>
7 of 8 tasks
|
Review at 8945af3 (non-author, draft). No blocker in the code; the scope needs rows on more than the J775D, and one log point.
Points to consider:
Assisted-by: LLM (Claude:Opus 5.5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 anddcp_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()becomesdcp_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 ofdcp_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-6is that base with this PR at 8945af3; kitpr2604-6bis 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.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
pr2604-6and ofpr2604-6bwith 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.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 itsexternal_nativecheck change, the check moving to the caller, which already made it.Not carried over from #2604:
dcp_retrain_sink_irq(), theDCP_HOTPLUG_SINK_IRQhotplug reason,DCP_SINK_IRQ_WINDOW_MS,DCP_SINK_IRQ_POWER_CYCLESand the power-cycle accounting. The T6020 tunnel-count fix to 8800ffe is offered separately.Unchanged:
dcp_dptx_recover_irq()(e19eb21);dcp_typec_sink_relink(), 5afc29b and a907f77);#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.
--strict: clean. The appledrm build has no new warning. Upstream host tests: 451 of 451, the apple-dcp suite included.Thanks to Ryan Murray and dj for their reviews of #2604, which led here.
Assisted-by: LLM (Claude:Opus 5.5)