From: Pavel Machek <pavel@ucw.cz>
To: Tejun Heo <htejun@gmail.com>
Cc: kernel list <linux-kernel@vger.kernel.org>, axboe@suse.de
Subject: Re: SATA powersave patches
Date: Mon, 11 Sep 2006 00:48:15 +0200 [thread overview]
Message-ID: <20060910224815.GC1691@elf.ucw.cz> (raw)
In-Reply-To: <4501655F.5000103@gmail.com>
Hi!
(cc-ed to the list)
> >>>Do you have SATA powersave patches somewhere handy? I found out that
> >>>SATA eats way too much power.
> >>Hello, Pavel.
> >>
> >>Do you mean link powersaving? Or disk spindown?
> >
> >Link powersaving... disk spindown should be handled by laptop_mode +
> >hdparm -y, right?
>
> Yes for disk spindown. Link powersaving is in the following git tree
> but it's ~2 months old.
>
> http://htj.dyndns.org/git/?p=libata-tj.git;a=shortlog;h=powersave
> git://htj.dyndns.org/libata-tj.git powersave
Thanks... I got it to work (on 2 the old tree, I was not able to
forward-port it), but power savings were not too big (~0.1W, maybe).
I'm getting huge (~1W) savings by powering down SATA controller, as in
ahci_pci_device_suspend(). It would be great to be able to power SATA
controller down, then power it back up when it is needed... I tried
following hack, but could not get it to work. Any ideas?
Pavel
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index 3e98334..b6e9f55 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -222,7 +222,7 @@ static void ahci_thaw(struct ata_port *a
static void ahci_error_handler(struct ata_port *ap);
static void ahci_post_internal_cmd(struct ata_queued_cmd *qc);
static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t state);
-static int ahci_pci_device_resume(struct pci_dev *pdev);
+ int ahci_pci_device_resume(struct pci_dev *pdev);
static int ahci_port_standby(void __iomem *port_mmio, u32 cap);
static int ahci_port_spinup(void __iomem *port_mmio, u32 cap);
static int ahci_port_suspend(struct ata_port *ap, pm_message_t state);
@@ -1082,6 +1082,9 @@ static unsigned int ahci_fill_sg(struct
return n_sg;
}
+int suspended;
+struct pci_dev *mydev;
+
int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t state)
{
struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev);
@@ -1089,6 +1092,11 @@ int ahci_pci_device_suspend(struct pci_d
u32 tmp;
int i;
+ if (suspended)
+ return;
+ suspended = 1;
+ mydev = pdev;
+
/* First suspend all ports */
for (i = 0; i < host_set->n_ports; i++) {
struct ata_port *ap;
@@ -1121,6 +1129,10 @@ int ahci_pci_device_resume(struct pci_de
struct ata_port *ap;
u32 i, tmp, irq_stat;
+ if (!suspended)
+ return;
+ suspended = 0;
+
tmp = readl(mmio + HOST_CTL);
if (!(tmp & HOST_AHCI_EN)) {
tmp |= HOST_AHCI_EN;
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index e92c31d..89fb997 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -2822,6 +2822,14 @@ int ata_scsi_queuecmd(struct scsi_cmnd *
struct Scsi_Host *shost = scsidev->host;
int rc = 0;
+ extern int suspended;
+ extern int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t state);
+ extern int ahci_pci_device_resume(struct pci_dev *pdev);
+ extern struct pci_dev *mydev;
+
+ if (suspended)
+ ahci_pci_device_resume(mydev);
+
ap = ata_shost_to_port(shost);
spin_unlock(shost->host_lock);
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
next parent reply other threads:[~2006-09-10 22:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20060908110346.GC920@elf.ucw.cz>
[not found] ` <45015767.1090002@gmail.com>
[not found] ` <20060908123537.GB17640@elf.ucw.cz>
[not found] ` <4501655F.5000103@gmail.com>
2006-09-10 22:48 ` Pavel Machek [this message]
2006-09-11 10:24 ` SATA powersave patches Tejun Heo
2006-09-18 10:05 ` Pavel Machek
2006-09-18 10:38 ` Tejun Heo
2006-11-06 13:57 ` Pavel Machek
2006-11-06 17:44 ` Tejun Heo
2006-11-12 18:39 ` Pavel Machek
2006-11-21 4:30 ` Tejun Heo
2006-11-21 23:07 ` Pavel Machek
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=20060910224815.GC1691@elf.ucw.cz \
--to=pavel@ucw.cz \
--cc=axboe@suse.de \
--cc=htejun@gmail.com \
--cc=linux-kernel@vger.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