Skip to content

arm64: apple: t6041: support J616c (M4 Max) on macOS 27.2 (26B123) firmware - #1954

Merged
DjDeveloperr merged 5 commits into
aurora-silicon:integration/aurorafrom
astaff:t6041/j616c-fw27-26b131
Nov 19, 2026
Merged

DjDeveloperr merged 5 commits into
aurora-silicon:integration/aurorafrom
astaff:t6041/j616c-fw27-26b131

Conversation

@astaff

@astaff astaff commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What this PR changes

This PR adds Linux support for macOS 27.2 (26B123) firmware on T6041 (M4 Max, verified on J616c MacBook Pro 16-inch).

  1. soc: apple: aop: map __EDATA and patch ED0p (60f279c2bc9e)
    • apple_aop checks one translated __EDATA firmware region after __ETEXT and writes its IOVA into ED0p.
    • It leaves unused ED0p entries untouched on 26.x firmware.
  2. accel/ane: add the H16 27.2 (26B123) profile (1a1c13889998)
    • ane adds the 26B123 preload rule (ane_h16_preload_26b123), checks unlocked DART protection bits, and frees pristine_data on rollback.
  3. drm/asahi: add T6041 27.2 (26B123) GPU support (f98da6090b66)
    • asahi adds v26b123 initdata layouts driven from the chip Config (covering both 40-core BASE and 32-core t6041_25g83::CONFIG 4-cluster layouts), upgrades the runtime graph, and uses release opcode 0x13 on 26B123.
  4. drm/apple, soc/apple: enable T6041 internal and external displays on 27.2 (e538e576af34)
    • display-gate and apple-dcp (apple_t6041_dcp{,ext}_v27_2()) admit apple,t6041-dcp and apple,t6041-dcpext (dcpext0..2) on 27.2.0 keyed purely on the DCP IP compatible and 26B123 UUID 964EDE5B-8F78-38C2-A727-519CC9F0AF27, failing closed on unapproved 27.x builds across both internal and headless/external T6041 topologies.
    • apple-dcp enables 41-bit DMA, live-session adoption, Type-C route PHY power, crossbar link-up, and DP/HDMI audio on T6041 dcpext.

Why

  • macOS 27.2 (26B123) updates the AOP, ANE, GPU, and DCP firmware interfaces on T6041.
  • Existing 26.5.2 (25F84) and 26.6.2 (25G83) desktop operation stays unchanged.

Hardware and host tests

  • Host selftests and arm64 KUnit
    • arm64 KUnit (ane, asahi fwid, and display-gate): passed cleanly, including t6041 27.2 admission and unapproved-27.x internal/external refusal controls.
    • tools/testing/selftests/drivers/gpu/apple-dcp/run.py: 88 / 88 passed, including t6041-v27-admission (with zero of_machine_is_compatible() stubs).
    • aop-bootargs-tests.py, g17-t6041-initdata-tests.py, g17-firmware-selection-tests.py, t6040-calibration-tests.py, and scripts/checkpatch.pl: passed cleanly.
  • Hardware tests on J616c (M4 Max, 16-core CPU, 40-core GPU, 64 GB RAM)
    • Booted cleanly with all 16 CPUs online, apple_aop, ane (0-ULP match), and Vulkan GPU compute (0 faults).
    • Checked internal panel (3456x2234@120), HDMI (dcpext0), dual USB-C DisplayPort (dcpext1..2), and DP/HDMI audio (0 faults).
    • Checked that 26B123 and 26B131 firmware binaries match across GFX, ANE, AOP, PMP, DeviceTree, and DCP code.

Paired bootloader PR

@RyanTheTide

Copy link
Copy Markdown
Contributor

The production boot stub pins at macOS 27.2 (26B123), so please retarget this to 27.2. 26B131 is the 27.2.1 build; please target the J616c on the 27.2 (26B123) stub.

…firmware

The T6041 AOP firmware shipped with macOS 27.2 (26B123) adds a
translated __EDATA segment after __ETEXT (at IOVA 0x10000020000) and
reads its base IOVA from the ED0p boot-argument patchbay entry, while
__OS_LOG remains identity-mapped.

