Commit graph

613 commits

Author SHA1 Message Date
Jean-Marc Ranger
d4f750cb22 experiments/smc.py: Adapt to API change in SMCEndpoint
Update experiments/smc.py to use fw/smc.py's new API.

Fixes: b9ddd74c02 ("hv/trace_smc.py: Add SMC tracer")

Signed-off-by: Jean-Marc Ranger <jmranger@hotmail.com>
2021-11-23 01:22:57 +09:00
Hector Martin
6906af06cc experiments/dcp.py: Use new ADT DART constructor
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-22 18:13:51 +09:00
Hector Martin
8778819831 m1n1.hw.dart: Fix typo
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-22 18:13:32 +09:00
Hector Martin
c8a8946e82 m1n1.hw.dart: Add a constructor that figures out DART type from the ADT
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-22 18:13:10 +09:00
Hector Martin
4027c34c7a proxy: Add proxy ops for pcie_init/shutdown
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-22 16:04:35 +09:00
Hector Martin
660d7482b9 hv/trace_pmgr.py: New script
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-22 07:21:07 +09:00
Hector Martin
5d214606df m1n1.hv: Add flag to hide the CPU prefix in hv.log()
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-16 17:20:47 +09:00
Hector Martin
06975c8b87 m1n1.hv: Add TraceMode.WSYNC to make writes synchronous, but not reads
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-16 17:20:21 +09:00
Hector Martin
ccbe181d75 m1n1.adt: Improve PMGR props parsing, add to dump_pmgr.py
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-16 17:19:42 +09:00
Janne Grunau
46c945ac95 usb: use dynamic paths for usb related ADT nodes
Adds support for the 3rd USB-C port on 2021 Macbook Pros.
Currently up to 8 USB-C ports are supported which should be sufficient
for expected future devices.

Tested on Macbook Pro 14" and Mac Mini.

Signed-off-by: Janne Grunau <j@jannau.net>
2021-11-12 23:48:32 +09:00
Janne Grunau
2724d69f4c iodev: usb: replace secondary usb iodevs with single vuart iodev
Signed-off-by: Janne Grunau <j@jannau.net>
2021-11-12 23:48:32 +09:00
Janne Grunau
3a2446c53b m1n1.proxy: remove trailing whitespace
Signed-off-by: Janne Grunau <j@jannau.net>
2021-11-12 23:48:32 +09:00
Hector Martin
c947f6aec3 m1n1.trace.asc: Add support for tracing DARTless ASCs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-11 15:22:25 +09:00
Hector Martin
9d2be299a4 tools/smccli.py: Simple shell for an instantiated SMCClient
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-10 20:43:51 +09:00
Hector Martin
eaa72c7a91 m1n1.fw.smc: Improve and add more functions
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-10 20:43:51 +09:00
Hector Martin
198fc24f14 m1n1.adt: Fix ranges prop decoding
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-10 20:43:51 +09:00
Hector Martin
927c12ad53 hv/trace_all.py: Trace all I/O ranges using the arm-io prop
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-10 20:43:51 +09:00
Hector Martin
ae7228f398 m1n1.asm: Fix bad objdump variable
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-10 20:43:51 +09:00
Hector Martin
b9ddd74c02 hv/trace_smc.py: Add SMC tracer
Also fix up a bunch of stuff in m1n1.fw.smc, but it's untested as a
client.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-10 20:43:51 +09:00
Vincent Duvert
407663b73d bootstrap_port: Improve UART baud setting
Rework the serial port bootstrap so it works correctly if the target is already
at 1500000 baud.

No baud adjustment is made if the proxy is using the serial-USB interface.

Tested with the Mac-to-Mac serial connection (macvdmtool) and the serial-USB
connection.

Signed-off-by: Vincent Duvert <vincent@duvert.net>
2021-11-10 16:02:44 +09:00
Hector Martin
8e0ca1a39c m1n1.hv: Print diagnostic info when MMIO forwarding fails
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-08 19:55:16 +09:00
Hector Martin
e19e74be8b m1n1.asm: Make work on macOS/clang
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-08 14:41:24 +09:00
Hector Martin
a4e922ecaf m1n1.hv: Map vUART IRQ properly
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-04 04:03:50 +09:00
Hector Martin
ff1b668a5d m1n1.hv: Fix broken cpu# in SYNC tracers
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-04 04:03:50 +09:00
Hector Martin
74dece703e m1n1.hv: Add support for dumping MMIO accesses in Python syntax to a log
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-04 04:03:50 +09:00
Hector Martin
bfc91be170 m1n1.hv: Keep track of started CPUs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-04 04:03:50 +09:00
Hector Martin
3d3d5ea5ad m1n1.hv: Forward more sysregs properly to EL12
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-04 04:03:50 +09:00
Hector Martin
85ca5b94cb m1n1.hv: Do map low RAM
Apparently this is still necessary

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-04 03:52:43 +09:00
Hector Martin
49858b6d2c m1n1.hv: Fix cpustart for >2 clusters
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-04 03:52:43 +09:00
Hector Martin
f2975c7e34 m1n1.utils: Fix bug in RangeMap
Adding a zero-length range was breaking things.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-04 03:52:43 +09:00
Hector Martin
075168c233 m1n1.hv: Handle MMIO/PMGR hooks dynamically
This makes m1n1 boot all the way on t6000

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-04 03:52:43 +09:00
Hector Martin
08f90e6dd6 m1n1.hv: Fix bug for sync tracing 64-bit writes
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-04 03:52:43 +09:00
Hector Martin
77074b9098 hv_aic: Support AICv2
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-04 03:52:42 +09:00
Hector Martin
339bd37077 m1n1.hv: Compute RAM base from bootargs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-02 02:22:47 +09:00
Hector Martin
e3f0836eae m1n1.hv: Use vUART base from ADT
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-02 02:22:17 +09:00
Hector Martin
68aec75918 memory: Larger PA support & dynamically map MMIO
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 21:00:56 +09:00
Hector Martin
bc82dbea4e m1n1.hw.dart: Add support for T6000 DARTs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 19:00:34 +09:00
Hector Martin
9fab740a77 tools/chainload.py: Add --quiet arg to suppress FB
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 19:00:34 +09:00
Hector Martin
f590ef73d0 m1n1.adt: Add field to pmgr devices
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 19:00:34 +09:00
Hector Martin
c76851ae11 m1n1.adt: Add pmap-io-ranges parsing
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 19:00:34 +09:00
Hector Martin
1e787e9d02 m1n1.adt: Add & use SafeGreedyRange
This avoids swallowing subcon errors silently, like GreedyRange does.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 19:00:34 +09:00
Hector Martin
7ff48f6201 memory: Make the RAM base dynamic
For now we compute this as phys_base aligned down to a 4GiB boundary.
Hopefully that works for future SoCs too.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 13:39:40 +09:00
Hector Martin
73180e29fa m1n1.hw.dart: Add show_error() and some more defs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-27 15:49:12 +09:00
Hector Martin
0d0a646922 m1n1.adt: Support per-compat prop decoding, make it work on t6000
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-21 18:41:13 +09:00
Hector Martin
ecceec9b5c experiments/cpu_pstate_latencies.py: Fix the asm
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-18 17:13:41 +09:00
Hector Martin
0255831153 m1n1.trace: Support HOOK mode
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-15 23:44:12 +09:00
Hector Martin
f49428bb65 m1n1.proxyutils: Fix GuardedHeap to actually work
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-15 23:44:12 +09:00
Hector Martin
1d0d60a846 m1n1.proxy: Fix weird typo in mask16
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-15 23:44:12 +09:00
Hector Martin
08873880fa m1n1.hv: Fix TLB invalidation issue
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-15 23:44:12 +09:00
Hector Martin
1444c93a24 proxy: Add P_MMU_INIT_SECONDARY
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-15 23:44:12 +09:00
Danny Lin
7a29455646 proxyclient: Fix typo in LazyADT str implementation
Fix the `gstr` typo so that `print(hv.adt)` works as expected.

