linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sata_nv: Don't attempt using ADMA for (READ|SET)_MAX commands
@ 2007-04-13 17:08 Kyle McMartin
  2007-04-13 17:19 ` Alan Cox
  0 siblings, 1 reply; 4+ messages in thread
From: Kyle McMartin @ 2007-04-13 17:08 UTC (permalink / raw)
  To: Robert Hancock; +Cc: linux-ide, jgarzik, bcollins

READ_NATIVE_MAX and SET_MAX were causing timeouts on sata_nv controllers.
Disabling ADMA helped, but that is quite a large hammer to use. Reverting
382a6652e91b34d5480cfc0ed840c196650493d4 also helped, but we might as well
fix it right, instead of disabling the performance gain on cache flushes
by using ADMA mode.

Signed-off-by: Kyle McMartin <kyle@canonical.com>

---

This patch depends on the Host Protected Area patch Alan sent to linux-ide
this week.

diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 9d9670a..eaf9b76 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -1162,6 +1162,20 @@ static void nv_adma_fill_sg(struct ata_queued_cmd *qc, struct nv_adma_cpb *cpb)
 		cpb->next_aprd = cpu_to_le64(0);
 }
 
+static int nv_blacklist_adma_for_hpa_cmds(struct ata_taskfile *tf)
+{
+	switch(tf->command) {
+	case ATA_CMD_READ_NATIVE_MAX:
+	case ATA_CMD_READ_NATIVE_MAX_EXT:
+	case ATA_CMD_SET_MAX:
+	case ATA_CMD_SET_MAX_EXT:
+		return 1;
+
+	default:
+		return 0;
+	}
+}
+
 static int nv_adma_use_reg_mode(struct ata_queued_cmd *qc)
 {
 	struct nv_adma_port_priv *pp = qc->ap->private_data;
@@ -1173,8 +1187,12 @@ static int nv_adma_use_reg_mode(struct ata_queued_cmd *qc)
 		return 1;
 
 	if((qc->flags & ATA_QCFLAG_DMAMAP) ||
-	   (qc->tf.protocol == ATA_PROT_NODATA))
-		return 0;
+	   (qc->tf.protocol == ATA_PROT_NODATA)) {
+		if (nv_blacklist_adma_for_hpa_cmds(&qc->tf))
+			return 1;	/* (SET|READ)_NATIVE_MAX time out in ADMA mdoe */
+		else
+			return 0;
+	}
 
 	return 1;
 }

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-04-13 22:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-13 17:08 [PATCH] sata_nv: Don't attempt using ADMA for (READ|SET)_MAX commands Kyle McMartin
2007-04-13 17:19 ` Alan Cox
2007-04-13 18:14   ` Mark Lord
2007-04-13 22:52     ` Robert Hancock

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).