Skip to content

target/arm: ISV=0 data abort emulation library

Lucas Amaral qemu-arm qemu-devel 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest6 patches 17 repliesIn review
  2. v56 patches 2 repliesSuperseded
  3. v46 patches 2 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v36 patches0 repliesSuperseded
v23 patches2 repliesSuperseded

Changes in v6 from the cover letter

- Replace cpu_memory_rw_debug() with get_phys_addr() + address_space_read/write() for proper guest MMU translation instead of debug access path (Richard Henderson)
- Handle page-crossing accesses via per-page chunked loop instead of rejecting them
- Replace custom sign_extend() with sextract64() from qemu/bitops.h (Richard Henderson)
- Remove unnecessary (void) casts (Richard Henderson)
- Add guest endianness support: be_data flag with ldn_le_p/ldn_be_p byte-order-aware helpers instead of host-endian memcpy (Richard Henderson)

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6target/arm/emulate: add ISV=0 emulation library with load/store immediatetarget/arm/emulate/a64-ldst.decode target/arm/emulate/arm_emulate.c target/arm/emulate/arm_emulate.h +2 more+456 -01 reply
2/6target/arm/emulate: add load/store register offsettarget/arm/emulate/a64-ldst.decode target/arm/emulate/arm_emulate.c+135 -01 reply
3/6target/arm/emulate: add load/store pairtarget/arm/emulate/a64-ldst.decode target/arm/emulate/arm_emulate.c+176 -01 reply
4/6target/arm/emulate: add load/store exclusivetarget/arm/emulate/a64-ldst.decode target/arm/emulate/arm_emulate.c+92 -01 reply
5/6target/arm/emulate: add atomic, compare-and-swap, and PAC loadtarget/arm/emulate/a64-ldst.decode target/arm/emulate/arm_emulate.c+278 -01 reply
6/6target/arm/hvf, whpx: wire ISV=0 emulation for data abortstarget/arm/hvf/hvf.c target/arm/whpx/whpx-all.c+103 -42 replies

Reviews trailers per patch

5 of 6 patches have a Reviewed-by or Acked-by.

PatchMohamed Mediouni
1/6R-b
2/6R-b
3/6R-b
4/6R-b
5/6R-b
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH v6 0/6] target/arm: ISV=0 data abort emulation library

Add a shared emulation library for AArch64 load/store instructions that cause ISV=0 data aborts under hardware virtualization, and wire it into HVF (macOS) and WHPX (Windows).

When the Instruction Syndrome Valid bit is clear, the hypervisor cannot determine the faulting instruction's target register or access size from the syndrome alone. This previously hit an assert(isv) and killed the VM. The library fetches and decodes the faulting instruction using a decodetree-generated decoder, then emulates it directly against the vCPU register file and memory.

The library uses its own a64-ldst.decode rather than sharing target/arm/tcg/a64.decode — TCG's trans_* functions emit IR into a translation block, while this library's execute directly. Decode patterns are kept consistent with TCG's where possible; differences are noted in the relevant commit messages.

Changes since v5:
- Replace cpu_memory_rw_debug() with get_phys_addr() + address_space_read/write() for proper guest MMU translation instead of debug access path (Richard Henderson)
- Handle page-crossing accesses via per-page chunked loop instead of rejecting them
- Replace custom sign_extend() with sextract64() from qemu/bitops.h (Richard Henderson)
- Remove unnecessary (void) casts (Richard Henderson)
- Add guest endianness support: be_data flag with ldn_le_p/ldn_be_p byte-order-aware helpers instead of host-endian memcpy (Richard Henderson)

Changes since v4:
- Rebased onto current master
- Add SPDX license identifier to new meson.build
- Resent as new top-level thread (Alex Bennée)

Changes since v3:
- Document decodetree pattern differences from TCG in commit messages for patches 1/6 and 5/6.

Changes since v2:
- Inject synchronous external abort (matching kvm_inject_arm_sea() syndrome) on unhandled instruction or memory error, instead of silently advancing PC or returning an error.
- Fix WHPX advance_pc bug: error paths no longer advance PC.
- Add page-crossing guard in mem_read/mem_write to prevent partial side effects.

Changes since v1:
- Split monolithic patch into 6 incremental patches: framework, then one patch per coherent instruction group (Peter)
- Removed per-backend callback ops; library uses CPUArchState directly for memory access (Mohamed)
- Removed mock unit tests (Mohamed; kvm-unit-tests is the right vehicle for decoder validation)
- Added architectural justification for separate decode file

Lucas Amaral (6):
target/arm/emulate: add ISV=0 emulation library with load/store
immediate
target/arm/emulate: add load/store register offset target/arm/emulate: add load/store pair target/arm/emulate: add load/store exclusive target/arm/emulate: add atomic, compare-and-swap, and PAC load target/arm/hvf,whpx: wire ISV=0 emulation for data aborts

 target/arm/emulate/a64-ldst.decode | 293 +++++++++++
 target/arm/emulate/arm_emulate.c   | 805 +++++++++++++++++++++++++++++
 target/arm/emulate/arm_emulate.h   |  30 ++
 target/arm/emulate/meson.build     |   8 +
 target/arm/hvf/hvf.c               |  46 +-
 target/arm/meson.build             |   1 +
 target/arm/whpx/whpx-all.c         |  61 ++-
 7 files changed, 1240 insertions(+), 4 deletions(-)
 create mode 100644 target/arm/emulate/a64-ldst.decode
 create mode 100644 target/arm/emulate/arm_emulate.c
 create mode 100644 target/arm/emulate/arm_emulate.h
 create mode 100644 target/arm/emulate/meson.build
Signature · 1 line
2.52.0