2019-11-01 21:28:30

by Anchal Agarwal

[permalink] [raw]
Subject: [PATCH] ACPICA: Enable sleep button on ACPI legacy wake

Currently we do not see sleep_enable bit set after guest resumes
from hibernation. Hibernation is triggered in guest on receiving
a sleep trigger from the hypervisor(S4 state). We see that power
button is enabled on wake up from S4 state however sleep button
isn't. This causes subsequent invocation of sleep state to fail
in the guest. Any environment going through acpi_hw_legacy_wake()
won't have sleep button enabled.

Signed-off-by: Anchal Agarwal <[email protected]>
Reviewed-by: Balbir Singh <[email protected]>
Reviewed-by: Frank van der Linden <[email protected]>
---
drivers/acpi/acpica/hwsleep.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index b62db8ec446f..a176c7802760 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -300,6 +300,17 @@ acpi_status acpi_hw_legacy_wake(u8 sleep_state)
[ACPI_EVENT_POWER_BUTTON].
status_register_id, ACPI_CLEAR_STATUS);

+ /* Enable sleep button */
+ (void)
+ acpi_write_bit_register(acpi_gbl_fixed_event_info
+ [ACPI_EVENT_SLEEP_BUTTON].
+ enable_register_id, ACPI_ENABLE_EVENT);
+
+ (void)
+ acpi_write_bit_register(acpi_gbl_fixed_event_info
+ [ACPI_EVENT_SLEEP_BUTTON].
+ status_register_id, ACPI_CLEAR_STATUS);
+
acpi_hw_execute_sleep_method(METHOD_PATHNAME__SST, ACPI_SST_WORKING);
return_ACPI_STATUS(status);
}
--
2.15.3.AMZN


2019-11-01 22:42:19

by Miguel Ojeda

[permalink] [raw]
Subject: Re: [PATCH] ACPICA: Enable sleep button on ACPI legacy wake

On Fri, Nov 1, 2019 at 10:25 PM Anchal Agarwal <[email protected]> wrote:
>
> Currently we do not see sleep_enable bit set after guest resumes
> from hibernation. Hibernation is triggered in guest on receiving
> a sleep trigger from the hypervisor(S4 state). We see that power
> button is enabled on wake up from S4 state however sleep button
> isn't. This causes subsequent invocation of sleep state to fail
> in the guest. Any environment going through acpi_hw_legacy_wake()
> won't have sleep button enabled.
>
> Signed-off-by: Anchal Agarwal <[email protected]>
> Reviewed-by: Balbir Singh <[email protected]>
> Reviewed-by: Frank van der Linden <[email protected]>

Somehow this does not have recipients listed, CC'ing lkml.

Cheers,
Miguel

2019-11-04 18:01:53

by Anchal Agarwal

[permalink] [raw]
Subject: Re: [PATCH] ACPICA: Enable sleep button on ACPI legacy wake

Apologies for resending it. Looks like it does not show in cc list it went to all mailing list however the thread do appear on lkml.
Thanks,
Anchal

+ Rafael, Bob

Also, is there a reason why this wasn't CC-ed to linux-acpi mailing list? It would be good to get feedback from there too..
I think I did to all the email id's generated from get_maintainer.pl. Ccing again
+ linux-acpi

Thanks,
Erik