Validate at most one additional translated firmware memory-region in
check_fw_regions(), requiring it to be non-empty, page-aligned, mapped
page-for-page in the AOP IOMMU domain, and placed at or after the end of
the __ETEXT region at EC0p. When such a region is present, require a
single 8-byte ED0p bootarg entry and patch it with the validated IOVA
before writing MMIO; when absent, leave any unused ED0p entry untouched
so 26.x firmware behavior is preserved.

Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
macOS 27.2 (26B123) ships a new resident Neural Engine image on T6041
(J616c). Its DATA framing, patchbay cells and zeroed range match 26A428
and its cold-boot and ABI-3 program parameters match ane_h16_build_26a428,
so add the normalized resident preload rule and profile to ane_h16_profiles.

Also enforce that none of the three H16 DARTs has TTBR/TCR protection
(bit 0) set before claiming DMA ownership in ane_h16_map(), free the
saved pristine_data snapshot on pre-RUN rollback in ane_h16_release(),
and cover the 26B123 preload rule and DART protection check in KUnit.

Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
@astaff
astaff force-pushed the t6041/j616c-fw27-26b131 branch from f0ba65d to 30dcfaf Compare November 18, 2026 17:24
@astaff astaff changed the title arm64: apple: t6041: support J616c (M4 Max) on macOS 27.2.1 (26B131) firmware arm64: apple: t6041: support J616c (M4 Max) on macOS 27.2 (26B123) firmware Nov 18, 2026
@astaff

astaff commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Retargeted to macOS 27.2 (26B123) (v26b123.rs, ane_h16_preload_26b123, and APPLE_J616C_DCP_26B123_UUID = "964EDE5B-8F78-38C2-A727-519CC9F0AF27"), rebased cleanly onto current integration/aurora, and verified end-to-end on J616c with aurora-silicon/aura#265. (GFX, ANE, AOP, PMP, DeviceTree, and SPTM are 0-byte identical between 26B123 and 26B131, and t604xdcp.bin is identical across all 10,375,168 bytes apart from the 3 UUID copies and 3 build-counter digits — full digest/diff table added to the PR description.)

@astaff
astaff marked this pull request as ready for review November 18, 2026 18:08
@astaff
astaff force-pushed the t6041/j616c-fw27-26b131 branch from 30dcfaf to 54e846c Compare November 19, 2026 00:08
@astaff

astaff commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Updated commit 4 (54e846cc4425) to also enable HDMI (dcpext0), dual USB-C DisplayPort (dcpext1..2), and DP/HDMI audio on J616c macOS 27.2 (26B123), pinned strictly to UUID 964EDE5B-8F78-38C2-A727-519CC9F0AF27, alongside aurora-silicon/aura#265.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the 27.2 work on the M4 Max. The firmware UUID and version pins for the new interfaces make sense.

Two gates select machines rather than hardware, and we try to avoid that in this tree:

  • include/linux/soc/apple/display.h:25-26 requires of_machine_is_compatible("apple,j616c") before the DCP version and UUID checks. The firmware pin already identifies the image. If the J614c or Mac Studio runs the same 26B123 DCP image, it should be admitted too. If its image differs, its UUID won't match anyway.
  • drivers/gpu/drm/asahi/g17/initdata/v26b123.rs:44 refuses anything other than chip_id == 0x6041 && active_cores == 40 && clusters == 4. If the 26B123 layout really depends on the core count, a comment naming that layout difference would cover it. Otherwise, could it be driven by the firmware variant and the chip's existing config, so 32-core parts get it too?

Could you key both on the firmware identity and the IP compatible only? If useful, we can run no-regression rows on our M4 Pro.

Add support for the T6041 (M4 Max) GPU firmware shipped with macOS 27.2
(26B123, iBoot mBoot-20457.41.3):

- Add the g17::fw::initdata::v26b123 wire layouts for the updated
  interface version, 60-slot register descriptor table and separate
  GPTBAT MMIO mapping, 0x2850-byte hardware-data object, 0x6c48-byte
  cold power configuration, cold power-state limiter table, 19-row AON
  sensor table, shifted region-C prefix (+4 bytes past +0x38), and
  relocated main-configuration power pointer (+0x481).
- Upgrade the T6041 25G83/25F84 runtime graph into distinct retained
  allocations when Variant::v26b123 is active, driving core count, AMCC
  register windows, OPPs, and power limits from the matched chip Config
  across both 40-core and 32-core 4-cluster T6041 parts while keeping all
  25G83 and 25F84 paths unchanged.
