Repository navigation
ane/h15: opt-in experimental M3 (H15) bring-up module - #121
Conversation
Four-stage opt-in module for T8122 (M3), T6030 (M3 Pro), T6031 (M3 Max), and T6034 (j514m/j516m). No silicon has run it. Stage 0 (dt) and stage 1 (status) are the only stages a volunteer can run safely now: stage 1 powers the ANE domains and reads the five MEASURED pmgr ACTUAL words; stages 2 (wrapper) and 3 (boot) refuse because no macOS capture has cleared the role of any engine-aperture word on H15. Three experimental overlays (T8122, T6030, T6031) carry the opt-in key ane-h15-experimental and add the MPM/CPU/TD/BASE power-controller nodes that the aurora t8122/t6030 pmgr dtsi files do not yet carry. Three shipped data-only overlays in packaging/dt/ follow the omarchy,data-only convention for tools/test_ane_overlays.py. The runbook, host ADT-walker self test, and tools/omarchy-ane-h15-stage (with the h15_stage field for the collector) complete the kit. Receipt: receipts/2026-10-03-ane-h15/README.md.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 15243501e2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| ## Unreleased | ||
|
|
||
| - H15 (M3) opt-in experimental bring-up module: `ane/h15/` (4 soc |
There was a problem hiding this comment.
Recreate the commit with the required Git identity
The reviewed commit's raw metadata records both author and committer as Codex <codex@openai.com>, whereas this repository mandates Joshua Warren <816217+joshuaswarren@users.noreply.github.com> for every commit; recreate the commit with the required identity so its provenance satisfies the repository policy.
AGENTS.md reference: AGENTS.md:L250-L257
Useful? React with 👍 / 👎.
| pm_runtime_enable(&pdev->dev); | ||
| ret = pm_runtime_get_sync(&pdev->dev); |
There was a problem hiding this comment.
Attach every declared power domain before runtime PM
All three experimental ANE nodes declare five power-domains, but a device with multiple generic PM domains is not attached to all of them by a bare pm_runtime_get_sync(); drivers must attach each domain (as ane_attach_genpd() already does in ane/src/ane_drv.c). Consequently stage 1 does not actually enable MPM/CPU/TD/BASE and will normally time out while polling their ACTUAL bits, defeating the module's only runnable MMIO stage.
Useful? React with 👍 / 👎.
| bN(b, data, size); | ||
| while (size & 3) bw(b, 0); |
There was a problem hiding this comment.
Advance the padding loop in the ADT test builder
Whenever a property size is not divisible by four, this loop never changes size, so the first arm-io property of size 7 appends bytes forever. As a result, the documented make -C ane/h15 check hangs and is eventually killed instead of exercising the parser.
Useful? React with 👍 / 👎.
| for (k = 0; k < stride / 4; k++) | ||
| v[k] = ane_h15_adt_rd32(a, row + 4u * k); | ||
| segs[i].phys = v[0]; | ||
| segs[i].iova = stride == 32 ? v[2] : v[1]; | ||
| segs[i].size = stride == 32 ? v[3] : v[2]; |
There was a problem hiding this comment.
Decode segment ranges as 64-bit words
For a valid 24-byte row, this loop executes six iterations and writes v[4] and v[5] past the four-element array; for a 32-byte row it writes four elements past it. It also reads each 64-bit ADT field as a separate 32-bit value, so phys, iova, and size are selected from the wrong halves even when no visible crash occurs. Copy or decode stride / 8 little-endian 64-bit words instead.
Useful? React with 👍 / 👎.
| if (n.nprops == 0 || n.nprops > 4096 || n.nchildren > 4096) { | ||
| *err = ANE_H15_EFORMAT; | ||
| n.nprops = 0; | ||
| n.nchildren = 0; | ||
| } |
There was a problem hiding this comment.
The supplied self-test deliberately constructs a valid root with zero properties and one child, but ane_h15_adt_node_at() classifies every zero-property node as malformed. Once the test-builder hang is fixed, ane_h15_adt_find_ane() therefore fails immediately with ANE_H15_EFORMAT; validate only the upper bounds rather than requiring nprops to be nonzero.
Useful? React with 👍 / 👎.
| pm_runtime_put_sync(&pdev->dev); | ||
| if (ane->fw_started) | ||
| dev_emerg(&pdev->dev, | ||
| "firmware started: do NOT unload; reboot to park the ANE\n"); | ||
| rpm_off: | ||
| return ret; |
There was a problem hiding this comment.
Disable runtime PM when an expected stage refuses
Stages 2 and 3 intentionally return errors, so their probes do not bind and ane_h15_remove() is never called; this exit path performs pm_runtime_put_sync() but leaves the pm_runtime_enable() from line 344 active. The staging tool subsequently unloads and reloads the module, leaving the platform device with stale runtime-PM state and potentially producing unbalanced-enable warnings on the next run; disable runtime PM on every failed-probe path.
Useful? React with 👍 / 👎.
| ane->engine = of_iomap(pdev->dev.of_node, 0); | ||
| ane->pmgr = of_iomap(pdev->dev.of_node, 1); | ||
| if (IS_ERR(ane->engine)) { ret = PTR_ERR(ane->engine); goto rpm_off; } | ||
| if (IS_ERR(ane->pmgr)) { ret = PTR_ERR(ane->pmgr); goto rpm_off; } |
There was a problem hiding this comment.
Treat NULL from of_iomap as a mapping failure
of_iomap() returns NULL, not an error pointer, when a resource cannot be translated or mapped. IS_ERR(NULL) is false, so a missing or failed engine/PMGR mapping proceeds into runtime PM and eventually dereferences ane->pmgr + offset, which can crash the kernel; test these results for NULL or use a managed platform-resource mapping helper.
Useful? React with 👍 / 👎.
| for (i = 0; i < 5; i++) { | ||
| u64 pa = (s->words[i].where == ANE15_WHERE_ENGINE) ? s->engine_pa : s->pmgr_pa; | ||
|
|
||
| dev_info(ane->dev, "word[%u] %-13s where=%s off=%#x size=%u tier=%d", |
There was a problem hiding this comment.
Log the complete H15 word table in the DT stage
The SoC word tables contain eleven entries, but stage 0 iterates only over the first five PMGR records. It therefore omits CPU_STATUS, RVBAR, the inferred mailbox and doorbell records, and the forbidden CoreSight record even though the runbook says stage 0 prints every word group and expects tiers 1–3; this removes the diagnostic inventory that volunteers are supposed to review before later stages.
Useful? React with 👍 / 👎.
| dev_info(ane->dev, "engine pa=%#llx size=%#x", s->engine_pa, s->engine_size); | ||
| dev_info(ane->dev, "pmgr pa=%#llx size=%#x", s->pmgr_pa, s->pmgr_size); | ||
| for (i = 0; i < 5; i++) | ||
| dev_info(ane->dev, "pmgr.%s offset=%#x", ANE_H15_PS_NAMES[i], |
There was a problem hiding this comment.
CRITICAL: Braced initializer used as an expression — the module does not compile
ANE_H15_PS_NAMES expands to { "ANE_SYS", "ANE_MPM", "ANE_CPU", "ANE_TD", "ANE_BASE" }, so ANE_H15_PS_NAMES[i] becomes { ... }[i], which is not a valid C expression (gcc: expected expression before '[' token). The other two sites introduce a local first (static const char *names[] = ANE_H15_PS_NAMES; at ane_h15_main.c:149 and :214); this function needs the same.
| dev_info(ane->dev, "pmgr.%s offset=%#x", ANE_H15_PS_NAMES[i], | |
| dev_info(ane->dev, "pmgr.%s offset=%#x", names[i], s->ps_off[i]); |
(Add static const char *names[] = ANE_H15_PS_NAMES; to ane_h15_stage_dt.) This also contradicts "The build was verified W=1-clean against the M2 3-1 tree" in ane/h15/README-bringup.md — the tree does not build as it stands.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
|
|
||
| if (row + stride > a->len) | ||
| return ANE_H15_EFORMAT; | ||
| for (k = 0; k < stride / 4; k++) |
There was a problem hiding this comment.
CRITICAL: Stack out-of-bounds write — v has 4 elements, the loop writes stride / 4
stride is 24 or 32, so this stores v[0]..v[5] (stride 24) or v[0]..v[7] (stride 32) into the 4-element u64 v[4] at ane_h15_adt.h:287, overwriting 16–32 bytes of stack on the first segment. The host self test walks exactly that path: ane_h15_adt_test.c builds a 48-byte segment-ranges, giving stride == 24.
| for (k = 0; k < stride / 4; k++) | |
| for (k = 0; k < 4u && k < stride / 4; k++) |
Only v[0]..v[3] are ever consumed below, so clamping the loop is the minimal fix (sizing v[8] also works). Note this parser walks firmware-supplied bytes, so the corruption is reachable from unvalidated input.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| return err; | ||
| if (ane_h15_adt_prop(a, c, "name", &nm, &size)) | ||
| continue; | ||
| if (size > 0 && !strncmp((const char *)nm, name, size) && |
There was a problem hiding this comment.
CRITICAL: This skips exactly the node being looked for, so arm-io is never found
For a standard ADT name property ("arm-io" plus its NUL, size == 7): size > 0 is true, !strncmp(nm, "arm-io", 7) is true, and !name[6] is true because name[6] is the NUL — so the continue on the next line fires for the exact match and the correct child is rejected before the real comparison on line 204 is ever evaluated. ane_h15_adt_child_named() then returns ANE_H15_ENOENT, which is what the first assertion in ane_h15_adt_test.c:90 exercises, so make -C ane/h15 check fails on the very first step. The condition also reads name[size - 1] past the end of the search literal whenever size > strlen(name) + 1.
It reads inverted relative to its own comment ("names match by length, but check exact NUL"): it should only reject a child whose name matches the prefix but keeps going (i.e. a longer name), not the terminal NUL case.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
|
|
||
| rmmod ane_h15 2>/dev/null || true | ||
| dmesg -c >/dev/null | ||
| insmod "${insmod_args[@]}" |
There was a problem hiding this comment.
CRITICAL: A failing insmod aborts the script before any receipt is written
set -euo pipefail (line 22) makes a non-zero insmod fatal, and insmod returns non-zero whenever probe() fails. Stages 2 and 3 always return -EPERM/-ENOENT/-ENOSYS, and stage 1 returns -ETIMEDOUT on the stuck-domain case — so precisely the verdict=REFUSED / verdict=FAIL outcomes the runbook tells the volunteer to send back (README-bringup.md steps 2-4) never reach lines 96-113 and no h15_stage JSON is emitted. The tool only produces a receipt when the stage succeeds, which is the one case that needs no diagnosis.
| insmod "${insmod_args[@]}" | |
| insmod "${insmod_args[@]}" || insmod_rc=$? |
then record ${insmod_rc:-0} in the JSON so a refusal is still receipted.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| 0x10000800000ull, 0x10000800000ull, 0x2ac000ull, | ||
| }; | ||
|
|
||
| /* root: 0 props, 1 child */ |
There was a problem hiding this comment.
WARNING: This blob's root node can never pass the parser's own guard
ane_h15_adt_node_at() rejects nprops == 0 with ANE_H15_EFORMAT (ane_h15_adt.h:82), and ane_h15_adt_find_ane() calls it for the root first (ane_h15_adt.h:223). So make -C ane/h15 check fails with find_ane: err=2 (want 0) before exercising the arm-io walk or the segment decode. Either give the root a dummy property (e.g. compatible) or drop n.nprops == 0 from the guard — a zero-property root is legal in an IODeviceTree-shaped blob. Together with the two findings in ane_h15_adt.h, the self test cannot pass as written.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| ane_type != soc->ane_type) { | ||
| dev_err(&pdev->dev, | ||
| "device apple,ane-type=%u (want %u); refusing\n", | ||
| ane_type, soc->ane_type); |
There was a problem hiding this comment.
SUGGESTION: ane_type is logged uninitialized when the property is missing
of_property_read_u32() short-circuits the ||, so if apple,ane-type is absent from the node, ane_type (declared at ane_h15_main.c:302) is still indeterminate when it is printed here — the one diagnostic that is supposed to explain why the probe refused. Initialize the declaration, or split the property-read failure into its own branch with a distinct message.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| * BEFORE the access so a hang leaves the last attempted | ||
| * address in the log. */ | ||
| for (i = 0; i < 5; i++) { | ||
| dev_crit(ane->dev, "ane_h15 read pmgr.%s pa=%#llx off=%#x", |
There was a problem hiding this comment.
SUGGESTION: This breadcrumb is missing its trailing newline
Without \n the printk record is appended to the previous dmesg line. This message exists solely so a hang leaves the last attempted address on its own line, so keep it terminated:
| dev_crit(ane->dev, "ane_h15 read pmgr.%s pa=%#llx off=%#x", | |
| dev_crit(ane->dev, "ane_h15 read pmgr.%s pa=%#llx off=%#x\n", |
The stage=dt: dev_info at ane_h15_main.c:185 has the same missing newline.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| module_path="./ane/h15/ane_h15.ko" | ||
| out=""; dry_run=0; root_check=0; idle=0 | ||
|
|
||
| usage() { sed -n '2,15p' "$0"; exit 2; } |
There was a problem hiding this comment.
SUGGESTION: usage() truncates the header comment mid-sentence
The comment block runs to line 21, so 2,15p cuts the pre-conditions list off after its second bullet and drops the --root-check and --idle notes:
| usage() { sed -n '2,15p' "$0"; exit 2; } | |
| usage() { sed -n '2,21p' "$0"; exit 2; } |
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| { | ||
| struct ane_h15_adt_node n = { .off = off }; | ||
|
|
||
| if (off + 8 > a->len) { |
There was a problem hiding this comment.
SUGGESTION: The bounds checks can wrap in 32-bit arithmetic
off is u32, so off + 8 here — and off + ANE_H15_ADT_PROP_HDR + ane_h15_adt_pad4(len) at lines 104 and 167 — is evaluated as unsigned int before being compared against the size_t a->len. A blob whose per-property len fields (masked to 31 bits, up to 4096 props) accumulate past 4 GiB wraps off back to a small value, the guard passes, and the following ane_h15_adt_rd32() reads megabytes outside the blob. Nothing calls this walker from the module today (only the host test does), but it exists to parse firmware-provided bytes — widen off to size_t, or reject len > a->len - off before advancing.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| static int ane_h15_ps_wait(struct ane_h15 *ane) | ||
| { | ||
| static const char *names[] = ANE_H15_PS_NAMES; | ||
| unsigned long deadline = jiffies + msecs_to_jiffies(ps_wait_ms); |
There was a problem hiding this comment.
SUGGESTION: ps_wait_ms is documented as per-word but the deadline is global
MODULE_PARM_DESC promises "Per-word pmgr ACTUAL=0xf wait, ms. Default 500", yet this single deadline is shared by all five words, so a slow ANE_CPU/ANE_TD/ANE_BASE domain gets whatever is left of the 500 ms (possibly zero) and is then reported as "stuck at". Move the assignment inside the outer loop for per-word semantics, or reword the parameter description.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: 13 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
WARNING
SUGGESTION
Files Reviewed (15 files)
Notes on method: read-only review at head Fix these issues in Kilo Cloud Reviewed by free · Input: 180.5K · Output: 27.1K · Cached: 1.4M |
Summary
(T8122 M3, T6030 M3 Pro, T6031 M3 Max, T6034 j514m/j516m). Four-stage
module (dt/status/wrapper/boot); no M3 silicon has run it.
refuse on H15 (no macOS capture has cleared the role of any
engine-aperture word).
ane/h15/with opt-in keyane-h15-experimental; the T8122/T6030overlays also add the MPM/CPU/TD/BASE power-controller nodes that
the aurora t8122-pmgr.dtsi / t6030-pmgr.dtsi do not yet carry.
packaging/dt/follow theomarchy,data-onlyconvention fortools/test_ane_overlays.py --data-only(validated by.github/workflows/aurora-dtbs.yml).ane/h15/README-bringup.md) with the volunteerprotocol, stop rules, and the four exact commands that the
first M3 owner runs.
ane/h15/ane_h15_adt_test.c,make -C ane/h15 check) exercises the pure parser on ahand-built IODeviceTree-shaped blob.
idle gate, and dmesg capture, and emits a JSON file with field
name
h15_stagefor the collector. Dry-run mode proves theplan without a kernel.
Standing rules respected
optin=<soc>matches.of_iomap(non-posted where the parent advertisesnonposted-mmio) instead ofdevm_platform_ioremap_resource_*.pr_critBEFORE the access so ahang leaves the last attempted address in the log.
default 0 = skip; boot_wait_ms absent because stage 3 refuses
before any wait).
ane_t6021CoreSightoffsets are listed as
ANE15_TIER_FORBIDDENin the per-SoCword table; the module never reads them.
What is INFERENCE / not measured
word roles, the SCRATCH wake word, the M3 firmware image that
iBoot preloads for a Linux boot, the Mach-O vm layout, the RVBAR
compose value. The b0 receipt (
receipts/2026-10-03-ane-h15/)lists every fact and its source.
What is NOT in this change
payload bytes are in git. The
omarchy-ane-firmware-fetchM3row stays empty.
data-only validation is the
aurora-silicon/linux aurora-wipboard trees (the same source
.github/workflows/aurora-dtbs.ymluses).
the aurora tree are referenced in the runbook but the W=1
receipt will land as a separate follow-up commit.
only); a t6034 owner copies the t6031 overlay and swaps the
compatible.
Files
ane/h15/ane_h15_main.c,ane_h15_soc.c,ane_h15.h,ane_h15_adt.h,ane_h15_adt_test.c,Makefile,README-bringup.mdane/h15/t8122-ane-experimental.dts,ane/h15/t6030-ane-experimental.dts,ane/h15/t6031-ane-experimental.dtspackaging/dt/t8122-ane-dataonly.dts,packaging/dt/t6030-ane-dataonly.dts,packaging/dt/t6031-ane-dataonly.dtstools/omarchy-ane-h15-stageCHANGELOG.md(one line)References
receipts/2026-10-03-ane-h15/README.md(b0 family decision, per-SoC table, evidence tiers)ane/h16/(merged H16 module; the structural template)ane/t6021/ane_t6021.h(proven ASC constants, fatal-read range)data/ane-soc/{t8122,t6030,t6031,t6034}.json(post-b0 corrected records)