> -----Original Message-----
> From: Anchal Agarwal <[email protected]>
> Sent: Monday, October 29, 2018 10:52 AM
> Subject: [PATCH] ACPICA: Enable sleep button on ACPI legacy wake
>
> Currently we do not see sleep_enable bit set after guest resumes from
> hibernation. Hibernation is triggered in guest on receiving a sleep trigger
> from the hypervisor(S4 state). We see that power button is enabled on wake
> up from S4 state however sleep button isn't. This causes subsequent
> invocation of sleep state to fail in the guest. Any environment going through
> acpi_hw_legacy_wake() won't have sleep button enabled.
>
> Signed-off-by: Anchal Agarwal <[email protected]>
> Reviewed-by: Balbir Singh <[email protected]>
> Reviewed-by: Frank van der Linden <[email protected]>
> ---
> drivers/acpi/acpica/hwsleep.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
> index b62db8ec446f..a176c7802760 100644
> --- a/drivers/acpi/acpica/hwsleep.c
> +++ b/drivers/acpi/acpica/hwsleep.c
> @@ -300,6 +300,17 @@ acpi_status acpi_hw_legacy_wake(u8 sleep_state)
> [ACPI_EVENT_POWER_BUTTON].
> status_register_id, ACPI_CLEAR_STATUS);
>
> + /* Enable sleep button */
> + (void)
> + acpi_write_bit_register(acpi_gbl_fixed_event_info
> + [ACPI_EVENT_SLEEP_BUTTON].
> + enable_register_id,
> ACPI_ENABLE_EVENT);
> +
> + (void)
> + acpi_write_bit_register(acpi_gbl_fixed_event_info
> + [ACPI_EVENT_SLEEP_BUTTON].
> + status_register_id, ACPI_CLEAR_STATUS);
> +
> acpi_hw_execute_sleep_method(METHOD_PATHNAME__SST,
> ACPI_SST_WORKING);
> return_ACPI_STATUS(status);
> }
> --
> 2.15.3.AMZN





2019-11-08 17:58:08

by Anchal Agarwal

[permalink] [raw]
Subject: Re: [PATCH] ACPICA: Enable sleep button on ACPI legacy wake

Gentle ping on this one.

--
Anchal

On Mon, Nov 04, 2019 at 09:58:16AM -0800, Agarwal, Anchal wrote:
> Apologies for resending it. Looks like it does not show in cc list it went to all mailing list however the thread do appear on lkml.
> Thanks,
> Anchal
> 
> + Rafael, Bob
>
> Also, is there a reason why this wasn't CC-ed to linux-acpi mailing list? It would be good to get feedback from there too..
> I think I did to all the email id's generated from get_maintainer.pl. Ccing again
> + linux-acpi
>
> Thanks,
> Erik
>
> > -----Original Message-----
> > From: Anchal Agarwal <[email protected]>
> > Sent: Monday, October 29, 2018 10:52 AM
> > Subject: [PATCH] ACPICA: Enable sleep button on ACPI legacy wake
> >
> > Currently we do not see sleep_enable bit set after guest resumes from
> > hibernation. Hibernation is triggered in guest on receiving a sleep trigger
> > from the hypervisor(S4 state). We see that power button is enabled on wake
> > up from S4 state however sleep button isn't. This causes subsequent
> > invocation of sleep state to fail in the guest. Any environment going through
> > acpi_hw_legacy_wake() won't have sleep button enabled.
> >
> > Signed-off-by: Anchal Agarwal <[email protected]>
> > Reviewed-by: Balbir Singh <[email protected]>
> > Reviewed-by: Frank van der Linden <[email protected]>
> > ---
> > drivers/acpi/acpica/hwsleep.c | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> > diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
> > index b62db8ec446f..a176c7802760 100644
> > --- a/drivers/acpi/acpica/hwsleep.c
> > +++ b/drivers/acpi/acpica/hwsleep.c
> > @@ -300,6 +300,17 @@ acpi_status acpi_hw_legacy_wake(u8 sleep_state)
> > [ACPI_EVENT_POWER_BUTTON].
> > status_register_id, ACPI_CLEAR_STATUS);
> >
> > + /* Enable sleep button */
> > + (void)
> > + acpi_write_bit_register(acpi_gbl_fixed_event_info
> > + [ACPI_EVENT_SLEEP_BUTTON].
> > + enable_register_id,
> > ACPI_ENABLE_EVENT);
> > +
> > + (void)
> > + acpi_write_bit_register(acpi_gbl_fixed_event_info
> > + [ACPI_EVENT_SLEEP_BUTTON].
> > + status_register_id, ACPI_CLEAR_STATUS);
> > +
> > acpi_hw_execute_sleep_method(METHOD_PATHNAME__SST,
> > ACPI_SST_WORKING);
> > return_ACPI_STATUS(status);
> > }
> > --
> > 2.15.3.AMZN
>
>
>
>
>