linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Robert Hancock <hancockrwd@gmail.com>
Cc: Marc Dionne <marc.c.dionne@gmail.com>,
	Matthew Garrett <mjg59@srcf.ucam.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-ide@vger.kernel.org, garzik@redhat.com
Subject: Re: Hang during boot, bisected to commit 96d60303fd
Date: Mon, 07 Jun 2010 11:22:37 +0200	[thread overview]
Message-ID: <4C0CBA5D.5000900@kernel.org> (raw)
In-Reply-To: <AANLkTinIM8swHZTide7MAQsaYbWcFD90FrKUXE9NFG-5@mail.gmail.com>

Hello,

On 06/07/2010 06:34 AM, Robert Hancock wrote:
> I'm thinking that the hardreset and device classification makes more
> sense as a place to do this anyways, since that's the point where we
> really know if there's a device connected or not.. Tejun, any
> thoughts?

Heh, of course it doesn't work.  Device presence can't be reliably
determined by sampling status once like that.  We don't have all the
crap in libata-eh for nothing.  :-)

Marc, can you please try the following patch?

Thanks.

diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 1984a6e..261f86d 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -541,29 +541,11 @@ static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
 	return -EINVAL;
 }

-static int ahci_is_device_present(void __iomem *port_mmio)
-{
-	u8 status = readl(port_mmio + PORT_TFDATA) & 0xff;
-
-	/* Make sure PxTFD.STS.BSY and PxTFD.STS.DRQ are 0 */
-	if (status & (ATA_BUSY | ATA_DRQ))
-		return 0;
-
-	/* Make sure PxSSTS.DET is 3h */
-	status = readl(port_mmio + PORT_SCR_STAT) & 0xf;
-	if (status != 3)
-		return 0;
-	return 1;
-}
-
 void ahci_start_engine(struct ata_port *ap)
 {
 	void __iomem *port_mmio = ahci_port_base(ap);
 	u32 tmp;

-	if (!ahci_is_device_present(port_mmio))
-		return;
-
 	/* start DMA */
 	tmp = readl(port_mmio + PORT_CMD);
 	tmp |= PORT_CMD_START;
@@ -1892,6 +1874,9 @@ static void ahci_error_handler(struct ata_port *ap)
 	}

 	sata_pmp_error_handler(ap);
+
+	if (!ata_dev_enabled(ap->link.device))
+		ahci_stop_engine(ap);
 }

 static void ahci_post_internal_cmd(struct ata_queued_cmd *qc)

-- 
tejun

  reply	other threads:[~2010-06-07  9:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTiktNufXK_pn6mP2-zyowAIbHlUy5TGu3AtpALv-@mail.gmail.com>
2010-06-03  2:00 ` Hang during boot, bisected to commit 96d60303fd Matthew Garrett
2010-06-03  2:11   ` Marc Dionne
2010-06-04  1:21   ` Marc Dionne
2010-06-04  3:42     ` Robert Hancock
2010-06-05  1:23       ` Marc Dionne
2010-06-05  1:37         ` Robert Hancock
2010-06-05  1:45           ` Marc Dionne
2010-06-05  2:01           ` Marc Dionne
2010-06-07  4:34             ` Robert Hancock
2010-06-07  9:22               ` Tejun Heo [this message]
2010-06-07 12:21                 ` Marc Dionne
2010-06-07 13:04                   ` Matthew Garrett
2010-06-07 13:09                     ` Tejun Heo
2010-06-03  1:54 Marc Dionne

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=4C0CBA5D.5000900@kernel.org \
    --to=tj@kernel.org \
    --cc=garzik@redhat.com \
    --cc=hancockrwd@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.c.dionne@gmail.com \
    --cc=mjg59@srcf.ucam.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).