Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
c406b40
drm/asahi: pgtable: check the struct page of a table outside the rese…
jgoyvaerts Oct 24, 2026
bc9e3aa
drm/asahi: identify the T6040 GPU firmware by its loaded text
jgoyvaerts Oct 24, 2026
c3666fc
drm/asahi: test shared firmware identity normalization
RyanTheTide Oct 25, 2026
65a4c71
drm/asahi: admit the alternate T6040 loaded 25G83 image
RyanTheTide Oct 25, 2026
8926476
drm/asahi: use the loaded image to select identified firmware
RyanTheTide Oct 26, 2026
801d253
drm/asahi: build T6040 initdata from validated per-chip calibration
RyanTheTide Oct 26, 2026
f6f90b2
drm/asahi: remove single-unit T6040 power defaults
RyanTheTide Oct 26, 2026
3108613
drm/asahi: cover the T6040 firmware queue floor in QID tests
RyanTheTide Oct 26, 2026
20971ad
drm/asahi: require a compute stamp for record fallback across recovery
RyanTheTide Oct 27, 2026
0a14291
drm/asahi: retain recovery progress when slot keys are unknown
RyanTheTide Oct 27, 2026
62c7346
drm/asahi: preserve firmware blame when any selected slot lacks identity
RyanTheTide Oct 27, 2026
e35e0e4
drm/asahi: initialize the G17 idle hold from the existing DT policy
RyanTheTide Oct 27, 2026
d375201
drm/asahi: preserve raw G17 firmware reports for clock and fault qual…
RyanTheTide Oct 27, 2026
33c9504
drm/asahi: snapshot the blamed render before acknowledging GPU recovery
RyanTheTide Oct 27, 2026
fd2c52d
soc: apple: drive T6040 GPU memory demand from publication and contin…
RyanTheTide Oct 27, 2026
77e47cd
drm/asahi: pass an opaque device across the CLPC FFI boundary
RyanTheTide Oct 27, 2026
9ddc2c0
drm/asahi: expose firmware-managed GPU core power as a read-only view
RyanTheTide Oct 27, 2026
01626e9
drm/asahi: retain memory demand until both firmware processors stop
RyanTheTide Oct 27, 2026
8c4c250
drm/asahi: freeze render progress before acknowledging G17 recovery
RyanTheTide Oct 27, 2026
5b9d99a
drm/asahi: record halted tiler capacity alongside G17 recovery progress
RyanTheTide Oct 27, 2026
bd32934
drm/asahi: trace G17 input conversion and scheduler hop boundaries
RyanTheTide Oct 27, 2026
0dd07fd
drm/asahi: bound the G17 tail cache separately from 25G83 auxiliary s…
RyanTheTide Oct 27, 2026
7c43e06
drm/asahi: admit a third loaded T6040 25G83 image
fbalazsy Oct 26, 2026
2a6f92c
drm/asahi: g17: never report a busy fragment queue on 25G83
jgoyvaerts Oct 27, 2026
9cf3377
drm/asahi: g17: drop the 25G83 fragment barrier
jgoyvaerts Oct 27, 2026
926df5c
drm/asahi: retire a G17 render group on its pass record when its stam…
DjDeveloperr Oct 28, 2026
7f9213a
drm/asahi: g17: drop the completion thread's frequency boost while th…
DjDeveloperr Oct 28, 2026
622f153
drm/asahi: g17: say what the stampless render retirement relies on
DjDeveloperr Oct 29, 2026
9b2bbe0
drm/asahi: g17: count the stamp fallback from the drain of the comman…
DjDeveloperr Oct 29, 2026
02015c4
drm/asahi: Format the client usage accounting paths
RyanTheTide Oct 30, 2026
063a6b5
drm/asahi: Account per-client engine time in fdinfo
RyanTheTide Oct 30, 2026
dafa6d0
drm/asahi: Format the G17 statistics integration paths
RyanTheTide Oct 30, 2026
7cb914b
drm/asahi: Export qualified G16S and G17P statistics
RyanTheTide Oct 30, 2026
79943c9
drm/asahi: lock only the VM reservation for read-only VM queries
jgoyvaerts Oct 27, 2026
f8835ae
drm/asahi: lock only the VM reservation for VA updates
jgoyvaerts Oct 27, 2026
7dee754
drm/asahi: g17: stop cancelling behind a failed command once it has r…
jgoyvaerts Oct 28, 2026
a2c0451
drm/asahi: take only the VM reservation in drop_mappings_before()
RyanTheTide Nov 1, 2026
d395fa7
drm/asahi: g17: keep innocent clients alive across another client's r…
jgoyvaerts Oct 28, 2026
58f751e
drm/asahi: g17: cancel consumers of a failed producer whatever it fai…
jgoyvaerts Oct 28, 2026
de668d6
drm/asahi: g17: accept ray traversal on 25G83
jgoyvaerts Nov 2, 2026
2ceed5c
drm/asahi: g17: program the tiler's segment limits on 25G83
jgoyvaerts Nov 2, 2026
1827a50
drm/asahi: g17: double the render pool so a partial render can't starve
jgoyvaerts Nov 2, 2026
fe2e3b0
drm/asahi: g17: make room for the tiler's partial-render records
jgoyvaerts Nov 2, 2026
46915b7
drm/asahi: g17: write partial renders' depth and stencil words as mac…
jgoyvaerts Nov 2, 2026
62c237f
drm/asahi: g17: walk every tile in the last segment of a partial render
jgoyvaerts Nov 2, 2026
f0fd63f
drm/asahi: g17: partial-render ordinary passes on 25G83, as macOS does
jgoyvaerts Nov 2, 2026
3707c2a
drm/asahi: g17: keep the 25G83 tiling array's doc comment on its func…
RyanTheTide Nov 3, 2026
eba9f72
drm/asahi: admit the observed 16-core T6040 layout
notmysegv Nov 1, 2026
92faefe
drm/asahi: admit 16-core T6040 GPUs by topology
notmysegv Nov 4, 2026
6b3a5a2
drm/asahi: share T604x register-window constructors
astaff Oct 28, 2026
d0dd1d3
drm/asahi: add T6041 and the measured 25F84 firmware profile
astaff Oct 28, 2026
1784b45
drm/asahi: write T6041's tiler segment control on 25F84
astaff Nov 3, 2026
187e26b
drm/asahi: drop the unread G17 firmware version tag
RyanTheTide Nov 5, 2026
399c38f
drm/asahi: g17: blame the running VM, not a starved one, for a keyles…
jgoyvaerts Nov 3, 2026
6dbc572
drm/asahi: g17: keep another VM's recovery out of an innocent VM's st…
jgoyvaerts Nov 3, 2026
8619dc4
drm/asahi: g17: do not count a failed VM's leftover hangs as a restar…
jgoyvaerts Nov 3, 2026
b650ddc
drm/asahi: g17: keep work a recovery dropped out of the VM status
jgoyvaerts Nov 3, 2026
c7284af
drm/asahi: g17: fail exhausted replays without poisoning their VM
jgoyvaerts Nov 3, 2026
1ccbcab
drm/asahi: g17: keep a VM a recovery found guilty out of later spared…
jgoyvaerts Nov 3, 2026
a6dc07a
drm/asahi: g17: blame a guilty VM's running render over a started one
jgoyvaerts Nov 3, 2026
e7fa52b
drm/asahi: g17: M5: describe the M5 boards and refuse those without b…
DjDeveloperr Nov 5, 2026
ba77be3
drm/asahi: g17: M5: give M5 VMs sparse tiles, render pool mappings an…
DjDeveloperr Nov 5, 2026
0f51320
drm/asahi: g17: M5: build the M5 firmware's InitData graph
DjDeveloperr Nov 5, 2026
63f20eb
drm/asahi: g17: M5: back M5 render and compute pools with the M5 free…
DjDeveloperr Nov 5, 2026
9893ab0
drm/asahi: g17: M5: install M5 queues and submit through the host com…
DjDeveloperr Nov 5, 2026
45fad2a
drm/asahi: g17: M5: accept the M5 render and compute program UAPI
DjDeveloperr Nov 5, 2026
d336efb
drm/asahi: g17: M5: submit compute on M5 queues
DjDeveloperr Nov 5, 2026
990bbd2
drm/asahi: g17: M5: encode M5 render commands
DjDeveloperr Nov 5, 2026
b854cf8
drm/asahi: g17: M5: submit renders on M5 render pairs
DjDeveloperr Nov 5, 2026
4d1cd52
drm/asahi: g17: M5: Fix existing M5 Mesa losing the GPU device on sta…
funkzy Nov 6, 2026
aabf802
drm/asahi: g17: M5: add the opt-in M5 thermal governor
DjDeveloperr Nov 5, 2026
368b72b
drm/asahi: g17: signal a cancelled job's fence before drm_sched frees it
DjDeveloperr Oct 25, 2026
763b7c4
drm/asahi: g17: describe the M5 Max (J716c) HW data
erikwb Oct 31, 2026
d6c1f88
drm/asahi: g17: J716c: encode its own AON PTD records
erikwb Oct 31, 2026
acad0f4
drm/asahi: g17: probe the M5 Max (J716c)
erikwb Oct 31, 2026
e4aa838
drm/asahi: g17: J716c: use its 8 MiB render blocks
erikwb Oct 31, 2026
cea200b
drm/asahi: g17: carry the minimum parameter-buffer size in renders
erikwb Oct 31, 2026
2a3f88f
drm/asahi: g17: M5: reinstall a compute queue the firmware killed wor…
erikwb Nov 1, 2026
42fdf07
drm/asahi: g17: M5: keep the firmware's blame for a GPU MMU fault
erikwb Nov 1, 2026
55f29e2
drm/asahi: fwid: Prepare firmware identity for two-role GPU images
funkzy Nov 5, 2026
ce1a38b
drm/asahi: g17: M5: Prepare the M5 graph's board values for a third b…
funkzy Nov 5, 2026
a8deaa4
drm/asahi: t6050: Support the GPU on the bare-metal M5 Ultra (J775D)
funkzy Nov 5, 2026
874cc5b
drm/asahi: t6050: Refuse unknown M5 Ultra GPU firmware before use
funkzy Nov 5, 2026
aeb61e2
rust: drm: gem: shmem: Fix memory corruption on a foreign dma-buf import
funkzy Nov 5, 2026
ed4b877
drm/asahi: g17: M5: Fix the M5 Ultra GPU staying at its lowest clock
funkzy Nov 5, 2026
8bc252f
drm/asahi: g17: M5: Fix light work settling at low clocks on the M5 U…
funkzy Nov 5, 2026
5b64c11
drm/asahi: Fix refused M5 renders after 255 reuses of a context slot
funkzy Nov 5, 2026
e65fea1
drm/asahi: mmu: Fix Vulkan device creation failing on bare-metal M5 GPUs
funkzy Nov 5, 2026
42162cc
drm/asahi: g17: M5: Give the M5 Ultra GPU its 3500 us idle standby delay
funkzy Nov 5, 2026
e219492
drm/asahi: g17: M5: Give the M5 Ultra's GPU boost its 20% idle tolerance
funkzy Nov 5, 2026
8d1f232
drm/asahi: g17: M5: Fix the Ultra power policy ignoring die 1's sensors
funkzy Nov 5, 2026
c9216e1
drm/asahi: g17: M5: Fix the Ultra firmware seeing half its cache cont…
funkzy Nov 5, 2026
a091f37
drm/asahi: g17: Fix the M5 Ultra thermal governor never seeing a temp…
funkzy Nov 5, 2026
9144c1d
drm/asahi: g17: Fix the M5 governor overriding fans userspace controls
funkzy Nov 5, 2026
1a08f40
drm/asahi: g17: Fix the M5 Ultra governor spinning the fans up early
funkzy Nov 5, 2026
d31655e
drm/asahi: g17: Fix large M5 render passes corrupting a client buffer
funkzy Nov 5, 2026
f91551c
drm/asahi: g17: M5: Run compute and render jobs on the bare-metal M5 …
funkzy Nov 5, 2026
fe3e38c
drm/asahi: g17: M5: Fix Ultra compute operand state sized for the M5 Pro
funkzy Nov 5, 2026
6ddfb67
drm/asahi: g17: Fix the recovery check of lockless submits on the T6041
funkzy Nov 5, 2026
bd9b8ba
drm/asahi: g17: Fix jobs succeeding on the output of a failed producer
funkzy Nov 5, 2026
086f288
drm/asahi: g17: M5: Fix waited-on work running at the lowest busy clock
funkzy Nov 5, 2026
1cf7b42
drm/asahi: g17: Fix false timeouts of M5 work behind its own context
funkzy Nov 5, 2026
c842bac
drm/asahi: t6050: Prepare M5 compute queue installs for bare-metal co…
funkzy Nov 5, 2026
783696d
drm/asahi: g17: Fix M5 Ultra compute dispatch encoded for four clusters
funkzy Nov 5, 2026
3309918
drm/asahi: g17: Fix M5 Ultra compute jobs waiting on another context
funkzy Nov 5, 2026
d1cfc73
drm/asahi: g17: Fix M5 Ultra compute jobs of one queue overlapping
funkzy Nov 5, 2026
d7f9279
drm/asahi: g17: Fix M5 Ultra compute jobs carrying no per-queue count
funkzy Nov 5, 2026
18cdc54
drm/asahi: g17: Fix large M5 heaps colliding with the driver's ring a…
funkzy Nov 5, 2026
27da4ea
drm/asahi: g17: Fix every compute job timing out on the M5 Ultra
funkzy Nov 5, 2026
c026391
drm/asahi: g17: Fix compute scratch leaking across processes on queue…
funkzy Nov 5, 2026
7c7b892
drm/asahi: g17: M5: Give M5 Ultra renders the Ultra's 16 GiB render pool
funkzy Nov 5, 2026
822c573
drm/asahi: g17: Reduce M5 job completion latency
funkzy Nov 5, 2026
ff8924e
drm/asahi: g17: Fix M5 Ultra faults when a tiling stage is resumed
funkzy Nov 5, 2026
89fea83
drm/asahi: g17: Leave the M5 Ultra's GPU-owned tiler state to the GPU
funkzy Nov 5, 2026
2147fc7
drm/asahi: g17: Match the M5 Ultra's tiling queue seed on rebinding
funkzy Nov 5, 2026
f2dee13
drm/asahi: g17: Fix M5 Ultra fragment kicks missing an ordering depen…
funkzy Nov 5, 2026
c974ddb
drm/asahi: g17: Fix M5 renders with many attachments being refused
funkzy Nov 5, 2026
a97dbd9
drm/asahi: g17: Prepare M5 render encodings for per-board selection
funkzy Nov 5, 2026
7c5b6ca
drm/asahi: g17: Fix GPU firmware restarts during M5 Ultra renders
funkzy Nov 5, 2026
ac66999
drm/asahi: g17: Fix M5 Ultra render passes flagged as recycled passes
funkzy Nov 5, 2026
6c82064
drm/asahi: g17: M5: Support parameter-buffer growth on the M5 Ultra
funkzy Nov 5, 2026
2b6b2ba
drm/asahi: g17: M5: Fix M5 misreading firmware event 7 as a compute f…
funkzy Nov 5, 2026
3cdd1e0
drm/asahi: g17: M5: Fix spurious and delayed kills of M5 contexts
funkzy Nov 5, 2026
b74b4fa
drm/asahi: g17: Fix M5 renders failing after their render pool grows
funkzy Nov 5, 2026
fa1c8f9
drm/asahi: g17: M5: Fix freeing memory the M5 GPU may still write at …
funkzy Nov 5, 2026
e8cff84
drm/asahi: g17: M5: Fix compute queues wedging on a full work ring
funkzy Nov 5, 2026
c2de598
drm/asahi: g17: M5: Fix M5 renders silently dropping their ray queries
funkzy Nov 5, 2026
b2275b1
drm/asahi: g17: Prevent M5 firmware crashes from InitData objects M5 …
funkzy Nov 5, 2026
b02044b
drm/asahi: g17: M5: Fix M5 power timeouts under a longer idle delay
funkzy Nov 5, 2026
4696f20
drm/asahi: g17: Fix GPU jobs that never retire after out-of-order sub…
funkzy Nov 5, 2026
42a61cd
drm/asahi: g17: Fix M5 submissions stalling when the shared work ring…
funkzy Nov 5, 2026
354fb5c
drm/asahi: g17: Fix restart-cancelled M5 compute jobs reporting success
funkzy Nov 5, 2026
048c8f5
drm/asahi: g17: Fix M5 compute timeouts judged by an early record
funkzy Nov 5, 2026
3b454f0
drm/asahi: g17: Fix freeing render state the M5 firmware still links
funkzy Nov 5, 2026
1c7e729
drm/asahi: g17: Fix skipped or repeated GPU effort updates on M5
funkzy Nov 5, 2026
3636a24
drm/asahi: g17: Fix M5 compute jobs failing with EBUSY when clients c…
funkzy Nov 5, 2026
4a3b9e3
drm/asahi: g17: Fix out-of-memory kills when many M5 compute clients …
funkzy Nov 5, 2026
59f2054
drm/asahi: g17: Fix M5 renders refused while their context changes pair
funkzy Nov 5, 2026
84b302e
drm/asahi: g17: Fix M5 GPU recovery failing or completing the wrong job
funkzy Nov 5, 2026
4f2b1cc
drm/asahi: g17: Fix M5 renders retiring before their writes land
funkzy Nov 5, 2026
d6a894d
drm/asahi: g17: Fix the M5 recovery log claiming listed jobs fail
funkzy Nov 5, 2026
9d19a84
drm/asahi: g17: M5: Fix slow kills of hung jobs after other clients f…
funkzy Nov 5, 2026
02aed39
drm/asahi: g17: M5: Fix M5 GPU completions being handled at a lowered…
funkzy Nov 5, 2026
2424dca
rust: workqueue: Let drivers queue work near a CPU, for 15% faster M5…
funkzy Nov 5, 2026
99062a7
rust: drm: sched: Let drivers place scheduler work, for 4% faster M5 …
funkzy Nov 5, 2026
e277e03
drm/asahi: g17: M5: Make M5 Ultra GPU jobs complete up to 20% faster …
funkzy Nov 5, 2026
e943aa8
drm/asahi: g17: M5: Fix one client's binds being able to crash the GP…
funkzy Nov 5, 2026
e746e4c
drm/asahi: g17: M5: Fix hung GPU work running on with no time limit
funkzy Nov 5, 2026
b27413a
drm/asahi: g17: Fix a process keeping access to a GPU queue after ano…
funkzy Nov 5, 2026
693a80a
drm/asahi: g17: Fix a released context's QoS entry pointing at memory…
funkzy Nov 5, 2026
4116a70
drm/asahi: Fix client binds silently replacing the kernel's GPU mappings
funkzy Nov 5, 2026
c8bf2ec
drm/asahi: g17: M5: Fix compute jobs overrunning their scratch pool
funkzy Nov 5, 2026
d7f31a4
drm/asahi: g17: M5: Fix one client exhausting system memory through G…
funkzy Nov 5, 2026
daee276
drm/asahi: Fix one client taking every GPU queue from the others
funkzy Nov 5, 2026
84b92fc
drm/asahi: mmu: Fix sparse tiles wasting 2 MiB of contiguous memory p…
funkzy Nov 5, 2026
23ea331
drm/asahi: pgtable: Fix a bad firmware table pointer making the drive…
funkzy Nov 5, 2026
a2f2b85
drm/asahi: g17: M5: Fix GPU jobs being able to write the kernel's com…
funkzy Nov 5, 2026
5517f34
drm/asahi: g17: Fix clients rewriting submitted GPU commands after th…
funkzy Nov 5, 2026
ea0521c
drm/asahi: g17: Fix GPU job fences being able to stall memory reclaim…
funkzy Nov 6, 2026
6803e95
drm/asahi: g17: Fix the driver's KUnit tests failing to build after t…
funkzy Nov 6, 2026
443ee65
drm/asahi: g17: J716c: write the MCC mask and topology words
erikwb Nov 6, 2026
77cb173
drm/asahi: g17: J716c: apply its controller defaults
erikwb Nov 6, 2026
848ffc6
drm/asahi: g17: Run the M5 Max on bare metal
erikwb Nov 6, 2026
a6a0c74
drm/asahi: Match the T6050 GPU by its G17S compatible
erikwb Nov 6, 2026
f5deea4
drm/asahi: g17: log the MMU fault banks on recovery
jgoyvaerts Oct 30, 2026
d76e8cf
drm/asahi: introduce the complete T6040 calibration reader
RyanTheTide Oct 26, 2026
ad90cc6
drm/asahi: test the complete T6040 performance selector ladder
RyanTheTide Oct 26, 2026
2a41c94
drm/asahi: build the carried G17 and M5 work on integration/aurora
edimoldovan Nov 10, 2026
90b9e22
rust: task: add Task::tgid()
jahnavi-MN496 Jul 16, 2026
6a2b96d
drm/asahi: bound repeated timeout recovery and G17 mailbox stalls
RyanTheTide Oct 21, 2026
76767e3
soc: apple: mailbox: let a consumer set the receive thread's minimum …
DjDeveloperr Oct 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 55 additions & 2 deletions Documentation/ABI/testing/sysfs-driver-asahi-agx-stats
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,58 @@ Description:
`#[repr(C)]` on the Rust side and its offsets are asserted at
build time in `sysfs.c`; readers must parse `key value` lines and
must not assume binary layout of this file.
G17 firmware has no supported decoder for this snapshot format;
its file reports unsupported rather than fabricated zero counters.

