Commit graph

2177 commits

Author SHA1 Message Date
Hector Martin
7cbd3e7612 rust: Upgrade log to 0.4.17
Fixes a compile warning.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-25 23:50:01 +09:00
Hector Martin
9602fb1859 hv_exc: Add a fast path for sysregs that can be handled without locking
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-25 20:08:59 +09:00
Hector Martin
a0f01809ce experiments/touchbar_rainbow.py: Better rainbow
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-23 18:12:09 +09:00
Hector Martin
b8b76f34f4 cpufreq: Correct fixup for M2 devices
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-19 04:44:58 +09:00
Hector Martin
a81314fe77 run_guest: Implement going to sleep
Getting back from sleep is left as an exercise to the reverse
engineer...

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-19 03:21:58 +09:00
Hector Martin
bd63b119ec startup: Direct primary CPU RVBAR entry to m1n1 main
This definitely isn't going to work yet, but it's better than ending up
in the secondary loop if it ever works.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-19 03:21:58 +09:00
Hector Martin
06b732e788 smp: Add smp_stop_secondaries()
Doesn't work properly yet since we can't restart them...

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-19 03:21:58 +09:00
Hector Martin
3288548faa utils: Add cpu_sleep() function
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-19 03:21:58 +09:00
Hector Martin
121d20cddf cpu_regs: Make fields usable from assembler
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-19 02:37:02 +09:00
Hector Martin
4638632657 hv: Implement emulated guest CPU shutdown
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-19 01:21:33 +09:00
Hector Martin
4d7b18d382 m1n1.proxy: Support negative arguments
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-19 01:02:03 +09:00
Hector Martin
cae2059c06 hv: Add a rendezvous timeout and panic on failure
Prints the CPUs that failed rendezvous, which should help debug what
caused them to go away.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 23:50:11 +09:00
Hector Martin
587da648a3 hv_exc: Be a bit more paranoid handling IPIs
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 23:38:40 +09:00
Hector Martin
b0c3f6d7ae hv: Implement ECV on M2 and later chips
This lets us eliminate HV timer ticks on secondary CPUs, which should
significantly improve the scalability of this whole thing.

