linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: linux-block@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>, Tejun Heo <tj@kernel.org>,
	James Bottomley <James.Bottomley@HansenPartnership.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org,
	linux-scsi@vger.kernel.org
Subject: [PATCH 0/7] Runtime PM support for AHCI host controller driver
Date: Thu, 18 Feb 2016 10:54:10 +0200	[thread overview]
Message-ID: <1455785657-22924-1-git-send-email-mika.westerberg@linux.intel.com> (raw)

Hi,

Linux already supports runtime PM of disks (drivers/scsi/sd.c) so that
after certain amount of idle time the disk is suspended automatically. This
series extends the support to AHCI host controllers. Whenever SATA ports
are determined to be idle (all children are runtime suspended) the host
controller is also suspended.

On recent Intel CPUs like Broxton this allows the CPU to go low power idle
states like S0ix runtime (given that all necessary blocks are also in their
correesponding low power states).

Patches [1-2/7] fix a lockup where disk is runtime suspended and the system
is put to sleep. They are independent of the rest of the series.

Patch [3/7] makes it possible for SATA ports to be runtime suspended when
there is not disk connected. For example on Lenovo Yoga 900 there are two
SATA ports which only one of them has disk connected. This patch allows the
host controller to runtime suspend whenever the disk is idle.

Rest of the patches bring runtime PM support for the AHCI driver. By
default runtime PM is blocked and needs to be unblocked from userspace
(following what other PCI drivers do). I've used following script to
unblock runtime PM for the whole stack (with 15 seconds of idle time):

------8<------8<------8<------8<------8<------8<------8<------
#!/bin/sh

TIMEOUT=${1:-15}
HOST=$(lspci -D | grep "SATA controller" | cut -f 1 -d ' ')
DISK=sda

# Enable runtime PM for all SATA ports
for port in /sys/bus/pci/devices/$HOST/ata*; do
	echo auto > $port/power/control
done
# Then for the host controller
echo auto > /sys/bus/pci/devices/$HOST/power/control

# And last for the disk
echo auto > /sys/block/$DISK/device/power/control
echo $(($TIMEOUT * 1000)) > /sys/block/$DISK/device/power/autosuspend_delay_ms
------8<------8<------8<------8<------8<------8<------8<------

Mika Westerberg (7):
  block: Add blk_set_runtime_active()
  scsi: Set request queue runtime PM status back to active on resume
  scsi: Drop runtime PM usage count after host is added
  ahci: Cache host controller version
  ahci: Convert driver to use modern PM hooks
  ahci: Add functions to manage runtime PM of AHCI ports
  ahci: Add runtime PM support for the host controller

 block/blk-core.c       |  24 ++++++++++++
 drivers/ata/ahci.c     | 102 +++++++++++++++++++++++++++++++++++--------------
 drivers/ata/ahci.h     |   1 +
 drivers/ata/libahci.c  |  55 +++++++++++++++++++++++---
 drivers/scsi/hosts.c   |   7 ++++
 drivers/scsi/scsi_pm.c |  10 +++++
 include/linux/blkdev.h |   2 +
 7 files changed, 167 insertions(+), 34 deletions(-)

-- 
2.7.0

             reply	other threads:[~2016-02-18  8:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18  8:54 Mika Westerberg [this message]
2016-02-18  8:54 ` [PATCH 1/7] block: Add blk_set_runtime_active() Mika Westerberg
2016-02-18  8:54 ` [PATCH 2/7] scsi: Set request queue runtime PM status back to active on resume Mika Westerberg
2016-02-18  8:54 ` [PATCH 3/7] scsi: Drop runtime PM usage count after host is added Mika Westerberg
2016-02-18 22:50   ` Julian Calaby
2016-02-19  8:18     ` Mika Westerberg
2016-02-18  8:54 ` [PATCH 4/7] ahci: Cache host controller version Mika Westerberg
2016-02-18  8:54 ` [PATCH 5/7] ahci: Convert driver to use modern PM hooks Mika Westerberg
2016-02-18 10:45   ` Andy Shevchenko
2016-02-18 13:12     ` Tejun Heo
2016-02-18 14:41       ` Christoph Hellwig
2016-02-18  8:54 ` [PATCH 6/7] ahci: Add functions to manage runtime PM of AHCI ports Mika Westerberg
2016-02-18  8:54 ` [PATCH 7/7] ahci: Add runtime PM support for the host controller Mika Westerberg
2016-02-18 16:40 ` [PATCH 0/7] Runtime PM support for AHCI host controller driver Tejun Heo
2016-02-19  8:39   ` Mika Westerberg
2016-02-19 15:12   ` Jens Axboe
2016-02-19 15:54 ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1455785657-22924-1-git-send-email-mika.westerberg@linux.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).