- Emit opcode 0x13 without incrementing the host power-assert tally for
  scheduler-state release on 26B123 (matching M5), as 0x14 is repurposed
  in 26B123.
- Register the normalized T6041 26B123 loaded-image identity for both the
  40-core and 32-core T6041 configurations in hw::t6041::BUILDS and cover
  both in the fwid and event-record unit tests.

Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
…27.2

Enable internal and external displays on T6041 boards running macOS 27.2
(26B123):

- Add apple_t6041_dcp_v27_2() and apple_t6041_dcpext_v27_2() keyed on the
  DCP IP compatibles (apple,t6041-dcp / apple,t6041-dcpext), 27.2.0
  firmware/compat versions, and UUID 964EDE5B-8F78-38C2-A727-519CC9F0AF27.
- Enable the internal display chain and external HDMI and USB-C chains in
  display-gate for the pinned 27.2 T6041 DCP image, while keeping external
  chains off on unapproved firmware-27 builds (including headless boards).
- Select DCP_FIRMWARE_V_27_0 for 27.2 T6041 internal and external DCPs
  after checking the v27 method table.
- Use 41-bit firmware DMA, live-session adoption, two DPTX ports, and
  sink metadata EDID on T6041 v27 dcpext.
- Build the two-entry disp0 clock table when apple,clock-ids is absent,
  and allow zero clocks on T6041 dcpext.
- Enable desktop Type-C route power, PHY handling, HDMI rail delay, and
  crossbar link-up on T6041 v27 dcpext.

Existing 26.5.2 and 26.6.2 desktop display support stays unchanged. Add
display-gate KUnit and apple-dcp selftests.

Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
@astaff
astaff force-pushed the t6041/j616c-fw27-26b131 branch from 7e4fac7 to e538e57 Compare November 19, 2026 17:53
@astaff

