Repository navigation
media: apple: prores: bind T6041's second engine (apr1) without an aux window - #2509
RyanTheTide wants to merge 5 commits into
Conversation
The M4 Max has a second ProRes engine, apr1, outside the SCODEC block. Its Apple device tree node lists only the engine and wrapper windows and no SCODEC system window, so a T6041 node may now have two reg entries (core, wrapper) as well as three (core, wrapper, aux). The other compatibles are unchanged. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The T6041 variant asked for core, wrapper and aux and failed the probe without all three. apr1 on the M4 Max sits outside the SCODEC block and has no aux window, so it could not bind. Keep core and wrapper required, and map the later SCODEC windows (aux, and ctrl on T6050) only when the node's reg-names lists them. Without the window the system or control rows are not applied, which the power-up path already allows. This follows the hardware description in the device tree, not the compatible or the instance. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Describe the two ProRes engines of the M4 Max from the J616c device tree. apr0 sits in the SCODEC block at the same addresses as on the T6040, with its SCODEC system window, DART and the SCODEC and SCODEC_STREAMING power domains. apr1 has only its engine and wrapper windows, interrupt 2010, its own single-stream DART at 0x585020000 (interrupt 2007) and the PRORES power domain (PMGR main bank, 0x3a8, under FAB6_SOC), which also resets it. All of it stays disabled in the SoC file. The J616c enables both engines. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Row from a J616c (M4 Max, binned T6041, macOS 26.6.2 firmware), as asked. Setup: daily 7.3.0 kernel, with Probe: both engines probe (
Profile 0 (Proxy) matched too: 789818 bytes, ebc7d8f2fd02 on both engines. There were 0 DART faults, 0 job errors and 0 timeouts on either engine. apr1 never raises its interrupt. Its line in /proc/interrupts (IRQ 2010) stays at 0 over 400 jobs, and the driver logs The ADT gives apr1
I can run a test build on this Mac if you want something specific checked, e.g. wrapper registers dumped on both engines after the rows are applied. |
|
Thanks for the row. Here is a read-only capture for apr0 vs apr1 that you can run on the current boot (trial DTB, out-of-tree https://gist.github.com/RyanTheTide/371045b52cbfe10aa9cbe7f85bf2b0c2 git clone https://gist.github.com/371045b52cbfe10aa9cbe7f85bf2b0c2.git apr-irqpeek
cd apr-irqpeek
sudo bash apr-irqpeek.sh # needs gcc, make and /lib/modules/$(uname -r)/build
sudo tar czf ~/apr-irqpeek.tgz -C /var/lib/aurora-test/apr-irqpeek "$(ls /var/lib/aurora-test/apr-irqpeek | tail -1)"It finds every What it reads (nothing is written to any register):
Why it is safe on a daily kernel: it is a small debugfs module ( Self-test (J616s, T6040, apr0 only, 7.3.0): rc 0, module unloaded, DART ERROR 0, no new dmesg lines, apr0 IRQ_ENABLE 0x3 and MODE 0xd, IRQ 1960 counted +1 per job. One run's sampler caught IRQ_STATUS 0x1 at the same moment as AIC hw_state 1 (unmasked); that is what a working line looks like. On a working engine that window is microseconds, so the sampler can miss it, but on apr1 it lasts milliseconds. |
|
Capture from the J616c (M4 Max, binned T6041), run as given (KO/ENC prebuilt from the gist's sources). The boot was a 7.3.0 test kernel with the trial DTB (apr0 + apr1 as in this PR), and apr1's engine raises its status, but the AIC line never goes high.
So the loss is between the engine and the AIC (the wrapper/routing side), not in the AIC mask or target. apr0 vs apr1 'before' snapshots differ in these registers:
Many of the T6041 wrapper rows read back 0 on apr1, and 0xc00 reads 0xf there against 0x7fffffff on apr0. Either the rows don't take on apr1's wrapper, or its wrapper is laid out differently (0x040/0x044 on apr1 hold the 0x001d00xx pattern that apr0 has at 0x018-0x038). If 0xc00 is the wrapper's interrupt forward mask, it would explain the line. I can run a test build that writes it on apr1 if you want that tried. run.log |
On a J616c (M4 Max) the second ProRes engine, apr1, finishes every job and raises IRQ_STATUS 0x1 with IRQ_ENABLE 0x3, but its AIC line (2010) never goes high: a read-only capture saw hw_state 0 in all 63 samples while the status was set, where apr0 shows status and hw_state together. Each apr1 job then waits for the watchdog's 4 ms poll, about 8 ms at HZ=250, so apr1 runs at 125 fps whatever the profile, against 1100-1600 fps on apr0. The same capture shows that apr1's wrapper does not end up like apr0's after the power-up rows: 0x338-0x350, 0x430-0x448, 0x948 and 0xa50 read back 0, and 0xc00 reads 0xf instead of 0x7fffffff. Two changes: - On an instance without an aux window (a wrapper outside the SCODEC block), apply the wrapper rows a second time, so a row that only takes once a later row (such as 0xc00) is set is written again. The values are unchanged, and apr0 and every other instance with an aux window get one pass as before. - Once a job has finished without its interrupt, poll that engine's completion with a 100 us hrtimer from submission instead of leaving it to the jiffy-granular watchdog. The interrupt stays requested and wins when it arrives; the watchdog still handles timeouts. Reported-by: AxxzyWasTaken <98161954+AxxzyWasTaken@users.noreply.github.com> Link: #2509 Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Thanks for the capture. It settles where the loss is: apr1 sets IRQ_STATUS and the AIC line stays low. New head: 44cc1db (one commit on top of 45ba8f9, What it changes
Test (same boot setup as before: trial DTB, git clone https://gist.github.com/371045b52cbfe10aa9cbe7f85bf2b0c2.git apr1-row && cd apr1-row
sudo bash apr1-row.sh # one encode per engine: 1080p HQ and 4444, 200 jobs each
sudo bash apr-irqpeek.sh # optional: shows whether the apr1 wrapper rows now read back like apr0
How to read it
|
|
Row for 44cc1db on the J616c. Setup as before: trial DTB with apr0 + apr1, module from this head built against my 7.3 kernel (W=1 clean), 1080p input, 8 frames per buffer set, 25 loops = 200 jobs per row.
Output is still byte-identical between the engines. There were 0 DART faults, 0 errors and 0 timeouts. The driver logs The 100 us poll works: apr1 is 2.8-4.3x faster than at 45ba8f9. It is still 1.5-3x slower than apr0, which gets its interrupt. The second pass of wrapper rows doesn't take. Your capture, run again after the change, shows apr1's wrapper exactly as before:
AIC 2010 hw_state is 0 in every sample, unmasked; IRQ_ENABLE is 0x3. So those rows aren't taking at all on apr1's wrapper, written once or twice. Either apr1's wrapper isn't the same block as apr0's, or it isn't clocked or powered when the rows are written. Its 0x040/0x044 values look like a different layout's defaults. A capture of what macOS leaves in apr1's wrapper would settle which. I can't get that from Linux; a macOS-side read of 0x584000000 + 0x000-0xc00 after an apr1 encode would. |
…pass The second pass of the wrapper rows on an instance without an aux window (T6041's apr1) changed nothing on the J616c: apr1's wrapper still holds the same 20 offsets apart from apr0's after the rows are written once or twice (0x338-0x350, 0x430-0x448, 0x948 and 0xa50 at 0, 0xc00 at 0xf against 0x7fffffff, and a shifted 0x001d00xx pattern at 0x018-0x044), and its interrupt still never reaches the AIC. The 100 us completion poll is what lifted apr1 from 125 fps to 543 (HQ) and 347 (4444) fps. Drop the second pass and measure instead. Every row of the wrapper is read back after it is written, and the first time an instance's wrapper does not take its rows, the driver logs each such row with its value before the write, the value written and the value read back, followed by a count. If any row did not take, the rows are applied and checked once more before the next job, after the engine has completed one, and that count is logged too. This separates a block that ignores the writes (the value before equals the value after), a block with a different layout (the value changes, but not to the written one) and a block that was not yet clocked at power-up (the rows take on the second check). Bit 31 is left out of the comparison: the 0x000-0x044 rows are written with it set and read it back as 0 on apr0 too. The completion poll stays. Reported-by: AxxzyWasTaken <98161954+AxxzyWasTaken@users.noreply.github.com> Link: #2509 Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Thanks for the row. The poll works, the second pass doesn't, so the second pass is gone. New head: 39687ee (one commit on top of 44cc1db; W=1 and checkpatch clean). The 100 us poll stays either way. What I checked first. apr1's windows in the DT match its ADT node: engine 0x585000000 and wrapper 0x584000000/16 MiB, with the same arm-io offset as apr0. Its clock gates (PRORES-V, PRORES-SOC-VNOM/VMAX) and its DART's gate (PRORES-DART) are all no-power-state children of PRORES (0x3a8), the domain the DT already uses. So no power domain is missing. apr1 also completes jobs with its DART working, and the rows are written in What 39687ee does. Instead of writing the rows again blindly, it reads every wrapper row back after writing it. The first time an engine's wrapper doesn't take its rows, it logs one line per row:
Bit 31 is left out of the comparison, because apr0 also reads it back as 0 at 0x000-0x044. apr0 should print nothing. Test (same setup: trial DTB, cd apr1-row && git pull
sudo bash apr1-row.sh
sudo dmesg | grep -E 'wrapper|without an interrupt'Please paste the macOS read. Yes, that would settle it. If your J616c can do it, please read apr1's wrapper (0x584000000 + 0x000-0xc00, plus 0x4008-0x401c) under macOS right after an apr1 ProRes encode, and apr0's at 0x300000000 for comparison. This is a register read on your own machine, not a disassembly. Any read-only route you already have works: a pmap/iomem dump from a debug kext, or m1n1 with macOS running as a guest. Even the 20 offsets that differ would tell us whether macOS gets apr1's wrapper to apr0's values, or leaves it at what Linux reads now. If it leaves it, the interrupt route is elsewhere, and a hypervisor MMIO trace of macOS bringing up apr1 is the next step. |
Problem
The M4 Max (T6041) has a second ProRes engine, apr1. Its Apple device tree node has only an engine window (0x585000000) and a wrapper window (0x584000000), interrupt 2010, its own DART at 0x585020000 (one stream, sid 0) and its own PRORES power domain. It has no SCODEC system (aux) window. The T6041 variant required core, wrapper and aux, so apr1 could never bind. The T6041 device tree also had no ProRes nodes at all; only the T6040 did.
Change
apple,t6041-proresnode may have two reg entries (core, wrapper) or three (core, wrapper, aux). Other compatibles are unchanged.reg-nameslists them. Without the window its system or control rows are not applied;apr_hw_init()already skips a missing window. This is a hardware-description check, not a compatible or instance check.Testing
make W=1arm64 LLVM build ofdrivers/media/platform/apple/prores/: no warnings.dt_binding_check DT_SCHEMA_FILES=apple,prores.yaml: clean.CHECK_DTBS=yfor t6041-j616c, t6041-j614c, t6041-j575c, t6040-j616s, t6040-j614s, t6040-j773s: no warnings, before or after. The new J616c dtb checked against the old schema reports apr1's two reg entries as too short, so the check does cover the new node.Still to run
Values taken from the J616c device tree
PRORES is PMGR group 1 (the main bank at 0x502280000), offset 0x3a8, parent FAB6_SOC, matching the
ARST(0xf7)reset function on apr1. apr1's clock gates are PRORES-V, PRORES-SOC-VNOM and PRORES-SOC-VMAX, and its DART's gate is PRORES-DART, all children of PRORES. FAB1_SOC (0x2d0), SCODEC (0x328) and SCODEC_STREAMING (0x330) are in PMGR group 0 (0x502800000) at the T6040's offsets. The ADT reg addresses are relative to arm-io and the interrupts are used as AIC numbers directly, as for apr0 on the T6040.Notes for review
Assisted-by: LLM (Claude:Opus 5.5)