ata: ahci: Enable DEVSLP by default on x86 with SLP_S0
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Fri, 27 Jul 2018 20:47:03 +0000 (13:47 -0700)
committerTejun Heo <tj@kernel.org>
Mon, 30 Jul 2018 14:09:28 +0000 (07:09 -0700)
commitb1a9585cc396cac5a9e5a09b2721f3b8568e62d0
treeb0583c80ba70729d1d9c01719d0fa1ca2fad1fbf
parenta5ec5a7bfd1f28d1905499641c9f589be36808c1
ata: ahci: Enable DEVSLP by default on x86 with SLP_S0

One of the requirement for modern x86 system to enter lowest power mode
(SLP_S0) is SATA IP block to be off. This is true even during when
platform is suspended to idle and not only in opportunistic (runtime)
suspend.

Several of these system don't have traditional ACPI S3, so it is
important that they enter SLP_S0 state, to avoid draining battery even
during suspend. So it is important that out of the box Linux installation
reach this state.

SATA IP block doesn't get turned off till SATA is in DEVSLP mode. Here
user has to either use scsi-host sysfs or tools like powertop to set
the sata-host link_power_management_policy to min_power.

This change sets by default link power management policy to min_power
with partial (preferred) or slumber support on idle for some platforms.

To avoid regressions, the following conditions are used:
- User didn't override the policy from module parameter
- The kernel config is already set to use med_power_with_dipm or deeper
- System is a SLP_S0 capable using ACPI low power idle flag
This combination will make sure that systems are fairly recent and
since getting shipped with SLP_S0 support, the DEVSLP function
is already validated.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
drivers/ata/ahci.c