Skip to content

DRAFT: T8142 Bringup - #26

Draft
ADevWithAnIdea wants to merge 36 commits into
mainfrom
PR_t8142_bringup
Draft

ADevWithAnIdea wants to merge 36 commits into
mainfrom
PR_t8142_bringup

Conversation

@ADevWithAnIdea

@ADevWithAnIdea ADevWithAnIdea commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

WIP, rn it's unreviewed llm output. Not going to merge until 27.3 final releases.

@ADevWithAnIdea
ADevWithAnIdea marked this pull request as draft November 16, 2026 21:12
jannau and others added 29 commits November 30, 2026 01:44
Adds new rust dependency sha1_smol.

Signed-off-by: Janne Grunau <j@jannau.net>
`__always_unused` and `__maybe_unused` look nicer than the plain
`__attribute__((unused))`. Copy the defines from Linux's
include/linux/compiler_attributes.h and convert the two in tree uses of
`__attribute__((unused))` to `__maybe_unused`.

Signed-off-by: Janne Grunau <j@jannau.net>
This survived longer than expected.

Signed-off-by: Janne Grunau <j@jannau.net>
New "/aliases" properties should not have been added. In addition this
one was undocumented.

Signed-off-by: Janne Grunau <j@jannau.net>
The use of "/aliases" to match FDT nodes to ADT nodes for copying device
specific data like tuneables is not desired in upstream devicetrees. One
alternative is to iterate over all FDT nodes and find matching ADT nodes
by comparing addresses. dt_disable_missing_devs() already does the same
so factor common functionality out for re-use.
No functional changes intended.

Signed-off-by: Janne Grunau <j@jannau.net>
New "/aliases" properties should not have been added. In addition these
were not documented in the apple,atcphy dt-bindings.
Instead of using the aliases iterate over all "/soc*" child device nodes
and match FDT and ADT atc-phy device nodes by their "core" MMIO address.

Signed-off-by: Janne Grunau <j@jannau.net>
Add function to check if a FDT node is compatible with any compatibles
from a list. This function return a bool and not libfdt's confusing
scheme of `0`: match , `1`: no match and negative for errors.

Signed-off-by: Janne Grunau <j@jannau.net>
atcphy is one of many device classes which need to lookup information
from their matching ADT nodes. Factor the mostly generic iterate over
all nodes and match ADT and FDT nodes out to a utility function.

Signed-off-by: Janne Grunau <j@jannau.net>
The upstream USB4 support will come without aliases for "acio" and "nhi"
device nodes. Use the common MMIO address matching machinery to find
ADT and FDT "acio" device nodes and do the runtime setup of the FDT
nodes.

Signed-off-by: Janne Grunau <j@jannau.net>
When the platform loses architectural state across WFI, advertise
idle=nop / arm64.nowfxt to Linux instead of permitting bare WFI/WFIT.

Signed-off-by: Yureka <yureka@cyberchaos.dev>
Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
J700 reports mBoot-18000.161.9 rather than the existing .10 build.
Resolve that build to the existing 26.6.2 record, retaining the actual
build string for consumers. No change to other firmware versions.

Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Assisted-By: LLM
The address-based cache maintenance used by the proxy loader must also
cover the automatic boot path. Clean chainload source images and their
updated ADT, decompressed executable payloads, the prepared FDT, and the
next-stage descriptor to PoC. Complete the copy-stub writes before
invalidating the instruction cache and branching.

This avoids relying on a set/way sweep when CLIDR reports no cache levels.

Assisted-By: LLM
Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Align the first cache operation down while keeping the end relative to
the original address, and return immediately for an empty range.

Previously an unaligned address plus a length extending into another
cache line could leave the final line untouched. This affects the C
chainload stub (44 bytes at an observed offset of 48 within a 64-byte
line) and the final arguments in an unaligned next_stage descriptor.
Those buffers are consumed after caches are disabled, so partial clean
coverage can leave stale instructions or arguments in RAM.

Assisted-By: LLM
Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
…ntries

Add fallback DAPF entries for dart-ane0, dart-ave0, and dart-ave1, and
reserve ANE and AVE/AVE0/AVE1 ASC firmware regions in kboot_prepare_dt()
when their FDT aliases are present.

Also return early when segment-ranges is absent or empty, fix the error
return on dt_get_or_add_reserved_mem() failure, and name ANE segments
"text" and "data".

Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Assisted-By: LLM
Move the atc-phy,t8130 (T8140 / A18 Pro) tunable table into src/atc.c
alongside t8103 and t8122, register atc-phy,t8130 in atc_fuses[] with
no fuses, add "apple,t8130-atcphy" to atcphy_compatibles[], and dispatch
purely on the ADT compatible string instead of chip_id. Clean up the
error path to delete properties from the selected tunable table.