(We leave them at 1Hz just in case, since that much won't hurt)

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 23:37:18 +09:00
Hector Martin
a75afff83b hv_exc: Pass through dangerous CYC_OVRD writes to Python
This makes it easier to experiment with the sleep/WFI stuff.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 23:36:55 +09:00
Hector Martin
40ae642d7b tools/apple_regs.json: Update some regs with stuff from XNU dumps
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 23:06:53 +09:00
Hector Martin
a1be8f233c m1n1.fw.smc: Add read32f()
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 22:09:07 +09:00
Hector Martin
7f9eaecbad m1n1.asm: Textually replace sysregs with their identifier
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 22:08:41 +09:00
Hector Martin
bdf54ba7e1 usb_dwc3: Populate serial number with the actual serial number
This will be useful for CI and similar use cases, to distinguish
different machines. Also fix spurious NUL-termination of the descriptor
strings while I'm here.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 22:07:21 +09:00
Hector Martin
b57a91726d experiments/cpu_pstate_latencies.py: Fix stuff
Extra pstates only for J416c, drop the second pstate field sets (still
no idea what that does), fix a mask.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 21:55:12 +09:00
Hector Martin
cf7da86eba cpufreq: Fix m1n1 stage 1 bugs
Old stage1 did cpufreq init and didn't do it right. Undo the damage in
stage2.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 21:55:12 +09:00
Hector Martin
9b944c5f56 payload: Pass m1n1 stage 1 version when chainloading
This might come in handy in the future.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 21:55:12 +09:00
Hector Martin
5a4e30a98d hv: Restore CYC_OVRD WFI mode and handle FIQ disable
Put the WFI mode back how macOS expects it on boot, since it won't set
it itself. Then, also trap attempts by macOS to disable FIQs. This
happens in the sleep/core off path. It is not sufficient to make all
that work properly, but it's a start.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 21:55:12 +09:00
Hector Martin
8cf0df0553 utils_asm: Save/restore CYC_OVRD register
This keeps the previous WFI setting instead of unconditionally flipping
to 3 then back to 2.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 21:55:12 +09:00
Hector Martin
b067f26971 cpu_regs.h: Add ACC_OVRD register
Not used yet, but might be in the future.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 21:55:12 +09:00
Hector Martin
cbd9b7b9e1 main, kboot: Move tunables/cpufreq/clk from main to kboot
I already screwed something up in cpufreq, and it makes it difficult to
understand what happened if it happens in stage1 before the proxy runs,
and difficult to undo in stage2.

Let's move all this stuff to kboot, since it isn't necessary until then
(and this will also avoid doing unnecessary init for macOS under the
HV). If we need it in proxy scripts, we can add proxy commands for this
later.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 21:55:12 +09:00
Hector Martin
145d39092f cpufreq: Fix a dumb bug and drop the DESIRED2 field
I don't think that field ever did anything and Apple don't set it on
newer macOS/SoCs. Also expand DESIRED1 to T602x width.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 20:45:10 +09:00
Hector Martin
b2a479f1bf chickens: Enable NEX power gating on P-cores
It seems we missed this config all along.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 20:45:10 +09:00
Asahi Lina
8f6e13b170 firmware: Add 13.3
This has the same iBoot version as 13.3.1, so firmwares probably did not
change.

Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-04-18 20:45:10 +09:00
Janne Grunau
1ae27426b3 kboot: Transfer touchbar calibration for t8112-j493
Signed-off-by: Janne Grunau <j@jannau.net>
2023-04-17 20:39:19 +09:00
Hector Martin
88b1866fcc experiments/spi.py: Cleanup/updates
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-16 21:23:46 +09:00
Hector Martin
46043704da rtkit: Drop oslog support
Nobody can figure out where this code came from and it's broken for
devices where OSLog is actually implemented these days... let's drop it
and see if anything complains.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-16 21:23:46 +09:00
Hector Martin
9b7ae1b443 m1n1.fw.mtp: Fix parsing of init messages
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-16 21:23:46 +09:00
Hector Martin
36bcc36173 m1n1.fw.asc.oslog: Implement properly
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-16 21:23:46 +09:00
Hector Martin
d5267123c1 experiments/mtp.py: Clean up
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-16 21:23:46 +09:00
Asahi Lina
19e00f1f23 m1n1.hv: Remove __OS_LOG segments from coprocessors
These are supposed to be after the kernel, so we'd have to move them
for the guest to be able to access them. It seems things work if we just
delete those segments.

Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-04-16 21:23:46 +09:00
Janne Grunau
22890f3ba1 experiments: Optimize bad apple video playback
Let ffmpeg rotate, align to stride and convert to RGBA.
Do not allocate a framebuffer for every frame.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-04-16 17:11:33 +09:00
Sasha Finkelstein
5681036b2e Add touchbar screen experiments
Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com>
2023-04-15 17:23:36 +09:00
Mark Kettenis
91ff36b277 kboot: Make missing iommu mappings non-fatal
Fixes: 21dc622735 ("kboot: Transfer display related memory carveouts to device tree")

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2023-04-15 13:22:14 +09:00
Hector Martin
06b88f14d2 dart: Detect locked t8110 DARTs
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-12 00:40:06 +09:00
Janne Grunau
2b2dd9ae89 kboot: Add DCP reserved mem support for t602x
Signed-off-by: Janne Grunau <j@jannau.net>
2023-04-12 00:40:06 +09:00
Hector Martin
ad53766d22 m1n1.fw.asc.{crash, ioreporting}: Do not align prealloc buffer sizes
On SMC on t602x, this is a small SRAM and we can run off the edge.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-12 00:40:06 +09:00
Hector Martin
aaeb3000e6 m1n1.hv: t6020 support
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-12 00:40:06 +09:00
Hector Martin
83513c36a3 nvme: Add nvme_ensure_shutdown()
We're not using it in the end because we fixed this in Linux, but I went
through the trouble of writing the function so we might as well leave it
lying around.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-12 00:40:06 +09:00
Hector Martin
c2c0ac04aa pcie: Add initial t602x support
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-12 00:40:06 +09:00
Hector Martin
046620d4d5 pmgr: Add pmgr_adt_power_{en,dis}able_index()
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-10 01:06:05 +09:00
Hector Martin
3bc3b0131f tools/pmgr_adt2dt.py: Add multidie support
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-09 23:50:42 +09:00
Hector Martin
41aac76fff Bring T6020 support up to parity with T6021
Missing smp/cpufreq/soc stuff.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-09 21:05:50 +09:00
Hector Martin
06884b5613 experiments/cpu_pstate_latencies.py: Fix SoC configs
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-09 21:04:40 +09:00
Hector Martin
dabad98d6e smp: Bump MAX_CPUS to 24
Needed for (presumed) M2 Ultra.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-09 20:37:56 +09:00