arm/hvf: Add a WFI handler
commit219c101fa7f9c528458cd6a491af371f01e20cba
authorPeter Collingbourne <pcc@google.com>
Thu, 16 Sep 2021 15:53:59 +0000 (16 17:53 +0200)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 21 Sep 2021 15:28:26 +0000 (21 16:28 +0100)
tree4a7910441e98bb2b8d17128f9a5561d61727cf0e
parenta1477da3ddeb1b76adb71af7b5c46a18120dc952
arm/hvf: Add a WFI handler

Sleep on WFI until the VTIMER is due but allow ourselves to be woken
up on IPI.

In this implementation IPI is blocked on the CPU thread at startup and
pselect() is used to atomically unblock the signal and begin sleeping.
The signal is sent unconditionally so there's no need to worry about
races between actually sleeping and the "we think we're sleeping"
state. It may lead to an extra wakeup but that's better than missing
it entirely.

Signed-off-by: Peter Collingbourne <pcc@google.com>
Signed-off-by: Alexander Graf <agraf@csgraf.de>
Acked-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Sergio Lopez <slp@redhat.com>
Message-id: 20210916155404.86958-6-agraf@csgraf.de
[agraf: Remove unused 'set' variable, always advance PC on WFX trap,
        support vm stop / continue operations and cntv offsets]
Signed-off-by: Alexander Graf <agraf@csgraf.de>
Acked-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Sergio Lopez <slp@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
accel/hvf/hvf-accel-ops.c
include/sysemu/hvf_int.h
target/arm/hvf/hvf.c