[RFC PATCH 0/2] x86: allow to notify host about guest entering s2idle

From: Grzegorz Jaszczyk
Date: Thu Jul 07 2022 - 08:57:06 EST


According to the mailing list discussion [1] about the preferred approach
for notifying hypervisor/VMM about guest entering s2idle state this RFC was
implemented.

Instead of original hypercall based approach, which involves KVM change [2]
and makes it hypervisor specific, implement different mechanism, which
takes advantage of MMIO/PIO trapping and makes it hypervisor independent.

Patch #1 extends S2Idle ops by new notify handler which will be invoked as
a very last command before system actually enters S2Idle states. It also
allows to register and use driver specific notification hook which is used
in patch #2.

Patch #2 introduces new driver for virtual PMC, which registers
acpi_s2idle_dev_ops's notify handler. Its implementation is based on an
ACPI _DSM evaluation, which in turn can perform MMIO access and allow to
trap and therefore notify the VMM about guest entering S2Idle state.

Please see individual patches and commit logs for more verbose description.

This patchset is marked as RFC since patch #2 implements driver for non
existing device "HYPE0001", which ACPI ID was not registered yet.
Furthermore the required registration process [3] will not be started
before getting positive feedback about this patchset.

[1] https://patchwork.kernel.org/project/linux-pm/patch/20220609110337.1238762-2-jaz@xxxxxxxxxxxx/
[2] https://patchwork.kernel.org/project/linux-pm/patch/20220609110337.1238762-3-jaz@xxxxxxxxxxxx/
[3] https://uefi.org/PNP_ACPI_Registry

Grzegorz Jaszczyk (2):
suspend: extend S2Idle ops by new notify handler
platform/x86: Add virtual PMC driver used for S2Idle

drivers/acpi/x86/s2idle.c | 11 +++++
drivers/platform/x86/Kconfig | 7 ++++
drivers/platform/x86/Makefile | 1 +
drivers/platform/x86/virt_pmc.c | 73 +++++++++++++++++++++++++++++++++
include/linux/acpi.h | 1 +
include/linux/suspend.h | 1 +
kernel/power/suspend.c | 4 ++
7 files changed, 98 insertions(+)
create mode 100644 drivers/platform/x86/virt_pmc.c

--
2.37.0.rc0.161.g10f37bed90-goog