* [PATCH v2] ata: ahci: Do not check ACPI_FADT_LOW_POWER_S0
@ 2022-08-25 18:01 Rafael J. Wysocki
2022-08-25 18:16 ` Limonciello, Mario
0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2022-08-25 18:01 UTC (permalink / raw)
To: Damien Le Moal; +Cc: linux-ide, Linux ACPI, LKML, Mario Limonciello
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
The ACPI_FADT_LOW_POWER_S0 flag merely means that it is better to
use low-power S0 idle on the given platform than S3 (provided that
the latter is supported) and it doesn't preclude using either of
them (which of them will be used depends on the choices made by user
space).
For this reason, there is no benefit from checking that flag in
ahci_update_initial_lpm_policy().
First off, it cannot be a bug to do S3 with policy set to either
ATA_LPM_MIN_POWER_WITH_PARTIAL or ATA_LPM_MIN_POWER, because S3 can be
used on systems with ACPI_FADT_LOW_POWER_S0 set and it must work if
really supported, so the ACPI_FADT_LOW_POWER_S0 check is not needed to
protect the S3-capable systems from failing.
Second, suspend-to-idle can be carried out on a system with
ACPI_FADT_LOW_POWER_S0 unset and it is expected to work, so if setting
policy to either ATA_LPM_MIN_POWER_WITH_PARTIAL or ATA_LPM_MIN_POWER is
needed to handle that case correctly, it should be done regardless of
the ACPI_FADT_LOW_POWER_S0 value.
Accordingly, drop the ACPI_FADT_LOW_POWER_S0 check from
ahci_update_initial_lpm_policy() along with the CONFIG_ACPI #ifdef
around it that is not necessary any more.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
v1 -> v2:
* Adjust subject (Damien).
* Drop #ifdef CONFIG_ACPI that is not necessary any more (Mario).
* Update the changelog.
---
drivers/ata/ahci.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
Index: linux-pm/drivers/ata/ahci.c
===================================================================
--- linux-pm.orig/drivers/ata/ahci.c
+++ linux-pm/drivers/ata/ahci.c
@@ -1609,15 +1609,12 @@ static void ahci_update_initial_lpm_poli
goto update_policy;
}
-#ifdef CONFIG_ACPI
- if (policy > ATA_LPM_MED_POWER &&
- (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) {
+ if (policy > ATA_LPM_MED_POWER) {
if (hpriv->cap & HOST_CAP_PART)
policy = ATA_LPM_MIN_POWER_WITH_PARTIAL;
else if (hpriv->cap & HOST_CAP_SSC)
policy = ATA_LPM_MIN_POWER;
}
-#endif
update_policy:
if (policy >= ATA_LPM_UNKNOWN && policy <= ATA_LPM_MIN_POWER)
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2] ata: ahci: Do not check ACPI_FADT_LOW_POWER_S0
2022-08-25 18:01 [PATCH v2] ata: ahci: Do not check ACPI_FADT_LOW_POWER_S0 Rafael J. Wysocki
@ 2022-08-25 18:16 ` Limonciello, Mario
2022-08-25 18:26 ` Rafael J. Wysocki
0 siblings, 1 reply; 5+ messages in thread
From: Limonciello, Mario @ 2022-08-25 18:16 UTC (permalink / raw)
To: Rafael J. Wysocki, Damien Le Moal; +Cc: linux-ide, Linux ACPI, LKML
On 8/25/2022 13:01, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> The ACPI_FADT_LOW_POWER_S0 flag merely means that it is better to
> use low-power S0 idle on the given platform than S3 (provided that
> the latter is supported) and it doesn't preclude using either of
> them (which of them will be used depends on the choices made by user
> space).
>
> For this reason, there is no benefit from checking that flag in
> ahci_update_initial_lpm_policy().
>
> First off, it cannot be a bug to do S3 with policy set to either
> ATA_LPM_MIN_POWER_WITH_PARTIAL or ATA_LPM_MIN_POWER, because S3 can be
> used on systems with ACPI_FADT_LOW_POWER_S0 set and it must work if
> really supported, so the ACPI_FADT_LOW_POWER_S0 check is not needed to
> protect the S3-capable systems from failing.
>
> Second, suspend-to-idle can be carried out on a system with
> ACPI_FADT_LOW_POWER_S0 unset and it is expected to work, so if setting
> policy to either ATA_LPM_MIN_POWER_WITH_PARTIAL or ATA_LPM_MIN_POWER is
> needed to handle that case correctly, it should be done regardless of
> the ACPI_FADT_LOW_POWER_S0 value.
>
> Accordingly, drop the ACPI_FADT_LOW_POWER_S0 check from
> ahci_update_initial_lpm_policy() along with the CONFIG_ACPI #ifdef
> around it that is not necessary any more.
Looking at the source commit for this behavior:
b1a9585cc396 ("ata: ahci: Enable DEVSLP by default on x86 with SLP_S0")
It was trying to set a policy tied to when the system is defaulting to
suspend to idle.
To try to match the spirit of the original request but not tying it to
the FADT, how about using pm_suspend_default_s2idle()?
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>
> v1 -> v2:
> * Adjust subject (Damien).
> * Drop #ifdef CONFIG_ACPI that is not necessary any more (Mario).
> * Update the changelog.
>
> ---
> drivers/ata/ahci.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> Index: linux-pm/drivers/ata/ahci.c
> ===================================================================
> --- linux-pm.orig/drivers/ata/ahci.c
> +++ linux-pm/drivers/ata/ahci.c
> @@ -1609,15 +1609,12 @@ static void ahci_update_initial_lpm_poli
> goto update_policy;
> }
>
> -#ifdef CONFIG_ACPI
> - if (policy > ATA_LPM_MED_POWER &&
> - (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) {
> + if (policy > ATA_LPM_MED_POWER) {
> if (hpriv->cap & HOST_CAP_PART)
> policy = ATA_LPM_MIN_POWER_WITH_PARTIAL;
> else if (hpriv->cap & HOST_CAP_SSC)
> policy = ATA_LPM_MIN_POWER;
> }
> -#endif
>
> update_policy:
> if (policy >= ATA_LPM_UNKNOWN && policy <= ATA_LPM_MIN_POWER)
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2] ata: ahci: Do not check ACPI_FADT_LOW_POWER_S0
2022-08-25 18:16 ` Limonciello, Mario
@ 2022-08-25 18:26 ` Rafael J. Wysocki
2022-08-25 18:29 ` Limonciello, Mario
0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2022-08-25 18:26 UTC (permalink / raw)
To: Limonciello, Mario
Cc: Rafael J. Wysocki, Damien Le Moal,
open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers),
Linux ACPI, LKML
On Thu, Aug 25, 2022 at 8:17 PM Limonciello, Mario
<mario.limonciello@amd.com> wrote:
>
> On 8/25/2022 13:01, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > The ACPI_FADT_LOW_POWER_S0 flag merely means that it is better to
> > use low-power S0 idle on the given platform than S3 (provided that
> > the latter is supported) and it doesn't preclude using either of
> > them (which of them will be used depends on the choices made by user
> > space).
> >
> > For this reason, there is no benefit from checking that flag in
> > ahci_update_initial_lpm_policy().
> >
> > First off, it cannot be a bug to do S3 with policy set to either
> > ATA_LPM_MIN_POWER_WITH_PARTIAL or ATA_LPM_MIN_POWER, because S3 can be
> > used on systems with ACPI_FADT_LOW_POWER_S0 set and it must work if
> > really supported, so the ACPI_FADT_LOW_POWER_S0 check is not needed to
> > protect the S3-capable systems from failing.
> >
> > Second, suspend-to-idle can be carried out on a system with
> > ACPI_FADT_LOW_POWER_S0 unset and it is expected to work, so if setting
> > policy to either ATA_LPM_MIN_POWER_WITH_PARTIAL or ATA_LPM_MIN_POWER is
> > needed to handle that case correctly, it should be done regardless of
> > the ACPI_FADT_LOW_POWER_S0 value.
> >
> > Accordingly, drop the ACPI_FADT_LOW_POWER_S0 check from
> > ahci_update_initial_lpm_policy() along with the CONFIG_ACPI #ifdef
> > around it that is not necessary any more.
>
> Looking at the source commit for this behavior:
>
> b1a9585cc396 ("ata: ahci: Enable DEVSLP by default on x86 with SLP_S0")
>
> It was trying to set a policy tied to when the system is defaulting to
> suspend to idle.
>
> To try to match the spirit of the original request but not tying it to
> the FADT, how about using pm_suspend_default_s2idle()?
The user can switch to "default S3" later anyway, so this wouldn't
help more than the check being dropped.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2] ata: ahci: Do not check ACPI_FADT_LOW_POWER_S0
2022-08-25 18:26 ` Rafael J. Wysocki
@ 2022-08-25 18:29 ` Limonciello, Mario
2022-08-25 18:36 ` Rafael J. Wysocki
0 siblings, 1 reply; 5+ messages in thread
From: Limonciello, Mario @ 2022-08-25 18:29 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Rafael J. Wysocki, Damien Le Moal,
open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers),
Linux ACPI, LKML
On 8/25/2022 13:26, Rafael J. Wysocki wrote:
> On Thu, Aug 25, 2022 at 8:17 PM Limonciello, Mario
> <mario.limonciello@amd.com> wrote:
>>
>> On 8/25/2022 13:01, Rafael J. Wysocki wrote:
>>> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>>
>>> The ACPI_FADT_LOW_POWER_S0 flag merely means that it is better to
>>> use low-power S0 idle on the given platform than S3 (provided that
>>> the latter is supported) and it doesn't preclude using either of
>>> them (which of them will be used depends on the choices made by user
>>> space).
>>>
>>> For this reason, there is no benefit from checking that flag in
>>> ahci_update_initial_lpm_policy().
>>>
>>> First off, it cannot be a bug to do S3 with policy set to either
>>> ATA_LPM_MIN_POWER_WITH_PARTIAL or ATA_LPM_MIN_POWER, because S3 can be
>>> used on systems with ACPI_FADT_LOW_POWER_S0 set and it must work if
>>> really supported, so the ACPI_FADT_LOW_POWER_S0 check is not needed to
>>> protect the S3-capable systems from failing.
>>>
>>> Second, suspend-to-idle can be carried out on a system with
>>> ACPI_FADT_LOW_POWER_S0 unset and it is expected to work, so if setting
>>> policy to either ATA_LPM_MIN_POWER_WITH_PARTIAL or ATA_LPM_MIN_POWER is
>>> needed to handle that case correctly, it should be done regardless of
>>> the ACPI_FADT_LOW_POWER_S0 value.
>>>
>>> Accordingly, drop the ACPI_FADT_LOW_POWER_S0 check from
>>> ahci_update_initial_lpm_policy() along with the CONFIG_ACPI #ifdef
>>> around it that is not necessary any more.
>>
>> Looking at the source commit for this behavior:
>>
>> b1a9585cc396 ("ata: ahci: Enable DEVSLP by default on x86 with SLP_S0")
>>
>> It was trying to set a policy tied to when the system is defaulting to
>> suspend to idle.
>>
>> To try to match the spirit of the original request but not tying it to
>> the FADT, how about using pm_suspend_default_s2idle()?
>
> The user can switch to "default S3" later anyway, so this wouldn't
> help more than the check being dropped.
Right, they could also change LPM policy to different policy later too
if they want.
This is just for setting up default policy. I think if you matched to
only when pm_suspend_default_s2idle() it would be the least likelihood
to change this default policy on unsuspecting people upgrading.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2] ata: ahci: Do not check ACPI_FADT_LOW_POWER_S0
2022-08-25 18:29 ` Limonciello, Mario
@ 2022-08-25 18:36 ` Rafael J. Wysocki
0 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2022-08-25 18:36 UTC (permalink / raw)
To: Limonciello, Mario
Cc: Rafael J. Wysocki, Rafael J. Wysocki, Damien Le Moal,
open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers),
Linux ACPI, LKML
On Thu, Aug 25, 2022 at 8:29 PM Limonciello, Mario
<mario.limonciello@amd.com> wrote:
>
> On 8/25/2022 13:26, Rafael J. Wysocki wrote:
> > On Thu, Aug 25, 2022 at 8:17 PM Limonciello, Mario
> > <mario.limonciello@amd.com> wrote:
> >>
> >> On 8/25/2022 13:01, Rafael J. Wysocki wrote:
> >>> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >>>
> >>> The ACPI_FADT_LOW_POWER_S0 flag merely means that it is better to
> >>> use low-power S0 idle on the given platform than S3 (provided that
> >>> the latter is supported) and it doesn't preclude using either of
> >>> them (which of them will be used depends on the choices made by user
> >>> space).
> >>>
> >>> For this reason, there is no benefit from checking that flag in
> >>> ahci_update_initial_lpm_policy().
> >>>
> >>> First off, it cannot be a bug to do S3 with policy set to either
> >>> ATA_LPM_MIN_POWER_WITH_PARTIAL or ATA_LPM_MIN_POWER, because S3 can be
> >>> used on systems with ACPI_FADT_LOW_POWER_S0 set and it must work if
> >>> really supported, so the ACPI_FADT_LOW_POWER_S0 check is not needed to
> >>> protect the S3-capable systems from failing.
> >>>
> >>> Second, suspend-to-idle can be carried out on a system with
> >>> ACPI_FADT_LOW_POWER_S0 unset and it is expected to work, so if setting
> >>> policy to either ATA_LPM_MIN_POWER_WITH_PARTIAL or ATA_LPM_MIN_POWER is
> >>> needed to handle that case correctly, it should be done regardless of
> >>> the ACPI_FADT_LOW_POWER_S0 value.
> >>>
> >>> Accordingly, drop the ACPI_FADT_LOW_POWER_S0 check from
> >>> ahci_update_initial_lpm_policy() along with the CONFIG_ACPI #ifdef
> >>> around it that is not necessary any more.
> >>
> >> Looking at the source commit for this behavior:
> >>
> >> b1a9585cc396 ("ata: ahci: Enable DEVSLP by default on x86 with SLP_S0")
> >>
> >> It was trying to set a policy tied to when the system is defaulting to
> >> suspend to idle.
> >>
> >> To try to match the spirit of the original request but not tying it to
> >> the FADT, how about using pm_suspend_default_s2idle()?
> >
> > The user can switch to "default S3" later anyway, so this wouldn't
> > help more than the check being dropped.
>
> Right, they could also change LPM policy to different policy later too
> if they want.
Exactly.
> This is just for setting up default policy. I think if you matched to
> only when pm_suspend_default_s2idle() it would be the least likelihood
> to change this default policy on unsuspecting people upgrading.
The only case where it matters is systems doing S3 by default that
would end up enabling DEVSLP. Would that confuse the BIOSes on them?
Maybe, but I think that S3 with DEVSLP enabled is generally expected
to work.
Anyway, I'm not religious about this, so I'll send a v3.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-08-25 18:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-25 18:01 [PATCH v2] ata: ahci: Do not check ACPI_FADT_LOW_POWER_S0 Rafael J. Wysocki
2022-08-25 18:16 ` Limonciello, Mario
2022-08-25 18:26 ` Rafael J. Wysocki
2022-08-25 18:29 ` Limonciello, Mario
2022-08-25 18:36 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox