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/[email protected]/
[2] https://patchwork.kernel.org/project/linux-pm/patch/[email protected]/
[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
[Public]
> -----Original Message-----
> From: Grzegorz Jaszczyk <[email protected]>
> Sent: Thursday, July 7, 2022 07:53
> To: [email protected]
> Cc: [email protected]; [email protected]; Limonciello, Mario
> <[email protected]>; [email protected]; [email protected];
> [email protected]; [email protected]; Rafael J.
> Wysocki <[email protected]>; Len Brown <[email protected]>; Hans de Goede
> <[email protected]>; Mark Gross <[email protected]>; Pavel Machek
> <[email protected]>; Mika Westerberg <[email protected]>; Sachi
> King <[email protected]>; open list:ACPI <[email protected]>; open
> list:X86 PLATFORM DRIVERS <[email protected]>; open
> list:HIBERNATION (aka Software Suspend, aka swsusp) <linux-
> [email protected]>
> Subject: [RFC PATCH 0/2] x86: allow to notify host about guest entering s2idle
>
> 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://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchw
> ork.kernel.org%2Fproject%2Flinux-pm%2Fpatch%2F20220609110337.1238762-
> 2-
> jaz%40semihalf.com%2F&data=05%7C01%7Cmario.limonciello%40amd.co
> m%7C514a545cf9aa4a7b6d9508da6018138b%7C3dd8961fe4884e608e11a82d9
> 94e183d%7C0%7C0%7C637927953769026163%7CUnknown%7CTWFpbGZsb3d8
> eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%
> 7C3000%7C%7C%7C&sdata=RIDiHUNpHUsBYyK3pwGND%2BWJoioXZNCKt
> mML2%2F1LAxs%3D&reserved=0
> [2]
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchw
> ork.kernel.org%2Fproject%2Flinux-pm%2Fpatch%2F20220609110337.1238762-
> 3-
> jaz%40semihalf.com%2F&data=05%7C01%7Cmario.limonciello%40amd.co
> m%7C514a545cf9aa4a7b6d9508da6018138b%7C3dd8961fe4884e608e11a82d9
> 94e183d%7C0%7C0%7C637927953769026163%7CUnknown%7CTWFpbGZsb3d8
> eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%
> 7C3000%7C%7C%7C&sdata=BqykAwWzO%2BfeGPSsAqTmX13O8F0Vvm3G
> PL56EpmdSJ8%3D&reserved=0
> [3]
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuefi.org
> %2FPNP_ACPI_Registry&data=05%7C01%7Cmario.limonciello%40amd.co
> m%7C514a545cf9aa4a7b6d9508da6018138b%7C3dd8961fe4884e608e11a82d9
> 94e183d%7C0%7C0%7C637927953769026163%7CUnknown%7CTWFpbGZsb3d8
> eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%
> 7C3000%7C%7C%7C&sdata=QXK52zFXJGEBm6xIv6IFeF7Xxgz4Yp5UmgLSQ
> diXtlI%3D&reserved=0
>
> 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
Thanks, you matched the implementation I was expecting.
This looks fine by me.
czw., 7 lip 2022 o 17:27 Limonciello, Mario
<[email protected]> napisaĆ(a):
>
> [Public]
>
>
>
> > -----Original Message-----
> > From: Grzegorz Jaszczyk <[email protected]>
> > Sent: Thursday, July 7, 2022 07:53
> > To: [email protected]
> > Cc: [email protected]; [email protected]; Limonciello, Mario
> > <[email protected]>; [email protected]; [email protected];
> > [email protected]; [email protected]; Rafael J.
> > Wysocki <[email protected]>; Len Brown <[email protected]>; Hans de Goede
> > <[email protected]>; Mark Gross <[email protected]>; Pavel Machek
> > <[email protected]>; Mika Westerberg <[email protected]>; Sachi
> > King <[email protected]>; open list:ACPI <[email protected]>; open
> > list:X86 PLATFORM DRIVERS <[email protected]>; open
> > list:HIBERNATION (aka Software Suspend, aka swsusp) <linux-
> > [email protected]>
> > Subject: [RFC PATCH 0/2] x86: allow to notify host about guest entering s2idle
> >
> > 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://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchw
> > ork.kernel.org%2Fproject%2Flinux-pm%2Fpatch%2F20220609110337.1238762-
> > 2-
> > jaz%40semihalf.com%2F&data=05%7C01%7Cmario.limonciello%40amd.co
> > m%7C514a545cf9aa4a7b6d9508da6018138b%7C3dd8961fe4884e608e11a82d9
> > 94e183d%7C0%7C0%7C637927953769026163%7CUnknown%7CTWFpbGZsb3d8
> > eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%
> > 7C3000%7C%7C%7C&sdata=RIDiHUNpHUsBYyK3pwGND%2BWJoioXZNCKt
> > mML2%2F1LAxs%3D&reserved=0
> > [2]
> > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchw
> > ork.kernel.org%2Fproject%2Flinux-pm%2Fpatch%2F20220609110337.1238762-
> > 3-
> > jaz%40semihalf.com%2F&data=05%7C01%7Cmario.limonciello%40amd.co
> > m%7C514a545cf9aa4a7b6d9508da6018138b%7C3dd8961fe4884e608e11a82d9
> > 94e183d%7C0%7C0%7C637927953769026163%7CUnknown%7CTWFpbGZsb3d8
> > eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%
> > 7C3000%7C%7C%7C&sdata=BqykAwWzO%2BfeGPSsAqTmX13O8F0Vvm3G
> > PL56EpmdSJ8%3D&reserved=0
> > [3]
> > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuefi.org
> > %2FPNP_ACPI_Registry&data=05%7C01%7Cmario.limonciello%40amd.co
> > m%7C514a545cf9aa4a7b6d9508da6018138b%7C3dd8961fe4884e608e11a82d9
> > 94e183d%7C0%7C0%7C637927953769026163%7CUnknown%7CTWFpbGZsb3d8
> > eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%
> > 7C3000%7C%7C%7C&sdata=QXK52zFXJGEBm6xIv6IFeF7Xxgz4Yp5UmgLSQ
> > diXtlI%3D&reserved=0
> >
> > 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
>
> Thanks, you matched the implementation I was expecting.
> This looks fine by me.
Thank you Mario.
Rafael, Sean, Hans - could you please kindly tell if this approach is
ok by you? If so I will want to start the registration process of ACPI
ID required for this series.
Previously Mario suggested that maybe Linux Foundation could own the
namespace and ID for this Virtual PMC device - could you please advise
in this matter?
Thank you in advance,
Grzegorz