Repository navigation
Conversation
dcp_is_t8132_ext() decides two things: which T8132 dcpexts the M4 26.6.2 backend (iomfb_m4.c, t8132_ext_drm.c) adopts, and how a T8132 dcpext's display hardware is driven. Since a dcpext handed over with the 27.2 image runs the firmware-27 backend, it is false there, and the hardware decisions went with it: the Air's dcpexts on 27.2 take Thunderbolt DP tunnels as T602X/T8142 pipelines would. Their DP IN pixel clocks are then not limited to the dcpext's own sources (2 and 4) and are started from source 0, the crossbar's DP IN output is never pointed at the dcpext at DCP's Activate, and the crossbar is brought up and down around a link configuration without the DP IN handshake the T8132 output needs. Add dcp_t8132_ext_hw(), any T8132 dcpext whatever backend drives it, and take the hardware decisions with it: - the tunnel pixel clock sources a route may use, and the clock source its SetLinkRate starts (dcp_route_tunnel_clock_blocked(), dcp_route_clock_rate(), dcp_tunnel_set_rate()); - the crossbar's DP IN selection at Activate, its link-up at DidChangeLinkConfiguration and its link-down around a new link configuration (dcp_tunnel_dpin_activate(), dcp_tunnel_crossbar_up(), dcp_tunnel_crossbar_down()); - a route's PHY without DP alt mode (dcp_typec_route_no_dp_alt()), the crossbar output brought up with the link (dcp_direct_crossbar_link()) and the dcpext's lack of tiles (dcp_typec_port_untileable()). dcp_is_t8132_ext() keeps everything of the M4 backend: its probe, teardown and sleep, its DRM hotplug (also for a refused tunnel clock, which on firmware 27 the pipe's own connector follows), its late teardown answers, its readiness and its connector-less ports. Nothing changes on 26.6.2, where every T8132 dcpext is both. A J773g dcpext on 27.2 drives only its fixed HDMI output and has no Type-C route, so the route and tunnel decisions never reach it; its direct crossbar link is the T6041 firmware-27 one as before. The host replays model both predicates: the tunnel clock sources hold on either backend (a mutation back to the M4 predicate fails), and the crossbar union replay covers a J713 dcpext on 27.2. Signed-off-by: Erik Bourget <erik@ebourget.net>
A T8132 dcpext on firmware 27.2 is a pipeline of the DRM device, with a connector, so a Thunderbolt DP tunnel routed to it was connected inline: dcp_fabric_run_attach() runs the DPTX connect from inside apple_dcp_tb_dp_tunnel(), under the fabric lock, and the connect waits up to two seconds for the firmware's link configuration. The tunnel's provider waits in that call all the while. A CalDigit TS5 replaces its DP IN request right after the first one (a new cookie): the provider retires the first binding's admission at once but can hand over the new request only after the call returns. DCP's Activate, 2 ms into the connect, then reached the retired binding, which refused it (-ESTALE): the DP IN never woke, no link configuration came, the connect timed out and its Deactivate was refused the same way. The dock's display stayed dark. Connect any T8132 dcpext's tunnel from the Type-C reconnect work, as the M4 backend's and the T6030 external processors' already are: the provider's call returns at once, it hands over the dock's new request, and the firmware's Activate meets the binding the fabric admitted. A pipeline of the DRM device starts its Type-C attachment there as the inline connect did (dcp_typec_attach_deferred(): its generation, cable, firmware metadata and relink state), and queues the connect for the session it started. Without a connector it still connects nothing. Other processors keep connecting inline, and the M4 backend's dcpext queues its connect as before. The new host replay runs both firmware backends through the attach and the Activate: the tunnel connects from the work, a pipeline of the DRM device starts its attachment, the crossbar's DP IN output is pointed at the dcpext before the DP IN handshake and a replaced binding touches nothing; each mutation back to the M4 predicate, or dropping the attachment, fails it. It runs with the host tests. Signed-off-by: Erik Bourget <erik@ebourget.net>
A T8132 dcpext selects its tunnel's DP IN output on the crossbar at DCP's Activate (dcp_t8132_tunnel_route_xbar()). When the Activate never comes, or is refused, the route is released with the output never selected, and dcp_typec_route_deactivate() asks the crossbar to idle it with apple_dpxbar_preselect(). The T8132 crossbar has the T602X register map and no preselect: it answers -EOPNOTSUPP, which the release kept as the route's deactivate_error. The route stayed owned with that error for good: every later tunnel request on the port first releases the retired route and fails with it, so after one failed tunnel bring-up every dock replug is refused with -EOPNOTSUPP until a reboot. The T8132 crossbar holds an output's ATC domain and writes its mux only while the output is selected (runtime PM): an output never selected is idle already. Take -EOPNOTSUPP for one as success, as for the T8142-layout crossbars. Signed-off-by: Erik Bourget <erik@ebourget.net>
…take On a machine with ordered dual-stream docks, each Type-C port has a primary and a secondary connector, and the secondary, a dock's second stream, is fixed to one Type-C-only pipeline: the lowest-indexed one. The pairing pass and the tunnel candidate hand a stream only a pipeline its connector is offered. That rule assumed a hybrid (a pipeline with an HDMI output) in front, as on the M2 Pro/Max laptops, where the primary stream takes the hybrid and the Type-C-only pipeline stays for the secondary. Where every pipeline of a port drives Type-C only, as the two dcpexts of the M4 MacBook Air and 14-inch MacBook Pro on firmware 27.2 (pipelines of the DRM device there), the lowest Type-C-only pipeline is also the lowest candidate, the one the primary stream is paired with. The secondary connector was offered that pipeline alone, so a dock's second stream never had one while its first was up: the pairing pass planned nothing for it, and once a compositor owned the display the tunnel candidate refused the other, free dcpext because the secondary connector does not offer its CRTC. Thunderbolt kept logging "dpin1: no display pipeline free; waiting for one" and retrying, and the second monitor of the dock stayed dark. Give the secondary connector the lowest Type-C-only pipeline above the port's lowest candidate, and the lowest Type-C-only one where there is none above it. With a hybrid in front that is the pipeline it had before; on those M4 machines it is the second dcpext. Nothing changes where the ordered policy does not apply (T6030, T6050, single-stream wiring), nor on firmware 26.6.2, where the M4 backend drives the Air's dcpexts with DRM devices of their own and the main device has no connector for their ports. The new host replay runs the production pairing pass and tunnel candidate on both layouts: a dock's two streams on either port, in either order, with and without a compositor, each get a pipeline of their own there, and a lone Type-C-only pipeline stays the secondary's. The rule before this change, and each other mutation, fails it. Signed-off-by: Erik Bourget <erik@ebourget.net>
When the pairing pass or the tunnel candidate has no pipeline for a DP tunnel, the tunnel's provider only logs that it waits for one, once, and retries every few seconds. Which filter refused the stream was left to kprobes. Say it at debug level, with the error, whether the connector order or a compositor's decided, the planned pipeline and the CRTCs the stream's connector is offered. Signed-off-by: Erik Bourget <erik@ebourget.net>
…ect or power-off The swap watchdog retires a present the firmware accepted and dropped (an external pipe that is not enabled accepts presents and drops them), so that the IOMFB queue goes on. A present in flight when a dock goes was not covered: the desktop turns the CRTC off, and the power-off stopped the watchdog. Such a present held the queue for ten seconds, until the queue's timeout declared the processor crashed, and that pipeline lit no display again: after a dock replug on firmware 27.2, one of its monitors stayed dark (IOMFB transaction timed out ... present=1 accepted=1). On firmware with the IOMFB queue, keep the watchdog of a present the firmware accepted and has not completed at the Type-C disconnect and at every CRTC power-off, arming it again if it was stopped (dcp_swap_watchdog_keep()). A power-off with no such present stops it as before. This applies to every queue-backed CRTC, the internal panel and fixed HDMI outputs included: a present of theirs that does not complete within the watchdog period is then retrained as on a Type-C output. Also arm the watchdog on a pipeline with Type-C routes and no fixed connector while no route is selected (dcp_swap_watched()). The dcpexts of J713, J715 and J604 declare a USB-C connector and are Type-C outputs with or without a route, so this reaches only pipelines without a fixed connector. On firmware without the queue such a pipeline is now watched as a routed one is, and nothing is kept across the disconnect or the power-off. The display and lifecycle selftests cover the unrouted pipeline, and the power-off with a present in flight. Signed-off-by: Erik Bourget <erik@ebourget.net>
…rmware answers
A T8132 dcpext on the M4 backend takes its display as released when the
firmware refuses or does not answer the release in time: the route of a
tunnel that is gone must not stay owned, or the next tunnel's setup
fails on the same release. The same hardware on firmware 27.2 did not:
after a dock replug whose DP IN Activate was refused, the dcpext's HPD
low and release timed out (-110), the disconnect returned that, and the
fabric kept the retired route. Every later tunnel request on the port
first released it again and failed the same way ("display teardown
failed: -110", "DP tunnel setup failed: -110"), until a reboot.
Release the display of any T8132 dcpext so (dcp_t8132_ext_hw()): any
error of its release, refused or timed out, is logged and the display
taken as released, and any error of the firmware-27 one's HPD low is
logged and the disconnect goes on to the release. Neither waits for or
records an answer still to come on firmware 27. The M4 backend keeps its
own HPD low, which lowers only the HPD its connect raised, and its link
and orphan handling. Other processors keep a refused release.
The Type-C reconnect work connects the next tunnel's display. For a
firmware-27 T8132 dcpext it still tries up to DPTX_RECONNECT_RETRIES
times, a DPTX_RECONNECT_DELAY apart; a failed try is logged with its
number.
A Deactivate after the tunnel went finds the DP IN adapter idled by the
tunnel's teardown already (-ESTALE): on every unplug, so debug only.
Signed-off-by: Erik Bourget <erik@ebourget.net>
…re 27 Compile the production bodies a firmware-27.2 T8132 dcpext's dock displays depend on against host mocks and replay an unplug with a present in flight and a replug: the swap watchdog of a pipeline with Type-C displays only (a present taken for a display that went is watched, before and after its route is released and across the CRTC's power-off), and the display release of a firmware-27.2 T8132 dcpext that does not answer. Pipelines with a fixed output, the internal panel, firmware without the IOMFB queue and other processors' releases keep what they had. Three negative controls each put one piece back as it was; each must fail the replay. Run with the host tests. Signed-off-by: Erik Bourget <erik@ebourget.net>
A T8132 dcpext's Thunderbolt DP tunnel has no DP PHY lanes to check: the lane count the firmware sets is the tunnel's. set_active_lane_count took that exception only for the M4 backend (dcp_is_t8132_ext()), so a firmware-27.2 dcpext logged "unexpected lane count" on every valid lane count increase of a tunnel. It is a hardware fact: decide it with dcp_t8132_ext_hw(), as the other T8132 hardware decisions are. Two comments follow the split of the predicates: - the no-DP-alt-mode route no longer says the dcpext is no apple_crtc pipeline, which is true of the M4 backend only; - the 5-6 ms between the T8132 crossbar's link-up and the DP IN set active again, which firmware 27.2 now also reaches, says what it is: the T602X-map crossbar reports no link state to wait for, the interval is the one the T8142-layout link-up uses and the T8132 tunnel has run with on both backends, and no shorter one has been measured. The rate selftest's fixture models the predicate. Signed-off-by: Erik Bourget <erik@ebourget.net>
… can reach The previous change fixed an ordered secondary connector to one Type-C-only pipeline, the lowest one above the port's lowest candidate. That breaks when the first stream has to take that pipeline. With a display on another port holding dcpext0, a dock's first stream takes dcpext1. When the other display goes and the dock's second stream comes, dcpext0 is free and can drive it, but the secondary connector offers only dcpext1, so the stream is refused (-EBUSY). Before the change it took dcpext0. No single fixed pipeline serves both orders. Offer the secondary connector every Type-C-only candidate whose route can carry the second stream: a pixel clock for its DP IN and a crossbar control feeding it (dcp_typec_port_carries_stream(), the checks the tunnel candidate makes). A compositor that reads possible_crtcs once then has a set holding every pipeline the stream can be given, whichever one the first stream took. Where a hybrid comes first (M2 Pro/Max laptops) the set is the one Type-C-only pipeline as before. A port whose second stream reaches no pipeline keeps the Type-C-only set, on which its tunnel is refused. The order between the streams is kept by the allocation instead: while the first stream has no pipeline, the second keeps off the port's lowest candidate, the one the first takes when both are free, as long as it is offered one above (dcp_fabric_second_yields()). The tunnel candidate ranks that pipeline last, and the pairing pass plans the second stream on it only when nothing above it is left for it. The replay adds the sequence above and the reverse order, with either pipeline busy first, a pipeline that cannot clock the second stream, the hybrid busy then free, and a pass that must fall back to the first stream's pipeline. Every assignment is checked against the masks as read at probe. The previous rule, the rule before it, and each other mutation fail it. Signed-off-by: Erik Bourget <erik@ebourget.net>
The earlier change to the swap watchdog did more than its case needed, and missed a race in it. - The dcpexts of the M4 MacBook Air and 14-inch MacBook Pro declare a USB-C connector, so they are Type-C outputs with or without a route, and their presents were watched after the route went. Arming the watchdog on any pipeline with Type-C routes and no fixed output (dcp_swap_watched()) reached only other machines. That rule is dropped. - The power-off read whether a present was in flight without the IOMFB queue's lock. The firmware's acceptance, which arms the watchdog, can run between that read and the cancel, and the cancel then stopped the watchdog of the very present that would not complete. - The power-off kept the watchdog of any queue-backed CRTC with a present in flight: the internal panel, a fixed HDMI output, a Type-C display still attached. On expiry the watchdog invalidates the mode and queues a hotplug on the pipeline's connector, which by then can hold a display plugged in after the timed-out present. iomfb_present_lost() now marks the present in flight lost and keeps its watchdog, under the queue's lock, where acceptance and completion run. The Type-C detach calls it, and so does the power-off of a CRTC whose display was unplugged since its power-on (the case that leaves the connection alone). Every other power-off stops the watchdog as before. The watchdog retires a lost present and only completes its flip: no mode is invalidated and no hotplug is queued. A present accepted later belongs to the current display and is retrained as before if it does not complete. The replay now runs the production watchdog, its retirement and the power-off. It covers a lost present retired after a replug without touching the new display, acceptance just before and just after the power-off takes the lock, a present completed or aborted after a replug, and panel, fixed HDMI and attached Type-C DPMS. Each of six mutations fails it. The display and lifecycle selftests follow. Signed-off-by: Erik Bourget <erik@ebourget.net>
…answered The release change took every release error of a firmware-27 T8132 dcpext as done. That includes a release that was never sent (-ENOSPC), a refusal, and errors on a live link or a fixed one (J773g's HDMI output, DPMS), where no tunnel has gone. On a timeout, the firmware-27 transport keeps the call's slot for its late reply, but the next connect could start at once. The firmware's Deactivate and lane-count calls carry no binding cookie, so a late Deactivate of the old release could idle the replacement's DP IN, and a late lane report could satisfy its link wait. Take a release as done only when it timed out for a display whose Thunderbolt tunnel is gone, that is when its provider has revoked the binding (dcp_t8132_tunnel_gone()), and only to hand the route back. Any other error is returned, as on every other path. An HPD low follows the same rule. Such a release marks the port held: - afk_late_replies_pending() covers a firmware-27 call whose slot waits for its late reply, as well as the M4 backend's compact orphans, and the late reply wakes its waiters; - meanwhile the firmware's Activate, Deactivate and link calls, and now also its lane-count and hotplug-detect reports, are taken as the old release's and not acted on; - the next connect waits for the answer. The answer ends the wait, and so does the session's revocation (the detach wakes it) or the CRTC's power-off. Without an answer after DCP_T8132_ORPHAN_WAIT, the M4 backend gives up on its orphans as before. On firmware 27 the port stays held and the connect fails, because the firmware still owns that call. The wait no longer polls in 50 ms slices, and afk_compact_orphans_wait() loses its last user. The AFK and selftest fixtures follow, and the AFK v2 send test checks that only the late reply of a timed-out call wakes its waiters. Signed-off-by: Erik Bourget <erik@ebourget.net>
…ned off The deferred connect of a T8132 dcpext's tunnel checked the fabric session alone. A tunnel's provider revokes its binding before the fabric retires the session, so the work could still send DPTX calls for a revoked binding and reach the refused Activate that deferring the connect was meant to avoid. The detach waits for the work under the fabric lock, so a replacement tunnel also waited behind the old one's two-second link wait. The connect passed recovery=false, so a CRTC turned off (typec_crtc_off, set without hpd_mutex, with the work cancelled without waiting) could still get HPD raised by a connect already running. Failed connects were retried five times, a second apart, whatever failed them. - Before each DPTX call, the connect checks the provider's admission of the session's binding as well (dcp_connect_admitted_locked()). - The detach completes a tunnel's link wait, so that a connect of the revoked session finds it revoked at once. - A deferred attachment queues its connect not to wake a CRTC turned off (typec_reconnect_recovery). The power-off sets typec_crtc_off under hpd_mutex, where the connect checks it before each call. An HPD that the connect raised before is the power-off's to release. - A T8132 dcpext connects once per tunnel on either firmware, as the M4 backend did. A replaced or revoked binding, a link that did not come or a release still unanswered is not changed by trying again. The tunnel's next request, or the CRTC's power-on, connects again. The new replay compiles the production reconnect work, connect, session and admission checks, release wait, detach and release. It revokes the binding before the work, between two DPTX calls and during the link wait, turns the CRTC off at each of those points, replaces the tunnel while the connect waits for the old release, and checks the release rules of the previous change. Each of ten mutations fails it. It runs with the host tests. Signed-off-by: Erik Bourget <erik@ebourget.net>
The four replays this series adds (dock-display-replug, dual-stream-pairing, t8132-v27-connect and t8132-v27-tunnel) are new Aurora contributions to the kernel tree: GPL-2.0-only, not a dual licence. Signed-off-by: Erik Bourget <erik@ebourget.net>
…accepts A routed Type-C port's encoder is narrowed to the pipeline driving it, on ordered dual-stream machines too: a route is made before the modeset and does not follow another CRTC there, so the atomic check pairs the connector with that pipeline only (apple_connector_atomic_best_encoder()). Name that mask (dcp_fabric_routed_crtc_mask()) and use it where a route is activated and where a connector adopts a routed port, instead of two copies of the connector-mask call. No change in behaviour. A dock stream's next attachment may be given another pipeline: on the M4 MacBook Air its first stream takes dcpext1 when another port holds dcpext0, and its second then takes dcpext0. Its route publishes the new mask before the hotplug that reports the display, as on every Type-C port. The pairing replay compiles the production atomic check against the fabric core and, for every attachment it makes (both dock streams, busy then free, the dock back on the other pipelines, a hybrid's primary on the hybrid), reads the connector's mask while routed and tries every CRTC with it: each one the mask offers is accepted, and no other. A routed mask that also offers the other Type-C pipeline fails it. Signed-off-by: Erik Bourget <erik@ebourget.net>
A present in flight when a Type-C display went is retired by the swap watchdog without a retrain, since the pipeline may drive another display by then. It was marked lost only if the firmware had accepted it when the detach or the CRTC's power-off looked, and any acceptance cleared the mark. A present begun for the display that went and accepted after both had looked was therefore taken as the next display's: on expiry the watchdog invalidated the mode and queued a hotplug against the display plugged in meanwhile. Keep with each present the Type-C attachment it was begun for, counted by the detaches before it (iomfb_present_begun_h17p()), and decide at its retirement whether that display went since. Acceptance no longer decides it. A stuck present of the display attached now is retrained as before. Outputs without Type-C detaches (the internal panel, a fixed HDMI output) keep their first count and are never taken as lost. The replug replay begins presents before accepting them. It adds a present begun before the detach and accepted after the detach and the power-off, and a replacement plugged in before expiry for each order of acceptance against the power-off. Judging the loss at acceptance, never taking a present as lost, or always doing so, fails it. Signed-off-by: Erik Bourget <erik@ebourget.net>
…ng's admission appledrm checks that the tunnel it was handed is still requested before each DCP call of its display connect (apple_dp_tunnel_binding_live()). The check releases the DP IN adapter's lock before the call goes out, and the tunnel's deactivation revokes the binding under that lock, so a revocation can fall between the check and the call: DCP is then asked to validate, connect or raise HPD for a tunnel that is going. Add apple_dp_tunnel_binding_call(), which runs a function under the adapter's lock while the binding is live and returns -ESTALE once it is revoked. appledrm queues each call there and waits for DCP's reply after it, since DCP's Activate and Deactivate for the binding take the same lock. Nothing in the provider changes. Signed-off-by: Erik Bourget <erik@ebourget.net>
…mission A Thunderbolt DP tunnel's connect checked the provider's admission of its binding before each DPTX call, then released the provider's lock and sent the call. The provider revokes the binding under that lock when the tunnel goes, and the detach that follows waits for this connect, so a revocation between the check and the call still let Validate, Connect, Request Display or HPD high go out for the revoked binding (a host case that revokes right after the check sent Validate). The connect could also report success for a binding revoked while it waited for the link. Queue each DPTX call of the connect under the provider's admission (apple_dp_tunnel_binding_call()): the V2 transport hands the queueing of the call, taking its slot and sending it, to a gate (dcp_dptx_send_gated()) that runs it there while the session's binding is live. A revocation then comes before the call, which is refused (-ESTALE), or after it. The reply is waited for outside, as DCP's Activate for the binding takes the provider's lock. The connect opens the gate around its calls, from the PHY setup to its HPD, and around the HPD it raises after the link wait; its release of a requested display and every other sender are not gated. Before reporting success, the connect checks the admission again: a binding revoked during the link wait leaves the display to its detach. Compact EPIC (desktop 26.x, the M4 backend) can wait for ring space while queueing, so it keeps the check before each call. The connect replay sends every DPTX call through the gate. It adds a revocation right after each of the connect's checks, and one during the link wait with the link come. Sending outside the gate, or not checking again after the wait, fails it. The AFK V2 selftest queues a command through a gate that refuses it and one that admits it. Signed-off-by: Erik Bourget <erik@ebourget.net>
…s answer A firmware-27 T8132 dcpext whose gone tunnel's release timed out holds its DPTX port until the firmware answers. Four things were wrong with that hold: - A connect that failed after Request Display released the display ignoring the result and cleared its port, so a release that timed out there neither held the port nor was sent again at the detach: the replacement's DPTX calls went out with the old release outstanding. - The connect cleared the hold outside hpd_mutex and before checking its session, so a connect paused there could clear a hold that a detach had just set. - An empty slot map was taken as the release done, while an answer that refuses the call frees its slot too. - The next connect waited for the answer for 15 seconds and then gave up for good. An answer that came later woke nobody, and a repeated request for the same tunnel was taken as done without a connect, so the display attached meanwhile stayed dark. One never answered left the port unusable without a word. A failed connect now releases its display the way a detach does (dcp_dptx_release_locked()), from the moment Request Display was sent, whatever it answered. A gone tunnel's release that times out holds the port. One not sent or refused is owed: the next release sends it, and a later connect sends it before its own calls. The hold is set and cleared under hpd_mutex only. The transport counts late answers that refuse their call (afk_late_refusals()), and the hold keeps the count from before its call was sent. A connect does not use a held port and does not wait for it: it returns -EBUSY. The answer queues dcp_t8132_port_work(), which frees the port if the release was carried out, sends the release again if it was refused, and then connects the display attached meanwhile from the reconnect work, for the session attached now. A CRTC turned off is not woken. The DPTX service's publication and a repeated request for the attached tunnel queue the same work, so a display whose connect could not run is connected when the cause goes, without the timed retries this series dropped. A release refused again, or never answered, keeps the port held until the display processor's DPTX endpoint is started again (dptxep_init()), and says so. The M4 backend keeps its wait for its compact calls' answers. DPMS now wakes that wait, as it changes what the wait looks for. The connect replay covers a revocation after Request with a release that times out, then a replacement; a release refused at the failed connect, owed to the detach or to the next connect; answers that come late, that refuse the release once or twice, or that never come; a display gone or replaced, or a CRTC turned off, before the answer; the service's publication; and the M4 backend's wait ended by a revocation or DPMS. Each of the old behaviours put back fails it, as do no resume, a resume that wakes a CRTC turned off, a refusal taken as the release, a dropped owed release, and DPMS without a wake. The AFK V2 selftest counts a late refusal and checks that a late answer queues its work. Signed-off-by: Erik Bourget <erik@ebourget.net>
…wn answer On firmware 27 a T8132 dcpext's DPTX port is held while the release of a display whose tunnel went is unanswered. The hold ended when no timed-out V2 command of the endpoint was pending and an endpoint-wide count of refused late answers had not moved since the release was sent. That count cannot tell which call an answer was for, and its state outlived the transaction: after a late refusal, a release sent again that failed left the count as the work had last read it, so the next run of the work (the dock repeating its request) took it as the release done and connected the next display with neither release carried out. An HPD low that timed out took the hold too, and its answer could run the work before the detach took the hold, leaving a released port held with nothing to wake it. The firmware's link calls were acted on again as soon as any late slot was free, though the port was still held. Follow the release itself. The V2 transport takes a ticket with a command (afk_service_call_ticket(), afk-ticket.h): sending numbers it, a timeout that keeps the slot makes it LATE, and the late reply of that command, not of any other, makes it DONE or REFUSED. dcp_dptx_release_locked() sends a firmware-27 release with the dcpext's ticket and holds the port on a timeout of a gone tunnel, as before. dcp_t8132_settle_locked(), under hpd_mutex where the hold is taken, ends it on the ticket alone: carried out, the port is free; refused, the display is still requested and its release is owed, which the next connect sends before any connect call (the existing owed-release path), as often as the dock asks, until one goes through. The release that takes the hold settles at once too, for an answer that came between the timeout and the hold. The work no longer sends releases of its own, and the endpoint-wide count and the pending-slot scan are gone. An HPD low that times out goes on to the release as before, whose answer alone decides; it takes no hold of its own. While the port is held, Will/DidChangeLinkConfiguration, Activate and Deactivate are answered as done at the DPTX callback's entry, before the link and 180 Hz state they reset for the next display; the hold, not a free slot, decides there and for the lane and rate reports. The M4 backend keeps its compact orphans and is unchanged. The connect replay models the ticket and adds: a late refusal, the release sent again refused, and two repeated requests (no connect call until a release goes through, then the dock connects); a refusal while the DPTX service is gone (sent first once it is back); another call's late answer and an older release's (the port stays held); an answer before the hold is taken; an HPD low unanswered with the release answered in time (the port is free); the link calls between the answer and the work. Their controls: any run of the work ends the hold, the release does not settle, the filter ends with the slot. The AFK V2 selftests check the ticket through the production sender and reply handler. Signed-off-by: Erik Bourget <erik@ebourget.net>
The firmware-27 T8132 port work (dcp_t8132_port_work()) is queued on the system workqueue by the DPTX transport's late answers, by the DPTX service's publication and by the tunnel provider's repeated request. The component unbind cancelled it while those producers could still queue it: an answer between the cancel and the endpoint's shutdown queued it again, and a work run after platform removal freed the DCP would take its hpd_mutex first. Disable it at probe, enable it in dcp_enable_typec_work() at bind and disable it synchronously in dcp_disable_typec_work(), as the other Type-C works: from unbind to the next bind nothing queues it, whatever the producers do, and a disabled work is never run after the DCP is freed. An answer that comes meanwhile is kept in the release's ticket; the bind queues the work once, which takes it (a release answered frees its port). The connect replay compiles the production enable and disable: an answer, a publication and a repeated request after the unbind queue nothing, and the next bind frees the port. Cancelling instead of disabling, or a bind that drops the kept answer, fails it. Signed-off-by: Erik Bourget <erik@ebourget.net>
A present on firmware with the IOMFB queue keeps the Type-C attachment it is for (the detaches before it, typec_unplugs), so that its watchdog retires a present of a display that went without retraining the pipeline's next display. The count was read when the firmware answered the SwapStart, after the host had sent it. A present started for the dock's display whose answer came after the detach and a replug took the replacement's count, and once accepted and stuck its watchdog invalidated the mode and queued a hotplug for the replacement. The watchdog also read the count under the queue's lock when it retired the present and retrained afterwards, so a detach in between retrained the replacement. Read the attachment as the host starts the present (do_swap() and the clear swap) and carry it in the SwapStart's cookie to its answer, which begins the present with it (iomfb_present_begun_h17p()). The watchdog takes the present's attachment from its retirement and compares it with the count under hpd_mutex, where a detach counts itself, and retrains under it: a detach after the retirement is seen, and one after the retrain finds it done for the display it takes away. The replug replay starts a present before the detach and answers it after the replug, and puts a detach between the retirement and the retrain (at the queue's lock and while the watchdog waits for hpd_mutex): the replacement is left alone, and its own stuck present is retrained as before. Reading the attachment at the answer, or deciding without hpd_mutex, fails it. Signed-off-by: Erik Bourget <erik@ebourget.net>
…sion A Thunderbolt tunnel's connect queues each DPTX call under the provider's admission of its binding (dcp_dptx_send_gated()), so that a revocation comes before the call, which is refused, or after it. Only the V2 transport did. On the M4 backend's compact transport the call went out after the connect's own check, so a revocation between that check and the queueing still sent the call for the revoked binding. A compact message is committed by its first fragment. Write that fragment through the same gate (afk_send_compact()): each try is one write to the ring under the admission, and a wait for ring space is outside it, so the provider's lock is never held while the firmware drains the ring, and the next try checks the admission again. A refused first fragment sends nothing, so no message is left half sent; the rest of an admitted message follows as before. Replies to firmware calls and other senders' commands are not gated, as on V2. Both transports ring the mailbox inside the admission, which can wait for its FIFO; the coprocessor drains that without any host lock. The comments now say so. The connect replay sends the M4 backend's calls through the production afk_send_compact(): revoked right after each of the connect's admission checks, only a release goes out after the revocation; revoked while a call waits for ring space, the next try is refused; a live binding's calls go out, waiting outside the admission. Sending the first fragment ungated, or waiting for space inside the admission, fails it. Signed-off-by: Erik Bourget <erik@ebourget.net>
A firmware-27 T8132 dcpext holds its DPTX port while the release of a display whose tunnel went is unanswered, and only that release's own answer ends the hold. An answer that refuses it leaves the release owed, and the replacement tunnel's connect sends it again first. That release held the port only while no tunnel was bound: with the replacement bound, a timeout of the release sent again was returned as on a live link. The port stayed usable, the firmware's link calls were acted on again and the release stayed owed. The dock's next request sent a third release and a connect while the second was still with the firmware, and an answer that carried the second out was followed by a third release the firmware could refuse, leaving the replacement dark. A release owed is of a display no longer wanted, whichever tunnel is bound now. Hold the port for it when it times out, as for a gone tunnel's (dcp_dptx_release_locked()): the hold ends on its own answer, which frees the port, or restores the debt if it refuses the release, and the next connect sends it once more. A failed connect's release is owed from the moment it is sent, so one that times out on a live link holds the port too. The release of a display still connected, on a live or a fixed link, fails as before. The connect replay times the release sent again out with the replacement bound, and has the dock repeat its request before the answer, or the answer come first: only one release is ever outstanding (the mock asserts it at every firmware-27 release), nothing connects until it is answered, and the answer connects the replacement with no release sent again. It also covers a refusal of the release sent again, the replacement going before the answer, a detach's release refused at once and sent again unanswered, and a failed connect's release unanswered on a live link. Holding the release sent again only for a gone tunnel, or owing a failed connect's release only once it failed, fails it. Signed-off-by: Erik Bourget <erik@ebourget.net>
…splays #2721, this branch's base, was merged into #2710 and that into #2673's branch, which has since taken main and the T6041 DP IN tunnel work. Resolved: - dcp.c (dcp_dptx_connect_raw()): the base's dcp_assert_hpd_before_link_wait() (fixed HDMI and DP2HDMI) for the HPD assertion before the link wait, with this branch's bookkeeping: a display is connected from its request on, a failure releases it through out_release (which keeps its release owed), and an -ESTALE binding is not logged as an error. The HPD after the link wait takes the base's condition (DP2HDMI with an adopted RTKit) inside this branch's DPTX gate. - dptxep.c: the base's lane check, which skips a DP tunnel on every SoC (this branch skipped it for a T8132 dcpext's tunnel). - dcp-fabric.c/.h: both crossbar tests, dcp_xbar_t8132() and the base's dcp_xbar_t6041(), and both sides' declarations. - apple-dcp selftests: the union of both sides' stand-ins. Signed-off-by: Erik Bourget <erik@ebourget.net>
… tests The merge of #2673's branch brought dcp_assert_hpd_before_link_wait() into dcp_dptx_connect_raw(), dcp_xbar_t6041() into the tunnel Activate and its own lane check into dptxport_call_set_active_lane_count(): - t8132-v27-connect-tests.py extracts dcp_assert_hpd_before_link_wait() with the fields it reads; a Type-C output never reads a fixed HDMI HPD, and the GPIO stand-in asserts that. - t8132-v27-tunnel-tests.py: a T8132 route is never a T6041 crossbar. - dptx-set-active-lane-count-tests.py: no T8132 release is outstanding in its cases (dcp_t8132_link_report_late()). - apple-dcp rate.py: the lane check no longer asks dcp_t8132_ext_hw(), so publication-hpd drops its now unused stand-in. Signed-off-by: Erik Bourget <erik@ebourget.net>
|
#3655 touches the same present-retirement code as this PR's "retire only the present of a display that went" and "tie a lost present to the display it was begun for". Whichever of the two lands second should fold them into one mechanism.
|
… fix/t8132-fw27-dock-displays Conflicts: drivers/gpu/drm/apple/afk.c The base serializes TX ring writes and doorbells under the endpoint's tx_lock mutex, taken in afk_send_epic_token(), so a send can no longer run under the service spinlock. Split the ring write from the doorbell (afk_epic_publish_locked() and afk_epic_ring(), with tx_lock held by the caller) and keep afk_send_epic_token() as before on top of them. The gated command send takes tx_lock before dcp_dptx_send_gated(), as the compact path does, and afk_command_enqueue() holds the service lock from the live-service check through the ring publication, dropping it only before the doorbell, so a CLOSE cannot retire the service between the check and the publication. Host harnesses updated for the base: t8132-v27-connect-tests.py names the endpoint's TX mutex tx_lock, and dock-display-replug-tests.py stubs dcp_has_panel() and follows the swap watchdog's new arm condition in its identity-at-acceptance mutation. The AFKV2 sender harness mocks the ring write and the doorbell separately and checks the locks held at each; the ring-admission extractor finds the block in afk_epic_publish_locked(). Signed-off-by: Erik Bourget <erik@ebourget.net>
There was a problem hiding this comment.
Superseded 12-01: not a hold under the merge bar (no shown failure). Only merge state checked; follow-ups: retarget after #2673, reconcile with #3655, full CI, J713 two-display TS5 row
Verdict: HOLD at 9cd5ca8a
Blockers:
- Non-
mainbase branch (j713-dcpext/air-dcpext-272/#2673): This PR still targets feature branchj713-dcpext/air-dcpext-272(#2673), so full build/KUnit/host-tests CI has not run againstmain. Once#2673lands onmain, please retarget this PR tomain, reconcile the present-retirement path with#3655if#3655lands first, and run full hosted CI. - Exact-head two-display dock hardware row (
9cd5ca8a): Current PR body rows at7f21093acover internal-panel (eDP-1) smoke/sleep only (no dock or external monitor attached). Please post an exact-head two-displayCalDigit TS5dock bring-up + unplug/replug recovery pass on J713 (T8132, fw27.2) once rebased/retargeted ontomain.
Checked:
- Verified
9cd5ca8ais a clean merge oforigin/j713-dcpext/air-dcpext-272(MERGEABLE), withpr-textandpr-readinesspassing on the feature-branch base.
Evidence
- Head commit:
9cd5ca8a28b4bbd004245807c810062092fbb73d(Merge remote-tracking branch 'origin/j713-dcpext/air-dcpext-272'). - Base branch:
j713-dcpext/air-dcpext-272(#2673).
|
Verified
|
|
We carry this PR in our J713 (M4 Air, T8132) daily kernel. On J713 with firmware 27.2, a two-monitor Thunderbolt dock (CalDigit TS5) failed on Carried alongside #3269 in our J713 daily kernel so dual external monitors on a Thunderbolt dock work cleanly in daily use. |
Reconcile the #3273 dock-display present-retirement, Type-C release, and host-test changes with main (c948713, including #2673, #3655, and #3939): - drivers/gpu/drm/apple/dcp.c, dcp-internal.h: drop the removed dcpext_scanout_* hooks from dcp_dptx_connect_raw() and dcp_dptx_release_locked(), keep release_owed and the AFK release ticket, retain both dcp_swap_watchdog_keep() and dcp_swap_watchdog_cancel(), and keep main's dcp_typec_fw_unplug_wait() + _dcp_poweroff(dcp, pipe_unplugged) in dcp_poweroff() alongside iomfb_present_lost(dcp, true). - drivers/gpu/drm/apple/iomfb.c: combine iomfb_retire_dropped_present_h17p() attachment reporting with main's shared iomfb_retire_present_locked_h17p() helper while keeping iomfb_present_begun_h17p() and iomfb_present_lost(). - drivers/gpu/drm/apple/iomfb_template.c, dcp_dropped_swap_test.c: record both iomfb_present_begun_h17p() attachment and present_fw_unplugs in dcp_present_begin() and dropped_test_start(). - tools/testing/selftests/drivers/gpu/apple-dcp/edid.py, lifecycle.py, tools/asahi/dock-display-replug-tests.py: keep both the AFK ticket fields in struct epic_cmd_info / apple_dcp_afkep and main's T6030 firmware 27.2 sleep stub (j516s_panel_service) in edid.py, and reconcile poweroff_replug / dock-display-replug mocks with _dcp_poweroff(), dcp_swap_watchdog_cancel(), and iomfb_retire_present_locked_h17p(). Signed-off-by: Erik Bourget <erik@ebourget.net>
A late reply to a ticketed standard service call (afk_service_call_ticket()) only checked the AFK transport retcode before marking the ticket AFK_TICKET_DONE. On a zero transport retcode, a truncated reply or one whose epic_service_call header fails the synchronous path's magic, group, or command check would therefore clear a held firmware-27 T8132 dcpext port instead of leaving the release owed. Record the service-call expectation (expected group, command, and whether the full reply buffer or length-checked envelope is required) on the pending command and validate the late reply's length and epic_service_call header (via afkv2_service_header_ok() / afkv2_service_reply_size() after dma_rmb()) before marking the ticket AFK_TICKET_DONE; invalid replies mark it AFK_TICKET_REFUSED. Also update the apple-dcp service-rebind recovery harness for afk_epic_publish_locked() and add late service-header negative cases to the apple-afkv2 sender selftest. Signed-off-by: Erik Bourget <erik@ebourget.net>
|
Rebased/merged live Summary of changes:
Verification at
Still pending at |
Conflicts resolved: - afk.c: main publishes a ring entry and rings a doorbell that does not sleep in one critical section, and keeps the slot of a command whose doorbell failed after that. This branch splits publication from the doorbell. afk_epic_publish_locked() now does main's publication and reports whether the entry is visible, afk_epic_ring() rings only a doorbell that sleeps, and afk_command_enqueue() hands a published command's slot to its sender, which keeps it for the late reply. A ticket following it becomes LATE, as after a timeout. - t8132-v27-connect-tests.py: new fields and afk_send_ret() for main. - apple-afkv2/extract-send.py, apple-dcp/recovery.py: the ticket and gate cases run on main's real ring writer. Added: a ticketed command whose doorbell fails. Signed-off-by: DjDeveloperr <hey@djdev.me>
dptxport_release_display() used the AFK timeout of its display processor (afk_timeout_ms: three seconds on T8152). Sent through the ticketed call it waited one second on every processor. Use the plain service call when no ticket follows the release. Signed-off-by: DjDeveloperr <hey@djdev.me>
A failed connect marked its display's release as owed on every processor. One the firmware refuses is then sent again before each connect, which gives up on the refusal, and before each detach, whose route stays owned. Elsewhere the release was sent once and its answer ignored: do that again on any processor but a T8132 dcpext, whose late and refused releases this follows. The new case in t8132-v27-connect-tests.py fails without it. Signed-off-by: DjDeveloperr <hey@djdev.me>
dcp-tunnel-prepare-tests.py and dcp-peer-shown-tests.py compile functions and a struct that now need dcp_t8132_ext_hw(), dcp_fabric_routed_crtc_mask() and u64. 21 host test jobs did not build without them. Signed-off-by: DjDeveloperr <hey@djdev.me>
There was a problem hiding this comment.
Approving at b2eea25bf3b3. I merged current main (2c667a4be5a6) into the branch, read the whole driver diff (the test files I ran and read only where I changed them), and pushed three commits on top.
Fixed (d3673ab10b71): a refused release could block a port on every other SoC. A failed connect marked its display's release as owed on all DCPs, not only T8132. If the firmware refused that release, every later connect sent it again first and gave up (and so did the detach, so the route stayed owned). main sends it once and ignores the answer. The new case in t8132-v27-connect-tests.py (a T6050 dcpext) fails without the fix. The owed release is now T8132 only; everyone else has main's behaviour.
Fixed (97314b869851): dptxport_release_display() lost the processor's own timeout (3 s on T8152) because it went through the ticketed call with a fixed 1 s.
Fixed (b2eea25bf3b3): 21 host test jobs did not build on the branch (dcp-tunnel-prepare-tests, dcp-peer-shown-tests); the targeted runs had missed them.
Merge notes:
afk.c:mainnow publishes a ring entry and rings a non-sleeping doorbell in one critical section, and keeps a command's slot when the doorbell fails afterwards. The branch splits publish and doorbell.afk_epic_publish_locked()doesmain's publish and reports whether the firmware can see the entry.afk_epic_ring()only rings a doorbell that sleeps. A published command keeps its slot, and its ticket becomes LATE as after a timeout.- On firmware 27 the service lock is now held across that non-sleeping doorbell, as the endpoint lock already was. Lock order stays service, endpoint,
afk_tx_lock. extract-send.py,recovery.pyandt8132-v27-connect-tests.pywere adapted tomain. I added a ticketed command whose doorbell fails, and checked that five mutations of the merged send path fail.
Checked on the pushed tree: asahi profile with KUnit, W=1 on drivers/gpu/drm/apple, drivers/soc/apple and drivers/thunderbolt: no warning that main does not have. Host tests: 1009/1030 in the full run at d3673ab10b71, and the remaining 21 (the jobs above) pass at the head. checkpatch --strict on the PR's diff: 0 errors; 2 warnings and 3 checks, all in test fixture stubs already in the branch. KUnit: built, not run.
Hardware rows owed at this head:
- J773g on 27.2: boot, HDMI DPMS off/on and unplug/replug, USB-C display if one is attached, a deep sleep, clean log. It drives one display and has no Thunderbolt dock, so it covers the shared present, AFK and DPTX paths but not a tunnel, the second dock stream or the held port.
- J713 (27.2): TS5 with two monitors: cold boot, dock and monitor unplug/replug, the late-release hold, DPMS, deep sleep. J713 on 26.6.2: one dock display, for the M4 backend's gated compact calls.
- J716c (27.2): TS5 unplug/replug and after sleep, for the gated tunnel connect on T6050.
Landing order: this conflicts with #3398 in afk.c (the first compact fragment), so the second to land needs a small merge. #3289 merges cleanly with it as text.
There was a problem hiding this comment.
Verdict: MERGE at b2eea25
Checked: Ran the exact T8132 deferred-connect and release suite, paired-completion suite, tunnel-prepare controls, and the AFK sender harness under ASan and UBSan. A failed connect owes a release only on T8132. Other processors retain their own release timeout and do not carry a refused release into the next connection. The ticketed send preserves the slot when a doorbell fails after publication, and a revoked binding fails before transmission or at the next retry. Checked the reported full host run and the two repaired suites on the current head.
Follow-ups: Split independently useful AFK ticketing changes from the dock lifecycle in future series.
What: Fix two-monitor Thunderbolt dock (
CalDigit TS5) display bring-up and unplug/replug recovery on 27.2-firmware M4 (T8132)dcpextpipelines by driving T8132 display hardware identically across both firmware backends, deferring tunnel connect and gating DPTX calls under tunnel-binding admission, offering the second dock stream all reachable Type-C-only pipelines, retiring lost presents without a retrain, and holding a firmware-27dcpextport until its timed-out or owed release is answered.Tested: Verified at current head
c87da41ccaa0(drm/apple: validate service headers on late ticketed replieson top ofed123f155c18, mergingmainc948713c6403which carries#2673,#3655, and#3939):linux-j713andlinux-j716carm64 kernel/DTB/modules builds pass cleanly (7.3.0+), targetedW=1arm64 compile is clean indrivers/gpu/drm/apple/*andapple_dp_tunnel_binding_call(), 4-config arm64 QEMU KUnit passes (679 passed, 3 skipped, 0 failed), all 46 targeted host test runs acrosst8132,dock-display,dual-stream,tunnel-route,dcpext26,dptx,tiled-split, andapple-afkv2pass (apple-dcpedid4/4includingservice-rebind,boot6/6,rate5/5,m49/9,audio2/2, andlifecycleDCP casesphysical-disconnect,fast-replug-bounce,stale-crtc-poweroff, anddropped-swap-teardownpass; remainingapple-dcplifecycle/phy/displayfailures are pre-existing onmainunder hostclang23-Werror), and all 5 display replays with negative controls pass (see Evidence). OnJ716c(M5 Max,T6050,27.2) in a composite trial kernel (8d250d354c97mergingc87da41ccaa0overorigin/maind3de772ac0c1, no external display connected), desktop boot (0Oops/WARN/BUG/Call trace) and3xeDP-1DPMS off/on (3456x2234@120restored) passed before the pass stopped ons2idle(rtcwake -m freeze, matching knownmainRTC-wake behaviour). Earlier-head9cd5ca8a28b4(internal-panel only on J713T813227.2and J716cT605027.2with#3662) and7f21093a0d31(37edba02c535) runs are preserved in Evidence.Risk: two-way door · M4 (
T8132: J713/J715 Air, J604 14" Pro, J773g mini) on27.2and26.6.2firmware; shared IOMFB lost-present retirement, gated Thunderbolt DP tunnel connects, failed-connect release handling, and V2 command tickets across Apple Silicon Macs.Revert:
git revert -m 1 <merge_commit>onmain(or revert the PR's commits in reverse order); no persistent on-disk, firmware, or boot-object state.Not yet: Exact-head
c87da41ccaa0two-monitorCalDigit TS5dock hotplug/unplug/replug and internal-panel regression row on J713 (T8132,27.2, currently off-network; composite kernel25e08d2ee142overorigin/maind3de772ac0c1built cleanly);c87da41ccaa0J716c (M5 Max,T6050,27.2)#3273-specific external-display unplug/replug and post-sleep checks (the composite trial had no external display connected and stopped ons2idlertcwake -m freeze); hostedmainCI (apple-build,host-tests, KUnit) atc87da41ccaa0; Macs not in the local lab (M4 Pro/Max, M2 Pro/Max laptop dock, J604/J715/J773g on27.2, and M4 on26.6.2).Details
Problem solved. On
27.2firmware the M4 MacBook Air's twodcpexts are pipelines of the DRM device, and a two-monitor Thunderbolt dock (CalDigit TS5) failed on three paths:dcpext's IOMFB queue until it was declared crashed, and the otherdcpextkept a dead route (-110or-EOPNOTSUPP) until a reboot.Design summary. This PR drives a
T8132dcpext's display hardware the same way on either firmware backend. The tunnel connects from the reconnect work, and each of its DPTX calls is queued under the tunnel provider's admission of its binding, on the V2 and the compact transport, so none goes out after the tunnel is revoked. It never wakes a CRTC that is turned off. A dock's second stream is offered every Type-C-only pipeline it can reach; a routed connector is offered the pipeline driving it, which is what the atomic check accepts. A present started for a display that went is retired without a retrain (and on#3655's unplugged-session path,iomfb_end_unplugged_session_h17p()retires it at once or falls back to the swap watchdog if held/unanswered). When a gone tunnel's release goes unanswered, the route is given back but the DPTX port is held until the firmware answers that release; the answer frees it and connects the display attached meanwhile, and a refusal leaves the release to be sent before the next connect. A release sent again that goes unanswered holds the port the same way, also with a replacement tunnel bound, so only one release is ever outstanding and nothing connects until it is answered and the release is no longer owed.This PR also adds one exported function to
drivers/thunderbolt/apple.c(commit 17), which the DRM side needs: without it every gated connect is refused. Nothing in the provider's behaviour changes. It can move to the Thunderbolt PR, or a small Thunderbolt prerequisite merged first, if the maintainers prefer one PR per subsystem.Known limitations (not changed here).
dcpext's port held until its DPTX endpoint starts again (the display processor's rebind), with no recovery that proves the old session ended.possible_crtcspast the hotplug of its next attachment, when that attachment had to take the other pipeline, is refused until it reads them again (a routed tunnel cannot move to another pipeline at a modeset).T8132crossbar's link-up and its DP IN set active again, which firmware27.2now reaches, is not proven as a strict lower bound (the crossbar reports no link state to wait for; a successful row shows the sequence works at that interval, not that it is the minimum).Commits. Commits 9–25 change functions that earlier commits also change, so they are separate commits on top rather than fixups.
drm/apple: tell T8132 dcpext display hardware from the M4 backend. A newdcp_t8132_ext_hw()is true for anyapple,t8132-dcpext, whichever backend drives it. It now decides the hardware questions:dcp_is_t8132_ext()(the M4 26.6.2 backend) keeps probe, teardown, sleep, DRM hotplug, late teardown answers, readiness and connector-less ports.drm/apple: connect a firmware-27 T8132 dcpext's DP tunnel from the work. The tunnel connects from the Type-C reconnect work, so the provider's call returns at once and it can hand over the dock's replacement request before DCP's Activate. A pipeline of the DRM device starts its Type-C attachment first (dcp_typec_attach_deferred()).drm/apple: a T8132 tunnel output never selected is idle at its release. The T8132 crossbar (runtime PM, T602X map) answers-EOPNOTSUPPto a preselect. For an output that was never selected, that answer now counts as idle, so the route no longer stays owned for good.drm/apple: give a dock's second stream a pipeline the first does not take. This fixed the secondary connector to one pipeline. Commit 10 replaces that rule.drm/apple: say why a Thunderbolt DP tunnel finds no pipeline: a debug-level reason when pairing or the tunnel candidate refuses a stream.drm/apple: keep the swap watchdog of a present in flight at a disconnect or power-off. Kept the watchdog of an accepted present at the Type-C disconnect and at every power-off of a queue-backed CRTC, and armed it on unrouted pipelines without a fixed connector. Commit 11 narrows both.drm/apple: release a firmware-27 T8132 dcpext display whatever the firmware answers. Took any release error as done on firmware 27 too, with the reconnect work's timed retries. Commits 12, 13, 19 and 20 replace this.tools/asahi: replay a dock's displays going and coming back on firmware 27. Commits 11 and 16 rewrite the replay.drm/apple: take the T8132 dcpext lane-count exception from the hardware. A tunnel has no DP PHY lanes to check, so firmware 27.2 no longer logs "unexpected lane count" on valid increases. Also corrects two comments, including what the 5–6 ms crossbar settle is.drm/apple: offer a dock's second stream every Type-C-only pipeline it can reach.dcp_typec_port_carries_stream()).dcp_fabric_second_yields()), both in the tunnel candidate and in the pairing pass, which falls back when nothing above that candidate is left.-EBUSY. With a hybrid in front (M2 Pro/Max) the mask is the one Type-C-only pipeline as before.drm/apple: retire only the present of a display that went.dcp_swap_watched()). The J713/J715 and J604 dcpexts declare a USB-C connector, so they are Type-C outputs without a route and were already watched.iomfb_present_lost()keeps the watchdog of a present in flight under the IOMFB queue's lock, where the firmware's acceptance and completion also run.drm/apple: hold a firmware-27 T8132 dcpext port until its release is answered. Only a release that timed out for a display whose tunnel is gone is taken as done, and only to give the route back.-ENOSPC, refusals, and live or fixed links return their error as on every other path. The firmware's Activate, Deactivate, link, lane-count and hotplug-detect calls are not acted on until the answer. Commits 19 and 20 change how the hold ends; commit 24 also holds for an owed release.drm/apple: admit every deferred tunnel DPTX call and leave a CRTC turned off. DPMS setstypec_crtc_offunderhpd_mutex, where the connect checks it before each call; the detach completes a tunnel's link wait; a T8132 dcpext connects once per tunnel on either firmware (the five blind retries a second apart are gone). Commit 18 replaces its admission check before each call.tools/asahi: license the dock display replays GPL-2.0-only.drm/apple: offer a routed Type-C connector the CRTC its atomic check accepts. No change in behaviour: a routed port's connector is offered the pipeline driving it, on ordered dual-stream machines too, as on the base, now through one helper (dcp_fabric_routed_crtc_mask()). A route does not follow another CRTC at a modeset, so that is whatapple_connector_atomic_best_encoder()accepts; a stream's next attachment publishes its new mask before the hotplug that reports it. The pairing replay checks this against the production atomic check at every attachment.drm/apple: tie a lost present to the display it was begun for. Each present keeps the Type-C attachment it is for (the detach count,iomfb_present_begun_h17p()); its retirement compares that with the count then. A stuck present of the display attached now is retrained as before. Commit 22 moves where the attachment is read.thunderbolt: apple: let appledrm queue a DCP call under a DP IN binding's admission.apple_dp_tunnel_binding_call()runs a function under the DP IN adapter's lock while the binding is live, else returns-ESTALE. The binding's revocation takes the same lock.drm/apple: queue a tunnel connect's DPTX calls under its binding's admission.dcp_dptx_send_gated(). For a Thunderbolt tunnel's connect, that runs it insideapple_dp_tunnel_binding_call(), so a revocation comes before the call, which is refused, or after it. The reply is waited for outside, as DCP's Activate for the binding takes the provider's lock.drm/apple: free a held firmware-27 T8132 dcpext port on the firmware's answer.dcp_dptx_release_locked()): a gone tunnel's release that times out holds the port; one not sent or refused is owed to the next release, and a later connect sends it first.hpd_mutexonly. A connect does not use a held port and does not wait for it.dcp_t8132_port_work()runs on each late answer, the DPTX service's publication and a repeated request for the attached tunnel, and connects the display attached meanwhile from the reconnect work, for the session attached now. A CRTC turned off is not woken. Commit 20 replaces how it decides the release was answered.drm/apple: free a held firmware-27 T8132 port only on its release's own answer.afk_service_call_ticket(),afk-ticket.h): sending numbers it, a timeout that keeps the slot makes it LATE, and the late reply of that command, not of any other, makes it DONE or REFUSED.dcp_t8132_settle_locked(), underhpd_mutex, ends the hold on that ticket alone: carried out, the port is free; refused, the release is owed and the next connect sends it before any connect call, as often as the dock asks, until one goes through. Another call's answer, an older release's, a run of the work or a free slot never ends it. The release that takes the hold settles at once too, for an answer that came before it.drm/apple: keep the T8132 port work off from unbind to the next bind. The work is disabled at probe, enabled at bind and disabled synchronously at unbind, as the other Type-C works: nothing queues it after unbind, and it never runs after the DCP is freed. The bind queues it once, which takes an answer that came meanwhile from the ticket.drm/apple: carry a present's attachment from its SwapStart. The attachment is read when the host starts the present and carried in the SwapStart's cookie to its answer, so a present started before a detach and answered after a replug is still the display's that went. The watchdog decides and retrains underhpd_mutex, where a detach counts itself.drm/apple: queue a compact DPTX call under its tunnel binding's admission. The M4 backend's compact transport commits a message with its first fragment: that fragment is written through the same gate, one ring write per try, and the wait for ring space is outside the admission. A refused first fragment sends nothing, so no message is left half sent.drm/apple: hold a firmware-27 T8132 port for an owed release sent again.dcp_dptx_release_locked()), also once the replacement tunnel is bound and its connect sent it. Before, it held only while no tunnel was bound: with the replacement bound the timeout was returned, the port stayed usable and the release stayed owed, so the dock's next request sent another release and a connect while the first was still with the firmware.drm/apple: stop a connect when a late refusal leaves its release owed: stopsdcp_dptx_connect_raw()with-EBUSYifrelease_owedremains set afterdcp_dptx_release_locked(), when a timed-out owed release settles with a late refusal before returning (clearing the port hold while leaving the release owed).9cd5ca8a28b4(Merge remote-tracking branch 'origin/j713-dcpext/air-dcpext-272' into fix/t8132-fw27-dock-displays): resolves theafk.cmerge conflict with#2673'stx_lockserialization by splittingafk_epic_publish_locked()andafk_epic_ring()underep->tx_lock, takingep->tx_lockbeforedcp_dptx_send_gated()inafk_send_command_common(), and holdingservice->lockinafk_command_enqueue()through ring publication only, plus updatingt8132-v27-connect-tests.py,dock-display-replug-tests.py, andapple-afkv2harnesses to match.ed123f155c18(Merge branch 'main' into fix/t8132-fw27-dock-displays): mergesmain(c948713c6403, carrying#2673,#3655, and#3939) intofix/t8132-fw27-dock-displays, dropping the removeddcpext_scanout_*hooks fromdcp_dptx_connect_raw()anddcp_dptx_release_locked(), reconcilingiomfb_retire_dropped_present_h17p()with#3655's sharediomfb_retire_present_locked_h17p()while preservingiomfb_present_begun_h17p()attachment tracking,iomfb_present_lost(),dcp_swap_watchdog_keep(), anddcp_swap_watchdog_cancel(), keepingmain'sdcp_typec_fw_unplug_wait()+_dcp_poweroff(dcp, pipe_unplugged)indcp_poweroff()alongsideiomfb_present_lost(dcp, true), preserving both the AFK ticket fields andmain's T6030 sleep stub (j516s_panel_service) inedid.py, and updatingdcp_dropped_swap_test.c,lifecycle.py, anddock-display-replug-tests.pyto match.c87da41ccaa0(drm/apple: validate service headers on late ticketed replies): records the expected standard service group/command and reply-length requirement onafk_service_call_ticket()commands and validates the late reply's length andepic_service_callheader (afkv2_service_header_ok()/afkv2_service_reply_size()afterdma_rmb()) inafk_late_ticket_state()before marking the ticketAFK_TICKET_DONE(invalid replies mark itAFK_TICKET_REFUSED), updatesrecovery.pyforafk_epic_publish_locked(), and adds late service-header negative tests toextract-send.py.What does not change
dcp_is_t8132_ext()anddcp_t8132_ext_hw(). Its release and HPD-low handling, and its compact orphans, are as before; its teardown wait is woken by events instead of polling in 50 ms slices, with the same bound. The main device has no connector for the dcpext ports, so the connector masks do not reach them. Its tunnel connect's compact calls are now queued under the provider's admission (commit 23).Behaviour changes beyond the M4 Air on 27.2
-EOPNOTSUPP.hpd_mutex; on#3655's unplugged-session path,iomfb_end_unplugged_session_h17p()retires it immediately or leaves it to the watchdog.Related. The Thunderbolt half of the same dock replug is a separate open PR,
#3269(targetingmain, not yet onmain). It holds the shared-rate DP re-link while the display reads its DPRX. Neither PR needs the other to build or to pass its tests. Both are needed for a two-monitor dock to light reliably across a replug. The hardware row should name whether it ran this PR alone or together with#3269, and record both SHAs if a J713 dock trial uses a combined build.Evidence
main(c948713c6403, carrying#2673,#3655, and#3939) intofix/t8132-fw27-dock-displaysated123f155c18, followed byc87da41ccaa0(drm/apple: validate service headers on late ticketed replies).c87da41ccaa0:kb run -p linux-j713andkb run -p linux-j716c,LLVM=1): exit0(Image.gz,dtbs,modules.tar.zst,7.3.0+).W=1arm64 compile (aurora_defconfig,LLVM=1,drivers/gpu/drm/apple/{afk,apple_drv,dcp-fabric-core,dcp-fabric,dcp,dptxep,iomfb}.o,drivers/thunderbolt/apple.o):0errors,0warnings indrivers/gpu/drm/apple/*andapple_dp_tunnel_binding_call()(only pre-existing kernel-doc warnings onapple_cioandapple_nhiindrivers/thunderbolt/apple.c).679 passed, 3 skipped, 0 failedacross all 4 suites):drivers/gpu/drm/apple/tests/display.kunitconfig:205 passed, 1 skipped(apple_g17_rx_util_min_test, needsCONFIG_UCLAMP_TASK),0 failed;drivers/gpu/drm/apple/tests/.kunitconfig:117 passed, 0 failed;drivers/gpu/drm/apple/tests/topology.kunitconfig:235 passed, 1 skipped, 0 failed(includes allapple-dcp-dropped-swap#3655tests);drivers/thunderbolt/.kunitconfig.apple-dpin:122 passed, 1 skipped, 0 failed(thunderbolt+apple-dpin-lifecycle).python3 -I tools/asahi/run-host-tests.py --only ...):t8132(6/6),dock-display(1/1),dual-stream(1/1),tunnel-route(1/1),dcpext26(23/23),dptx(10/10),tiled-split(2/2), andapple-afkv2(2/2, gcc + clang, including the new late service-header cases) —46/46 passed.apple-dcp:edid(4/4includingservice-rebind),boot(6/6),rate(5/5),m4(9/9),audio(2/2), andlifecycleDCP cases (physical-disconnect,fast-replug-bounce,stale-crtc-poweroff,dropped-swap-teardown, etc.,32/37) pass; remainingapple-dcplifecycle(5),phy(7/14), anddisplay(22/24) failures are pre-existing onmainunder hostclang23-Werror.t8132-v27-connect-tests.py:30negative controls passed,38scenarios passed;dock-display-replug-tests.py:10negative controls passed,9scenarios passed;dual-stream-pairing-tests.py:9negative controls passed,29scenarios passed;t8132-v27-tunnel-tests.py:3negative controls passed,5targets passed;tunnel-route-tests.py:4negative controls passed.git merge-tree --write-tree origin/main HEAD: clean (1ae6e2862cefc661e21525b17a675da97c4eb40b,0conflicts).git diff --check origin/main..HEAD: clean (0errors).scripts/checkpatch.pl --strict --git c87da41ccaa0~1..c87da41ccaa0:0errors,0warnings,0checks;drivers/+include/diff has0errors and 1 pre-existing new-file MAINTAINERS warning forafk-ticket.h, already covered bydrivers/gpu/drm/apple/.c87da41ccaa0:M5 Max,T6050, firmware27.2, default cmdline +watchdog.open_timeout=120, chained trial Stage 2, no external display attached): composite8d250d354c97(origin/maind3de772ac0c1+#3717,#3398+#3410,#3409,#3273c87da41ccaa0,#3289,#3359;afk.cconflict with#3398resolved by addingallow_closedtostruct afk_compact_fragment): booted cleanly to desktop (0Oops/WARN/BUG/Call trace;err+lines:avdprobe-2,M5 bare-metal bootstrap EPROBE_DEFER,systemd-gpt-auto-generatorpair, boot-timeapple-dcp ... AFK ... unable to match service; failed units:aurora-peripherals.servicealso on default, plusspeakerguardd-v2-switchtest.service), and3xeDP-1DPMS off/on restored3456x2234cleanly (0Oops/WARN;open_ioav_gated(): IOAVVideoInterface open failedfirmware syslog line on each DPMS-on, not compared against stock). Stopped ons2idle(rtcwake -d /dev/rtc1 -m freeze -s 10, did not wake — matches knownmainbehaviour where RTC wake froms2idlerequires a key press); no external display was attached (DP-1..6disconnected), so#3273-specific external-display and deep-sleep checks remain unrun.M4 Air,T8132, firmware27.2): composite25e08d2ee142(origin/maind3de772ac0c1+#3717,#3273c87da41ccaa0,#3289,#3300,#3359,#3409) built cleanly (kb run -p linux-j713,352 s, exit0,CONFIG_DRM_APPLE_DCP_T8132=y); hardware pass not run (J713 currently off-network).ed123f155c18merge):M4 Air,T8132,27.2) at9cd5ca8a28b4(standalone build; Linux7.3.0, battery 50% to 43%, default command line, GRUB one-shot + one-shot Stage 2 carryingt8132-j713.dtb, no dock or external display attached):DP-1toDP-4present,disconnected);eDP-1connected and enabled;0failed units,0AppArmor denials,0Oops/WARN;errlines = baseline3(no-ENODEVlines).s2idlex2 (rtcwake -m freeze -s 15); 1x deep suspend/resume (rtcwake -d /dev/rtc1 -m mem -s 20,suspend_statssuccess3,fail0, no reset); after the deep sleep one extraerrline,apple-sleep ... 302600000.gpu stop reported 1; physical sleep completed, which the default kernel logs after its own deep sleep too.M5 Max,T6050, firmware27.2, AC, default command line, default Stage 2, no dock or external display attached) at9cd5ca8a28b4merged with#3662(37a19f92f82b, now onmain): boots to desktop, 4xeDP-1DPMS off/on andpm_test=devicessuspend/resume returned to3456x2234@120,vkcube --c 240 --wsi waylandclean on BorealisApple M5 Max (G17C B1), 1 failed unit (aurora-peripherals.service, same as default), 0 LSM denials, 0 GPU/MMU faults or Oops/WARN.7f21093a0d31— J713 (M4 Air,T8132,27.2) in candidate37edba02c535(j713-dcpext/air-dcpext-272fd3dc16c121b+#32737f21093a0d31+#32972b1bab104938+#33004b09f0691c2d, without#3269, default command line +panic=10, no dock or external monitor attached): clean boot (0failed units,0AppArmor denials, 3 baselineerrlines), 3 DPMS off/on cycles before and after sleeps, 20 ss2idlePASS,deepsleep PASS.