Signed-off-by: Danny Lin <danny@kdrag0n.dev>
2021-10-11 12:42:55 +09:00
Alyssa Rosenzweig
8010e38376 Add smc.py script to enable radios
Add a basic SMC client and a script in experiments/ using it to enable
the radios. Running this before booting Linux will make the network
controller devices show up in lspci, even if Linux lacks an SMC driver.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
2021-10-11 12:41:27 +09:00
Martin Povišer
925215aea2 proxyclient: Expect m1n1 at /dev/ttyACM0
Change the default serial port.

Signed-off-by: Martin Povišer <povik@protonmail.com>
2021-10-11 12:40:43 +09:00
Hector Martin
3a4b2870a8 experiments/cpu_pstates.py: Only set DVMR if necessary
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-24 01:16:32 +09:00
Hector Martin
febf83a981 experiments/cpu_pstates.py: Enable DVMR unconditionally
Seems this is not always enabled by the bootloader on some systems

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-24 00:53:07 +09:00
Sven Peter
0b4d5bd793 proxyclient: hv: Add simple DWC3/XHCI/ATCPHY tracer
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-09-22 19:01:03 +09:00
TophEvich
913c775165 proxyclient: removed unused code
Little clean-up of unused proxyclient code.
Code used/referenced by commented out sections were taken
into account and left behind to be used by it at a later point.

Signed-off-by: TophEvich <84676511+TophEvich@users.noreply.github.com>
2021-09-22 19:00:34 +09:00
Martin Povišer
18bc2c7db1 Add m1n1.hw.admac, experiments/speaker_amp.py
Add initial code for driving the ADMAC hw blocks, also add a script
which shows it in action by streaming audio to the Mac mini's embedded
speaker.

Signed-off-by: Martin Povišer <povik@protonmail.com>
2021-09-22 16:02:35 +09:00
Martin Povišer
d25581ddb3 Fill in m1n1.hw.i2c
Signed-off-by: Martin Povišer <povik@protonmail.com>
2021-09-22 16:02:35 +09:00
Hector Martin
9dc332b660 tools/dump_pmgr.py: Show fixed clock usages from DT
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-22 01:03:10 +09:00
Hector Martin
a816f2718b m1n1.hv: Improve bt()
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-22 00:36:41 +09:00
Hector Martin
9cc0c0a55b m1n1.hv: Add lower() command to send an exception to the guest
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-22 00:36:40 +09:00
Hector Martin
36e0283a87 hv: Handle PAC mask automatically
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 23:28:31 +09:00
Hector Martin
bce239b36f exception: Make space in the stack for full exception context
This is step 1 of the rework to make reentrant exceptions work

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 20:29:19 +09:00
Hector Martin
04668b370a m1n1.proxyutils: Print and clear L2C regs on SErrors
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 17:15:49 +09:00
Hector Martin
0e3770ca47 hv, m1n1.hv: Add cpu() command to switch CPU contexts
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 13:18:06 +09:00
Hector Martin
5feae51f25 tools/run_guest.py: Add --debug-xnu argument
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 13:15:24 +09:00
Hector Martin
9545371c87 m1n1.hv: Add more PMGR hacks for xnu bug workarounds etc
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 13:15:04 +09:00
Hector Martin
160ced7449 m1n1.hv: Also guard IMX pstate
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 00:40:31 +09:00
Hector Martin
16314a6203 m1n1.fw.pmp: New module
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-20 18:01:21 +09:00
Hector Martin
6211e9f9e6 m1n1.hw.pmgr: New module
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-20 18:01:09 +09:00
Hector Martin
eae9eceff1 m1n1.adt: Fix more pmgr fields, improve dump_pmgr.py
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-20 17:55:45 +09:00
Hector Martin
d2d5952aa5 tools: dump_pmgr.py
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-20 03:00:40 +09:00
Hector Martin
1e98c320df m1n1.adt: Pretty sure the v_ things were wrong
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-20 02:49:58 +09:00
Hector Martin
5c99406790 m1n1.hv: Guard UART0 pmgr regs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-20 02:48:23 +09:00
Hector Martin
c461b5d033 m1n1.adt: Add clock-frequencies decoding
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-19 22:33:38 +09:00
Hector Martin
6c070fa224 m1n1.proxyutils: Only set baud if connected via serial
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-19 22:32:58 +09:00
Hector Martin
99e38d24d0 experiments/cpu_pstates.py: Remove p-core boost testing hack
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-19 02:28:49 +09:00
Hector Martin
c8eb9a7862 experiments: Add cpu_pstate_latencies.py
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-19 02:03:27 +09:00
Hector Martin
6a620ddab9 experiments: Add cpu_pstates.py
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-19 02:03:24 +09:00
Hector Martin
c3ba77ce16 hv_exc: Handle SYS_IMP_APL_CYC_OVRD in the fast path
m1n1 now uses this for SMP, and due to wfi FIQ leakage from the HV
timer this gets spammed thousands of times per second. Handle it in
the HV directly.

