Hector Martin
10880ca1a6
hv_vm: Unbork >32bit mmiotrace
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-16 03:01:10 +09:00
Hector Martin
09a44e5a92
hv_exc: Disable stolen time accounting
...
This doesn't work with SMP.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:32:57 +09:00
Hector Martin
509481d5d5
hv: Add SMP support
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:32:57 +09:00
Hector Martin
184a516367
hv_exc: Make IPI/IRQ/timer/PMC emulation storage per-CPU
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:26:14 +09:00
Hector Martin
56b54a6641
hv_vm/hv_exc: Add cpu_id to exception & mmiotrace structs
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
a13a23d5fa
iodev: Add a spinlock and allow console for secondaries
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
cd59d39686
memory.h: Add mmu_active() function
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
c690eb1c9d
utils: Make spinlocks reentrant
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
787c46e8c7
hv_exc: Add a Big Hypervisor Lock
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
d53b40da48
memory: Add mmu_init_secondary() to init MMU for secondaries
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
52f432f0f6
memory: Add guard pages at the end of stacks
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
2f8beb02b4
cpu_regs.h: Add more registers needed for HV config
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
8752d5fbba
gxf: Per-CPU gxf stack
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
368b48a365
hv_wdt: Make HV WDT CPU configurable and WDT optional
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
6c186f8468
hv_asm: Move SP saving to a variable, per-CPU
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
c317b73b8c
utils: Add a basic spinlock implementation
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:19:37 +09:00
Hector Martin
bb7c8ad3c5
hv_asm: Unmask SErrors inside the HV
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:19:37 +09:00
Hector Martin
90b10ef9f7
smp: Add smp_id() and use TPIDR_EL[12] to keep the SMP ID
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:19:37 +09:00
Hector Martin
571a19c9a3
smp: Align secondary_stacks & export to header
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 22:00:29 +09:00
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
Hector Martin
db0252a1d6
hv_exc: Steal time from the guest during HV exceptions
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-28 00:38:42 +09:00
Hector Martin
dd443d2c2c
cpu_regs: Fix missing IMP_APL prefixes
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-28 00:38:11 +09:00
Hector Martin
0265edebba
hv_exc: Add ACTLR_EL1 sysreg forwarding
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-28 00:37:48 +09:00
Hector Martin
a21e46031e
kboot: Only initialize PCIe when booting a kernel payload
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-28 00:04:52 +09:00
Hector Martin
bd8ae6f4f6
pcie: Add a pcie_shutdown() function and call it on hv init
...
Guests don't like it if PCIe is initialized already
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-28 00:03:11 +09:00
Hector Martin
77a36a7d34
utils,proxy: Add basic SIMD register fetch and mutation support
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-27 22:57:25 +09:00
Hector Martin
ae55e1c5dc
hv_vm: Add debug breadcrumbs
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-27 22:05:23 +09:00
Hector Martin
f792b128c5
hv_vm: Suspend watchdog around mmiotrace event writes
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-27 22:05:23 +09:00
Vincent Duvert
3d1747466b
Add an option to disable checksumming if possible
...
* Introduce feature flags which allows the proxy and m1n1 to determine which
features they have in common.
* Add a feature flag that disables checksumming (by replacing checksums with
constant values) for the data packets exchanged by REQ_MEMREAD, REQ_MEMWRITE
and REQ_EVENT. The feature is enabled if m1n1 supports it; checksumming is kept
enabled for UART communication.
* To ensure no packet loss when checksumming is disabled, an extra sentinel
value is added after the exchanged data for memory read/write operations.
Signed-off-by: Vincent Duvert <vincent@duvert.net>
2021-05-27 21:34:37 +09:00
Hector Martin
85411d1714
hv_vm: Add support for 128-bit ops, stp/ldp, fix some emu bugs
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-27 21:29:58 +09:00
Hector Martin
bfe8c94c47
hv_wdt: Add hypervisor watchdog on secondary core
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-27 21:28:43 +09:00
Hector Martin
c93f856c92
exception: Only enable IRQs on the primary core
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-27 21:28:43 +09:00
Hector Martin
0a91cc2b08
gxf: Make gl_call work with GXF or SPRR locked
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-27 21:28:43 +09:00
Hector Martin
a5a974791b
hv: Support handling GL2 exceptions
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-27 21:28:43 +09:00
Hector Martin
b1e09ad509
exception,gxf: Turn off PAN on exception entry
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-27 21:11:14 +09:00
Hector Martin
aa72f50e50
iodev: Do not print leading * for empty buffer prints on alt path
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-27 21:10:00 +09:00
Hector Martin
0786894201
uart: Add uart_printf()
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-27 21:09:48 +09:00
Hector Martin
532b43f0a4
utils: debug_printf: Use vsnprintf instead of vsprintf
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-27 21:09:15 +09:00
Hector Martin
81808da562
hv_exc: Set the step timer to 100 cycles
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-25 20:12:20 +09:00
Hector Martin
e92e075fba
hv_exc: Add IPI and guest timer FIQ virtualization
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-25 20:12:20 +09:00
Hector Martin
75f206e65c
hv_exc, hv.py: Add support for interrupting guest with ^C
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-25 20:12:20 +09:00
Hector Martin
1ce8d8b706
hv: Add hv_write_hcr() to handle GXF
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-25 20:12:20 +09:00
Hector Martin
2e014f58fa
hv: Implement a periodic hypervisor ptimer and use vtimer for stepping
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-25 20:12:20 +09:00
Hector Martin
76c283deba
hv_vm: Delay after sync mmiotrace events
...
This allows the USB hardware to get a chance to deliver the packets to
the host, in case the poke would break it.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-25 20:12:20 +09:00
Hector Martin
1b1653dfe9
hv_vm: Simplify r31 handling, move LR adjustment to hv_exc.c
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-25 20:12:20 +09:00
Hector Martin
48c7fc725b
cpu_regs.h: Add IPI and VM timer reg defines
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-25 20:12:20 +09:00
Hector Martin
e484d6df70
cpu_regs.h: Add Apple-defined exception types
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-25 20:12:20 +09:00
Hector Martin
b1f55015eb
arm_cpu_regs.h: Add sysreg exception ISS bit defines
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-25 20:12:20 +09:00
Hector Martin
74b8863a7f
arm_cpu_regs.h: Add timer bit defines
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-25 20:12:20 +09:00
Hector Martin
e99680cb1e
hv: Rename HV_HOOK proxy start type to HV
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-25 20:12:20 +09:00
Hector Martin
25f4500cea
utils.h: Do sysreg defines in a way that allows extracting the fields
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-25 19:51:08 +09:00
Hector Martin
0192bd6617
gxf: Add gxf_enabled()
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-25 19:49:12 +09:00
Hector Martin
aacbdf0949
GXF_STATUS -> GXF_STATUS_EL1
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-22 04:42:38 +09:00
Hector Martin
09cdebf08b
gxf: Don't try to touch HCR_EL2 if GXF is enabled
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-22 03:21:01 +09:00
Hector Martin
76dca8c891
memory: Unbork EL0 execution
...
We need to make m1n1 itself EL0-executable.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-22 02:48:17 +09:00
Hector Martin
da440672a8
uartproxy: Send events without copying data to a giant buffer
...
We don't have 64K of stack.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-16 19:04:51 +09:00
Hector Martin
7abebaec88
iodev: Add iodev_queue() API to queue data without kicking transmission
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-16 19:04:51 +09:00
Mark Kettenis
9604907b2d
pcie: minimal initialization
...
Minimal initialization of the PCIe hardware such that the tunable
can be applied such that they don't have to be passed along in
the devicetree.
Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2021-05-16 02:43:44 +09:00
Hector Martin
28ab4e1611
hv_vm: Handle load/store instructions with update
...
These don't get instruction syndromes, so we need to stop relying on
that to determine the access size.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-15 23:57:48 +09:00
Hector Martin
afc088840d
hv: Add Python-side MMIO emulation hooks
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-15 23:57:48 +09:00
Hector Martin
323b02ce1d
hv: Implement basic MMIO tracing to Python
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-15 23:57:48 +09:00
Hector Martin
a1f6b2502a
usb_dwc3: Send a ZLP after multiple-of-512 transfers
...
This fixes the stalling issue with readmem() of a multiple of 512 bytes.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-15 21:47:22 +09:00
Hector Martin
57708b529f
usb_dwc3: Change xfer_in_progress to a bool
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-15 21:47:22 +09:00
Hector Martin
58489bf72c
iodev, usb: Add flush() call to flush buffers to the host
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-15 21:47:22 +09:00
Hector Martin
67c7043b9a
utils: In EL1, instead of rebooting, break into HV
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-15 20:42:50 +09:00
Hector Martin
03b70eed94
hv_vm: Move dprintf macro to utils.h, add more debugging
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-15 20:38:32 +09:00
Hector Martin
3de3b54b7e
hv_asm: Restore all registers on return to guest
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-15 20:36:39 +09:00
Janne Grunau
a742f05532
usb/hv: add second CDC ACM interface for virtualized UART
...
Signed-off-by: Janne Grunau <j@jannau.net>
2021-05-15 19:47:08 +09:00
Sven Peter
4a893dc57a
apple_regs: document more SPRR regs
...
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-05-15 16:38:45 +09:00
Hector Martin
5d3f154d0f
hv_vm: Correctly split software mapped L2 blocks
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-15 01:28:44 +09:00
Hector Martin
bf34611bf4
hv_vm: Add out-of-bounds IPA check
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-15 01:15:17 +09:00
Hector Martin
e919b63a02
hv_vm: Add register-offset LDR/STR emulation, fix bugs
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-15 00:43:39 +09:00
Hector Martin
1a5ba2c67e
hv_vm: Fix bad asserts
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-14 21:49:11 +09:00
Hector Martin
920ff59483
exception: Unbork EL1 stack
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-13 21:14:58 +09:00
Hector Martin
9efa91bf87
gxf: Do not disable the MMU around GXF calls
...
We are now SPRR compatible.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-13 18:31:27 +09:00
Hector Martin
b9ed00c6f3
memory: Initialize SPRR permissions
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-13 18:16:56 +09:00
Hector Martin
8af8dadee1
memory: Support L3 mappings, map m1n1 code as RX.
...
This replaces the old pagetable code with an adapted version of what
hv_vm.c does, which can handle block and page mappings more
intelligently.
Then, map the m1n1 code section as RX. This allows us to work in modes
where W^X is enforced.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-13 18:14:31 +09:00
Hector Martin
3e1ea2d503
memory: Add separate mappings for EL0 data access
...
This unborks stack and constant pool accesses from el0_call.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-13 17:36:02 +09:00
Hector Martin
7685800b45
heapblock: Assert if not initialized
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-13 17:33:57 +09:00
Hector Martin
9ffab4ac98
hv_vm.c: Remove stray ;
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-13 17:33:48 +09:00
Sven Peter
1c604a77c5
gxf: add support for guarded exception levels
...
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-05-11 15:48:40 +09:00
Sven Peter
9120cb8426
memory: allow to reinit and temporarily disable the MMU
...
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-05-11 15:48:40 +09:00
Sven Peter
b00c5e6522
utils.h: add msr_sync convenience macros
...
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-05-11 15:48:40 +09:00
Sven Peter
36efdd2ac3
allow cpu_regs.h to be included in .S files
...
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-05-11 15:48:40 +09:00
Sven Peter
813e40f4ca
exception_asm.S: skip msr hcr_el2 if not required
...
When guarded exception levels are enabled hcr_el2 can no longer be written to from EL2.
A future commit will however use el1_call to jump to GL1. It will setup hcr_el2 before
enabling GXF such that the write doesn't have to happen in el1_call anymore
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-05-11 15:48:40 +09:00
Sven Peter
148fe31122
exception_asm.S: correctly setup sp for EL1
...
The previous code switched SPSel to EL0 but then used eret to
jump to EL1h which uses SP_EL1 instead
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-05-11 15:48:40 +09:00
Hector Martin
ed32cf6328
hv_exc: Add a hacky STEP feature to interrupt guest after a while
...
This should eventually be a proper single step feature or something, but
for now...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-09 03:25:51 +09:00
Hector Martin
bcdafe8d00
hv_vm: Short-circuit hv_translate when MMU is off
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-09 03:25:51 +09:00
Hector Martin
8d5596a1a1
hv_vm: Fix bug when making L2 mappings
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-09 03:25:51 +09:00
Hector Martin
52823eaab6
hv_asm: Turn off PAN on exception entry
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-09 03:25:51 +09:00
Hector Martin
4c043a0f97
memory: Move SCTLR/TCR defines to arm_cpu_regs.h
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-09 03:25:51 +09:00
Hector Martin
0203aa6d3d
proxy: Add framebuffer ops
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-08 03:42:21 +09:00
Hector Martin
aad892d461
fb: Implement fb_shutdown() & friends
...
Clean up after ourselves before chainload
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-07 12:19:20 +09:00
Hector Martin
0ae3455d51
hv_vuart: World's stupidest virtual UART implementation
...
Work in progress...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-05 04:03:44 +09:00
Hector Martin
9407dba2e0
hv_vm: Initial data abort handling
...
Supports software-mapping for a subset of ldr/str instructions.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-05 04:03:44 +09:00
Hector Martin
8a64441bcd
hv_vm: Extend hv_translate() for stage1 and write modes
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-05 03:27:19 +09:00
Hector Martin
c0c7c57dd0
hv_vm: Fix bug inhv_pt_map_l4()
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-05 03:24:37 +09:00
Hector Martin
ce3a673413
uart: Move registers to uart_regs.h
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-05 03:23:25 +09:00
Hector Martin
27af846aae
hv_vm.c: Move SPTE_TYPE to bit 50
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-05 03:23:04 +09:00
Hector Martin
0e987f031b
utils: Add flush_and_reboot() to do the iodev flush dance
...
Use this for exceptions, asserts, etc.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-05 03:21:48 +09:00
Hector Martin
50f112c396
hv: Add support for address translation & abort decoding
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-05 00:28:39 +09:00