G16S (T6040/V25G83) and G17P (T8140/V26A428) use a separate,
qualified snapshot. The G13/G14 output above is unchanged.
The following keys replace the legacy keys on these firmwares:

utilisation_status, pstate_status
Each is valid, stale, or unavailable. Numeric metrics
are printed only while their capability is valid;
otherwise their value is the string unsupported.

util_tiler_percent, util_renderer_percent, util_device_percent
Unsigned integer percent (0..100), from tag 0x13
words 3, 4 and 6 respectively (zero-based). Device
utilisation is independent of the overlapping engines;
it is never their sum. Each complete valid packet from
either role contributes one sample to a shared integer
mean, rounded down. Reads do not consume samples.
A packet with any value above 100 invalidates the whole
utilisation capability. Zero is a valid sample.

pstate Logical selector 0..10 from tag 0x10 word 6. Words 1
and 2 form a little-endian u64 firmware timestamp.
The first timestamp establishes a baseline. Invalid
selectors and backwards timestamps remove pstate
validity; timestamps are never extended across epochs.
P0 is a logical state, not a core-power measurement.

requested_frequency_hz, achieved_frequency_hz, busy_ns,
power_mw, temperature_raw
Always unsupported on these firmwares. The statistics
packet does not identify performance table A or B;
a selector is neither a host request nor a measured
frequency. No qualified busy-time duration, power unit
or temperature field is available.

