linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.6.24 1/1] sata_sil24: prevent hba lockup when pass-through ATA commands are used
@ 2008-01-01 16:50 Gwendal Grignou
  2008-01-09  2:17 ` Tejun Heo
  0 siblings, 1 reply; 5+ messages in thread
From: Gwendal Grignou @ 2008-01-01 16:50 UTC (permalink / raw)
  To: linux-ide

Fix commands timeout with Sil3124/3132 based HBA when pass-through ATA
commands [where ATA_QCFLAG_RESULT_TF is set] are used while other
commands are active on other devices
connected to the same port with a Port Multiplier.
Due to a hardware bug, these commands must be sent alone, like ATAPI commands.
---
 drivers/ata/sata_sil24.c |   36 ++++++++++++++++++++++++++----------
 1 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 96fd526..56cddc7 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -832,16 +832,32 @@ static int sil24_qc_defer(struct ata_que
 	struct ata_link *link = qc->dev->link;
 	struct ata_port *ap = link->ap;
 	u8 prot = qc->tf.protocol;
-	int is_atapi = (prot == ATA_PROT_ATAPI ||
-			prot == ATA_PROT_ATAPI_NODATA ||
-			prot == ATA_PROT_ATAPI_DMA);
-
-	/* ATAPI commands completing with CHECK_SENSE cause various
-	 * weird problems if other commands are active.  PMP DMA CS
-	 * errata doesn't cover all and HSM violation occurs even with
-	 * only one other device active.  Always run an ATAPI command
-	 * by itself.
+
+	/*
+	 * There is a bug in the chip:
+	 * Port LRAM Causes the PRB/SGT Data to be Corrupted
+	 * If the host issues a read request for LRAM and SActive registers
+	 * while active commands are available in the port, PRB/SGT data in
+	 * the LRAM can become corrupted. This issue applies only when
+	 * reading from, but not writing to, the LRAM.
+	 *
+	 * Therefore, reading LRAM when there is no particular error [and
+	 * other commands may be outstanding] is prohibited.
+	 *
+	 * To avoid this bug there are two situations where a command must run
+	 * exclusive of any other commands on the port:
+	 *
+	 * - ATAPI commands which check the sense data
+	 * - Passthrough ATA commands which always have ATA_QCFLAG_RESULT_TF
+	 *   set.
+	 *
 	 */
+	int is_excl = (prot == ATA_PROT_ATAPI ||
+		       prot == ATA_PROT_ATAPI_NODATA ||
+		       prot == ATA_PROT_ATAPI_DMA ||
+		       (qc->flags & ATA_QCFLAG_RESULT_TF));
+
 	if (unlikely(ap->excl_link)) {
 		if (link == ap->excl_link) {
 			if (ap->nr_active_links)
@@ -849,7 +865,7 @@ static int sil24_qc_defer(struct ata_que
 			qc->flags |= ATA_QCFLAG_CLEAR_EXCL;
 		} else
 			return ATA_DEFER_PORT;
-	} else if (unlikely(is_atapi)) {
+	} else if (unlikely(is_excl)) {
 		ap->excl_link = link;
 		if (ap->nr_active_links)
 			return ATA_DEFER_PORT;

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

* Re: [PATCH 2.6.24 1/1] sata_sil24: prevent hba lockup when pass-through ATA commands are used
  2008-01-01 16:50 [PATCH 2.6.24 1/1] sata_sil24: prevent hba lockup when pass-through ATA commands are used Gwendal Grignou
@ 2008-01-09  2:17 ` Tejun Heo
  2008-01-10  4:53   ` Jeff Garzik
  0 siblings, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2008-01-09  2:17 UTC (permalink / raw)
  To: Gwendal Grignou; +Cc: linux-ide, Jeff Garzik

Gwendal Grignou wrote:
> Fix commands timeout with Sil3124/3132 based HBA when pass-through ATA
> commands [where ATA_QCFLAG_RESULT_TF is set] are used while other
> commands are active on other devices
> connected to the same port with a Port Multiplier.
> Due to a hardware bug, these commands must be sent alone, like ATAPI commands.

Thanks a lot.  You forgot S-O-B.

Acked-by: Tejun Heo <htejun@gmail.com>

Jeff, please queue this for 2.6.24.  Gwendal, IIRC you guys use lots of
PMPs on your server farms, right?  How is the current code working
there?  Do you guys see any detection problems?

-- 
tejun

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

* Re: [PATCH 2.6.24 1/1] sata_sil24: prevent hba lockup when pass-through ATA commands are used
  2008-01-09  2:17 ` Tejun Heo
