[RFC PATCH kvmtool 0/5] ARM: Implement PSCI SYSTEM_SUSPEND
Oliver Upton
oupton at google.com
Fri Mar 11 09:57:12 PST 2022
This is a prototype for supporting KVM_CAP_ARM_SYSTEM_SUSPEND on
kvmtool. The capability allows userspace to expose the SYSTEM_SUSPEND
PSCI call to its guests.
Implement SYSTEM_SUSPEND using KVM_MP_STATE_SUSPENDED, which emulates
the execution of a WFI instruction in the kernel. Resume the guest when
a wakeup event is recognized and reset it to the requested entry address
and context ID.
Patches 2-4 are small reworks to more easily shoehorn PSCI support into
kvmtool.
Patch 5 adds some SMCCC handlers and makes use of them to implement PSCI
SYSTEM_SUSPEND. For now, just check the bare-minimum, that all vCPUs
besides the caller have stopped. There are also checks that can be made
against the requested entry address, but they are at the discretion of
the implementation.
Tested with 'echo mem > /sys/power/state' to see that the vCPU is in
fact placed in a suspended state for the PSCI call. Hacked the switch
statement to fall through to WAKEUP immediately after to verify the vCPU
is set up correctly for resume.
It would be nice if kvmtool actually provided a device good for wakeups,
since the RTC implementation has omitted any interrupt support.
kernel changes: http://lore.kernel.org/r/20220311174001.605719-1-oupton@google.com
Oliver Upton (5):
TESTONLY: Sync KVM headers with pending changes
Allow architectures to hook KVM_EXIT_SYSTEM_EVENT
ARM: Stash vcpu_init in the vCPU structure
ARM: Add a helper to re-init a vCPU
ARM: Implement PSCI SYSTEM_SUSPEND
arm/aarch32/kvm-cpu.c | 72 ++++++++++++++++++++
arm/aarch64/kvm-cpu.c | 66 +++++++++++++++++++
arm/include/arm-common/kvm-cpu-arch.h | 23 ++++---
arm/kvm-cpu.c | 95 ++++++++++++++++++++++++++-
arm/kvm.c | 9 +++
include/kvm/kvm-cpu.h | 1 +
include/linux/kvm.h | 21 ++++++
kvm-cpu.c | 8 +++
8 files changed, 283 insertions(+), 12 deletions(-)
--
2.35.1.723.g4982287a31-goog
More information about the linux-arm-kernel
mailing list