Fixes: #107

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-18 22:33:28 +09:00
Hector Martin
37b2fdda7c m1n1.adt: Handle empty function props
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-18 22:27:13 +09:00
Hector Martin
2d952752db proxy: Add smp_wait() to the proxy
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-17 15:25:34 +09:00
Hector Martin
b16bad61b4 m1n1.utils: Fix RegAccessor assignment
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-17 00:34:56 +09:00
Hector Martin
bbf8889d87 m1n1.trace.asc: Print more registers
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-17 00:34:42 +09:00
Hector Martin
36a7f3f2e1 m1n1.hw.asc: Print raw messages in hex
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-17 00:34:22 +09:00
Hector Martin
0d13ed692e m1n1.fw.asc: Align buffer sizes in reply messages
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-17 00:33:34 +09:00
Hector Martin
966b50a753 m1n1.fw.asc: Support booting an ASC
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-17 00:33:12 +09:00
Hector Martin
b53b627cb9 m1n1.hw.dart: Support initializing a DART from scratch
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-17 00:30:41 +09:00
Hector Martin
97ed24a908 m1n1.fw.asc: Make DVA offset configurable
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-17 00:30:14 +09:00
Hector Martin
77fbb05623 m1n1.adt: Pretty-print functions
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-16 17:06:51 +09:00
Hector Martin
961f8eae4d m1n1.adt: Print a useful diag when a prop fails to parse
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-16 16:48:22 +09:00
Hector Martin
de8b490b01 m1n1.adt: Add some mcc props
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-16 16:47:45 +09:00
Hector Martin
3b6a645db6 m1n1.adt: Support master (templated) ADTs properly
They used to parse but not round-trip, now they do

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-16 16:47:22 +09:00
Hector Martin
9ecaeb9e1b m1n1.hv: Add SMP support
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:32:57 +09:00
Hector Martin
509481d5d5 hv: Add SMP support
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:32:57 +09:00
Hector Martin
d68e4e42dd m1n1.trace: Show CPU number in default MMIO PrintTracer 2021-09-15 23:32:57 +09:00
Hector Martin
e88d55005a m1n1.trace: Use hv.log() in Tracer.log() 2021-09-15 23:32:57 +09:00
Hector Martin
a4efa373f3 m1n1.trace: Make Tracer.trace() take read/write args
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:32:57 +09:00
Hector Martin
81aaa72740 m1n1.hv: Improve pmgr hack messages
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:32:57 +09:00
Hector Martin
2598b3a7ba m1n1.hv: Only patch exception handling on CPU#0
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:27:21 +09:00
Hector Martin
e06e58e864 m1n1.xnutools: Update decode_debugger_state() for 12.0
We need to find a better way of doing this...

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:26:45 +09:00
Hector Martin
290e851d98 m1n1.hv: Add read/write args to hv.trace_range()
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:25:12 +09:00
Hector Martin
683161eef4 m1n1.hv: Make sysreg storage per-CPU
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
3871fa1e2f m1n1.hv: Add hv.log() that prepends CPU index, use it
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
56b54a6641 hv_vm/hv_exc: Add cpu_id to exception & mmiotrace structs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
6627873267 m1n1.hv, run_guest.py: Make exception hook enable an argument
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
368b48a365 hv_wdt: Make HV WDT CPU configurable and WDT optional
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
aa11841808 m1n1.adt: s/gate/psidx/
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 21:59:13 +09:00
Hector Martin
496516ded0 m1n1.adt: PMGR and function call stuff
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 17:11:45 +09:00
Hector Martin
dfb10956bc m1n1.fw.dcp: Add OSSerialize parser for DCPAV properties
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 17:08:21 +09:00
Hector Martin
9b91c90f3a m1n1.utils: Move FourCC definition here
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 17:08:21 +09:00
Hector Martin
fa50bb6474 fb: Do not restore logo when using kboot
Also don't clear the whole screen, only the console section so the logo
is glitchless.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-31 14:10:52 +09:00
Hector Martin
219950235c fw.dcp.ipc: Define rt_bw_config_t properly
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-30 12:09:36 +09:00
Hector Martin
4df78129aa m1n1.shell: Fix broken signature thing for some objects
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-29 01:36:27 +09:00
Hector Martin
63547f6fc9 m1n1.fw.asc.mgmt: Print endpoints
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-29 01:36:01 +09:00
Hector Martin
0584200aaf m1n1.fw.dcp.manager: Make map_buf() work
What it needs to do is map the buffer to the disp dart stream 4,
apparently (or maybe the stream varies?)

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-29 01:35:25 +09:00
Hector Martin
43c93af949 m1n1.fw.asc: Handle DARTless ASCs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-29 01:32:27 +09:00
Hector Martin
eec6bbdeaf m1n1.hw.dart: Fix dirty cache clobbering on iomap_at()
Fixes: #102

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-29 00:03:39 +09:00
Alyssa Rosenzweig
eb466796d8 fw.dcp: Add some stubs needed for modesetting
This isn't enough to set the video mode yet but it gets us further. I
think allocate_memory/map_buf/powerOnDART need real implementations,
otherwise setting a video mode crashes the DCP in an APIODMA interrupt
handler, whatever that is.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
2021-08-24 21:09:35 +09:00
Hector Martin
e6d3b6b6c6 m1n1.adt: Handle borked reg properties
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-24 12:20:31 +09:00
Hector Martin
d0731de381 m1n1.hv: Fix pac_mask for linux
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-23 23:10:28 +09:00
Hector Martin
c39fe2fbde m1n1.fw.asc: Handle syslog/ioreporting buffer size properly
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-23 23:10:28 +09:00
Hector Martin
1666d86d43 fw.asc.mgmt: Handle version negotiation properly
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-23 23:04:23 +09:00
Hector Martin
cc39491863 m1n1.proxy: Allow overriding default timeout with M1N1TIMEOUT
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-23 17:03:20 +09:00
Hector Martin
017f050fff hv_vuart: Implement RX & enough to support Linux
This works to get to a serial shell on Linux, and to use m1n1-as-LV1
proxyclient with M1N1DEVICE=/dev/m1n1-sec

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-23 17:02:28 +09:00
Hector Martin
c2c6da3df2 fw.dcp.ipc: Remove junk prints
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-14 16:53:32 +09:00
Hector Martin
fa3b1ddcf6 experiments/dcp.py: Add DCP driver example
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-14 16:40:18 +09:00
Hector Martin
de5b5d996c m1n1.fw.dcp: Add DCP client framework, port tracer to it
This also includes an update to the macOS 12.0 beta ABI

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-14 16:39:17 +09:00
Hector Martin
b32aec3786 m1n1.trace.asc: Use shared reg/msg definitions, improve syslog
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-14 16:37:09 +09:00
Hector Martin
27a0a15eee m1n1.hw/fw.asc: Add basic ASC driver and RTKit handling
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-14 16:36:49 +09:00
Hector Martin
7b01b0525b m1n1.trace.asc: Be more clear about endpoint number in log
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-14 16:34:24 +09:00
Hector Martin
105b671fb3 m1n1.hw.dart: Add mutation functions (iomap, iowrite)
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-14 16:33:18 +09:00
Hector Martin
fc5ce75c21 m1n1.adt: Add repr()
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-14 16:32:26 +09:00
Hector Martin
fe503a3802 m1n1.proxy: Handle zero-length readmem()
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-14 16:32:07 +09:00
Hector Martin
a96e277b56 m1n1.utils: Add Constant support to Register
This allows setting register fields to an expected contant value, e.g.
because they are opcodes for a variable-format register (like a mailbox)

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-14 16:31:10 +09:00
Hector Martin
b00b36620a m1n1.utils: Add unhex() helper
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-14 16:30:38 +09:00
Hector Martin
f8110dd409 hv_exc: Handle M1RACLES mitigation here due to 12.0 spam
macOS 12.0 added a silly ineffective "mitigation" that clears the
register on every context switch. This doesn't actually mitigate
anything, but it does make this sysreg trap performance-critical,
so we have to move its handling into the C side.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-14 16:30:18 +09:00
Andrew Worsley
bd5211909e Fix Exception when no Signature present
Signed-off-by: Andrew Worsley <amworsley@gmail.com>
2021-08-03 23:54:23 +09:00
Pip Cet
d709b047d8 proxyclient/m1n1/utils.py: don't compact non-adjacent ranges
Signed-off-by: Pip Cet <pipcet@gmail.com>
2021-08-03 13:53:41 +09:00
Andrew Worsley
1d932888f9 Add command categories to reduce command clutter
Based on a suggestion from Ludwig Schubert it now uses the inspect class
to generate signatures of the functions for the help messages and
the qualified names which is a big improvement.