The host uses a 16 ms age/averaging-window limit for V25G83 and
32 ms for V26A428 (two nominal periods). These are conservative
host policies, not firmware guarantees about packet duration.
The oldest contributing utilisation sample bounds its window.
A logical pstate has no qualified periodic-report cadence and
remains valid until a replacement or an epoch boundary; its
host receive time is retained in diagnostics, not used to invent
a periodic-report deadline.
Suspend/resume, restart, statistics-ring quarantine, observed
core gating and teardown end validity. After an epoch boundary,
each ring's already queued records are discarded before new
baselines are accepted. A quarantined statistics ring disables
both roles' exports until reprobe; a trace-ring error does not.

Reads take the device mutex and do not wake the GPU. The
firmware_reports debugfs view retains per-role raw packets,
counts and host monotonic receive times, plus capability status,
policy, timestamp and diagnostic tick deltas. Tick deltas are
never accumulated as GPU busy time. Firmware role streams are
merged in drain order without deduplication.
17 changes: 17 additions & 0 deletions Documentation/devicetree/bindings/gpu/apple,agx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,23 @@ properties:
- const: hw-cal-b
- const: globals

apple,clpc:
$ref: /schemas/types.yaml#/definitions/phandle
description: |
Host performance controller receiving GPU submission and idle demand.
GFX supplier power cannot represent GPU work on firmware that keeps
its coprocessor domain powered while the cores are idle.