Includes tunable_CIO_SHIM and optional CLKMON_CFG /
LN{0,1}_RX_TOP_USB_EQA entries matching upstream Asahi m1n1 commit
7621bede.

Co-Authored-By: Yureka <yureka@cyberchaos.dev>
Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Assisted-By: LLM
On platforms where firmware such as AOP runs under Exclaves, the ADT
omits the standard segment-ranges property that m1n1 normally uses to
reserve preloaded coprocessor memory and pass its IOVA mappings to Linux.
To recover those mappings without hardcoding addresses, walk the live
hardware DART page tables directly.

Port the read-only DART page-table walking logic from
proxyclient/m1n1/hw/dart.py into src/dart.c as dart_walk_fdt_mappings()
(supporting T8020, T6000, and 3-/4-level T8110 DARTs), and add a generic
dt_reserve_dart_mappings() helper in src/kboot.c that reads the
consumer's iommus specifiers and publishes the discovered ranges as
/reserved-memory apple,asc-mem nodes. Wire it up for the optional "aop"
and "aop1" aliases.

Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Assisted-By: LLM
Reserve /chosen/memory-map TrustCache unconditionally when it lies within
usable RAM. On chips where these pages remain write-protected on
secondary cores after iBoot handoff (like T8140), leaving them in the
Linux page allocator causes permission faults.

Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Assisted-By: LLM
Newer laptops, starting from the Neo (J700), carry power-lut-* properties
in /arm-io/disp0. These are large panel calibration blobs (several KB on
newer MacBooks) that vary per device, so forward any present power-lut-*
properties to Linux under dcp/apple,provider-properties instead of
hardcoding them in Linux.

A final solution for the Linux devicetree handoff still needs to be
agreed upon with upstream.

Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Assisted-By: LLM
dockchannel_uart_iodev_can_write() returns true whenever DATA_TX_FREE > 0,
even if the FIFO has less space remaining than the full console string.
Calling blocking dockchannel_uart_iodev_write() from iodev_console_write()
then spins forever once the 4 KB FIFO fills with no debug receiver
attached.

Add an optional write_nonblock callback to struct iodev_ops used by
console writes (falling back to write when unset), and implement it for
dockchannel_uart so unwritten bytes remain in the console ringbuffer.
This leaves iodev_queue() semantics intact for uartproxy and USB console
output, and avoids dropping bytes on standard serial UARTs.

Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Assisted-By: LLM
Cherry-picked from AsahiLinux/m1n1 PR #589 (commit a7857af8bb6a).

Signed-off-by: Yureka <yureka@cyberchaos.dev>
Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Assisted-By: LLM
isp_init() previously powered on the ISP PMGR domain just to read
ISP_ASC_VERSION and immediately powered it back off, even though it
already switched on chip_id to find the PMGR offset and every ISP
revision maps 1:1 to a chip_id.

Drop the PMGR power-cycling, ISP_ASC_VERSION probe, and T8132 bypass
shortcut in favor of switching directly on chip_id (and firmware version
where heap_top varies across macOS versions), and add T6040/T6041
(0x2000000) and T8140 (0x2200000, high IOVA base).

Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Assisted-By: LLM
Match CIO v2 ACIO nodes ("acio,v2", RC at ADT reg[1] vs FDT reg[0]) and
CIO4 ATC PHY nodes ("apple,t6040-atcphy", core at ADT reg[2] vs FDT
reg[0]) using kboot_setup_matching_nodes(), without devicetree aliases:

- For "acio,v2", copy the merge-fabric and interrupt-management NHI
  tunables into "apple,tunable-nhi" on child "apple,t8103-usb4-nhi" nodes.
- For "apple,t6040-atcphy" ("atc-phy,t6040"), copy the fabric, common,
  and fused analog/PLL calibration tables into "apple,tunable-cio4-fabric",
  "apple,tunable-cio4-common", and "apple,tunable-cio4-analog".

Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Assisted-By: LLM
Newer laptops (starting from MacBook Neo) include per-unit fuse_aciphy_0
and fuse_aciphy_1 calibration fuses. Forward them generically to Linux
as apple,aciphy-fuses.

Assisted-By: LLM
Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Replace the T8132-specific raw ADT property forwarding, hardcoded board
power tables, and SGX MMIO core-mask probing in src/kboot_gpu.c with a
single generic GPU DT handoff for modern Apple Silicon GPUs (G16+ with
resident firmware carveouts, dispatched for any non-G13/G14 chip whose
/arm-io/sgx node exposes gfx-data-base).

Forward only genuinely boot-time or per-unit fused ADT state:
- Reserved memory carveouts resolved via memory-region-names (ttbs,
  pagetables, l2, handoff, firmware, and optional firmware-secondary
  for dual-ASC GPUs).
