Commit graph

294 commits

Author SHA1 Message Date
Hector Martin
4acc3d7c7f hv_vm: Mask off operand size for store emulation
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 17:42:03 +09:00
Mark Kettenis
4e88360eb1 main: Fix compiler error
Older versions of GCC throw a "initializer element is not contstant"
error.  Fix this.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2021-09-03 10:59:46 +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
Mark Kettenis
77b0cdb7c9 pcie: Only initialize ports that are actually present
The macbook pro and macbook air only have a single PCIe port

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2021-08-31 02:07:24 +09:00
Hector Martin
56799d34e8 usb_dwc3: Properly handle CDC status separately per pipe
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-30 23:53:05 +09:00
Pip Cet
b7ad368158 uart: avoid relying on UTRSTAT_RXD == 1
Signed-off-by: Pip Cet <pipcet@gmail.com>
2021-08-24 22:11:19 +09:00
Pip Cet
6a92a3e71a iodev, usb_dwc3: cosmetic fixes
Signed-off-by: Pip Cet <pipcet@gmail.com>
2021-08-24 22:11:19 +09:00
Pip Cet
9a5707889a hv_vuart: Avoid reporting bytes in the RX buffer when it's empty.
Signed-off-by: Pip Cet <pipcet@gmail.com>
2021-08-24 21:07:43 +09:00
Hector Martin
19b16f77d8 startup: Split density field from depth print
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-24 21:00:50 +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
4b4ae3ab90 aic: Add trivial AIC scaffolding, move regs to aic_regs.h
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-23 17:01:33 +09:00
Hector Martin
18eb02fa92 uart: Add more UART reg defines and use them
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-23 17:00:53 +09:00
Hector Martin
31bf2b5ac9 iodev: Make iodev_can_read() return the queued byte count
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-23 17:00:14 +09:00
Hector Martin
3bdf036161 Revert "cpio: add functions to create cpio images"
This reverts commit cd4b563a31.
2021-08-23 15:27:37 +09:00
Hector Martin
68c1f1c1a6 Revert "kboot: move SEPFW to initrd before booting"
We've decided this needs to go via reserved-ranges, not in the
initramfs.

This reverts commit 6afe9ebaf9.
2021-08-23 15:27:20 +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
Hector Martin
a18033e569 main: Add a searchable tag to find the m1n1 version
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-12 16:13:33 +09:00
Alyssa Rosenzweig
a52330809b startup: Prettyify video depth dump
Use the right unit. for rgb10x2, this prints "30bpp" instead of "0x1E".

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
2021-08-03 13:48:28 +09:00
Sven Peter
856a9dbd1b usb: don't initialize more than once
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-07-10 16:29:05 +09:00
Sven Peter
5d2315a865 uartproxy: flush iodev before shutting down
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-07-10 16:29:05 +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
6afe9ebaf9 kboot: move SEPFW to initrd before booting
Bootstrapping SEPOS requires to setup a scratch buffer and
will have to be handled by the final OS. We pass along
the firmware image by appending it to the initramfs.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-07-09 15:40:11 +09:00
Sven Peter
cd4b563a31 cpio: add functions to create cpio images
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-07-09 15:40:11 +09:00
Hector Martin
95aeb7bb83 hv: Use hv_write_hcr() for initial configuration
This might make things work if GXF is already enabled, maybe.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-22 01:15:00 +09:00
Janne Grunau
98076ef693 usb: disable tps6598x interrupts
Restore the interrupt masks on chainload or HV guest start. The
interrupt mask is not restored on the USB-C port used by the hypervisor.
This prevents an interrupt storm in the guest when the other USB-C port
is exposed to the guest. Both tps6598x share unfortunately an interrupt
line.

