All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Lord <lkml@rtr.ca>
To: Jeff Garzik <jeff@garzik.org>
Cc: Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>,
	"linux-ide@vger.kernel.org" <linux-ide@vger.kernel.org>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] 2.6.xx: sata_mv: another critical fix
Date: Tue, 21 Mar 2006 00:00:36 -0500	[thread overview]
Message-ID: <200603210000.36552.lkml@rtr.ca> (raw)
In-Reply-To: <441F4F95.4070203@garzik.org>

This patch addresses a number of weird behaviours observed
for the sata_mv driver, by fixing an "off by one" bug in processing
of the EDMA response queue.

Basically, sata_mv was looking in the wrong place for
command results, and this produced a lot of unpredictable behaviour.

Signed-off-by: Mark Lord <mlord@pobox.com>
--- linux-2.6.16/drivers/scsi/sata_mv.c	2006-03-20 00:53:29.000000000 -0500
+++ linux/drivers/scsi/sata_mv.c	2006-03-20 23:34:32.000000000 -0500
@@ -1098,36 +1098,39 @@
  *      Inherited from caller.
  */
 static u8 mv_get_crpb_status(struct ata_port *ap)
 {
 	void __iomem *port_mmio = mv_ap_base(ap);
 	struct mv_port_priv *pp = ap->private_data;
 	u32 out_ptr;
+	u8 ata_status;
 
 	out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS);
 
 	/* the response consumer index should be the same as we remember it */
 	assert(((out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) ==
 	       pp->rsp_consumer);
 
+	ata_status = pp->crpb[pp->rsp_consumer].flags >> CRPB_FLAG_STATUS_SHIFT;
+
 	/* increment our consumer index... */
 	pp->rsp_consumer = mv_inc_q_index(&pp->rsp_consumer);
 
 	/* and, until we do NCQ, there should only be 1 CRPB waiting */
 	assert(((readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS) >>
 		 EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) ==
 	       pp->rsp_consumer);
 
 	/* write out our inc'd consumer index so EDMA knows we're caught up */
 	out_ptr &= EDMA_RSP_Q_BASE_LO_MASK;
 	out_ptr |= pp->rsp_consumer << EDMA_RSP_Q_PTR_SHIFT;
 	writelfl(out_ptr, port_mmio + EDMA_RSP_Q_OUT_PTR_OFS);
 
 	/* Return ATA status register for completed CRPB */
-	return (pp->crpb[pp->rsp_consumer].flags >> CRPB_FLAG_STATUS_SHIFT);
+	return ata_status;
 }
 
 /**
  *      mv_err_intr - Handle error interrupts on the port
  *      @ap: ATA channel to manipulate
  *
  *      In most cases, just clear the interrupt and move on.  However,

  reply	other threads:[~2006-03-21  5:00 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-21  0:57 [git patch append] sata_mv fix Jeff Garzik
2006-03-21  5:00 ` Mark Lord [this message]
2006-03-21 12:13   ` [PATCH] 2.6.xx: sata_mv: another critical fix Sander
2006-03-21 13:51     ` Mark Lord
2006-03-21 15:37       ` Sander
2006-03-21 18:33         ` Linus Torvalds
2006-03-21 19:15           ` Sander
2006-03-21 19:22             ` Mark Lord
2006-03-21 19:35             ` Linus Torvalds
2006-03-21 20:44               ` Sander
2006-03-21 20:59                 ` Linus Torvalds
2006-03-21 21:09                   ` Jeff Garzik
2006-03-21 21:19                     ` Linus Torvalds
2006-03-21 21:37                       ` Jeff Garzik
2006-03-22  5:48                         ` Sander
2006-03-22  9:00                       ` Sander
2006-03-22 14:50                         ` Mark Lord
2006-03-22 17:09                           ` Sander
2006-03-22 17:53                             ` Eric D. Mudama
2006-03-22 18:01                               ` Sander
2006-03-22 17:55                             ` Mark Lord
2006-03-28  4:34                             ` Mark Lord
2006-05-03 12:16                               ` Sander
2006-05-03 12:42                                 ` Mark Lord
2006-05-03 13:32                                   ` Sander
2006-05-03 16:46                                     ` Mark Lord
2006-05-03 18:39                                       ` Sander
2006-03-22  2:12   ` 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=200603210000.36552.lkml@rtr.ca \
    --to=lkml@rtr.ca \
    --cc=akpm@osdl.org \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.