Repository navigation
drm/agx: current badapple driver; pick the backend from the loaded firmware - #105
Merged
Merged
Conversation
Since the snapshot this driver was imported from, badapple's driver has: - queued a render's 3D job behind a barrier on its TA job's stamp, which the firmware resolves itself, instead of the driver kicking the 3D job when it sees the TA stamp; render stamps now count up by 0x100 per job, as Apple's do, and RegionC +0x8970 makes the scheduler poll a waiting barrier; - capped the GPU at pstate 4 (740 MHz) by default, about half the power of the top 1098 MHz, since nothing throttles it for heat (agx.max_pstate=1..6); - kept renders within 8192x4096 macrotiles, as twice that wedges the firmware; - dropped its debugfs dump. [Orchard: from kiki/badapple@74ef26a patches/linux-0020-agx.patch (badapple c6db02f, eead4b9, d64625b, 1c6d6e0); merged into the driver that carries dr1408's 21B91 backend: that path keeps its own stamps (agx21_render_rewrite()) and the fixed DONE_STAMP in the shared TA/3D builders, so only the 20G81 path changes.] Assisted-by: LLM
The driver speaks two GPU firmware builds: badapple's 16.6.1 (20G81), the XS Max's and, byte for byte, the XR's, and dr1408's 17.1.1 (21B91), the iPad 8's and, byte for byte, the XR's. A module parameter defaulting to 21b91 chose between them for every board, so a board handed the other build would start the wrong backend. Recognise the build from the firmware itself: the SHA-256 of its 0x44000-byte __TEXT segment, which iBoot loads at firmware address 0 and m1n1 reserves (apple,segment-ranges), against the two known builds. The Mach-O header with its UUID is not in a loaded segment, so the code itself is the fingerprint. agx.firmware still overrides; without a match the board's apple,firmware-build decides, else 20g81, the build badapple runs. Assisted-by: LLM Signed-off-by: Henrik Klee <henrik@goat-code.com>
The iPad 8 is given 17.1.1's GPU firmware (21B91). The driver recognises the build from the loaded firmware; apple,firmware-build is its fallback when it cannot, so the iPad 8 never falls back to the XS Max's 20G81. Assisted-by: LLM Signed-off-by: Henrik Klee <henrik@goat-code.com>
henrikklee
pushed a commit
to ricktav/linux
that referenced
this pull request
Dec 4, 2026
The ANS storage controller of the A9 and A10 loses power with its PCIe port in system sleep. nvme_suspend() shuts such a controller down but leaves CC.EN set, and power cycling the port of a controller in that state hangs the SoC. Stop it the way iOS does (AppleEmbeddedNVMeController on sleep: freeze the queue, shut the controller down, keep no state). With the I/O queues drained and the NVMMU idle, send the shutdown notification and require it to complete, then clear CC.EN, wait for RDY to drop, take the controller off the bus and retire every NVMMU translation. Only then is the host told that the port may be powered off. Resume is the reset that follows any suspend, which brings the controller up as after boot. A stop that fails does not continue into sleep: the controller is reset and the suspend returns -EBUSY. The ANS host data selects this per SoC, for S8003 and T8010. [Orchard: from orchard PR OrchardLinux#117, commit 40a8b18d, and the stop it builds on from orchard PR OrchardLinux#105, commit d2247b1c. Left out: the kexec handoff, the cold reset and the diagnostics. The stop is selected by the ANS host data instead of the board's device tree, and the DART is saved and restored by its own PM callbacks.] Assisted-by: LLM Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com> Link: OrchardLinux/orchard#231 (comment)
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.
Part of the badapple import (https://forgejo.toe.quest/kiki/badapple @74ef26a). Nothing has run on hardware; with today's boot recipes nothing changes.
8047723b…, 21B91c63d55b5…, from the IPSWs), else the board'sapple,firmware-build, else 20g81 (badapple's). XR/XS/XS Max -> 20G81 (byte-identical firmware on XR and XS Max), iPad 8 -> 21B91 (t8020-ipad8.dtsi sets the fallback). Binding updated.Checked: full apple-16k kernel build (agx module, no warnings); all A12 DTBs compile; orchard test_source_* pass. Goes with OrchardLinux/mesa#45 (badapple Mesa refresh assumes this driver).