ACPI: x86: Adjust Microsoft LPS0 _DSM handling sequence
PATCH 1/1 ACPI: x86: Adjust Microsoft LPS0 _DSM handling sequence
In Windows the Microsoft _DSM doesn't call functions 3->5->7 for suspend and 8->6->4 for resume like Linux currently does.
Rather it calls 3->7->5 for suspend and 6->8->4 for resume. Align this calling order for Linux as well.
--- drivers/acpi/x86/s2idle.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/acpi/x86/s2idle.c +7 -7
@@ -485,11 +485,11 @@ int acpi_s2idle_prepare_late(void)ACPI_LPS0_ENTRY , lps0_dsm_func_mask, lps0_dsm_guid);if (lps0_dsm_func_mask_microsoft >0 ) { -acpi_sleep_run_lps0_dsm (ACPI_LPS0_ENTRY , - lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);/* modern standby entry */ acpi_sleep_run_lps0_dsm (ACPI_LPS0_MS_ENTRY , lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); +acpi_sleep_run_lps0_dsm (ACPI_LPS0_ENTRY , + lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); }list_for_each_entry (handler, &lps0_s2idle_devops_head, list_node) {
@@ -524,11 +524,6 @@ void acpi_s2idle_restore_early(void)if (handler->restore) handler->restore (); -/* Modern standby exit */ -if (lps0_dsm_func_mask_microsoft >0 ) -acpi_sleep_run_lps0_dsm (ACPI_LPS0_MS_EXIT , - lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); -/* LPS0 exit */ if (lps0_dsm_func_mask >0 ) acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?
@@ -539,6 +534,11 @@ void acpi_s2idle_restore_early(void)acpi_sleep_run_lps0_dsm (ACPI_LPS0_EXIT , lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); +/* Modern standby exit */ +if (lps0_dsm_func_mask_microsoft >0 ) +acpi_sleep_run_lps0_dsm (ACPI_LPS0_MS_EXIT , + lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); +/* Screen on */ if (lps0_dsm_func_mask_microsoft >0 ) acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON,
Signature · 1 line
2.34.1
Quoted 8 lines · Mario Limonciello
In Windows the Microsoft
_DSMdoesn't call functions 3->5->7 for suspend and 8->6->4 for resume like Linux currently does.Rather it calls 3->7->5 for suspend and 6->8->4 for resume. Align this calling order for Linux as well.
Link:
https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/modern-standby-states
I didn't catch the ordering in the link. Was there any issue that prompted this change?
David
Quoted 53 lines
Signed-off-by Mario Limonciello <[email protected]>---
drivers/acpi/x86/s2idle.c | 14 +++++++-------1 file changed, 7 insertions(+), 7 deletions(-)drivers/acpi/x86/s2idle.c +2
-2@@ -485,11 +485,11 @@ int acpi_s2idle_prepare_late(void) ACPI_LPS0_ENTRY, lps0_dsm_func_mask, lps0_dsm_guid); if (lps0_dsm_func_mask_microsoft > 0) { - acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY, - lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); /* modern standby entry */ acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_ENTRY, lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); + acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY, + lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);}
list_for_each_entry(handler,&lps0_s2idle_devops_head,list_node) {drivers/acpi/x86/s2idle.c +0
-0@@ -524,11 +524,6 @@ void acpi_s2idle_restore_early(void) if (handler->restore) handler->restore();
- /* Modern standby exit */
- if (lps0_dsm_func_mask_microsoft> 0)
- acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_EXIT, - lps0_dsm_func_mask_microsoft,lps0_dsm_guid_microsoft);
-
/* LPS0 exit */
if (lps0_dsm_func_mask> 0) acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?drivers/acpi/x86/s2idle.c +0
-0@@ -539,6 +534,11 @@ void acpi_s2idle_restore_early(void) acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT, lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
+ /* Modern standby exit */
+ if (lps0_dsm_func_mask_microsoft> 0)
+ acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_EXIT, + lps0_dsm_func_mask_microsoft,lps0_dsm_guid_microsoft);
+
/* Screen on */
if (lps0_dsm_func_mask_microsoft> 0) acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON,
Quoted 10 lines · David E. Box
Quoted 8 lines · Mario Limonciello
In Windows the Microsoft
_DSMdoesn't call functions 3->5->7 for suspend and 8->6->4 for resume like Linux currently does.Rather it calls 3->7->5 for suspend and 6->8->4 for resume. Align this calling order for Linux as well.
Link:
https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/modern-standby-statesI didn't catch the ordering in the link.
Yeah it's tough to interpret from the link, because the picture at the bottom is missing annotations.
Basically if you look at the picture the blue part is the screen on/off.
The green part is "modern standby" and then the little "humps" are LPS0 enter/exit.
Quoted 2 lines
Was there any issue that prompted this
change?
We were debugging an unrelated problem and noticed the difference comparing the
BIOS debugging log from Windows and Linux.
If an OEM depends on this call order in that code used in LPS0 phase requires changes from MS phase I could hypothesize this fixes it.
Quoted 1 line
David
BTW - is there interest in supporting the Microsoft _DSM GUID for Intel side too?
It's an incongruity today that we run both AMD GUID and Microsoft GUID for AMD systems but only run Intel GUID for Intel systems.
Quoted 54 lines
Quoted 54 lines
Signed-off-by Mario Limonciello <[email protected]>--- drivers/acpi/x86/s2idle.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)drivers/acpi/x86/s2idle.c +2
-2@@ -485,11 +485,11 @@ int acpi_s2idle_prepare_late(void) ACPI_LPS0_ENTRY, lps0_dsm_func_mask, lps0_dsm_guid); if (lps0_dsm_func_mask_microsoft > 0) { - acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY, - lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); /* modern standby entry */ acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_ENTRY, lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); + acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY, + lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);}
list_for_each_entry(handler,
&lps0_s2idle_devops_head,list_node) {drivers/acpi/x86/s2idle.c +0
-5@@ -524,11 +524,6 @@ void acpi_s2idle_restore_early(void) if (handler->restore) handler->restore(); - /* Modern standby exit */ - if (lps0_dsm_func_mask_microsoft > 0) - acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_EXIT, - lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); - /* LPS0 exit */ if (lps0_dsm_func_mask > 0)acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?
drivers/acpi/x86/s2idle.c +5
-0@@ -539,6 +534,11 @@ void acpi_s2idle_restore_early(void) acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT, lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); + /* Modern standby exit */ + if (lps0_dsm_func_mask_microsoft > 0) + acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_EXIT, + lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); + /* Screen on */if (
lps0_dsm_func_mask_microsoft> 0) acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON,
Quoted 36 lines · Mario
Quoted 10 lines · David E. Box
Quoted 8 lines · Mario Limonciello
In Windows the Microsoft
_DSMdoesn't call functions 3->5->7 for suspend and 8->6->4 for resume like Linux currently does.Rather it calls 3->7->5 for suspend and 6->8->4 for resume. Align this calling order for Linux as well.
Link:
https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/modern-standby-statesI didn't catch the ordering in the link.
Yeah it's tough to interpret from the link, because the picture at the bottom
is missing annotations.Basically if you look at the picture the blue part is the screen on/off.
The green part is "modern standby" and then the little "humps" are LPS0 enter/exit.
Quoted 2 lines
Was there any issue that prompted this
change?We were debugging an unrelated problem and noticed the difference comparing the
BIOS debugging log from Windows and Linux.
If an OEM depends on this call order in that code used in LPS0 phase requires
changes from MS phase I could hypothesize this fixes it.
Quoted 8 lines
Quoted 1 line
David
BTW - is there interest in supporting the Microsoft
_DSMGUID for Intel side too?It's an incongruity today that we run both AMD GUID and Microsoft GUID for AMD systems
but only run Intel GUID for Intel systems.
There hasn't been a need yet. Rafael have you look at it?
David
Quoted 57 lines
Quoted 57 lines
Quoted 57 lines
Signed-off-by Mario Limonciello <[email protected]>---
drivers/acpi/x86/s2idle.c | 14 +++++++-------1 file changed, 7 insertions(+), 7 deletions(-)drivers/acpi/x86/s2idle.c +2
-2@@ -485,11 +485,11 @@ int acpi_s2idle_prepare_late(void) ACPI_LPS0_ENTRY, lps0_dsm_func_mask, lps0_dsm_guid); if (lps0_dsm_func_mask_microsoft > 0) { - acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY, - lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); /* modern standby entry */ acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_ENTRY, lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); + acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY, + lps0_dsm_func_mask_microsoft,
lps0_dsm_guid_microsoft);
}
list_for_each_entry(handler,&lps0_s2idle_devops_head,list_node) {drivers/acpi/x86/s2idle.c +0
-0@@ -524,11 +524,6 @@ void acpi_s2idle_restore_early(void) if (handler->restore) handler->restore();
- /* Modern standby exit */
- if (lps0_dsm_func_mask_microsoft> 0)
- acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_EXIT, - lps0_dsm_func_mask_microsoft,lps0_dsm_guid_microsoft);
-
/* LPS0 exit */
if (lps0_dsm_func_mask> 0) acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?drivers/acpi/x86/s2idle.c +0
-0@@ -539,6 +534,11 @@ void acpi_s2idle_restore_early(void) acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT, lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
+ /* Modern standby exit */
+ if (lps0_dsm_func_mask_microsoft> 0)
+ acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_EXIT, + lps0_dsm_func_mask_microsoft,lps0_dsm_guid_microsoft);
+
/* Screen on */
if (lps0_dsm_func_mask_microsoft> 0) acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON,
Quoted 38 lines · David E. Box
Quoted 37 lines · Mario
Quoted 10 lines · David E. Box
Quoted 8 lines · Mario Limonciello
In Windows the Microsoft
_DSMdoesn't call functions 3->5->7 for suspend and 8->6->4 for resume like Linux currently does.Rather it calls 3->7->5 for suspend and 6->8->4 for resume. Align this calling order for Linux as well.
Link:
https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/modern-standby-statesI didn't catch the ordering in the link.
Yeah it's tough to interpret from the link, because the picture at the bottom
is missing annotations.Basically if you look at the picture the blue part is the screen on/off.
The green part is "modern standby" and then the little "humps" are LPS0 enter/exit.
Quoted 2 lines
Was there any issue that prompted this
change?We were debugging an unrelated problem and noticed the difference comparing the
BIOS debugging log from Windows and Linux.
If an OEM depends on this call order in that code used in LPS0 phase requires
changes from MS phase I could hypothesize this fixes it.Quoted 1 line
David
BTW - is there interest in supporting the Microsoft
_DSMGUID for Intel side too?
Quoted 6 lines
Quoted 3 lines
It's an incongruity today that we run both AMD GUID and Microsoft GUID for AMD systems
but only run Intel GUID for Intel systems.There hasn't been a need yet. Rafael have you look at it?
David
AFAICT from Linux side it should be a one line patch to drop:
lps0_dsm_func_mask_microsoft = -EINVAL;
Quoted 55 lines
Quoted 55 lines
Quoted 55 lines
Quoted 55 lines
Signed-off-by Mario Limonciello <[email protected]>--- drivers/acpi/x86/s2idle.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)drivers/acpi/x86/s2idle.c +2
-2@@ -485,11 +485,11 @@ int acpi_s2idle_prepare_late(void) ACPI_LPS0_ENTRY, lps0_dsm_func_mask, lps0_dsm_guid); if (lps0_dsm_func_mask_microsoft > 0) { - acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY, - lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); /* modern standby entry */ acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_ENTRY, lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); + acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY, + lps0_dsm_func_mask_microsoft,
lps0_dsm_guid_microsoft);
}list_for_each_entry(handler,
&lps0_s2idle_devops_head,list_node)
{drivers/acpi/x86/s2idle.c +0
-5@@ -524,11 +524,6 @@ void acpi_s2idle_restore_early(void) if (handler->restore) handler->restore(); - /* Modern standby exit */ - if (lps0_dsm_func_mask_microsoft > 0) - acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_EXIT, - lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); - /* LPS0 exit */ if (lps0_dsm_func_mask > 0)acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?
drivers/acpi/x86/s2idle.c +5
-0@@ -539,6 +534,11 @@ void acpi_s2idle_restore_early(void) acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT, lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); + /* Modern standby exit */ + if (lps0_dsm_func_mask_microsoft > 0) + acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_EXIT, + lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); + /* Screen on */if (
lps0_dsm_func_mask_microsoft> 0) acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON,
Rafael J. Wysocki
maintainerQuoted 40 lines · David E. Box
Quoted 38 lines · Mario
Quoted 10 lines · David E. Box
Quoted 8 lines · Mario Limonciello
In Windows the Microsoft
_DSMdoesn't call functions 3->5->7 for suspend and 8->6->4 for resume like Linux currently does.Rather it calls 3->7->5 for suspend and 6->8->4 for resume. Align this calling order for Linux as well.
Link:
https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/modern-standby-statesI didn't catch the ordering in the link.
Yeah it's tough to interpret from the link, because the picture at the bottom
is missing annotations.Basically if you look at the picture the blue part is the screen on/off.
The green part is "modern standby" and then the little "humps" are LPS0 enter/exit.
Quoted 2 lines
Was there any issue that prompted this
change?We were debugging an unrelated problem and noticed the difference comparing the
BIOS debugging log from Windows and Linux.
If an OEM depends on this call order in that code used in LPS0 phase requires
changes from MS phase I could hypothesize this fixes it.Quoted 1 line
David
Quoted 8 lines
Quoted 6 lines
BTW - is there interest in supporting the Microsoft
_DSMGUID for Intel side too?It's an incongruity today that we run both AMD GUID and Microsoft GUID for AMD systems
but only run Intel GUID for Intel systems.There hasn't been a need yet. Rafael have you look at it?
Nothing official ATM AFAICS.
But I guess it'll need to be used on Intel at one point too.
Quoted 46 lines · Mario Limonciello
In Windows the Microsoft
_DSMdoesn't call functions 3->5->7 for suspend and 8->6->4 for resume like Linux currently does.Rather it calls 3->7->5 for suspend and 6->8->4 for resume. Align this calling order for Linux as well.
Link https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/modern-standby-statesSigned-off-by Mario Limonciello <[email protected]>--- drivers/acpi/x86/s2idle.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)drivers/acpi/x86/s2idle.c +2
-7@@ -485,11 +485,11 @@ int acpi_s2idle_prepare_late(void)ACPI_LPS0_ENTRY , lps0_dsm_func_mask, lps0_dsm_guid);if (lps0_dsm_func_mask_microsoft >0 ) { -acpi_sleep_run_lps0_dsm (ACPI_LPS0_ENTRY , - lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);/* modern standby entry */ acpi_sleep_run_lps0_dsm (ACPI_LPS0_MS_ENTRY , lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); +acpi_sleep_run_lps0_dsm (ACPI_LPS0_ENTRY , + lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); }list_for_each_entry (handler, &lps0_s2idle_devops_head, list_node) {@@ -524,11 +524,6 @@ void acpi_s2idle_restore_early(void)if (handler->restore) handler->restore (); -/* Modern standby exit */ -if (lps0_dsm_func_mask_microsoft >0 ) -acpi_sleep_run_lps0_dsm (ACPI_LPS0_MS_EXIT , - lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); -/* LPS0 exit */ if (lps0_dsm_func_mask >0 ) acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?@@ -539,6 +534,11 @@ void acpi_s2idle_restore_early(void)acpi_sleep_run_lps0_dsm (ACPI_LPS0_EXIT , lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
drivers/acpi/x86/s2idle.c void acpi_s2idle_restore_early(void)
Quoted 10 lines
drivers/acpi/x86/s2idle.c +5
-1+/* Modern standby exit */ +if (lps0_dsm_func_mask_microsoft >0 ) +acpi_sleep_run_lps0_dsm (ACPI_LPS0_MS_EXIT , + lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); +/* Screen on */ if (lps0_dsm_func_mask_microsoft >0 ) acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON, --
Applied as 6.5 material, thanks!