From: Shaohua Li <shaohua.li@intel.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Tejun Heo <tj@kernel.org>, linux-ide <linux-ide@vger.kernel.org>
Subject: Re: [RFC] add DMA setup FIS auto-activate feature
Date: Thu, 23 Jul 2009 15:25:18 +0800 [thread overview]
Message-ID: <20090723072518.GA3545@sli10-desk.sh.intel.com> (raw)
In-Reply-To: <4A6807A8.30403@pobox.com>
On Thu, Jul 23, 2009 at 02:48:08PM +0800, Jeff Garzik wrote:
> Tejun Heo wrote:
> > Jeff Garzik wrote:
> >> AA was added in SATA II, and the SATA II specs specifically mention that
> >> AA was not present in SATA 1.0.
> >
> > Yeap, it wasn't in SATA 1.0 but it was in ahci 1.0 so _theoretically_
> > all ahcis should be fine with it. We can introduce ATA_FLAG_FPDMA_AA
> > and let the drivers set it.
>
>
> Yep -- that was the logical conclusion of my rhetorical question at the
> beginning of this thread ;-)
Something like below?
Add SATA DMA setup FIS auto-activate feature in AHCI.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 336eb1e..d5d67b8 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -2802,7 +2802,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
/* prepare host */
if (hpriv->cap & HOST_CAP_NCQ)
- pi.flags |= ATA_FLAG_NCQ;
+ pi.flags |= ATA_FLAG_NCQ | ATA_FLAG_FPDMA_AA;
if (hpriv->cap & HOST_CAP_PMP)
pi.flags |= ATA_FLAG_PMP;
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 2c6aeda..62355cf 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2303,6 +2303,7 @@ static void ata_dev_config_ncq(struct ata_device *dev,
{
struct ata_port *ap = dev->link->ap;
int hdepth = 0, ddepth = ata_id_queue_depth(dev->id);
+ const u16 *id = dev->id;
if (!ata_id_has_ncq(dev->id)) {
desc[0] = '\0';
@@ -2317,6 +2318,10 @@ static void ata_dev_config_ncq(struct ata_device *dev,
dev->flags |= ATA_DFLAG_NCQ;
}
+ if ((ap->flags & ATA_FLAG_FPDMA_AA) && ata_id_has_fpdma_aa(id))
+ ata_dev_set_feature(dev, SETFEATURES_SATA_ENABLE,
+ SATA_FPDMA_AA);
+
if (hdepth >= ddepth)
snprintf(desc, desc_sz, "NCQ (depth %d)", ddepth);
else
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 9c75921..f549405 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -306,6 +306,7 @@ enum {
/* SETFEATURE Sector counts for SATA features */
SATA_AN = 0x05, /* Asynchronous Notification */
SATA_DIPM = 0x03, /* Device Initiated Power Management */
+ SATA_FPDMA_AA = 0x02, /* DMA Setup FIS Auto-Activate */
/* feature values for SET_MAX */
ATA_SET_MAX_ADDR = 0x00,
@@ -525,6 +526,9 @@ static inline int ata_is_data(u8 prot)
#define ata_id_has_atapi_AN(id) \
( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \
((id)[78] & (1 << 5)) )
+#define ata_id_has_fpdma_aa(id) \
+ ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \
+ ((id)[78] & (1 << 2)) )
#define ata_id_iordy_disable(id) ((id)[ATA_ID_CAPABILITY] & (1 << 10))
#define ata_id_has_iordy(id) ((id)[ATA_ID_CAPABILITY] & (1 << 11))
#define ata_id_u32(id,n) \
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 79b6d7f..ca210d8 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -190,6 +190,7 @@ enum {
ATA_FLAG_NO_POWEROFF_SPINDOWN = (1 << 11), /* don't spindown before poweroff */
ATA_FLAG_NO_HIBERNATE_SPINDOWN = (1 << 12), /* don't spindown before hibernation */
ATA_FLAG_DEBUGMSG = (1 << 13),
+ ATA_FLAG_FPDMA_AA = (1 << 14), /* driver supports Auto-Activate */
ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */
ATA_FLAG_NO_IORDY = (1 << 16), /* controller lacks iordy */
ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */
next prev parent reply other threads:[~2009-07-23 7:25 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-23 3:45 [RFC] add DMA setup FIS auto-activate feature Shaohua Li
2009-07-23 3:50 ` Tejun Heo
2009-07-23 3:59 ` Jeff Garzik
2009-07-23 5:40 ` Shaohua Li
2009-07-23 5:45 ` Tejun Heo
2009-07-23 6:07 ` Jeff Garzik
2009-07-23 6:12 ` Tejun Heo
2009-07-23 6:48 ` Jeff Garzik
2009-07-23 7:25 ` Shaohua Li [this message]
2009-07-23 18:07 ` Robert Hancock
2009-07-23 18:11 ` Jeff Garzik
2009-07-23 20:52 ` Tejun Heo
2009-07-24 9:12 ` Shaohua Li
2009-07-25 0:47 ` Tejun Heo
2009-07-27 1:24 ` Shaohua Li
2009-07-27 1:31 ` Tejun Heo
2009-07-29 1:20 ` Jeff Garzik
2009-07-23 6:18 ` Robert Hancock
2009-07-23 9:55 ` Sergei Shtylyov
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=20090723072518.GA3545@sli10-desk.sh.intel.com \
--to=shaohua.li@intel.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
--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).