Also greatly reduced the clutter by putting the class functions into seperate
categories based on their class name. Now the top level help fits on one
page making it much more readable.

Signed-off-by: Andrew Worsley <amworsley@gmail.com>
2021-08-03 13:52:31 +09:00
Andrew Worsley
ddb6951abb Fix some review comments, spacing
Signed-off-by: Andrew Worsley <amworsley@gmail.com>
2021-08-03 13:52:31 +09:00
Andrew Worsley
255f1bac16 Add some doc string to write/read/mrs/msr
Signed-off-by: Andrew Worsley <amworsley@gmail.com>
2021-08-03 13:52:31 +09:00
Andrew Worsley
eab52cc855 Extend help to all commands
Also print 1 line summary or full output if called directly on command

Signed-off-by: Andrew Worsley <amworsley@gmail.com>
2021-08-03 13:52:31 +09:00
Andrew Worsley
bf4f702077 Add some docstrings/help to shell commands
Signed-off-by: Andrew Worsley <amworsley@gmail.com>
2021-08-03 13:52:31 +09:00
Andrew Worsley
012ecc07e7 Add simple help command to shell tool
Signed-off-by: Andrew Worsley <amworsley@gmail.com>
2021-08-03 13:52:31 +09:00
Andrew Worsley
2ea43e6ff1 Briefly document protocol
Signed-off-by: Andrew Worsley <amworsley@gmail.com>
2021-08-03 13:52:31 +09:00
Hector Martin
63e8d0d48e m1n1.fw.dcp.ipc: Fix late_init_signal return type
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-07-18 02:28:27 +09:00
Hector Martin
9fae977161 m1n1.fw.dcp.ipc: Add SizedArray/SizedBytes to handle data/len pairs
The serialization always uses fixed-length arrays. These wrappers use a
length argument (possibly coming later in the args) to size the fields
so that the arrays are truncated or padded to the right length as
returned to the user.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-07-18 02:28:26 +09:00
Hector Martin
231aa772fd m1n1.fw.dcp: Initial DCP log tracing implementation
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-07-15 22:29:01 +09:00
Hector Martin
f635d64429 hv/trace_dcp.py: Update call list for 11.4 (partial?)
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-07-15 22:28:27 +09:00
Hector Martin
0034311ee3 m1n1.utils: Add indent argument to chexdump
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-07-15 22:27:52 +09:00
Hector Martin
4a6fa4b0e1 hv/trace_dcp.py: Redo cmd/ack handling properly, add logging & msg list
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-07-15 16:27:56 +09:00
Sven Peter
5b86c1ee8d proxyclient: sep: add initial code to boot SEPOS
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-07-09 15:58:00 +09:00
Sven Peter
93ca3fae08 hv: add hardware breakpoint support
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-07-09 15:52:40 +09:00
Sven Peter
e0d889fac1 hv: add proper single stepping support
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-07-09 15:52:40 +09:00
Sven Peter
620f1972ce linux.py: add missing serial import
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-07-09 15:41:04 +09:00
Janne Grunau
e74b79dc2a m1n1/hv: fix irq trace after "Rework MMIO PT handling & tracing"
Also removes unused leftover demonstration code which came obsolete by
tracer scripts. See hv/trace_gpio.py for an example.