apple,idle-off-delay-ms:
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 2
maximum: 1000
default: 2
description:
Continuous idle time before GPU power-off, in milliseconds. The G17
backend extends the firmware's native delay with its host idle-hold
control; an absent property preserves the native policy.

operating-points-v2: true

apple,firmware-abi:
Expand Down
72 changes: 72 additions & 0 deletions Documentation/gpu/asahi-g17-recovery-safety.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
G17 repeated-timeout containment
===============================

The 73f audit found workload-reachable host-liveness hazards. The journal
alone cannot attribute the observed machine reset to one of them; no hardware
reproduction is claimed here.

* Compute replay called Packet::check_dependencies with the device mutex
held. That routine used MAX_SCHEDULE_TIMEOUT. If an input needed completion
service taking the same mutex, the event worker could deadlock. Replay now
checks statuses without sleeping and fails an unexpectedly unmet dependency.
Initial publication waits off-lock in 10 ms cancellation/status-check slices,
with one absolute 2 s budget (10 s for a selected long submission).
* G17 mailbox receive drained an indefinitely replenished FIFO under rx_lock
with IRQs disabled. G17 now uses a oneshot threaded receive IRQ, consumes at
most 64 messages per pass, then sleeps 1-2 ms off-lock with the IRQ masked
when its budget is exhausted. The level condition retriggers without
discarding messages. Explicit receive polling has the same finite budget.
* G17 mailbox transmit without a send-empty IRQ could busy-poll for 500 ms
under tx_lock with IRQs disabled. Non-atomic G17 callers now sleep off-lock
between checks; an atomic G17 send polls for at most 1 ms. All sleeping
retries share a single 500 ms deadline, including contention between senders.
Removal, cookie, provider lifecycle and PM ownership gates are retained.
* Scheduler failure callbacks no longer synchronously join preparation leases
and RTKit receive work. They mark the runtime lost and queue the event worker.
Recovery joins preparation for at most 2 s. Runtime stop halts both firmware
producers first and joins preparation for at most 2 s before detachment.
If a builder remains stalled, its stopped firmware, graphs and reservations
remain owned in Shared::state. Timeout is never an ownership witness. That
path does not re-arm a polling loop; a later queued completion/owner return
may finish the stopped teardown. Explicit device shutdown still joins every
borrower before returning or releasing provider resources.
* Borrowed render graphs and off-lock queued retirements previously renewed
the watchdog without incrementing a render deferral counter. Both engines
now charge deferrals, and render transaction grace ends after eight polls.
Existing three replay credits remain finite and are never reset here.
* A per-device burst limit stops the runtime on the eighth actual scheduler
timeout in a 30 s window or the eighth restart handshake in a 30 s window.
VM changes, new publications, recovery generations and replay do not reset
those counters; terminal loss latches. The 30 s window contains eight
two-second expirations, including a stalled deferred timeout that cannot
complete its normal per-client settlement. This limits host recovery load even
when each individual handshake succeeds. Legitimate long jobs only consume
this budget after their independent bounded execution allowance expires.

