linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH #upstream-fixes] libata: don't use 32bit PIO for small transfers
@ 2011-09-06  4:21 Tejun Heo
  2011-09-06  9:49 ` Alan Cox
  2011-09-07 10:41 ` Alan Cox
  0 siblings, 2 replies; 5+ messages in thread
From: Tejun Heo @ 2011-09-06  4:21 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Alan Cox, linux-ide, tom.leiming

Some configurations have problems with using 32bit PIO on ATAPI cdb
transfers.  The most likely cause is different division of payload
across FISes but hasn't been confirmed.  There isn't much to be gained
by using 32bit PIO for small transfers.  Play it safe and use 16bit
PIO for transfers smaller than 512 bytes.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-and-Tested-by: Lei Ming <tom.leiming@gmail.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=40592
Cc: Alan Cox <alan@linux.intel.com>
Cc: stable@kernel.org
---
 drivers/ata/libata-sff.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

This fixes the problem but I'm slightly uneasy about it as I don't
know what's going on for sure.  However, given that we've been using
16bit PIO for far longer time and haven't seen much problem, this
seems like a sensible thing to do.  Alan, Jeff, what do you guys
think?

Thanks.

diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index c24127d..60e3bac 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -617,7 +617,15 @@ unsigned int ata_sff_data_xfer32(struct ata_device *dev, unsigned char *buf,
 	unsigned int words = buflen >> 2;
 	int slop = buflen & 3;
 
-	if (!(ap->pflags & ATA_PFLAG_PIO32))
+	/*
+	 * Some configurations have problem with 32bit PIO on ATAPI cdb
+	 * transfers and there isn't much to be gained by using 32bit PIO
+	 * for small transfers anyway.  Fall back to 16bit if 32bit isn't
+	 * enabled or transfer size is smaller than ATA_SECT_SIZE.
+	 *
+	 * https://bugzilla.kernel.org/show_bug.cgi?id=40592
+	 */
+	if (!(ap->pflags & ATA_PFLAG_PIO32) || buflen < ATA_SECT_SIZE)
 		return ata_sff_data_xfer(dev, buf, buflen, rw);
 
 	/* Transfer multiple of 4 bytes */

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

end of thread, other threads:[~2011-09-14 18:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-06  4:21 [RFC PATCH #upstream-fixes] libata: don't use 32bit PIO for small transfers Tejun Heo
2011-09-06  9:49 ` Alan Cox
2011-09-14  7:44   ` Ming Lei
2011-09-14 18:51     ` Alan Cox
2011-09-07 10:41 ` Alan Cox

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