- Silicon-fused core GPU OPPs grouped by voltage into operating-points-v2
  (opp-hz, apple,alternate-opp-hz, opp-microvolt, apple,sram-microvolt,
  apple,perf-index), supporting both pre-populated and empty OPP tables.
- Optional silicon-fused CS OPPs (apple,cs-opp) and trailing minimum SRAM
  voltage (apple,csafr-min-sram-microvolt) when present in both ADT and DT.
- Optional per-SKU active MCC mask (apple,active-mcc-mask from
  active-mcc-bit-vector).
- Runtime firmware version metadata (apple,firmware-version,
  apple,firmware-compat, apple,firmware-build).

Static SoC constants (RTKit private VM aperture, AIC SW interrupt address,
sampling period, GPC enable, relative power curves, board power limits)
and live SGX MMIO reads (silicon revision, shader core fuse mask) belong
in the Linux driver rather than the bootloader.

Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Assisted-By: LLM
On Exclave-split DCP generations (T8140, T6050, T8152), iBoot places the
coprocessor's __SHARED_DATA_RW segment at the tail of DCP data carveouts
(such as region-id-50/73/88), mapped at a separate DART IOVA from the
preceding data prefix.

Inspect the coprocessor's ADT segment-ranges in
dt_carveout_reserved_regions() and trim any carveout whose tail matches
a firmware segment. This is a NOP on arlier SoCs where a segment covers
the entire carveout (phys == paddr).

Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Assisted-By: LLM
Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Assisted-By: LLM
Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Signed-off-by: Tom Morford <tom@morford.co>
Assisted-By: LLM
iBoot loads the coprocessor's __OS_LOG format-string metadata table into
normal host RAM for macOS unified logging. Linux RTKit never reads this
segment, so skip it by name in dt_reserve_asc_firmware() instead of
reserving it in /reserved-memory.

Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Assisted-By: LLM
Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Assisted-By: LLM
Cody Ho and others added 7 commits November 30, 2026 22:43
On T8140 (MacBook Neo), the single USB controller ADT node is named
/arm-io/usb-drd without a numeric suffix. adt_device_prefix_addrs()
previously required a trailing digit ('0'..'9'), causing
dt_disable_missing_devs() to find zero usb-drd nodes and disable
/soc/usb@40a280000 along with its DARTs and ATC PHY (which in turn
blocked dcpext from getting dp-phy).

Accept an exact unnumbered prefix match as port 0 in addition to
numbered nodes.

Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Assisted-By: LLM
Recognize mBoot 20457.41.3 and 20457.60.65.0.1 so consumers receive numeric
firmware versions and select the current protocol layout.

Assisted-By: LLM
Signed-off-by: Cody Ho <codyho@stanford.edu>
Select cache control at compatible dispatch and use the handoff ADT readiness
predicate instead of assuming the older way-counter layout. Preserve the ADT
carveout fallback.

Hardware checked on T8142: one AMCC, four planes, eight channels. iBoot already
enables the cache; an OFF-to-ON transition is not claimed.

Assisted-By: LLM
Signed-off-by: Cody Ho <codyho@stanford.edu>
Select the asynchronous request interface through cluster initialization data.
Preserve older cluster initialization paths and omit legacy features absent from
the M5 ADT.

Hardware evidence: E/P boot states P5/P6; 510 directed clock transitions
measured with seven repetitions each.

Assisted-By: LLM
Signed-off-by: Cody Ho <codyho@stanford.edu>
Discover Centauri through ADT when the older WLAN node is absent. Reuse
antenna-SKU copying and generate the documented host platform identity from
chosen board/chip metadata for the wifi-control alias.

Only pass static board metadata. Linux retains ownership of PCI reset, firmware
loading, DMA and radio state. Verified the generated host identity and antenna
SKU against the current board ADT.

Assisted-By: LLM
Signed-off-by: Cody Ho <codyho@stanford.edu>
Add T8142 (M5) to isp_iova_base() and isp_init() with its 0x1700000
shared-allocation boundary, scan all valid firmware segments for the
heap start, and report V27_3B1 as compatible with V27_2 in
dt_set_isp_fwdata().

Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Assisted-By: LLM
Preserve upper device-visible IOVA prefix bits from ADT vm-base and FDT
apple,dma-range on 3-level DARTs so dart_get_mapping() and
dart_walk_fdt_mappings() emit full device-visible IOVAs (such as the
0x100_0000_0000 aperture used by T8142 DCP/DISP0).

Extend dt_reserve_dart_mappings() with an optional physical-range
exclusion so T8142 display handoff reuses the generic DART table walker
to reserve resident DCP firmware/data segments while leaving /vram to
dt_vram_reserved_region().

Signed-off-by: Cody Ho <codyho@cs.stanford.edu>
Assisted-By: LLM
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