[PATCH v2 00/31] target/arm: fully model WFxT instructions for A-profile

Alex Bennée posted 31 patches 1 month, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260422101043.1234229-1-alex.bennee@linaro.org
Maintainers: Peter Maydell <peter.maydell@linaro.org>, Alexander Graf <agraf@csgraf.de>, Paolo Bonzini <pbonzini@redhat.com>, Pedro Barbuda <pbarbuda@microsoft.com>, Mohamed Mediouni <mohamed@unpredictable.fr>
There is a newer version of this series
target/arm/cpu.h               |  27 ++
target/arm/internals.h         |  31 +-
target/arm/syndrome.h          | 595 +++++++++++++++++++++++++++------
target/arm/tcg/helper-defs.h   |   3 +-
target/arm/tcg/translate.h     |  32 ++
target/arm/tcg/a32.decode      |   5 +-
target/arm/tcg/a64.decode      |   5 +-
target/arm/tcg/t16.decode      |   4 +-
target/arm/tcg/t32.decode      |   4 +-
target/arm/arm-powerctl.c      |   4 +-
target/arm/cpu.c               |  53 ++-
target/arm/helper.c            |  12 +-
target/arm/hvf/hvf.c           |  14 +-
target/arm/kvm.c               |   5 +-
target/arm/machine.c           |   2 +-
target/arm/tcg/debug.c         |   2 +-
target/arm/tcg/op_helper.c     | 216 ++++++++++--
target/arm/tcg/tlb_helper.c    |   6 +-
target/arm/tcg/translate-a64.c |  58 +++-
target/arm/tcg/translate.c     |  33 +-
target/arm/tcg/vfp_helper.c    |   5 +-
target/arm/whpx/whpx-all.c     |  13 +-
22 files changed, 929 insertions(+), 200 deletions(-)
[PATCH v2 00/31] target/arm: fully model WFxT instructions for A-profile
Posted by Alex Bennée 1 month, 1 week ago
This series fully models the behaviour of WFxT instructions. We
already had support for WFE for M-profile but we left off A-profile as
it has more potential sources of wake-ups. The main one is the event
stream which includes events from significant bits of the timer
ticking over.

The series starts with some refactoring of the syndrome register
helpers to use registerfields. We then expand the WFIT trap handling
to report the register used. We then implement the event stream events
for SEV, global monitor and the timer related ones before enabling WFE
for A-profile and then finally WFET.

Note on AI usage. As an experiment I previously posted an RFC series
with the help of Gemini. This series however is a ground up
re-implementation which takes some different approaches on modelling
the event stream. In particular rather than running multiple timers we
use the same wxft timer and just compute if the timeout or timer event
will come first.

v2
  - I've kept the tests separate, see:

    Message-ID: <20260417164328.1009132-1-alex.bennee@linaro.org>
    Date: Fri, 17 Apr 2026 17:43:20 +0100
    Subject: [PATCH 0/7] tests/tcg: more capabilities for aarch64-softmmu tests
    From: =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>

  - tweaks to global monitor behaviour
  - STLR/STL will also trigger events to avoid deadlocks
  - see under the --- in the patches for details

Alex.

Alex Bennée (31):
  target/arm: migrate basic syndrome helpers to registerfields
  target/arm: migrate system/cp trap syndromes to registerfields
  target/arm: migrate FP/SIMD trap syndromes to registerfields
  target/arm: migrate eret trap syndromes to registerfields
  target/arm: migrate SME trap syndromes to registerfields
  target/arm: migrate PAC trap syndromes to registerfields
  target/arm: migrate BTI trap syndromes to registerfields
  target/arm: migrate BXJ trap syndromes to registerfields
  target/arm: migrate Granule Protection traps to registerfields
  target/arm: migrate fault syndromes to registerfields
  target/arm: migrate debug syndromes to registerfields
  target/arm: migrate wfx syndromes to registerfields
  target/arm: migrate gcs syndromes to registerfields
  target/arm: migrate memory op syndromes to registerfields
  target/arm: migrate check_hcr_el2_trap to use syndrome helper
  target/arm: use syndrome helpers in arm_cpu_do_interrupt_aarch32_hyp
  target/arm: use syndrome helpers to set SAME_EL EC bit
  target/arm: make whpx use syndrome helpers for decode
  target/arm: make hvf use syndrome helpers for decode
  target/arm: use syndrome helpers in merge_syn_data_abort
  target/arm: use syndrome helpers to query VNCR bit
  target/arm: remove old syndrome defines
  target/arm: report register in WFIT syndromes
  target/arm: teach arm_cpu_has_work about halting reasons
  target/arm: redefine event stream fields
  target/arm: ensure aarch64 DISAS_WFE will exit
  target/arm: implements SEV/SEVL for all modes
  target/arm: hoist event broadcast code into a helper
  target/arm: implement global monitor events
  target/arm: enable event stream on WFE instructions
  target/arm: implement WFET

 target/arm/cpu.h               |  27 ++
 target/arm/internals.h         |  31 +-
 target/arm/syndrome.h          | 595 +++++++++++++++++++++++++++------
 target/arm/tcg/helper-defs.h   |   3 +-
 target/arm/tcg/translate.h     |  32 ++
 target/arm/tcg/a32.decode      |   5 +-
 target/arm/tcg/a64.decode      |   5 +-
 target/arm/tcg/t16.decode      |   4 +-
 target/arm/tcg/t32.decode      |   4 +-
 target/arm/arm-powerctl.c      |   4 +-
 target/arm/cpu.c               |  53 ++-
 target/arm/helper.c            |  12 +-
 target/arm/hvf/hvf.c           |  14 +-
 target/arm/kvm.c               |   5 +-
 target/arm/machine.c           |   2 +-
 target/arm/tcg/debug.c         |   2 +-
 target/arm/tcg/op_helper.c     | 216 ++++++++++--
 target/arm/tcg/tlb_helper.c    |   6 +-
 target/arm/tcg/translate-a64.c |  58 +++-
 target/arm/tcg/translate.c     |  33 +-
 target/arm/tcg/vfp_helper.c    |   5 +-
 target/arm/whpx/whpx-all.c     |  13 +-
 22 files changed, 929 insertions(+), 200 deletions(-)

-- 
2.47.3


Re: [PATCH v2 00/31] target/arm: fully model WFxT instructions for A-profile
Posted by Alex Bennée 1 month, 1 week ago
Alex Bennée <alex.bennee@linaro.org> writes:

> This series fully models the behaviour of WFxT instructions. We
> already had support for WFE for M-profile but we left off A-profile as
> it has more potential sources of wake-ups. The main one is the event
> stream which includes events from significant bits of the timer
> ticking over.
>
<snip>
>   target/arm: enable event stream on WFE instructions
>   target/arm: implement WFET
<snip>

I've posted v3 to handle the missing WFE exception and fix a minor
syndrome bug on the WFET exception.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro