Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
40 changes: 40 additions & 0 deletions .github/workflows/dt-overlays.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: dt-overlays

# The ANE device tree overlays against every linux-asahi board device tree they
# select (tools/asahi-dtbs, tools/test_ane_overlays.py), plus the offline
# omarchy-ane-dt and omarchy-ane-m2-enable checks.
on:
push:
branches: [main]
paths:
- packaging/**
- tools/asahi-dtbs
- tools/test_ane_dt.py
- tools/test_ane_m2.py
- tools/test_ane_overlays.py
- .github/workflows/dt-overlays.yml
pull_request:
paths:
- packaging/**
- tools/asahi-dtbs
- tools/test_ane_dt.py
- tools/test_ane_m2.py
- tools/test_ane_overlays.py
- .github/workflows/dt-overlays.yml

jobs:
overlays:
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
# fdtget and fdtput; dtc and fdtoverlay come from the kernel tree.
- run: sudo apt-get update -qq && sudo apt-get install -y -qq --no-install-recommends device-tree-compiler flex bison
- run: tools/asahi-dtbs "$RUNNER_TEMP/asahi"
- name: tests (kernel dtc 1.7.2, libfdt linked in)
run: |
export PATH="$RUNNER_TEMP/asahi/bin:$PATH"
dtc --version
python3 tools/test_ane_dt.py
python3 tools/test_ane_m2.py
ANE_DTBS="$RUNNER_TEMP/asahi/dtbs" python3 tools/test_ane_overlays.py
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# Changelog

## Unreleased

### Added

- ANE overlays for every SoC with cited values. T6000 (M1 Pro) and the T6002
(M1 Ultra) die 0 get the T6001 nodes, behind the opt-in keys `ane-t6000` and
`ane-t6002`; `ane.ko` binds them with the `apple,t6000-ane` data. T6020 (M2
Pro) and the T6022 (M2 Ultra) die 0 get the T6021 nodes, but the package
does not install them: no driver binds them. The macOS 13.5 ADTs give the
same values on these SoCs. T8112 and M3 and later get no overlay.
- `omarchy-ane-check` prints `UNTESTED SoC: SOC` on every SoC other than T8103,
T6001 and T6021, and fails on a SoC that no driver supports.
- `tools/test_ane_overlays.py` applies every overlay to every linux-asahi
7.1.13 board device tree it selects. `tools/asahi-dtbs` builds those device
trees, byte for byte as the Arch package has them, and a dtc 1.7.2 with
libfdt linked in. The `dt-overlays` workflow runs them.

### Changed

- The overlays install to `/usr/share/omarchy-platform/dtb-overlays`, the
directory of omacom/omarchy-mac#677. It was
`/usr/lib/omarchy-platform/dtb-overlays`. `OVERLAY_DIR` in `omarchy-ane-dt`
is the one place that names it. While `.dtbo` files are still in the old
directory (a hand install), `omarchy-ane-dt apply` refuses and keeps the
current copies; the README gives the three move commands. `update-m1n1-dtbs`
and the hooks stay: Arch Linux ARM installs have no omarchy-mac-boot.
- The T600x and T602x overlays share their nodes through `t600x-ane.dtsi` and
`t602x-ane.dtsi`. The T6001 and T6021 `.dtbo` files do not change.
- `omarchy-ane-dt` names the libfdt trap when fdtoverlay renumbers a phandle.
- The README chip table gives each SoC its ANE firmware, support state,
overlay gate, and the data that is missing.

## 0.4.0 (2026-10-01)

The T6021 (M2 Max) driver stays opt-in. This release adds whole-model runs on
Expand Down
69 changes: 35 additions & 34 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions ane/src/ane_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -919,8 +919,8 @@ static const struct ane_soc ane_soc_t8103 = {
};

static const struct ane_soc ane_soc_t6000 = {
/* M1 Pro and M1 Max share this compatible and SET base (proven on
* T6001/t6001-test-host); M1 Pro still needs a board overlay and a tester. */
/* M1 Pro, M1 Max and M1 Ultra die 0 share this compatible and SET base
* (proven on T6001/t6001-test-host); M1 Pro and M1 Ultra are untested. */
.ps_base = 0x28e08c000ULL,
.qual = ANE_QUALIFIED,
.tm_retention = true,
Expand Down
5 changes: 3 additions & 2 deletions packaging/90-omarchy-ane-dt.hook
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Before 95-m1n1-install.hook (asahi-scripts), so the update-m1n1 it runs after
# a kernel update reads the overlaid board device tree.
# a kernel update reads the overlaid board device tree. The second Target is
# OVERLAY_DIR of omarchy-ane-dt.
[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Operation = Remove
Target = usr/lib/modules/*/dtbs/*
Target = usr/lib/omarchy-platform/dtb-overlays/*
Target = usr/share/omarchy-platform/dtb-overlays/*

[Action]
Description = Adding the ANE node to the board device tree...
Expand Down
10 changes: 7 additions & 3 deletions packaging/build-dtbo
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
#!/bin/bash
# Compile the enabled and opt-in device tree overlays in packaging/dt/overlays:
# SOURCE PREFIX-NAME.dts becomes
# DESTDIR/usr/lib/omarchy-platform/dtb-overlays/PREFIX/omarchy-NAME.dtbo
# DESTDIR/OVERLAY_DIR/PREFIX/omarchy-NAME.dtbo
# OVERLAY_DIR is the constant in packaging/omarchy-ane-dt.
# For a package recipe: packaging/build-dtbo "$pkgdir". Needs dtc.
set -euo pipefail
destdir=${1:?usage: build-dtbo DESTDIR}
dt=$(dirname -- "$(realpath -- "$0")")/dt
here=$(dirname -- "$(realpath -- "$0")")
dt=$here/dt
overlay_dir=$(sed -n 's/^OVERLAY_DIR = "\(.*\)"$/\1/p' "$here/omarchy-ane-dt")
[[ -n $overlay_dir ]] || { echo "build-dtbo: no OVERLAY_DIR in $here/omarchy-ane-dt" >&2; exit 1; }
while read -r prefix source state; do
[[ -n $prefix && $prefix != \#* ]] || continue
[[ $state == enabled || $state == opt-in ]] || { echo "build-dtbo: $prefix: $state, not installed"; continue; }
name=${source%.dts}
[[ $source == *.dts && $name == "$prefix"-?* ]] || { echo "build-dtbo: $source: not named $prefix-NAME.dts" >&2; exit 1; }
out=$destdir/usr/lib/omarchy-platform/dtb-overlays/$prefix/omarchy-${name#"$prefix"-}.dtbo
out=$destdir/$overlay_dir/$prefix/omarchy-${name#"$prefix"-}.dtbo
install -d "${out%/*}"
dtc -q -@ -I dts -O dtb -o "$out" "$dt/$source"
echo "build-dtbo: $prefix ($state): ${out#"$destdir"}"
Expand Down
15 changes: 11 additions & 4 deletions packaging/dt/overlays
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
# Device tree overlays the package installs. SOURCE PREFIX-NAME.dts installs as
# /usr/lib/omarchy-platform/dtb-overlays/PREFIX/omarchy-NAME.dtbo
# (packaging/build-dtbo). PREFIX selects the board device trees by file name.
# STATE: enabled applies by default; opt-in applies only after the owner
# opts in (the overlay's "omarchy,opt-in" string, listed in
# OVERLAY_DIR/PREFIX/omarchy-NAME.dtbo (packaging/build-dtbo; OVERLAY_DIR is
# the constant in packaging/omarchy-ane-dt). PREFIX selects the board device
# trees by file name. STATE: enabled applies by default; opt-in applies only
# after the owner opts in (the overlay's "omarchy,opt-in" string, listed in
# /etc/omarchy-platform/dtb-overlays.opt-in); disabled is not installed.
# Tested SoCs are enabled (T8103, T6001) or opt-in for a driver that cannot
# unload (T6021). Untested SoCs are opt-in. SoCs that no driver binds are
# disabled. The SoC table is in README.md, "Chip coverage".
#
# PREFIX SOURCE STATE
t8103 t8103-ane.dts enabled
t6000 t6000-ane.dts opt-in
t6001 t6001-ane.dts enabled
t6002 t6002-ane.dts opt-in
t6020 t6020-ane.dts disabled
t6021 t6021-ane.dts opt-in
t6021 t6021-uboot-serial-stdin.dts opt-in
t6022 t6022-ane.dts disabled
21 changes: 21 additions & 0 deletions packaging/dt/t6000-ane.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: GPL-2.0+ OR MIT
/*
* ANE for T6000 (M1 Pro) board device trees. UNTESTED, OPT-IN: installed, but
* it applies only when "ane-t6000" is a line of
* /etc/omarchy-platform/dtb-overlays.opt-in. No M1 Pro has run ane.ko.
*
* The nodes are the T6001 ones (t600x-ane.dtsi): the macOS 13.5 ADTs of j314s
* and j316s have the same ane0, dart-ane0 and pmgr ANE values as j316c, and
* ane.ko drives both with apple,t6000-ane and SET base 0x28e08c000.
*/
/dts-v1/;
/plugin/;

/ {
/* dtb-overlays.sh: a kernel tree that has the node keeps its own. */
omarchy,skip-if-compatible = "apple,t6000-ane";
/* dtb-overlays.sh: applies only when opted in. */
omarchy,opt-in = "ane-t6000";
};

/include/ "t600x-ane.dtsi"
155 changes: 4 additions & 151 deletions packaging/dt/t6001-ane.dts
Original file line number Diff line number Diff line change
@@ -1,162 +1,15 @@
// SPDX-License-Identifier: GPL-2.0+ OR MIT
/*
* ANE for T6001 (M1 Max) board device trees, for kernels whose trees lack it.
*
* The nodes are those of the lab overlay ane/t6001-j316c-set-domains.dts,
* which bound ane.ko and ran exact fp16 programs on the M1 Max host. Two
* changes make it safe on every stock T6001 tree:
* - AIC and ane_sys@268 are reached by path. The lab file uses their raw
* phandles 0x13 and 0x18, which are right only while the kernel keeps them.
* - The pmgr window is 0x1c000. The lab file sets 0x14000 to cover SET0 at
* 0xc000. linux-asahi 7.1.13 ships 0x4000, but linux-aurora 7.1.12 already
* ships 0x1c000 with a child past 0x14000, so 0x14000 would cut that off.
* set5@c030 stays out of the ane node: it is past ADT range1 0xc02c.
* Tested: the nodes of t600x-ane.dtsi bound ane.ko and ran exact fp16
* programs on the M1 Max host.
*/
/dts-v1/;
/plugin/;

/ {
/* dtb-overlays.sh: a kernel tree that has the node keeps its own. */
omarchy,skip-if-compatible = "apple,t6000-ane";

fragment@0 {
target-path = "/soc/interrupt-controller@28e100000";
aic: __overlay__ {
};
};

fragment@1 {
target-path = "/soc/power-management@28e080000/power-controller@268";
ps_ane_sys: __overlay__ {
};
};

fragment@2 {
target-path = "/soc/power-management@28e080000/power-controller@2c8";
ane_cpu_pd: __overlay__ {
};
};

fragment@3 {
target-path = "/soc/power-management@28e080000";

__overlay__ {
reg = <0x2 0x8e080000 0 0x1c000>;

ps_ane_set0: power-controller@c000 {
compatible = "apple,t6000-pmgr-pwrstate", "apple,pmgr-pwrstate";
reg = <0xc000 4>;
#power-domain-cells = <0>;
#reset-cells = <0>;
label = "ane_set0";
power-domains = <&ane_cpu_pd>;
};

ps_ane_base: power-controller@c008 {
compatible = "apple,t6000-pmgr-pwrstate", "apple,pmgr-pwrstate";
reg = <0xc008 4>;
#power-domain-cells = <0>;
#reset-cells = <0>;
label = "ane_base";
power-domains = <&ps_ane_set0>;
};

ps_ane_set1: power-controller@c010 {
compatible = "apple,t6000-pmgr-pwrstate", "apple,pmgr-pwrstate";
reg = <0xc010 4>;
#power-domain-cells = <0>;
#reset-cells = <0>;
label = "ane_set1";
power-domains = <&ps_ane_base>;
};

ps_ane_set2: power-controller@c018 {
compatible = "apple,t6000-pmgr-pwrstate", "apple,pmgr-pwrstate";
reg = <0xc018 4>;
#power-domain-cells = <0>;
#reset-cells = <0>;
label = "ane_set2";
power-domains = <&ps_ane_base>;
};

ps_ane_set3: power-controller@c020 {
compatible = "apple,t6000-pmgr-pwrstate", "apple,pmgr-pwrstate";
reg = <0xc020 4>;
#power-domain-cells = <0>;
#reset-cells = <0>;
label = "ane_set3";
power-domains = <&ps_ane_base>;
};

ps_ane_set4: power-controller@c028 {
compatible = "apple,t6000-pmgr-pwrstate", "apple,pmgr-pwrstate";
reg = <0xc028 4>;
#power-domain-cells = <0>;
#reset-cells = <0>;
label = "ane_set4";
power-domains = <&ps_ane_base>;
};

ps_ane_set5: power-controller@c030 {
compatible = "apple,t6000-pmgr-pwrstate", "apple,pmgr-pwrstate";
reg = <0xc030 4>;
#power-domain-cells = <0>;
#reset-cells = <0>;
label = "ane_set5";
power-domains = <&ps_ane_base>;
};
};
};

fragment@4 {
target-path = "/soc";

__overlay__ {
ane_dart0: iommu@285800000 {
compatible = "apple,t6000-dart";
reg = <0x2 0x85800000 0x0 0x00004000>;
#iommu-cells = <1>;
interrupt-parent = <&aic>;
interrupts = <0 0 771 4>;
power-domains = <&ps_ane_sys>;
status = "okay";
};

ane_dart1: iommu@285810000 {
compatible = "apple,t6000-dart";
reg = <0x2 0x85810000 0x0 0x00004000>;
#iommu-cells = <1>;
interrupt-parent = <&aic>;
interrupts = <0 0 771 4>;
power-domains = <&ane_cpu_pd>;
status = "okay";
};

ane_dart2: iommu@285820000 {
compatible = "apple,t6000-dart";
reg = <0x2 0x85820000 0x0 0x00004000>;
#iommu-cells = <1>;
interrupt-parent = <&aic>;
interrupts = <0 0 771 4>;
power-domains = <&ane_cpu_pd>;
status = "okay";
};

ane@284000000 {
compatible = "apple,t6000-ane";
reg-names = "engine";
reg = <0x2 0x85c04000 0x0 0x0024000>;
interrupt-parent = <&aic>;
interrupt-names = "ane";
interrupts = <0 0 770 4>;
iommus = <&ane_dart0 0>, <&ane_dart1 0>, <&ane_dart2 0>;
power-domains = <&ane_cpu_pd>,
<&ps_ane_set1>,
<&ps_ane_set2>,
<&ps_ane_set3>,
<&ps_ane_set4>;
status = "okay";
};
};
};
};

/include/ "t600x-ane.dtsi"
26 changes: 26 additions & 0 deletions packaging/dt/t6002-ane.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// SPDX-License-Identifier: GPL-2.0+ OR MIT
/*
* ANE for T6002 (M1 Ultra) board device trees: the die-0 ANE only. UNTESTED,
* OPT-IN: installed, but it applies only when "ane-t6002" is a line of
* /etc/omarchy-platform/dtb-overlays.opt-in. No M1 Ultra has run ane.ko.
*
* Die 0 is the T6001 die (t600x-ane.dtsi): the macOS 13.5 ADT of j375d has
* the same ane0, dart-ane0 and pmgr ANE values as j316c.
*
* The die-1 ANE (ADT ane2: 0x2284000000, interrupt 770 on die 1, DARTs at
* 0x2285800000) is left out. ane.ko takes the SET block from its per-
* compatible descriptor, not from the node: apple,t6000-ane has the die-0
* base 0x28e08c000 (ane/src/ane_drv.c ane_soc_t6000). A die-1 node would
* guard its engine reads with the die-0 power state.
*/
/dts-v1/;
/plugin/;

/ {
/* dtb-overlays.sh: a kernel tree that has the node keeps its own. */
omarchy,skip-if-compatible = "apple,t6000-ane";
/* dtb-overlays.sh: applies only when opted in. */
omarchy,opt-in = "ane-t6002";
};

/include/ "t600x-ane.dtsi"
Loading
Loading