Lock order remains stop -> state and state -> preparation wait/reclaim. All
preparation joins and deferred fence completion/destruction run outside state.
Runtime stop uses try_lock for the stop owner, avoiding a recursive join from
an off-lock fence callback. Receive callbacks only retain/copy ingress and
queue work; no firmware ring is polled while an IRQ spinlock is held without
a finite iteration/time bound on the G17 paths. RX acknowledgement is still
level-sensitive, and TX publication/removal remains serialized by tx_lock.

The existing control backpressure timer has 1,000 finite retries; its event
probes do not consume or reset that budget. Event-ring ingress is bounded by
EVENT_SLOTS; trace/statistics consume a snapshot producer. Render retirement
loops remove one retained tracker per successful iteration (or mark one as
accounted); compute replay consumes a retained replay per iteration. Shared
capacity deadlines remain absolute and failed fences do not release mappings
or return physical reservations. The new storm limits additionally bound
repeated recoveries and timeouts across those paths.

KUnit exercises 64 consecutive watchdog timeouts with recovery pending under
real state/preparation mutexes, a retained lease that must time out rather
than be freed, late lease return with failed admission still closed, restart
storms and nonblocking replay status checks. The mailbox tests use normal RAM
as never-empty RX and never-draining TX registers, invoking the production
poll/send functions for 64 RX passes and eight atomic TX timeouts plus a
sleeping TX timeout/removal control. The isolated Asahi scenario runs with
lockdep, PROVE_LOCKING and panic_on_warn. Software tests cannot establish
that physical fabric/firmware or the original reset is fixed; separately
controller-gated Neo qualification remains necessary.
80 changes: 80 additions & 0 deletions Documentation/gpu/asahi-usage-stats.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
.. SPDX-License-Identifier: GPL-2.0-only OR MIT

