Commit graph

1827 commits

Author SHA1 Message Date
Hector Martin
5787eb2d64 hv_exc: Fix global IPIs
Reported-by: Joey Gouly <joey.gouly@arm.com>

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-18 13:26:28 +09:00
Hector Martin
72788291e6 memory: Map all RAM to the top, minus carveouts
This unbreaks dcp.py and other things that need to access reserved
regions. This way we don't have to start doing manual MMU maps, but
we're still safe from SErrors caused by hitting TZ carveouts.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-16 01:00:33 +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
Hector Martin
da024ffbd8 memory: Only map available RAM
We saw some crazy speculation running in the HV breaking things by
reading from invalid RAM, so let's actually map only what's available.
For now we do map all lowmem as we haven't seen SErrors there yet, but
we stop at the high boundary.

Fixes: #97

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
Danny Lin
37e8f425bf smp: Fix smp_call macros with fewer than 4 arguments
The full 4-argument version of smp_call is smp_call4; smp_call doesn't
exist.

Signed-off-by: Danny Lin <danny@kdrag0n.dev>
2021-10-11 12:42:31 +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
e1515b4376 i2c: Make error paths wait for bus in i2c_smbus_read
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-10 23:49:51 +09:00
Hector Martin
64cb9892b1 tps6598x: Correctly clear all IRQ flags
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-10 23:18:04 +09:00
Hector Martin
675f11dc59 tps6598x: Get rid of TPS_WRITE_DELAY
This was a poor workaround for the broken i2c code.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-10 23:16:26 +09:00
Hector Martin
d20a79435c i2c: Fix waiting for read transactions
We weren't waiting until the STOP after reads, causing borkage.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-10 23:15:32 +09:00
Hector Martin
11ba4a0aac hv: format fix
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-03 00:30:42 +09:00
Hector Martin
b9f1eb29e9 kboot: Only try to parse actual CPUs in /cpus
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-03 00:28:08 +09:00
Hector Martin
2736f0dd07 hv: Transfer ACTLR_EL1 (not just EL2) to secondaries
Also capture config at cpu0 guest entry time, to make sure we don't
carry over guest changes to EL1 regs after that.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-24 10:57:27 +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
6707fd5bb9 tools/gen_reg_class.py: Fix multibit field defs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 23:28:42 +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
5eed8f674d hv_vm: Fix guest SError handling
This was broken, but somewhat masked by another bug in hv_vm.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 22:17:52 +09:00
Hector Martin
56c3d93787 hv_exc: Enable SErrors in the hypervisor
This finally works properly now

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 21:18:13 +09:00
Hector Martin
78cf104b1f hv_vm: Guard emulated read/writes to catch SErrors/aborts
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 21:18:13 +09:00
Hector Martin
4f92a77efd exception: Allow guarding SError exceptions
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 21:18:13 +09:00
Hector Martin
25bc815821 hv: Store exception info regs on entry, and use it
This is the second part of allowing nested exceptions

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 21:18:13 +09:00
Hector Martin
607464f8b0 proxy/uartproxy/hv_asm: Add syncs to flush SErrors
This makes sure any pending memory ops that might trigger an
asynchronous SError do so here, and not later. This fixes SErrors
breaking proxy ops.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 20:31:52 +09:00
Hector Martin
d44d0a4f16 Revert "hv_asm: Unmask SErrors inside the HV"
This reverts commit bb7c8ad3c5.

This is broken.
2021-09-21 20:30:07 +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
e08457aaa9 Makefile, m1n1.ld: Build with debug info
This allows addr2line to work. The Mach-O output should be unchanged.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 17:13:03 +09:00
Hector Martin
a16731e8b3 hv_exc: Avoid delivering spurious HV-triggered IPIs to the guest
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 17:13:03 +09:00
Hector Martin
098d394a5c exception: Handle Fast IPIs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 13:33:23 +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
977cbdf4f8 hv_exc: New time accounting around Python callbacks
This does an explicit hypervisor rendezvous. It's not great because it
introduces spurious guest IPIs, but xnu doesn't seem to care...

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 13:17:00 +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
64dab94821 hv_aic: Use aic.h instead of just declaring aic_base
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 00:42:19 +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
945b75a0f8 hv_aic: Fix regression introduced by 4b4ae3ab
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 00:40:04 +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