Commit graph

2222 commits

Author SHA1 Message Date
Eileen Yoon
2b62c08619 aop: Stream high-power mic samples to ADMAC
Output audio format still unknown, not sure if it's garbage (see lpai
commit) or some weird packed float encoding I'm not figuring out.

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
0ebc339761 aop.ipc: Use print as default logger
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
33c4591ff3 aop.ipc: Rename & fill in more property keys
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
9202652908 aop.ipc: Fill in more known audio config fields
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
a4fb7af657 hv/trace_dcp: Fix afk/epic API breakage
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
7298f42ce7 hv/trace_aop: Handle afk/epic API breakage
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
eebff23b5a afk.rbep: s/BLOCK_SIZE/BLOCK_STEP/
Otherwise the previous commit is way too confusing.

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
476c31e973 afk.rbep: Bootstrap ringbuf block size at runtime
Make the ringbuffer class robust to various block sizes to generalize to
both DCP and AOP.

The first three blocks of the ringbuffer is reserved for exchanging size,
rptr, wptr:

```
           bufsize      unk
00000000  00007e80 00070006 00000000 00000000 00000000 00000000 00000000 00000000
00000020  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000040  *   rptr
00000080  00000600 00000000 00000000 00000000 00000000 00000000 00000000 00000000
000000a0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
000000c0  *   wptr
00000100  00000680 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000120  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000140  *
```

Each block is spread out by some block_size multiple of 0x40 (step). The
0th block holds the size of the ringbuffer contents, the 1st block holds
the rptr, and the 2nd block holds the wptr. The actual contents of the
ringbuffer starts after the first three blocks, which will be
collectively called the "header".

However, this block_size isn't constant. DCP seems to consistently use
0x40, but AOP can use both 0x40/0x80. Since we're not given the block_size,
so wemust bootstrap it. Recall we are given the total size of the
rinbuffer in the mailbox message. Since we're always given the size of
the ringbuffer `bufsize` at offset +block_size * 0 (or simply 0), and we
can find the header size by subtracting `bufsize` from the total size.
Since we also know that the header is always 3 blocks wide, we can
divide the header size by 3 to obtain the block_size.

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
e76fc526e9 afk.epic: Support sending v2 EPIC subheader
Default to version=4 as to not break DCP

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
71c59d9894 afk.epic: Create API to register report handlers
Because AOP gets a lot of reports ;)

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
e430874a2a afk.epic: Support sending direct notify messages
Much simpler than the command messages. We just write directly into the
TX ringbuffer.

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
5f59c5460c afk.epic: Handle EPIC replies by subtype
DCP only gets two reply types: a u32 retcode or a command reply. It
previously checked for retcode by checking length(data) == 4 and
assuming command otherwise. AOP can get other reply types (e.g. STRING
after probing device). It actually sends us the reply subtype in the
EPICSubHeader, so use that information and handle replies accordingly.

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
6426bdf6a5 afk.epic: Enum for EPICSubtype & service init v2
Consistently use an enum for EPICSubtype (used later) and support the v2
EPICService intializer protocol used by AOP.

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
bf5a3a6e98 m1n1.fw.afk: Add more hello handlers used by aop
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
eb3710edb1 experiments/dcp: Make dcp*.py scripts run again
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
8fd1e4bef4 m1n1.adt: Parse aop audio pdm ratios
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
0ac31ec584 m1n1.utils: Strip before splitting on chexundump()
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
6e8d16aaa1 m1n1.fw.aop: Add aop client and ep boilerplate
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
65501cdd70 m1n1.fw.aop: Fix 13.5 bootargs ABI break + rename
Move from __init__.py to base.py so it can be imported.

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Daniel Berlin
3a8068a73d Cleanup and name some previouly-unnamed registers
Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
2024-10-31 01:22:58 +09:00
Daniel Berlin
61cf1084d0 Support cpufreq for t6031
This seems to work, and matches the info i can find.

Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
2024-10-31 01:17:40 +09:00
Daniel Berlin
4b0fde22a3 Support new version of AIC used by M3
Small changes, mostly some offsts are now available in the DT,
and a mask change.

Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
2024-10-31 01:17:00 +09:00
Sasha Finkelstein
6b83e98e30 clk: Revert PDM clock initialization.
AOP does it itself, and doing it in m1n1 confuses it into not
being able to boot.

Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com>
2024-10-29 05:27:00 +09:00
Hector Martin
277e8e71de display: Exclude j413 from Sequoia workaround by changing the logic
It seems this model does not need it *and* it somehow causes
nondeterministic problems.

Also add a delay to the poweroff/on sequence to be more conservative.

Fixes: #406
Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-28 22:22:15 +09:00
Christian Gmeiner
9d445d8291 hw/aes.py: Fix python error after 183991ca19
Fixes: 183991ca19 ("m1n1.hw.dart: Hide all DART variants behind common interface")
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
2024-09-25 08:32:39 +09:00
Davide Cavalca
a71c0724db docker: install rust toolchain for stage1 builds
Signed-off-by: Davide Cavalca <dcavalca@fedoraproject.org>
2024-09-25 08:31:20 +09:00
Ayrton
58fe1d7f0c Makefile: Fix build when using clang as AS
Unlike gcc, clang enforces -mgeneral-regs-only when used as the assembler so
this removes that flag to fix the error in #393. This is only needed for
utils_asm.S which has code saving/restoring SIMD state, but this commit applies
it to all asm files for simplicity since code for fp regs shouldn't be generated
unless they're explicitly used anyway.

