Repository navigation
iommu/apple-dart: cio: release the clock protection of every removed port DART - #3962
Draft
themartiano wants to merge 1 commit into
Draft
themartiano wants to merge 1 commit into
themartiano wants to merge 1 commit into
Conversation
…port DART A wake sets the clock protection slice of each USB4 port DART again. apple_dart_cio_release() clears it before the port's ACIO drops the DART's power domain, but only on the J714s and J716c. The J713's ports have the same slices, set by the same apple_dart_cio_on(), and nothing clears them when the cable goes. Measured on an older tree without this release: a J713 hung hard in 5 of 5 runs (no panic, watchdog reset) when a Thunderbolt display was unplugged during a suspend, right where ACIO removes its DARTs and drops its domains. With the slices cleared there (0x12 -> 0x2) it survived that, the same unplug in a real deep sleep, and an unplug after one. Whether a DART has such a slice is what its apple,clock-protection property says, so use that and drop the machine list. The driver cannot be unbound, so the DARTs removed are the ones an ACIO host depopulates. On the J713 that adds both ports' NHI and PCIe-C DARTs. On the J714s and J716c only the two DARTs the list already admitted have the property. No other device tree has it. Signed-off-by: Eduardo <git@martiano.me>
This was referenced Dec 2, 2026
This branch has not been deployed
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.
What: A wake sets the clock protection slice of each USB4 port DART again.
apple_dart_cio_release()clears it before the port's ACIO drops the DART's power domain, but only on the J714s and J716c, picked by machine name. The J713's port DARTs have the same slices, set by the sameapple_dart_cio_on(), and nothing clears them when the cable goes. The first unplug after a docked sleep then gates a guarded domain and the machine hangs. This drops the machine list: the DART's ownapple,clock-protectionproperty decides.Overlaps #2441 (draft, open): it rewrites the same two machine-name lines in
apple_dart_cio_atc_port()to a T6050 hardware check. This PR deletes that function, so the two conflict inapple-dart-cio.c, and #2441's hunk is no longer needed with this PR. #2441 alone would keep the release T6050-only, so the J713 would still hang. #2441's head already conflicts with main in six other files.Tested: Host side at the head, on main 30c1870. KUnit
apple-darton arm64 QEMU with CONFIG_APPLE_DART_J713_DCP=y: 50/50, including the newapple_dart_test_cio_release. With main'sapple-dart-cio.cunder the same test, the new case fails (49/50). The suites CI picks,apple-dartandjpeg, pass as CI runs them (40/40 and 15/15), but CI'sapple-dart.kunitconfigdoes not set CONFIG_APPLE_DART_J713_DCP, so it skips the new case together with the other J713 host DART cases. Host testsrun-host-tests.py --only cio5/5 and--only dart24/24, the same as main. arm64 W=1 LLVM 20 build ofdrivers/iommu/: 0 warnings. checkpatch --strict: clean. Hardware, measured on an older tree, not at this head: J713 on 26.6.2, Thunderbolt display unplugged during a suspend (pm_test=platform): 5 of 5 hard hangs (no panic, watchdog reset) without a release; with the slices cleared (0x12 -> 0x2) it survived that, the same unplug in a real deep sleep, and an unplug after one. The two arms differ by more than this change; a no-fix A/B on one kernel was not run. This commit is in our7.3.0 next4test kernel (main ba12094 plus this and other open branches; the files it touches are the same on today's main). A row at this head is not yet run.Risk: two-way · J713 (both USB4 ports). J714s and J716c: the same two DARTs as before, only the log text changes ("T6050:" becomes "CIO DART").
Other Macs: The release runs on every Mac when a DART is removed, but it returns at once for a DART without
apple,clock-protection. On main that property is in exactly three trees. J713: the NHI and PCIe-C DARTs of both USB4 ports (slices 14, 15, 18, 19) are new here. Its DCP and display DARTs also have the property, but the driver cannot be unbound (suppress_bind_attrs) and nothing depopulates them, so they are never removed. J714s and J716c: onlyacio2_dartandapciec2_darthave it, the two the machine list already admitted, so nothing changes for them. No other tree has the property, so no other Mac runs the clearing. A Mac that gets slices in its tree later (the J715, for example) is covered without a code change.Not yet: J713 rows at this head: an awake unplug before any sleep (both DARTs log
nothing to clear); docked deep sleep, wake, unplug (PS_PROT slice 18/19 0x12 -> 0x2, machine stays up); unplug during a deep sleep; replug with display, USB and PCIe back. A J714s or J716c regression row (one docked sleep with an unplug after it).Details
apple_dart_cio_atc_port()(machine names plus the parent's name or compatible) is deleted.apple_dart_cio_release()now runs for any DART with a clock-protection slice (dart->cio). Its place inapple_dart_remove()and the order (streams disabled and TLB flushed first, then the slice cleared, then the domain may go off) are unchanged.tb-cio-sleep.c): this one stops a hang, those shorten a wait and handle a case not seen on hardware. They touch different files and each applies alone.Evidence
tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/iommu/apple-dart.kunitconfig --kconfig_add CONFIG_APPLE_DART_J713_DCP=y 'apple-dart*'(clang 23.1.5): 50/50. The same withdrivers/iommu/apple-dart-cio.ctaken from main:apple_dart_test_cio_releasefails, 49/50 (main's machine check faults on the test DART, which has no DT node).scripts/ci/apple-kunit.py planpicksapple-dart jpeg;run:apple-dart40/40,jpeg15/15. That config leaves CONFIG_APPLE_DART_J713_DCP unset, so the new case is not in those 40.tools/asahi/run-host-tests.py --only cio: 5/5 (atc-cio-sleep,cio-native,dart-cio-owner,dart-cio-power,tb-cio-sleep);--only dart: 24/24. Main: the same.make O=<dir> LLVM=/usr/lib/llvm20/bin/ ARCH=arm64 olddefconfigfrom our J713 test kernel's config (7.3.0-0.next3), thenW=1 drivers/iommu/(clang 20.1.8): 0 warnings;apple-dart.obuilt (it includesapple-dart-cio.c).scripts/checkpatch.pl --strict -g main..HEAD: 0 errors, 0 warnings, 0 checks.apple,clock-protectionon main 30c1870:t6050-j714s-sleep-soc.dtsi(2 nodes),t6050-j716c-sleep-devices.dtsi(2),t8132-j713.dts(10:dcp_dart,disp0_dart,usb4_0/1_dart,usb4_0/1_pcie_dart,dcpext0/1_dart,dispext0/1_dart). No other tree.git merge-treewith this branch conflicts inapple-dart-cio.c(new) and in the six files where T6050 sleep: select usb/phy/thunderbolt/pci/iommu/nvme handling by hardware, not board #2441 already conflicts with main.