astaff commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review! Both machine gates are now removed and keyed purely on the IP compatibles and firmware identities:

  1. DCP 27.2 admission (include/linux/soc/apple/display.h, drivers/soc/apple/display-gate.c, e538e576af34):
    Dropped of_machine_is_compatible() from display.h (renaming the helpers to apple_t6041_dcp_v27_2() / apple_t6041_dcpext_v27_2() and APPLE_T6041_DCP_26B123_UUID), so any board whose apple,t6041-dcp / apple,t6041-dcpext node presents 27.2.0 and UUID 964EDE5B-8F78-38C2-A727-519CC9F0AF27 (J616c, J614c, J575c) is admitted automatically while any other UUID fails closed. Also extended gate_t6041_max_run() to check each external stage's dcpext node for unapproved firmware-27 builds so headless T6041 topologies without internal dcp firmware properties stay gated as well.

  2. G17 26B123 initdata & 32-core T6041 (drivers/gpu/drm/asahi/g17/initdata/v26b123.rs, hw/t6041.rs, f98da6090b66):
    initialize_25g83() already populates active_cores, cfg.windows (6 vs 8 AMCCs), DT OPPs/CS/AFR tables, and chip.max_power_mw/leakage from cfg, and both 32-core and 40-core T6041 parts have 4 GPU clusters (g0TR..g3TR). Dropped active_cores != 40 from upgrade_26b123() (documenting the 4-cluster T6041 layout requirement and preserving cfg.perf's relative ladders when active_cores != 40), and paired BUILD_26B123 with both BASE ((4, 40)) and t6041_25g83::CONFIG ((4, 32)) in hw::t6041::BUILDS just like BUILD_25G83.

No-regression rows on M4 Pro would be very welcome if convenient!

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for removing both machine gates. DCP admission now follows the IP compatible and the firmware UUID, and the 26B123 initdata covers the 32-core parts too, with a comment on the four-cluster layout. We will run a no-regression row on our M4 Pro.

The 26B123 builds made T6041 admit five firmware builds, but the
asahi_g17_ta_mode KUnit suite still asserted three, so
policy_is_local_to_the_admitted_t6041_builds and every test that asks
t6041_ta_mode_1() panicked on the count.

Expect five, check that the 40- and 32-core entries of both 25G83 and
26B123 share their rules, and hold 26B123 to the TA mode and register
programs the other T6041 builds run.

Signed-off-by: Diljit Singh <hey@djdev.me>
@DjDeveloperr

Copy link
Copy Markdown
Contributor

@astaff I added d3a9ec7 (tests only): the asahi_g17_ta_mode KUnit suite (g17/fw/render.rs:1762) still asserted that T6041 admits 3 builds. With the two 26B123 entries hw/t6041.rs now has 5, so policy_is_local_to_the_admitted_t6041_builds and every test that calls t6041_ta_mode_1() would panic. It now expects 5, checks that the 40- and 32-core entries of both 25G83 and 26B123 share their rules, and checks that 26B123 keeps the T6041 TA mode and register programs. CI hasn't run on it yet (the linux queue is ~130 runs deep).

Review, on the board-scoping question. Nothing here reaches the Neo (T8140) or the M5 (T6050): the g17 variant and offset changes only exist in the T6041 build table, and the M5 already treats opcode 0x13 the same way. Three points remain, all outside T6041:

  1. ane_h16_backend.c:941-944: ane_h16_dart_protection(b, true) runs on every H16 ANE: apple,t6041-ane, which J614s/J616s use through t604x.dtsi, and apple,t8132-ane (J713, J773g). Any of those boards whose iBoot leaves bit 0 of DART+0x200 set now gets -EPERM at MAP on 26.6.2, where MAP used to succeed. Refusing firmware-owned roots is sensible, but is bit 0 known to be clear on 26.x for those boards? If not, please either limit the refusal to the 26B123 profile or say so in the commit. We'll check the H16 DART map protect log lines on our M4 mini.
  2. aop.rs:2096-2125: on boards that check their firmware regions (apple,t6041-aop, apple,t8132-aop), any single translated region other than EC0p is taken as __EDATA, checked only for starting after __ETEXT. That's fine on 26.x trees, but the gate is the region layout rather than the firmware or the SoC, so a 27.2 M4 mini/J713 would write ED0p too. Can it match the segment by name, or check ED0p exists before accepting the region?
  3. display-gate.c:3303: the log says "internal display only", but gate_t6041_internal() has already refused that unapproved internal DCP, so nothing is enabled.

Also on cross-board scope: the DCP gate (display.h:19-46) is keyed on the apple,t6041-dcp(ext) compatible plus the 26B123 UUID, and T6040 boards use that compatible too. That works if T6040's 27.2 DCP image has a different UUID, which seems likely.

@DjDeveloperr
DjDeveloperr merged commit 7f01c9e into aurora-silicon:integration/aurora Nov 19, 2026
7 checks passed
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Merged as 7f01c9e. linux Actions has been stalled org-wide since ~16:24Z (checks queued since 19:16Z), so this went in under the owner's runner-outage rule. Host tests for the touched areas pass, and the PR's code built into the Neo (Ryzen kit) and M5 (on-device) test kernels. MacBook Neo (J700) A/B with the whole J616c set: no regression (work: display, G17P dEQP smoke, ANE, AOP, camera stream/runtime-PM/reopen, deep sleep). M5 Pro (J714s, T6050) A/B: PASS on every row. Post-merge: CI is watched once runners return, and the M4 mini row checks H16 ANE map/protect on T8132.

@RyanTheTide

Copy link
Copy Markdown
Contributor

M4 Pro (J616s, T6040) row on d3a9ec7: pass. Built from the exact head with the fleet75 config recipe (olddefconfig delta vs fleet75: +APPLE_J613_DISPLAY_SYNC, MT7932_AWDL y->n).

Rows on every test boot
boot Stage 2 kernel result
production aura b10 fleet75 baseline
A main 8fb038f + aura#373 0e35033e + aura#265 230c9f34 fleet75 pass
control main 8fb038f fleet75 pass
B production b10 linux#1954 d3a9ec7 pass
C A + aura#304 22f12251 linux#2216 5f25058 pass
D A + aura#304 22f12251 linux#1954 d3a9ec7 pass

Each test boot: SELinux enforcing, 0 failed units, 0 AVC denials, 0 kernel lines at err level, s2idle 2/2 (rtcwake, Wi-Fi reconnects, gateway ping ok), 0 DART faults, NVMe/USB/Wi-Fi up, eDP connected with 6 modes, AVE H.264 and HEVC 120-frame encodes byte-identical to production, GL and Vulkan both report "Apple M4 Pro (G16S B1)", AOP RTKit up with 8 IIO devices, ANE bound. Aura ran as a one-shot ESP Stage 2 (Stage 1 unchanged); kernels were built from the exact PR heads with the fleet75 config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants