Repository navigation
accel/ane: H17 (Neo) clean driver: first inference, MobileNetV1 16/16 - #801
Merged
Merged
Conversation
Install a read-only observer before the platform bus can power or attach DMA. Require loader raw-boot evidence and the measured cold CPU, child, CE and DART state before acquisition. Add staged power, private SID0 mapping, preload verification, scratch boot and four-command startup. Restrict the ANE DART profile to SID0 without resetting foreign streams. Deny secure and Exclave commands at publication. Add an internal program path with kernel-tag validation, UUID and exact-output completion and an observed FREE acknowledgment that retains backing until reboot. Refuse a second program lifetime: H17 can reuse the previous output BAR on a later program's first job. Normal map synchronization remains; extra TLB invalidates do not fix this defect. Original-HWX frontend integration and a production immutable-DATA manifest remain pending. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Describe the measured child PWGATE window, four DAPF ranges and the loader's per-boot DATA preservation digest. Allow disabled nodes to specify firmware DVAs before the loader supplies preload reservations. Give the three ANE DARTs a dedicated compatible so their SID0-only ownership profile is determined by DT rather than an operator knob. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Supply PMGR, PWGATE and the four ordinary SID0 DAPF ranges. Remove the high-only DART DMA window so the private domain can reach the identity MMIO pages as well as the firmware DVAs. Keep production nodes disabled. Add a separate test DTB that enables the ANE and its three SID0-only DARTs. It supplies neither loader cold-boot evidence nor personalized preload addresses; the trusted loader must provide those for acquisition. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Hold the system sleep lock across staged actions so acquisition cannot race a suspend preparation that observed the old unretained state. Document maintenance coverage for the explicit lead test DTB. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Keep the one-program-per-firmware-boot restriction at the shared publication boundary as well as in the backend. Verify refusal after a successful LOAD and UNLOAD without writes, pool consumption or a pending transaction. Retain the kernel-tag and secure-command policy tests. Track allocation tags so teardown waits for the exact CREATE EXPP pool's FREE rather than an unrelated free. Reject duplicate DART phandles and malformed CPU-load notifications before using their state. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Keep the transport publication calls separate from the assertion macros so the second-LOAD cases pass strict checkpatch alignment checks. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Include platform_device.h before dereferencing the backend platform device and of_device.h for of_dma_configure(). The arm64 LLVM build otherwise fails on incomplete types and an implicit function declaration. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Describe the engine, PMGR and PWGATE windows required by the T8140 binding, and include its required DAPF ranges. The old example only provided the engine window, causing dt_binding_check diagnostics. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
The H17 firmware submits a job on a direct path that reuses the engine's current BAR context. After the engine ran a different program, the first job of the next program could write through the earlier program's output binding, even when that program had been terminated and unloaded. The backend therefore allowed one program lifetime per firmware boot. Bit 0 of the EXECUTE flags word at offset 0x30 keeps a request off the direct path and queues it for the full execution loop, which installs a fresh BAR context. The transport now sets it in its copy of the first EXECUTE after any change of program or process, and after LOAD, CREATE, TERMINATE or UNLOAD, since firmware IDs may be reused. Later jobs of the same process keep the direct path. On the J700 this made 11 of 11 program switches correct, at about 60 us extra on the switching job only. Drop the one-program claim in the cold backend and the second-LOAD fence in the transport. The execute encoder gains a validated flags field. H16 shares the firmware design but has not executed under Linux yet, so its requests are published unchanged. KUnit covers the switch rule, lifetime resets, the H16 exemption, the admitted second LOAD and the encoder flags (61 of 61 pass under UML). Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Bring the T8140 staged cold backend (ane/h17-cold-acquired) and the queued first EXECUTE after a program change (ane/h17-switch-requeue) onto the H16 first-inference stack, which carries the ABI 3 program path and the command arena reuse on the same shared transport. Conflict resolution: - SHAREDMALLOC FREE: one handler and one retired-surface array. H16 26A428 replies 1 (native_free), H17 25G83 replies DVA|1 with a zero length and handle (allow_free). Backing stays until reset on both. Requests with FREE disabled are refused with -EOPNOTSUPP, as before. - ane_fw_command_denied() was added by both sides; keep one copy. - Kconfig, Makefile, MAINTAINERS and the documentation take both sides. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Route the T8140 backend through the H16 program session and the ABI 3 accel node, so the Neo runs original H17 HWX programs through the clean kernel driver instead of the research harness. The MobileNetV1 224 linked program (28 tasks) is the target. - HWX validation accepts the H17 Mach-O subtype (9) beside H16 (7), and the task stream opens with 0 on H17 and 1 on H16; the last task may end the __text section unpadded. A program's engine subtype must match the backend's. - A program's __DATA/__bss scratch becomes a kernel-owned EXECUTE input, bound to private memory, carrying a linked program's DRAM edges between tasks. The generic and operation sections gain its entry; the operation section is validated against the program descriptor's BAR bases, which rejects the legacy kernel tag 2 that asserts the firmware. A kernel LOAD slot spans its section's whole 16 KiB pages. - The transport's switch-safe predicate (H17) lets one firmware session load and switch between programs; H16 keeps one program per boot. The accel node reports the real chip family in GET_CAPS and the H17 chip id is added to the ABI. - The H17 cold backend drops its one-shot LOAD/EXECUTE/UNLOAD and uses the shared session and its ABI 3 node, with program mappings from the same private window and FREE admitted for the firmware's deferred pool free. KUnit covers the MobileNet HWX header as a fixture (refs 3 scratch, 6 x, 7 y, 8 kernel 1007; 28 tasks), the generic/operation sections, a full session run with the queued first EXECUTE, and program switching. 139/139 under UML x86_64. Not yet tested on hardware. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
The probe stage read the CE block, RVBAR, the CPU wrapper, scratch, the DAPF bank and the three DARTs while ANE_SYS could be off. It is off by then on a fleet kernel: generic DART runtime PM suspends the DARTs after their probe, and the refused platform probe detaches the ANE power domain with power-off. The first such read stalled the bus and hung the Neo. Read registers in the order the H17 U2 runs measured as safe. The probe stage reads only PMGR (ANE_SYS, the CPU and sub-block power states) and checks the child power states and the raw-boot evidence. The map stage powers ANE_SYS through genpd, reads PWGATE, turns the CPU on, clears the PWGATE request, turns the sub-block on, and only then reads and checks the engine and DART reset state, before Linux writes anything to the engine. ANE_SYS itself is no cold marker in either state. The quarantine dump skips engine and DART registers until the engine is powered. Every backend register access now goes through one set of helpers with an empty trace hook, so a debug build can log each physical address before the access. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
ane-run.py loads one H16G or H17 HWX once, builds its sections with h16-sections.py, and runs any number of input cases, comparing each output with an expected file within an ulp bound and reporting host latency. Padding lanes marked 0xffff in the expected file are not compared. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
The cold engine check refuses any enabled DART stream, but the snapshot only logged the version, protect, lock and error words, so a refusal on the stream enables could not be told apart from the others. Log each non-zero stream enable word. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
The Linux DART driver enables every stream globally when it binds and isolates streams through their TCRs, so on the Neo all three ANE DARTs read stream enable words 0 and 8 as 0xffff once bound, on every boot. The cold engine check treated that as a non-reset DART and refused map. Keep checking version, protect, lock and error, and stop judging the stream enables. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
The accel node had no fop_flags, so the VFS refused to open it on the fleet kernels, which require FOP_UNSIGNED_OFFSET for DRM-style nodes whose offsets are never negative. The node does no mmap and no seeking, so declaring unsigned offsets is correct and makes it openable again. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Bring the H16 first-inference and latency work into the H17 clean path, which shares ane_h16_session, the transport and the ABI 3 node: - the first EXECUTE of a program on the engine, the first one after boot included, takes the queued path (+0x30 bit 0); the session tracks this by program generation, so it applies to H16 and H17 - each EXECUTE descriptor carries the whole HWX section of its surface - a failed EXECUTE logs its step and flags, the reports and last state seen, the rows sent and acknowledged, and the firmware log ring - waits poll in 20-50 us steps and back off on long waits; the H17 backend uses the same steps - no SHA-256 of the HWX on every EXECUTE - the J616s ANE device tree, H14 lifetime and PM work, timing stats Conflicts resolved: - program lifetime: a LOAD is refused while the previous program is still loaded (H16); a switch-safe transport (H17) keeps holding several programs, and its transport still requeues on every program or process change - the linked-program scratch binding was written on both sides; keep one copy in the bindings loop, accepting a size from the __bss size up to its 16 KiB mapping - queued flag: one name, ANE_H16_EXECUTE_FLAG_QUEUED; shared tags: shared_tags - the accel node fop_flags were set on both sides; keep one - the fake firmware in the program KUnit hands out the lowest free program and process IDs and reuses them after teardown, and H17 MobileNet now expects the whole 0x4c000 input section Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
The H17 firmware owns 0x380000 bytes from its TEXT DVA (boot argument +0x10), but the preload covers only TEXT (0xc0000) and DATA (0x2ac000), so the last 0x14000 bytes, 0x1000036c000 to 0x10000380000, were never mapped. The firmware keeps runtime heap state there: on the Neo the first relu program faulted on DART0 right after CREATE (writes at 0x1000037c040 to 0x1000037fc00), and the EXECUTE then timed out. The research harness had mapped the whole span. Map that tail zeroed and device-writable right after the preload, as the H16 backend does, and keep it until reset like the preload. The layout check refuses a DATA segment that overlaps TEXT, runs past the span, is not in whole 16 KiB pages, or a span that reaches the command pool. Name the span once and use it for the boot argument too. KUnit: the measured layout, a DATA segment that ends the span, and the refused layouts. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
ane_h16_boot_data.h defines the per-revision MMIO table and the profile table for every unit that includes it. The boot KUnit uses only the MMIO table and the preload KUnit only the profiles, so W=1 warned about the other one in each. Mark both __maybe_unused. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
On the Neo (fleet14g, attempt C) the first queued relu EXECUTE reached EXELOOP, which logged the mcache custom BAR record (config 1, type 0, BAR 4, value 36) and then asserted in CAneProgramManagerHx.cpp line 416. No report followed and the request timed out. The record comes from the linear program descriptor relocation tuple, as on H16. Every H17 request that ran, including the 16/16 relu, add and MobileNet runs, sent none. Send no custom BAR record from an H17 session; the firmware keeps its default mcache DSID. H16 is unchanged. The program buffers landing at the DVA the research harness gave its EXPP allocation is not an overlap: shared allocations and program mappings come from the same bump allocator, and the EXPP allocation follows the program mappings. KUnit: an H17 session loads a linear program, sends no record, and the EXECUTE has the base length with a zero record count. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
On the Neo (fleet14g) the first relu64 EXECUTE, sent with no custom BAR record, still made the H17 firmware assert in its program manager (CAneProgramManagerHx.cpp line 416) right after it logged the request: two buffers of 0x1000 bytes. The generic section installed at LOAD declares both relu64 buffers as 0x4000 bytes (the surface allocation), and the research harness, which ran relu, add and MobileNet on the Neo, always sent that declared size. The descriptor carried the HWX section size instead, which is smaller for relu64 and add64. Send the size the generic section declared for each buffer. It lies between the tensor span and the mapped allocation, so the descriptor never reaches past the mapping. MobileNet is unchanged: its declared input size is the whole 0x4c000 section. The LOAD sections the kernel installs for relu are byte-identical to the harness package; the resource IDs differ only in numbering the harness also used. KUnit: the session test now expects the declared size for both descriptors. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
7da7f19 made every EXECUTE descriptor carry the buffer size the generic section declared at LOAD. That fixed the H17 program-manager assert (relu64 and MobileNet then passed on the Neo), but it also changed H16, where only the whole-section size has run on the J616s. For small H16 programs the declared size is the larger allocation, which the H16 firmware has never been sent. Use the declared size on H17 only and keep the HWX section size on H16. MobileNet is unaffected on both: its declared input size is the whole 0x4c000 section. KUnit: the H16 session test expects the section size again; the H17 linear-program test expects the declared size, which differs from the section there. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Contributor
Author
|
Merge gate: host selftests 158/158 on 94c72b4 (tools/asahi/run-host-tests.py), KUnit 167/167, hardware results in the description (Neo, fleet14g, boot 96e365b9). Merging. 🤖 Generated with Claude Code |
This was referenced Nov 1, 2026
notmysegv
pushed a commit
to notmysegv/linux
that referenced
this pull request
Nov 4, 2026
…tion/aurora Bring integration/aurora up to aurora-wip 52f0a6b, the source of 7.3.0-aurora-fleet14h, promoted on all four machines on 2026-11-02. The range also covers the fleet14g source b35adc7. It adds aurora-silicon#792, aurora-silicon#750, aurora-silicon#783, aurora-silicon#784, aurora-silicon#793, aurora-silicon#774, aurora-silicon#794, aurora-silicon#796, aurora-silicon#798, aurora-silicon#800, aurora-silicon#802 and aurora-silicon#801. No conflicts. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
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.
Runs the Neo (J700, T8140) Neural Engine through the clean driver: cold acquisition of the iBoot-preloaded firmware (from #714), the shared H16 session and ABI 3 node, and the fixes found on hardware tonight.
Hardware, Neo, fleet14g + these modules (kit
neo-kit, branch head 94c72b4), boot 96e365b9:Fixes on top of the cold path, each found from a hardware run:
The production DT keeps the ANE and its DARTs disabled; the DART cold profile only applies to the new
apple,t8140-ane-dartcompatible on those nodes, so nothing changes on a default boot. Enabling it for the Neo needs the loader hand-off, as aura#37 did for the M4 Pro.KUnit 167/167, W=1 and checkpatch clean.
🤖 Generated with Claude Code