Signed-off-by: Janne Grunau <j@jannau.net>
2021-06-18 14:26:54 +09:00
Hector Martin
7e5054548a hv_vm: Rename SPTE_SYNC_TRACE to SPTE_TRACE_UNBUF
It's not really synchronous, it just flushes USB buffering.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-15 16:10:06 +09:00
Hector Martin
a664bd5d55 hv_vm: Minor fixes to pagetable code
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-15 15:47:44 +09:00
Hector Martin
7ff613665b hv_asm.S: Add comments to the vectors
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-15 15:47:24 +09:00
Hector Martin
5751fa0019 hv_vm: Remove broken hv_max_proxy_hook
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-15 15:47:07 +09:00
Mark Kettenis
d33d7ba89d kboot: Provide MAC addresses in device tree
Read the MAC addresses from the ADT and store them in
"local-mac-address" properties on the relevant nodes in the FDT.
This relies on appropriate aliases in the provided FDT, which
matches how U-Boot provides MAC addresses on embedded targets.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2021-06-15 15:27:18 +09:00
Sven Peter
9e061c2b50 usb_dwc3: shutdown the DART as well when shutting down usb
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-06-10 15:41:33 +09:00
Janne Grunau
88275b5cb5 hv: add AIC interrupt tracing
Implemented by MMIO tracing of AIC's event register. Proposed by pipcet.

Signed-off-by: Janne Grunau <j@jannau.net>
2021-06-10 15:41:02 +09:00
Sven Peter
3e807d6686 dart: shutdown to bypass mode
This allows payloads to use DMA for anything that's not PCIe
even without a DART driver. It also restores the DART registers
the state the were left by iBoot.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-06-10 00:00:37 +09:00
Janne Grunau
4b5c016368 hv: disable PMU counters inside the hypervisor
Signed-off-by: Janne Grunau <j@jannau.net>
2021-06-09 19:47:20 +09:00
Janne Grunau
d61bf13cb0 hv: shadow perf monitor IRQ mode and state
The development Mac OS kernel panics if the PMCR0 sysreg is in an
unexpected state. To avoid that the hypervisor needs to shadow the
interrupt mode and interrupt active flag after it mask the PM FIQ.
Mac OS reads and writes frequently from PMCR0 and PMC 0/1 so handling
in m1n1 is preferred over Python.

Signed-off-by: Janne Grunau <j@jannau.net>
2021-06-09 19:47:20 +09:00
Sven Peter
9529ec2b4f usb: add hpm_init and split usb_init and usb_iodev_init
This allows to bringup the USB PHY and the HPM for the
payload without having to initialize the CDC ACM driver
at the same time.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-06-09 19:45:38 +09:00
Sven Peter
d2b619957c tps6598x: add support for the USB PD chip
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-06-09 19:45:38 +09:00
Sven Peter
103100bb42 i2c: add i2c support
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-06-09 19:45:38 +09:00
Hector Martin
a175b6d159 proxy: Add reboot() call to hard reboot the system
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-04 15:09:11 +09:00
Hector Martin
393089f076 hv_exc: Also pass through (E)HID4, since it's noisy
This seems to be poked every time the kernel does a specific kind of
dcache flush...

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-30 03:37:12 +09:00
Hector Martin
f1cfe27e31 hv: Use AFSR_GL1 when in guarded mode.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-30 03:34:17 +09:00
Hector Martin
cd5a00ec87 uartproxy: Use only appropriate iodevs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-30 02:11:10 +09:00
Hector Martin
c794ea6dc2 hv_vuart: Make compatible with xnu and enable
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-30 01:39:26 +09:00
Hector Martin
ccc2d0b450 usb_dwc3: Implement CLEAR FEATURE, tweak things
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-28 17:52:48 +09:00
Hector Martin
4195b09c41 hv_wdt: Remove dead include
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-28 04:30:13 +09:00
Hector Martin
775902112d hv.py: Add M1RACLES mitigation
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-28 02:41:17 +09:00
Hector Martin
fe651cb9d7 hv_vm: Add more load/store emulation
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-28 02:13:23 +09:00
Hector Martin
12a7a0f1bb hv_exc: Allow the guest to see a bit of stolen time
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-28 02:13:23 +09:00
Hector Martin
fe2e89573e hv: Move break handling to hv_tick(), properly poll
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-28 02:13:23 +09:00
Hector Martin
66fc157e94 fb: Improve visuals
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-28 00:45:05 +09:00