Asahi client engine time
========================

Asahi reports the following optional keys in each DRM file's fdinfo, following
:doc:`drm-usage-stats`::

drm-engine-vertex: 123456 ns
drm-engine-fragment: 234567 ns
drm-engine-compute: 345678 ns

``vertex`` is the tiling/vertex stage of render commands, ``fragment`` is their
fragment stage, and ``compute`` is compute dispatch. These are separate timelines:
vertex and fragment can overlap. There is no separately submitted blit engine in
the driver's command ABI. Copies executed by compute or render are included in
the engine that executes them.

The counters belong to the open DRM file, rather than to a PID or a queue handle.
All queues and VMs of that file contribute to the same ledger. Duplicated or
inherited file descriptors share counters and must be deduplicated using
``drm-client-id``. Closing a queue or VM does not reset its file's counters, and
completions retain the ledger until their firmware work retires. A new DRM file
starts at zero, even when another file in the same process has submitted work.

Time source and limits
----------------------

Only completed stage intervals are reported. A long-running command contributes
after retirement, so polling during execution can temporarily show no change.
Counters accumulate monotonically, saturating at the largest unsigned 64-bit
value. Conversion rounds down by less than one nanosecond per retired stage.

G13 and G14 use the firmware's internal start/end timestamp cells. The existing
timestamp microsequence operations run even when the application requests no
timestamp output. Internal buffers were already allocated for each command;
fdinfo never reads an application's timestamp buffer.