@ 2008-01-10  4:53   ` Jeff Garzik
  2008-01-10  6:47     ` [PATCH #upstream-fixes] " Tejun Heo
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Garzik @ 2008-01-10  4:53 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Gwendal Grignou, linux-ide

Tejun Heo wrote:
> Gwendal Grignou wrote:
>> Fix commands timeout with Sil3124/3132 based HBA when pass-through ATA
>> commands [where ATA_QCFLAG_RESULT_TF is set] are used while other
>> commands are active on other devices
>> connected to the same port with a Port Multiplier.
>> Due to a hardware bug, these commands must be sent alone, like ATAPI commands.
> 
> Thanks a lot.  You forgot S-O-B.
> 
> Acked-by: Tejun Heo <htejun@gmail.com>
> 
> Jeff, please queue this for 2.6.24.  Gwendal, IIRC you guys use lots of
> PMPs on your server farms, right?  How is the current code working
> there?  Do you guys see any detection problems?

hrm, I don't see the original message in my inbox.  Would one of you 
mind resending the original?

	Jeff




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

* [PATCH #upstream-fixes] sata_sil24: prevent hba lockup when pass-through ATA commands are used
  2008-01-10  4:53   ` Jeff Garzik
@ 2008-01-10  6:47     ` Tejun Heo
  2008-01-10 21:56       ` Jeff Garzik
  0 siblings, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2008-01-10  6:47 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Gwendal Grignou, linux-ide

From: Gwendal Grignou <gwendal@google.com>

Fix commands timeout with Sil3124/3132 based HBA when pass-through ATA
commands [where ATA_QCFLAG_RESULT_TF is set] are used while other
commands are active on other devices connected to the same port with a
Port Multiplier.  Due to a hardware bug, these commands must be sent
alone, like ATAPI commands.

Signed-off-by: Gwendal Grignou <gwendal@google.com>
Acked-by: Tejun Heo <htejun@gmail.com>
---
 drivers/ata/sata_sil24.c |   37 ++++++++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 11 deletions(-)

diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 96fd526..b4c674d 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -832,16 +832,31 @@ static int sil24_qc_defer(struct ata_queued_cmd *qc)
 	struct ata_link *link = qc->dev->link;
 	struct ata_port *ap = link->ap;
 	u8 prot = qc->tf.protocol;
-	int is_atapi = (prot == ATA_PROT_ATAPI ||
-			prot == ATA_PROT_ATAPI_NODATA ||
-			prot == ATA_PROT_ATAPI_DMA);
-
-	/* ATAPI commands completing with CHECK_SENSE cause various
-	 * weird problems if other commands are active.  PMP DMA CS
-	 * errata doesn't cover all and HSM violation occurs even with
-	 * only one other device active.  Always run an ATAPI command
-	 * by itself.
-	 */
+
+	/*
+	 * There is a bug in the chip:
+	 * Port LRAM Causes the PRB/SGT Data to be Corrupted
+	 * If the host issues a read request for LRAM and SActive registers
+	 * while active commands are available in the port, PRB/SGT data in
+	 * the LRAM can become corrupted. This issue applies only when
+	 * reading from, but not writing to, the LRAM.
+	 *
+	 * Therefore, reading LRAM when there is no particular error [and
+	 * other commands may be outstanding] is prohibited.
+	 *
+	 * To avoid this bug there are two situations where a command must run
+	 * exclusive of any other commands on the port:
+	 *
+	 * - ATAPI commands which check the sense data
+	 * - Passthrough ATA commands which always have ATA_QCFLAG_RESULT_TF
+	 *   set.
+	 *
+ 	 */
+	int is_excl = (prot == ATA_PROT_ATAPI ||
+		       prot == ATA_PROT_ATAPI_NODATA ||
+		       prot == ATA_PROT_ATAPI_DMA ||
+		       (qc->flags & ATA_QCFLAG_RESULT_TF));
+
 	if (unlikely(ap->excl_link)) {
 		if (link == ap->excl_link) {
 			if (ap->nr_active_links)
@@ -849,7 +864,7 @@ static int sil24_qc_defer(struct ata_queued_cmd *qc)
 			qc->flags |= ATA_QCFLAG_CLEAR_EXCL;
 		} else
 			return ATA_DEFER_PORT;
-	} else if (unlikely(is_atapi)) {
+	} else if (unlikely(is_excl)) {
 		ap->excl_link = link;
 		if (ap->nr_active_links)
 			return ATA_DEFER_PORT;

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

* Re: [PATCH #upstream-fixes] sata_sil24: prevent hba lockup when pass-through ATA commands are used
  2008-01-10  6:47     ` [PATCH #upstream-fixes] " Tejun Heo
@ 2008-01-10 21:56       ` Jeff Garzik
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff Garzik @ 2008-01-10 21:56 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Gwendal Grignou, linux-ide

Tejun Heo wrote:
> From: Gwendal Grignou <gwendal@google.com>
> 
> Fix commands timeout with Sil3124/3132 based HBA when pass-through ATA
> commands [where ATA_QCFLAG_RESULT_TF is set] are used while other
> commands are active on other devices connected to the same port with a
> Port Multiplier.  Due to a hardware bug, these commands must be sent
> alone, like ATAPI commands.
> 
> Signed-off-by: Gwendal Grignou <gwendal@google.com>
> Acked-by: Tejun Heo <htejun@gmail.com>
> ---
>  drivers/ata/sata_sil24.c |   37 ++++++++++++++++++++++++++-----------
>  1 file changed, 26 insertions(+), 11 deletions(-)

applied



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

end of thread, other threads:[~2008-01-10 21:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-01 16:50 [PATCH 2.6.24 1/1] sata_sil24: prevent hba lockup when pass-through ATA commands are used Gwendal Grignou
2008-01-09  2:17 ` Tejun Heo
2008-01-10  4:53   ` Jeff Garzik
2008-01-10  6:47     ` [PATCH #upstream-fixes] " Tejun Heo
2008-01-10 21:56       ` Jeff Garzik

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