Repository navigation
iommu/apple-dart: keep page tables after a failed invalidate at root retire - #546
Merged
DjDeveloperr merged 1 commit intoOct 28, 2026
Merged
Conversation
…retire On DARTs with a firmware root mirror or handoff, retiring a locked root runs a range invalidate of the slots Linux published. apple_dart_hw_unmap_locked_ttbr() dropped its result, returned 0 and cleared the root. The invalidate that apple_dart_domain_free() checks afterwards then found no root, issued no command and returned 0, so the domain's page tables were freed even after a TLB timeout, while the hardware could still cache translations through them. Before the handoff DARTs took that path, a whole-stream flush there returned the error and the page tables were kept. Return the first retire-time invalidate error, and remember it per stream on the DART. apple_dart_domain_free() keeps the page tables when its own retire or invalidate fails, and also when a consumer release or an attach rollback retired the root first and its invalidate failed. The remembered error is never cleared, because only the hardware could show that the TLB no longer holds those entries; later domains on that stream keep their page tables too. The host fixture now builds apple_dart_hw_unmap_locked_ttbr(), apple_dart_release_device() and apple_dart_domain_free(), and forces the TLB command to time out for a direct free, a release before the free and a rollback before the free. Each keeps the page tables, and the timeout cases fail on the old code. A comment in apple_dart_check_fw_map() now says the firmware leaf is checked, because only the root entry is snapshotted. The message of ff5c39a ("iommu/apple-dart: keep stream invalidates out of handed-off slots") also lists resume as a user of the stream invalidate, but apple_dart_resume() returns early for locked DARTs, and handoff requires a locked DART, so resume never reaches it. In this tree the fixture also stubs apple_dart_has_borrowed() and the DCP domain fields that apple_dart_release_device(), apple_dart_t8110_hw_invalidate_tlb() and apple_dart_domain_free() read; no borrowed display root is involved in these cases. Signed-off-by: DjDeveloperr <[email protected]> (cherry picked from omacom/linux-aurora commit 07d64c6)
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.
Mirror of the review fix on omacom/linux-aurora#235 (commit 07d64c6 there), so both trees keep the same DART handoff code.
On DARTs with a firmware root mirror or handoff, retiring a locked root runs a range invalidate of the slots Linux published.
apple_dart_hw_unmap_locked_ttbr()dropped its result and cleared the root. The invalidate thatapple_dart_domain_free()checks afterwards then found no root, issued no command and returned 0, so the domain's page tables were freed even after a TLB timeout.apple_dart_hw_unmap_locked_ttbr()returns the first retire-time invalidate error, and the DART remembers it per stream (locked_retire_err).apple_dart_domain_free()keeps the page tables when its own retire or invalidate fails, and also when a consumer release or an attach rollback retired the root first and its invalidate failed.Testing:
tools/asahi/apple-dart-fw-tests.py: 73/73. The newretire-*cases force the TLB command to time out for a direct free, a release before the free and a rollback before the free; each keeps the page tables, and the timeout cases fail on the old code. In this tree the fixture also stubsapple_dart_has_borrowed()and the DCP domain fields.APPLE_DART_KUNIT_TEST): 25/25.The cherry-pick applied without conflicts. The commit message notes that ff5c39a's message lists resume, which never reaches the stream invalidate for a locked DART.