The G15 and native G16 backends reuse the internal timestamp cells already read
by their successful retirement statistics path. The shared G17 execution backend,
including T6040/G16S and T8140/G17P, charges the timestamp pairs delivered by its
once-only completion path. These backends use the firmware's 24 MHz command timer;
the classic backend uses its hardware configuration's timer frequency.

These are firmware stage envelopes, not hardware shader occupancy measurements.
They can include firmware scheduling, preemption and stalls between the stage's
start and end operations. Intervals are summed without attempting to merge
overlapping commands on the same engine. Missing, zero-start or reversed intervals
are ignored. Failed or cancelled commands do not contribute incomplete intervals;
successful stages that retired before a later failure remain counted. An
unexecuted G17 replay contributes only when it eventually retires successfully.
There is no submit-to-completion wall-time fallback in the current backends.

``drm-cycles-*`` and ``drm-maxfreq-*`` are intentionally absent. The timestamp
clock is independent of the variable GPU execution clock. Treating command timer
ticks as GPU busy cycles, or multiplying time by a sampled/maximum GPU frequency,
would give incorrect frequency-weighted utilization. Per-client execution-cycle
counters would require a separate hardware measurement source.

Accounting cost
---------------

Each file allocates one three-counter ledger. Queues and pending completions
retain references to it. Retirement adds one relaxed, saturating atomic update
per valid stage, with no new locks or allocations. The native backends reuse
existing timestamp reads. Classic completion callbacks read two internal cells
per stage; commands without application timestamps also execute two existing
timestamp microsequence operations per stage. Reading fdinfo loads three counters
and does not traverse queues, wait for fences or access hardware.

Host arithmetic tests
---------------------

The ledger uses only ``core`` and can be tested directly from a source checkout::

rustc --edition 2021 --test drivers/gpu/drm/asahi/usage.rs -o /tmp/asahi-usage-test
/tmp/asahi-usage-test

Tests cover conversion, missing/reset timestamps, saturation, overlapping stages,
client isolation, out-of-order completions and simultaneous queues sharing a file.
1 change: 1 addition & 0 deletions Documentation/gpu/drivers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ GPU Driver Documentation

