Skip to content

dapf: Find each DART's DAPF from the ADT and initialize them on T8132 - #14

Open
Youwes09 wants to merge 5 commits into
GravityLinux:mainfrom
Youwes09:t8132-dapf
Open

Youwes09 wants to merge 5 commits into
GravityLinux:mainfrom
Youwes09:t8132-dapf

Conversation

@Youwes09

@Youwes09 Youwes09 commented Oct 30, 2026 •

Copy link
Copy Markdown

DAPF init was skipped on T8132 because it raised an SError. dapf_entries
hardcodes each DART's DAPF reg index, but on T8132 dart-pmp, dart-dcp and
dart-dcpext0 have no DAPF, and the reg at that index is a PS_PROT page shared
by many DARTs.

Changes

  • pmgr: pmgr_adt_power_is_active() reports whether a device and the
    parents it depends on are powered. Virtual gates (dart-ane's on T8132, under
    an ANE_SYS that is off at boot) have no state of their own.
  • Find each DAPF from the ADT. Walk every DART under /arm-io and take the
    DAPF from its instance property, in either layout: {type, unit, name[8]}
    per reg range (the range of type DAPF), or {type, name[8]} per DART range
    (an entry of type DAPF puts the DAPF in the range after them). The entry
    count tells them apart. The table is now only a fallback for DARTs with no
    instance. No chip checks.
  • Skip a DAPF with no filter data. On T8132, T8142 and T8152, dart-ave has
    a DAPF but no filter data; it was reported as an error.
  • Power the device behind the DART. The gates are on the DART or on the
    device named without dart- (isp, ane, ave, pmp). Power it only if it is
    off and restore it after; if its state cannot be read, power it and leave it
    on rather than write unpowered.
  • Drop the T8132 skip in kboot_boot().

ADT collection

Simulated against every ADT in GravityLinux/adt-collection; each DART that
gets initialized is exactly one whose instance lists a DAPF:

SoC DAPFs initialized
T8103 aop, ave, isp, ane
T8132 (J713, J604) aop, mtp, isp, ane (ave: no filter data)
T8132 (J773) aop, ane (ave: no filter data)
T8140 pmp, mtp, ave, isp, ane
T8142 mtp, isp, ane (ave: no filter data)
T8152 ane, ane1 (ave: no filter data)
T6040 aop, ave0, ane0
T6041 isp0, mtp, aop, ave0, ave1, ane0
T6050 pmp0, pmp1 (no filter data), ave0, ave1, ane0

The table missed ave0/ave1/ane0 on T6040/T6041, pmp0/pmp1 on T6050 and ane1
on T8152.

Testing

J713 (Mac16,12, 13" M4 Air), macOS 26.6.2 firmware, booting Linux 7.3: no
SError, keyboard and trackpad work.

A debug build read each DAPF's registers before and after init:

  • Before init, every DAPF holds random contents with the enable bit clear:
    iBoot leaves no configuration to preserve.
  • After init, every filter reads back as written, except that the end address
    is rounded up to a 4-byte boundary (...000 reads back ...003).
  • The ANE DAPF keeps its filters across a full ANE_SYS power cycle, so
    initializing once in m1n1 is enough.

Not tested on other SoCs.

@Youwes09
Youwes09 force-pushed the t8132-dapf branch 2 times, most recently from dd87c94 to a259f3a Compare October 30, 2026 05:26
pmgr_adt_power_is_active() lets a caller power a device only if it is
off and leave it as it was found. Like pmgr_set_mode_recursive(), it
follows each gate's parents: on T8132, dart-ane's gates are virtual,
under an ANE_SYS that is off at boot.

Assisted-By: LLM
Signed-off-by: Youwes09 <yuvi.shen@outlook.com>
dapf_entries hardcodes the DAPF reg index of a fixed set of DARTs. On
T8132, dart-pmp, dart-dcp and dart-dcpext0 have no DAPF, and their reg
at that index is a PS_PROT page shared by many DARTs, which raises an
SError when written. Newer SoCs also have DAPFs on DARTs the table does
not name: dart-ave0/1 and dart-ane0 on T6040/T6041, dart-pmp0/1 on
T6050 and dart-ane1 on T8152.

Walk every DART under /arm-io and take the DAPF from its "instance"
property, which types each reg range by fourcc in one of two layouts:
{type, unit, name[8]} per range, or {type, name[8]} per DART range with
the DAPF in the range after them. The entry count tells them apart.
Fall back to the table for a DART with no instance list.

Assisted-By: LLM
Signed-off-by: Youwes09 <yuvi.shen@outlook.com>
On T8132, T8142 and T8152, dart-ave has a DAPF but lists no filter
data, so there is nothing to write, yet it was reported as an error.
Look the data up before powering the device and skip the DAPF if there
is none.

Assisted-By: LLM
Signed-off-by: Youwes09 <yuvi.shen@outlook.com>
The DAPF is clock gated with the device behind its DART. On T8132,
T8140, T8142 and T8152, the DART lists no gates of its own; they are on
the device named without "dart-" (isp, ane, ave, pmp), so those DAPFs
were written unpowered. An empty clock-gates, as on T8132's mtp and
aop, counts as none.

Power the device only if it is off, and power it down again only then:
the old code gated a device it found running. If the state cannot be
read, power the device and leave it on rather than write to it
unpowered.

Assisted-By: LLM
Signed-off-by: Youwes09 <yuvi.shen@outlook.com>
DAPF init was skipped on T8132 because it raised an SError. With each
DAPF found from the ADT and its device powered, the full set
initializes.

Without the MTP's DAPF, its DART reports a SID exception as soon as the
MTP starts and RTKit never gets a HELLO, so the keyboard and trackpad
stay dead.

Assisted-By: LLM
Signed-off-by: Youwes09 <yuvi.shen@outlook.com>
@Youwes09 Youwes09 changed the title dapf: Find the DAPF by instance type and initialize it on T8132 dapf: Find each DART's DAPF from the ADT and initialize them on T8132 Oct 30, 2026
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.

1 participant