[RFC PATCH kvmtool 0/5] ARM: Implement PSCI SYSTEM_SUSPEND

Will Deacon will at kernel.org
Fri May 6 06:01:01 PDT 2022


On Fri, Mar 11, 2022 at 05:57:12PM +0000, Oliver Upton wrote:
> 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(-)

Looks like the kernel-side changes are queued now, so please can you resend
this series? I also think you can drop the AArch32 support, unless you see a
compelling reason for it?

Will



More information about the linux-arm-kernel mailing list