Signed-off-by: Janne Grunau <j@jannau.net>
2021-07-09 15:31:08 +09:00
Hector Martin
e00e8f178d hv/trace_dcp.py: Fix stuff
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-24 02:12:07 +09:00
Hector Martin
819d2cf6bc hv/trace_dcp.py: Parsing a bunch of stuff now
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-24 01:15:32 +09:00
Hector Martin
3cfe943ec3 m1n1.trace.asc.Syslog: Fix message termination
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-24 01:15:15 +09:00
Hector Martin
7687d00f5f m1n1.trace.asc: Add EP.start() to initialize endpoints
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-24 01:14:57 +09:00
Hector Martin
c490f74872 m1n1.trace.asc: Move EP handlers to per-EP objects
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-23 20:19:30 +09:00
Hector Martin
b4c2272855 m1n1.hw.dart: Don't cache invalid mappings
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-23 20:19:30 +09:00
Hector Martin
b4fef18e12 m1n1.trace.dart: Log invalidates
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-23 17:04:30 +09:00
Hector Martin
92c3ad223c m1n1.proxyutils.RegMonitor: Add ASCII mode, overridable readmem, abbrev
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-23 17:02:14 +09:00
Hector Martin
faa37342f9 m1n1.utils.chexdump: Add abbreviation
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-23 17:01:17 +09:00
Hector Martin
cf00bedade m1n1.hv.HV: Upload ADT late to allow user overrides
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-22 02:02:06 +09:00
Hector Martin
94f5c29c9f hv/trace_dcp.py: More things
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-22 01:39:38 +09:00
Hector Martin
9a480c656b m1n1.shell.HistoryConsole: Guard against mon.poll() exceptions
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-22 01:39:38 +09:00
Hector Martin
912776372a m1n1.trace.asc: Support more messages, syslog decoding, associated DART
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-22 01:39:38 +09:00
Hector Martin
42b7adad06 m1n1.trace.dart: Add DART tracer/handler
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-22 01:39:38 +09:00
Hector Martin
b7147a130a m1n1.trace.ADTDevTracer: Fix _reloadcls() binding issue
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-22 01:39:38 +09:00
Hector Martin
c76489e6dd m1n1.hw.dart: Move DART support code here, add IOVA resolver
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-22 01:39:38 +09:00
Hector Martin
d025574e1d m1n1.hv.HV: Run passive tracers *before* issuing the MMIO write
E.g. this means tracers run *before* an ASC command gets sent, which
might be relevant if the same memory is used for commands and responses.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-22 01:39:38 +09:00
Hector Martin
d255a74271 m1n1.hv: Add HV.run_shell() convenience function, fix messages
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-22 01:39:38 +09:00
Hector Martin
83b05e7743 m1n1.utils.RegAccessor: Pass through None when register is unavailable
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-22 01:39:38 +09:00
Hector Martin
d942984b72 m1n1.utils.Reloadable: Be verbose about what gets reloaded
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-22 01:39:38 +09:00
Hector Martin
026c16c7c2 m1n1.utils.chexdump(): Fix justification
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-22 01:39:38 +09:00
Hector Martin
32d03f3ae2 m1n1.utils.RegMap: Fix register access widths
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-22 01:39:38 +09:00
Hector Martin
f7063e6f06 m1n1.trace.Tracer: Multiple bugfixes
- Set ident properly before looking up cache
- Off-by-one error in regmap lookups
- Reload regmap classes on reload

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-21 16:24:04 +09:00
Hector Martin
035aa486d6 m1n1.hv: Properly update current shell globals after run_script()
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-21 16:19:43 +09:00
Hector Martin
a714c74e1a m1n1.utils.Reloadable: Only reload each module once
This avoids confusion with types changing ID when the same module is
repeatedly reloaded. Now we use the file mtime and only reload things
which have changed since last time, and dependent modules.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-21 16:00:00 +09:00
Alyssa Rosenzweig
ba478f2de5 mini.hv.dcp: Decode common messages
This accounts for most of the DCP traffic once macOS is booted. I used
a sophisticated side-channel hypervisor timing attack to determine the
message functions [ adding time.sleep(1) ]

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
2021-06-21 14:02:25 +09:00
Alyssa Rosenzweig
6adf0c692c mini.trace.asc: Don't log handled messages
ASC handlers now return a boolean to indicate whether they successfully
handled the message (True if so). In that case, printing the underlying
mailbox traffic is redundant, so let's hide it.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
2021-06-21 14:02:25 +09:00
Hector Martin
86e233931e m1n1.trace.asc: Add core endpoint numbers
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-21 02:51:46 +09:00
Hector Martin
e4a591d81a m1n1.trace.asc: Fix MSG_EP_MAP.LAST
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-21 02:49:55 +09:00
Hector Martin
71cdcb9bef ASCTracer: Fix subclassing
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-21 02:43:01 +09:00
Hector Martin
dbeb174ac9 m1n1.hv: Don't die on ^C in the shell 2021-06-21 02:34:07 +09:00
Hector Martin
03ceed3a97 m1n1.hv: Fix map_hook_idx read/write options
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-21 02:06:22 +09:00
Hector Martin
7632a57ff3 m1n1.trace.asc: Implement basic message handling/dispatch
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-21 02:05:36 +09:00
Hector Martin
8a0125ac17 m1n1.trce.gpio: Use new register arrays
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-21 02:05:08 +09:00
Hector Martin
86154a8194 dart_dump.py: Use new 2D register arrays
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-21 02:04:35 +09:00
Hector Martin
2e250df645 run_guest.py: Don't die if -m or -c fails, bring up a shell instead.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-21 02:04:09 +09:00
Hector Martin
0a3bd5c91b m1n1.utils: Add support for multidimensional reg arrays in RegMap
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-21 02:03:18 +09:00
Hector Martin
9e42f4fc0f m1n1.trace: Add a state stash to Tracer that persists
This allows Tracers to keep internal state around even across complete
re-instantiations.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-21 02:02:05 +09:00
Hector Martin
7090138779 m1n1.utils: Make Register sub-subclasses work, optimize
Now figures out the fields/etc in a metaclass, not at object
instantiation time.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-21 02:01:07 +09:00
Hector Martin
8d61a81bed m1n1.hv: Wrap tracer calls in a shell to handle exceptions
This allows you to fix a tracer and retry ('cont' or ^D) or skip
('skip') its execution.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-21 01:58:47 +09:00
Hector Martin
7c19dcc33f m1n1.hv: Handle symbol addresses properly for Linux
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-19 21:51:36 +09:00
Hector Martin
8197538078 m1n1.hv: Add System.map support and make pac_mask configurable
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-19 15:53:14 +09:00