Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Upton <oupton@google.com>
To: kvmarm@lists.cs.columbia.edu
Cc: kvm@vger.kernel.org, Marc Zyngier <maz@kernel.org>,
	James Morse <james.morse@arm.com>,
	 Alexandru Elisei <alexandru.elisei@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	 linux-arm-kernel@lists.infradead.org,
	Peter Shier <pshier@google.com>,
	 Ricardo Koller <ricarkol@google.com>,
	Reiji Watanabe <reijiw@google.com>, Will Deacon <will@kernel.org>,
	 Julien Thierry <julien.thierry.kdev@gmail.com>,
	Oliver Upton <oupton@google.com>
Subject: [RFC PATCH kvmtool 0/5] ARM: Implement PSCI SYSTEM_SUSPEND
Date: Fri, 11 Mar 2022 17:57:12 +0000	[thread overview]
Message-ID: <20220311175717.616958-1-oupton@google.com> (raw)
In-Reply-To: <20220311174001.605719-1-oupton@google.com>

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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

       reply	other threads:[~2022-03-11 17:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220311174001.605719-1-oupton@google.com>
2022-03-11 17:57 ` Oliver Upton [this message]
2022-03-11 17:57   ` [RFC PATCH kvmtool 1/5] TESTONLY: Sync KVM headers with pending changes Oliver Upton
2022-03-11 17:57   ` [RFC PATCH kvmtool 2/5] Allow architectures to hook KVM_EXIT_SYSTEM_EVENT Oliver Upton
2022-03-11 17:57   ` [RFC PATCH kvmtool 3/5] ARM: Stash vcpu_init in the vCPU structure Oliver Upton
2022-03-11 17:57   ` [RFC PATCH kvmtool 4/5] ARM: Add a helper to re-init a vCPU Oliver Upton
2022-03-11 17:57   ` [RFC PATCH kvmtool 5/5] ARM: Implement PSCI SYSTEM_SUSPEND Oliver Upton
2022-05-06 13:01   ` [RFC PATCH kvmtool 0/5] " Will Deacon
2022-05-06 19:18     ` Oliver Upton

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=20220311175717.616958-1-oupton@google.com \
    --to=oupton@google.com \
    --cc=alexandru.elisei@arm.com \
    --cc=james.morse@arm.com \
    --cc=julien.thierry.kdev@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maz@kernel.org \
    --cc=pshier@google.com \
    --cc=reijiw@google.com \
    --cc=ricarkol@google.com \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox