Re: [PATCH 1/2] x86: notify hypervisor about guest entering s2idle state

Limonciello, Mario
2022-06-16T16:58:54Z

On 6/16/2022 11:48, Sean Christopherson wrote:
> On Wed, Jun 15, 2022, Grzegorz Jaszczyk wrote:
>> pt., 10 cze 2022 o 16:30 Sean Christopherson <seanjc@google.com> napisał(a):
>>> MMIO or PIO for the actual exit, there's nothing special about hypercalls. As for
>>> enumerating to the guest that it should do something, why not add a new ACPI_LPS0_*
>>> function? E.g. something like
>>>
>>> static void s2idle_hypervisor_notify(void)
>>> {
>>> if (lps0_dsm_func_mask > 0)
>>> acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT_HYPERVISOR_NOTIFY
>>> lps0_dsm_func_mask, lps0_dsm_guid);
>>> }
>>
>> Great, thank you for your suggestion! I will try this approach and
>> come back. Since this will be the main change in the next version,
>> will it be ok for you to add Suggested-by: Sean Christopherson
>> <seanjc@google.com> tag?
>
> If you want, but there's certainly no need to do so. But I assume you or someone
> at Intel will need to get formal approval for adding another ACPI LPS0 function?
> I.e. isn't there work to be done outside of the kernel before any patches can be
> merged?

There are 3 different LPS0 GUIDs in use. An Intel one, an AMD (legacy)
one, and a Microsoft one. They all have their own specs, and so if this
was to be added I think all 3 need to be updated.

As this is Linux specific hypervisor behavior, I don't know you would be
able to convince Microsoft to update theirs' either.

How about using s2idle_devops? There is a prepare() call and a
restore() call that is set for each handler. The only consumer of this
ATM I'm aware of is the amd-pmc driver, but it's done like a
notification chain so that a bunch of drivers can hook in if they need to.

Then you can have this notification path and the associated ACPI device
it calls out to be it's own driver.