Commit graph

2046 commits

Author SHA1 Message Date
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
95dd7b90a4 chickens: Add preliminary T6000 support
P-core chickens need checking.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 19:00:34 +09:00
Hector Martin
ed21a80bc3 chickens: Refactor and update M1 bits
This adds some missing fixes for M1/T8103 and reworks the code to split
off common parts, and also handle per-revision bits.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 13:41:12 +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
38fc7a0780 Configure early debug features by SoC type
To build a version with early UART support, set it in config.h

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 13:36:42 +09:00
Vincent Duvert
b15be6bcd7 Remove hardcoded UART/WDT addresses
The M1 Pro/Max Macs use a different base address for the UART and the
WDT than earlier models.

Remove hardcoded base addresses constants and replace them with loads
from the ADT.

- The base address of the WDT is already retrieved in wdt_disable; also
use this address when triggering a reboot.
- Retrieve the base address of uart0 in uart_init. If the operation
fails, the error will be signaled on the early uart (if not disabled).
- The early debug UART can’t use the ADT (or shouldn’t) so it is now
disabled by default. To enable it, add
-DEARLY_UART -DEARLY_UART_BASE=0xuart_address
to the CFLAGS.

Signed-off-by: Vincent Duvert <vincent@duvert.net>
2021-11-01 11:27:29 +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
39d1d9a904 payload: Only load DTs that are compatible with this device
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-18 18:26:27 +09:00
Hector Martin
120ac16493 payload: Support setting boot-args as a payload.
Just use "boot-args=foo bar baz\n" as a payload

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-18 18:18:01 +09:00
Hector Martin
097c2f752a payload: Make vars static
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-18 18:17:42 +09:00
Hector Martin
e763faa3c1 string.h: Add toupper()/tolower()
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-18 18:17:15 +09:00
Hector Martin
ef83f62d0e cpufreq: New module to initialize CPU p-states
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-18 17:34:40 +09:00
Hector Martin
4fa0200053 main: Export chip_id as a global
Some things need to be chip-specific, as the ADT isn't generic enough.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-18 17:33:49 +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
6d9bc7fa8f pmgr: Unify defs with Linux, clean up device relationships.
This enables parent devices that are required by active child devices,
because iBoot leaves behind some broken dependencies.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-18 16:52:59 +09:00
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