Signed-off-by: Ayrton Munoz <a.munoz3327@gmail.com>
2024-09-25 08:30:36 +09:00
Daniel Berlin
69d241ccc2 Give AMX context reg a name.
This register is used to store AMX context information.

Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
2024-09-25 08:27:13 +09:00
Sasha Finkelstein
a42c839120 z2: Deal with missing calibration data
(by not sending anything in that case)

Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com>
2024-09-25 08:26:16 +09:00
Janne Grunau
48837f4d47 kboot: Expose m1n1 console log in phram MTD reserved memory node
This registers a log buffer IODEV similar to the frame buffer IODEV. It
is using a console IODEV to allow writing to the buffer until m1n1 jumps
to the next stage. This allows also to increase the buffer size without
increasing m1n1's size. The current CONSOLE_BUFFER_SIZE of 8k is not
large enough to hold the entire log of executing m1n1 under the
hypervisor on the M1 Ultra Mac Studio.

Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-25 08:25:42 +09:00
Janne Grunau
1d5556ccf3 kboot: Expose ADT in phram MTD reserved memory node
Requires CONFIG_MTD_PHRAM in Linux.

Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-25 08:25:42 +09:00
Janne Grunau
d76dd3a16e kboot: Add param for no-map proterty in dt_get_or_add_reserved_mem()
Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-25 08:25:42 +09:00
Janne Grunau
2ef60e6360 hv: Use architectural ACTLR_EL12 on M2+ for secondary init
Fixes: 99571e5 ("hv: Use architectural ACTLR_EL12 on M2+")
Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-25 08:22:45 +09:00
Janne Grunau
5c8c3ccc7b m1n1: hv: Use Apple implementation specific ACTLR_EL12 on M1*
Fixes: 99571e5 ("hv: Use architectural ACTLR_EL12 on M2+")
Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-25 08:22:45 +09:00
Janne Grunau
b3e9eb1223 github: workflow: Update to actions/upload-artifact@v4
Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-25 08:22:36 +09:00
Asahi Lina
99571e5308 hv: Use architectural ACTLR_EL12 on M2+
Signed-off-by: Asahi Lina <lina@asahilina.net>
2024-09-22 01:09:43 +09:00
Hector Martin
83ac04c1a9 fb: Fix FB junk leftover from stage1 in stage2
Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-18 00:00:22 +09:00
Hector Martin
9741ff9b97 fb: Fix UAF after fb shutdown
fb_console_reserve_lines() in mmu_shutdown() was causing a blit from the
freed framebuffer, putting heap metadata junk at the top left corner.

Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-17 23:59:29 +09:00
Hector Martin
cdb6d41aa2 display: Add workaround for Sequoia DCP handoff bug
Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-17 23:42:42 +09:00
Hector Martin
793ca17209 firmware: Add 15.0 and function to check SFW against a range
Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-17 23:42:05 +09:00
Hector Martin
8a122f86c4 exception: Fix EL1 exception return path
Signed-off-by: Hector Martin <marcan@marcan.st>
2024-08-11 20:21:21 +09:00
Hector Martin
94a6b50684 m1n1.find_regs: Fix register names
Signed-off-by: Hector Martin <marcan@marcan.st>
2024-08-11 20:21:21 +09:00
Asahi Lina
e41d51d222 m1n1.trace.agx: Decode VDM on G14X
Signed-off-by: Asahi Lina <lina@asahilina.net>
2024-06-15 16:46:04 +09:00
Asahi Lina
9d9bcd564c m1n1.proxyutils: Add v13_5
Signed-off-by: Asahi Lina <lina@asahilina.net>
2024-06-15 16:46:04 +09:00
Asahi Lina
52e1855c2a m1n1.trace.agx: Perfctr stuff
Signed-off-by: Asahi Lina <lina@asahilina.net>
2024-06-15 16:46:04 +09:00
Asahi Lina
c602bfd72e m1n1.constructutils: Don't spam
Signed-off-by: Asahi Lina <lina@asahilina.net>
2024-06-15 16:46:04 +09:00
Asahi Lina
97e27d8a11 m1n1.agx.initdata: Updates
Signed-off-by: Asahi Lina <lina@asahilina.net>
2024-06-15 16:46:04 +09:00
Asahi Lina
4d9ae1a907 m1n1.trace.agx: Helper stuff & misc fixes
Signed-off-by: Asahi Lina <lina@asahilina.net>
2024-06-15 16:46:04 +09:00
Asahi Lina
b50e29bcf6 m1n1.fw.agx: Helper and sampler stuff
Signed-off-by: Asahi Lina <lina@asahilina.net>
2024-06-15 16:46:04 +09:00
Janne Grunau
421dfa4252 dcp: Fix firmware mapping check on t8103/t600x
t8103 and t600x use "asc-dram-mask" in iop-dcp-nub to mask bits out of
DMA addresses. This needs to be used in the firmware mappings
check/remap since the segments have maskable bits sets.

Fixes: 8332e24 ("dcp: Undo carnage from bad stage1 DART code")
Signed-off-by: Janne Grunau <j@jannau.net>
2024-05-18 14:51:24 +09:00