Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Shane Huang <shane.huang@amd.com>
Cc: linux-ide@vger.kernel.org, Aaron Lu <aaron.lwe@gmail.com>
Subject: Re: [PATCH v2] ahci: implement aggressive SATA device sleep support
Date: Thu, 23 Aug 2012 11:09:39 -0400	[thread overview]
Message-ID: <503647B3.6050706@pobox.com> (raw)
In-Reply-To: <1345761072-2123-1-git-send-email-shane.huang@amd.com>

On 08/23/2012 06:31 PM, Shane Huang wrote:
> This patch enables Aggressive Device Sleep only if both host controller
> and device support it.
[...]

> @@ -2323,6 +2324,26 @@ int ata_dev_configure(struct ata_device *dev)
>   			}
>   		}
>
> +		if (ata_id_has_devslp(dev->id)) {
> +			err_mask = ata_dev_set_feature(dev,
> +						       SETFEATURES_SATA_ENABLE,
> +						       SATA_DEVSLP);
> +			if (err_mask)
> +				ata_dev_err(dev,
> +					    "failed to enable DEVSLP (err_mask=0x%x)\n",
> +					    err_mask);
> +			else {
> +				dev->flags |= ATA_DFLAG_DEVSLP;
> +				err_mask = ata_read_log_page(dev,
> +						ATA_LOG_SATA_SETTINGS,
> +						dev->sata_settings,
> +						1);
> +				if (err_mask)
> +					ata_dev_warn(dev,
> +						     "failed to get Identify Device Data\n");
> +			}
> +		}
> +
>   		dev->cdb_len = 16;
>   	}
>

1) Contra the patch description (quoted above), you are enabling 
SATA_DEVSLP on the device regardless of power policy or host controller 
support.

I'm not sure about the ata_dev_configure() change.  If the power policy 
is not enabling aggressive sleep, we should not send this command to the 
device.

2) If we are going to unconditionally add ATA_SECT_SIZE bytes to every 
ata_device structure, let's at least move the ata_read_log_page() call 
outside of the devslp test, so that others may have this information 
even if the device does not support devslp.

3) please define constants in linux/ata.h for sata_settings information, 
rather than using hexidecimal constants ("magic numbers").

4) is it wise to issue SET_FEATURES / SATA_DEVSLP prior to programming 
the host controller?  that order seems wrong.

	Jeff






  reply	other threads:[~2012-08-23 15:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-23 22:31 [PATCH v2] ahci: implement aggressive SATA device sleep support Shane Huang
2012-08-23 15:09 ` Jeff Garzik [this message]
2012-08-24  0:49   ` Aaron Lu
2012-08-24 10:46   ` Huang, Shane
2012-08-24 15:18     ` Huang, Shane
2012-08-24 15:36     ` Jeff Garzik
2012-08-27 10:36       ` Huang, Shane
2012-08-27 16:08         ` Jeff Garzik

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=503647B3.6050706@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=aaron.lwe@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=shane.huang@amd.com \
    /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