amdgpu/index
apple-dcp-backlight
asahi-usage-stats
i915
imagination/index
intel-display/index
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/asahi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ config DRM_ASAHI
select RUST_DRM_GEM_SHMEM_HELPER
select RUST_DRM_GPUVM
select RUST_APPLE_RTKIT
select CRYPTO_LIB_SHA256
help
DRM driver for Apple AGX GPUs (G13x, found in the M1 SoC family)

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/asahi/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0

obj-$(CONFIG_DRM_ASAHI) += asahi.o
asahi-y := asahi_core.o sysfs.o g17/sync_input.o g17/sync_output.o g17/sync_scope.o g17/trace.o
asahi-y := asahi_core.o fwid.o sysfs.o g17/sync_input.o g17/sync_output.o g17/sync_scope.o g17/trace.o g17/clpc.o g17/fans.o
CFLAGS_g17/trace.o := -I$(src)/g17

asahi-$(CONFIG_DRM_ASAHI_G15) += g15/glue.o
Expand Down
18 changes: 9 additions & 9 deletions drivers/gpu/drm/asahi/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,14 @@ impl<T, U: RawAllocation> Drop for GenericAlloc<T, U> {
// the invariant, and greater than debug_len as checked above.
unsafe {
let p = p.as_ptr().add(self.debug_offset - debug_len);
(p as *mut u32).write(STATE_DEAD);
p.cast::<u32>().write(STATE_DEAD);
}
}
}
if debug_enabled(DebugFlags::FillAllocations) {
if let Some(p) = self.ptr() {
// SAFETY: Writing to our inner base pointer with our known inner size is safe.
unsafe { (p.as_ptr() as *mut u8).write_bytes(0xde, self.size()) };
unsafe { p.as_ptr().cast::<u8>().write_bytes(0xde, self.size()) };
}
}
if self.padding != 0 {
Expand All @@ -178,7 +178,7 @@ impl<T, U: RawAllocation> Drop for GenericAlloc<T, U> {
// the inner base pointer, after `size()` bytes.
let guard = unsafe {
core::slice::from_raw_parts(
(p.as_ptr() as *mut u8 as *const u8).add(self.size()),
p.as_ptr().cast::<u8>().cast_const().add(self.size()),
self.padding,
)
};
Expand Down Expand Up @@ -313,8 +313,8 @@ pub(crate) trait Allocator {
unsafe {
let p = p.as_ptr();
p.write_bytes(0x42, debug_offset - 2 * debug_len);
let cur = p.add(debug_offset - debug_len) as *mut AllocDebugData;
let prev = p.add(debug_offset - 2 * debug_len) as *mut AllocDebugData;
let cur = p.add(debug_offset - debug_len).cast::<AllocDebugData>();
let prev = p.add(debug_offset - 2 * debug_len).cast::<AllocDebugData>();
prev.copy_from(cur, 1);
cur.copy_from(&debug, 1);
};
Expand Down Expand Up @@ -344,7 +344,7 @@ pub(crate) trait Allocator {
if debug_enabled(DebugFlags::FillAllocations) {
if let Some(p) = ret.ptr() {
// SAFETY: Writing to our inner base pointer with our known inner size is safe.
unsafe { (p.as_ptr() as *mut u8).write_bytes(0xaa, ret.size()) };
unsafe { p.as_ptr().cast::<u8>().write_bytes(0xaa, ret.size()) };
}
}

Expand All @@ -354,7 +354,7 @@ pub(crate) trait Allocator {
// the inner base pointer, after `size()` bytes.
let guard = unsafe {
core::slice::from_raw_parts_mut(
(p.as_ptr() as *mut u8).add(ret.size()),
p.as_ptr().cast::<u8>().add(ret.size()),
padding,
)
};
Expand Down Expand Up @@ -536,7 +536,7 @@ impl Allocator for SimpleAllocator {
);

let mut obj = crate::gem::new_kernel_object(&self.dev, size_aligned)?;
let p = obj.vmap()?.addr as *mut u8;
let p = obj.vmap()?.addr.cast::<u8>();
if debug_enabled(DebugFlags::FillAllocations) {
let obj_size = obj.size();
if let Ok(vmap) = obj.vmap() {
Expand Down Expand Up @@ -990,7 +990,7 @@ impl HeapAllocator {
let (obj_start, obj_size, p) = self.mm.with_inner(|inner| -> Result<_> {
let idx = idx.unwrap_or(inner.backing_objects.len() - 1);
let obj = &mut inner.backing_objects[idx];
let p = obj.0.vmap()?.addr as *mut u8;
let p = obj.0.vmap()?.addr.cast::<u8>();
Ok((obj.2, obj.0.size(), p))
})?;
assert!(obj_start <= start);
Expand Down
Loading