From: Lucas Amaral <lucaaamaral@gmail.com>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, agraf@csgraf.de,
Lucas Amaral <lucaaamaral@gmail.com>
Subject: [PATCH v2 0/3] target/arm: ISV=0 data abort emulation library
Date: Thu, 12 Mar 2026 23:18:47 -0300 [thread overview]
Message-ID: <20260313021850.42379-1-lucaaamaral@gmail.com> (raw)
In-Reply-To: <20260309214852.92545-1-lucaaamaral@gmail.com>
When a guest triggers a data abort with ISV=0 (e.g. STP, LDP, SIMD/FP
load/store, writeback addressing, atomics, exclusives), the ESR syndrome
does not carry the access size or target register, so the hypervisor
cannot emulate MMIO without decoding the faulting instruction.
v1 handled this inside HVF with a hand-written decoder. Based on review
feedback from Mohamed Mediouni and Peter Maydell, v2 restructures the
implementation as:
- A shared emulation library in target/arm/emulate/ with a decodetree
decoder (a64-ldst.decode), usable by any hypervisor backend.
- A callback-based interface (struct arm_emul_ops) that abstracts
register and memory access, keeping the library hypervisor-agnostic.
- HVF and WHPX backends wired as the first two consumers.
Instruction classes handled (DDI 0487):
- Load/store pair: STP, LDP, STNP, LDNP, STGP, LDPSW (C3.3.14-16)
- SIMD/FP load/store pair and single (C3.3.10, C3.3.14-16)
- All immediate addressing: unscaled, post/pre-index, unsigned offset
- Register offset addressing with extend (C3.3.9)
- Exclusives: STXR, LDXR, STXP, LDXP (C3.3.6)
- Atomics: LDADD, LDCLR, LDEOR, LDSET, LDSMAX/MIN, LDUMAX/MIN, SWP
- Compare-and-swap: CAS, CASP (C3.3.1)
- LDRAA/LDRAB with FEAT_PAuth (C6.2.121)
- PRFM, DC maintenance (as NOPs)
Intentionally omitted (not observed in ISV=0 MMIO traps during testing):
- AdvSIMD structure loads/stores (LD1/ST1 etc.)
- MTE load/stores (FEAT_MTE)
- 128-bit atomics (FEAT_LSE128)
- MOPS (FEAT_MOPS)
KVM NISV handling is a natural follow-up -- it requires similar
arm_emul_ops callbacks using KVM vcpu ioctls.
v1 -> v2:
- Moved from HVF-specific inline decoder to shared library
in target/arm/emulate/ (Mohamed Mediouni)
- Added decodetree decoder for structured instruction parsing
(Peter Maydell)
- Made hypervisor-agnostic; wired HVF and WHPX (Peter Maydell)
- Added CASP register-pair validation (odd/r31 -> UNHANDLED)
- Added unit tests (19 test cases)
- Split into 3 patches for reviewability
Lucas Amaral (3):
target/arm: add AArch64 ISV=0 instruction emulation library
tests: add unit tests for ISV=0 emulation library
target/arm: wire ISV=0 emulation into HVF and WHPX
target/arm/emulate/a64-ldst.decode | 293 ++++++++++++
target/arm/emulate/arm_emulate.c | 738 +++++++++++++++++++++++++++++
target/arm/emulate/arm_emulate.h | 55 +++
target/arm/emulate/meson.build | 16 +
target/arm/hvf/hvf.c | 94 +++-
target/arm/meson.build | 1 +
target/arm/whpx/whpx-all.c | 86 +++-
tests/unit/meson.build | 1 +
tests/unit/test-arm-emulate.c | 540 +++++++++++++++++++++
9 files changed, 1820 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
create mode 100644 tests/unit/test-arm-emulate.c
--
2.52.0
next prev parent reply other threads:[~2026-03-13 2:19 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 21:48 [PATCH] target/arm/hvf: emulate ISV=0 data abort instructions Lucas Amaral
2026-03-10 1:28 ` Mohamed Mediouni
2026-03-10 9:23 ` Peter Maydell
2026-03-13 2:18 ` Lucas Amaral [this message]
2026-03-13 2:18 ` [PATCH v2 1/3] target/arm: add AArch64 ISV=0 instruction emulation library Lucas Amaral
2026-03-13 6:33 ` Mohamed Mediouni
2026-03-13 8:59 ` Peter Maydell
2026-03-13 2:18 ` [PATCH v2 2/3] tests: add unit tests for ISV=0 " Lucas Amaral
2026-03-13 2:18 ` [PATCH v2 3/3] target/arm: wire ISV=0 emulation into HVF and WHPX Lucas Amaral
2026-03-15 3:41 ` [PATCH v3 0/6] target/arm: ISV=0 data abort emulation library Lucas Amaral
2026-03-15 3:41 ` [PATCH v3 1/6] target/arm/emulate: add ISV=0 emulation library with load/store immediate Lucas Amaral
2026-03-15 3:41 ` [PATCH v3 2/6] target/arm/emulate: add load/store register offset Lucas Amaral
2026-03-15 3:41 ` [PATCH v3 3/6] target/arm/emulate: add load/store pair Lucas Amaral
2026-03-15 3:41 ` [PATCH v3 4/6] target/arm/emulate: add load/store exclusive Lucas Amaral
2026-03-15 3:41 ` [PATCH v3 5/6] target/arm/emulate: add atomic, compare-and-swap, and PAC load Lucas Amaral
2026-03-15 3:41 ` [PATCH v3 6/6] target/arm/hvf, whpx: wire ISV=0 emulation for data aborts Lucas Amaral
2026-03-16 2:50 ` [PATCH v4 0/6] target/arm: ISV=0 data abort emulation library Lucas Amaral
2026-03-16 2:50 ` [PATCH v4 1/6] target/arm/emulate: add ISV=0 emulation library with load/store immediate Lucas Amaral
2026-03-19 22:00 ` Richard Henderson
2026-03-16 2:50 ` [PATCH v4 2/6] target/arm/emulate: add load/store register offset Lucas Amaral
2026-03-16 2:50 ` [PATCH v4 3/6] target/arm/emulate: add load/store pair Lucas Amaral
2026-03-16 2:50 ` [PATCH v4 4/6] target/arm/emulate: add load/store exclusive Lucas Amaral
2026-03-16 2:50 ` [PATCH v4 5/6] target/arm/emulate: add atomic, compare-and-swap, and PAC load Lucas Amaral
2026-03-16 2:50 ` [PATCH v4 6/6] target/arm/hvf, whpx: wire ISV=0 emulation for data aborts Lucas Amaral
2026-03-17 14:27 ` [PATCH v4 0/6] target/arm: ISV=0 data abort emulation library Alex Bennée
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260313021850.42379-1-lucaaamaral@gmail.com \
--to=lucaaamaral@gmail.com \
--cc=agraf@csgraf.de \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.