Commit graph

45 commits

Author SHA1 Message Date
Asahi Lina
6feceef2b0 hv_vm: Retry mapped page faults
This is usually a race that happens when the Python side has just
removed a hook, but there was already a CPU core faulting on an access.

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-09-27 06:02:28 +09:00
Asahi Lina
b48e33a333 hv: More instructions
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-06-02 22:50:52 +09:00
Asahi Lina
25d33aa4c7 hv_vm: Implement more opcodes
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
5b534cbf31 hv_vm: Add more SIMD ops to emulation
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
b88785fa58 hv_vm: Add 32-bit LDP emulation
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
e2f63a07b2 hv: Improve VM emulation for tracer
Adds support for up to 64-byte ops and more SIMD/paired operations.
This is good enough to trace a lot of GPU VM address space.

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-04-16 19:06:22 +09:00
Zzzec
bad788e67e hv_vm: fix an alignment problem in hv_map
Signed-off-by: Zzzec <1223544545@qq.com>
2022-01-03 18:23:39 +09:00
Hector Martin
07c7cc09f3 hv_vm: Dynamically allocate top-level page tables
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-17 21:46:55 +09:00
Hector Martin
6765bc3ff6 hv_vm: Support >36-bit PAs
This needs an extra L1 translation level, but only on SoCs with support
for >36-bit PAs. On M1, we bypass it and keep starting at L2.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-02 02:35:26 +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
Hector Martin
78cf104b1f hv_vm: Guard emulated read/writes to catch SErrors/aborts
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 21:18:13 +09:00
Hector Martin
25bc815821 hv: Store exception info regs on entry, and use it
This is the second part of allowing nested exceptions

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 21:18:13 +09:00
Hector Martin
bce239b36f exception: Make space in the stack for full exception context
This is step 1 of the rework to make reentrant exceptions work

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 20:29:19 +09:00
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
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
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
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
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
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
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
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
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
a5a974791b hv: Support handling GL2 exceptions
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-27 21:28:43 +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
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
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
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
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
9ffab4ac98 hv_vm.c: Remove stray ;
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-13 17:33:48 +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
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
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
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
Hector Martin
23304719cd hv: Move VM code to hv_vm.c
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-04 15:38:17 +09:00