Commit graph

703 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
Hector Martin
481f662271 hv_vm: Fix CTRR hugepage issue
This is the hypervisor counterpart to da9ceddeac.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-09 19:46:13 +09:00
Mario Hros
2f96635420 mcc: Reuse existing T6000 impl for T6020
Signed-off-by: Mario Hros <git@reversity.org>
2023-04-09 19:46:13 +09:00
Mario Hros
049bc64e36 smp: Add T6021 CPU start offset
Signed-off-by: Mario Hros <git@reversity.org>
2023-04-09 19:46:13 +09:00
Mario Hros
da03138eec cpufreq: Add T6021 clusters
Signed-off-by: Mario Hros <git@reversity.org>
2023-04-09 19:46:13 +09:00
Mario Hros
e71ad13474 chickens: Add preliminary T6020 support
Signed-off-by: Mario Hros <git@reversity.org>
2023-04-09 19:46:12 +09:00
Mario Hros
afb68db34c chickens: Force nonspec for rev 0x0 of Avalanche
Signed-off-by: Mario Hros <git@reversity.org>
2023-04-09 19:46:12 +09:00
Mario Hros
2e040a6729 chickens: Add T6021 chickens
Signed-off-by: Mario Hros <git@reversity.org>
2023-04-09 17:56:01 +09:00
Mario Hros
d033044a80 soc: Add T6021 defines
Signed-off-by: Mario Hros <git@reversity.org>
2023-04-09 17:56:01 +09:00
Mario Hros
34f49a56fc nvme: assume die 0 if clock-gates not set
Signed-off-by: Mario Hros <git@reversity.org>
2023-04-09 17:56:01 +09:00
Asahi Lina
fa3dcd3e77 payload: Add tso=1 m1n1 option to enable TSO
Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-03-28 19:06:20 +09:00
Asahi Lina
0a05a0171e proxy: Add smp_is_alive() thunk
Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-03-28 19:06:20 +09:00
Eileen Yoon
4a679b12bd tunables_static: improve sequence iter
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2023-03-28 17:19:45 +09:00
Eileen Yoon
2abf3af38e tunables_static: add t8103 ane tunables
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2023-03-28 17:19:45 +09:00
Eileen Yoon
cf09e4ff56 tunables_static: abstraction to reuse entries
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2023-03-28 17:19:45 +09:00
Hector Martin
a633b90634 kboot: Remove leftover IPD lookup dead code
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-03-19 20:30:01 +09:00
Hector Martin
a024101b75 kboot: Pass keyboard layout ID & country code in HID device
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-03-19 18:14:44 +09:00
Janne Grunau
c6c426581b pcie: Add link speed override for SD card reader
The SD card reader on Macbook Pro 14"/16" and Mac Studio uses yet
another property to override the port's "maximum-link-speed" property.
Add parsing for "expected-link-speed" and always look in the port's
first child for these properties.
Increases the link speed to PCIe 2.0 which is required for the full
bandwidth of SDXC UHS-II.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-03-12 00:32:10 +09:00
Asahi Lina
5d5fa70efa firmware: Add 13.1/13.2 to version list
Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-03-06 15:15:17 +09:00
Janne Grunau
583f290b2b Add a space between '//' and '#' to satisfy clang-format 15
Signed-off-by: Janne Grunau <j@jannau.net>
2023-02-02 09:51:08 +09:00
Janne Grunau
c8c0bd5dc5 display: Check if FB IOVA is available on dart-disp0
Fixes a copy and paste error in 1b5dee2496 checking dart-dcp twice.

Fixes: 1b5dee2496 ("display: Map the framebuffer if it is not mapped")
Signed-off-by: Janne Grunau <j@jannau.net>
2023-02-02 09:50:33 +09:00
Janne Grunau
4e7398e3a8 display: Start scanning for fb IOVA at vm-base
Required for M2 devices as the M2 Mac mini.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-02-02 09:50:33 +09:00
Janne Grunau
bff8aa647c dcp: Offset temporary IOVA space from vm-base
Required on M2 devices.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-02-02 09:50:33 +09:00
Janne Grunau
7e33a578d8 rtkit: Extend IOVA to 36-bit
Required for DCP on M2.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-02-02 09:50:33 +09:00
Janne Grunau
f68a842ab7 rtkit: Apply "asc-dram-mask" consistently
Required for DCP on M2 which requires 36-bit IOVA space.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-02-02 09:50:33 +09:00
Janne Grunau
6466f8dec8 dcp: Parse dart SID for DCP
Required for M2 which for which the dice showed "5".

Signed-off-by: Janne Grunau <j@jannau.net>
2023-02-02 09:50:33 +09:00
Janne Grunau
8af2489d84 dart: Increase IO address space to 36-bit
This address space a single TTBR can hold with a 16k page size. Required
for DCP on M2.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-02-02 09:50:33 +09:00
Janne Grunau
93abc760b2 dart: Add checks to dart_translate_internal()
Previous assumptions are not longer true with dart8110 on M2.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-02-02 09:50:33 +09:00