From: Tejun Heo <htejun@gmail.com>
To: Marc Bowes <marcbowes@gmail.com>
Cc: Robert Hancock <hancockrwd@gmail.com>,
James Bottomley <James.Bottomley@hansenpartnership.com>,
linux-ide@vger.kernel.org
Subject: Re: SATA: link online but device misclassified
Date: Mon, 29 Jun 2009 19:20:18 +0900 [thread overview]
Message-ID: <4A489562.8080404@gmail.com> (raw)
In-Reply-To: <cfa4e840906200613mac35e8ei69e40f9bcddd37dc@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 179 bytes --]
Marc Bowes wrote:
> Ok. Just keep me informed :)
Please test the attached patch and report the resulting boot log. Oh
and please turn on CONFIG_PRINTK_TIME.
Thanks.
--
tejun
[-- Attachment #2: gigabyte-unreliable-online.patch --]
[-- Type: text/x-patch, Size: 3975 bytes --]
drivers/ata/ahci.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
drivers/ata/libata-eh.c | 15 +++++++++++----
include/linux/libata.h | 1 +
3 files changed, 60 insertions(+), 4 deletions(-)
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 2141a31..58cf5f7 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -2677,6 +2677,48 @@ static bool ahci_broken_suspend(struct pci_dev *pdev)
return !ver || strcmp(ver, dmi->driver_data) < 0;
}
+static bool ahci_broken_online(struct pci_dev *pdev)
+{
+#define ENCODE_BUSDEVFN(bus, slot, func) \
+ (void *)(unsigned long)(((bus) << 8) | PCI_DEVFN((slot), (func)))
+ static const struct dmi_system_id sysids[] = {
+ /*
+ * There are several gigabyte boards which use
+ * SIMG5723s configured as hardware RAID. Certain
+ * 5723 firmware revisions shipped there keep the link
+ * online but fail to answer properly to SRST or
+ * IDENTIFY when no device is attached downstream
+ * causing libata to retry quite a few times leading
+ * to excessive detection delay.
+ *
+ * As these firmwares respond to the second reset try
+ * with invalid device signature, considering unknown
+ * sig as offline works around the problem acceptably.
+ */
+ {
+ .ident = "EP45-DQ6",
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR,
+ "Gigabyte Technology Co., Ltd."),
+ DMI_MATCH(DMI_BOARD_NAME,
+ "EP45-DQ6"),
+ },
+ .driver_data = ENCODE_BUSDEVFN(0x0a, 0x00, 0),
+ },
+ { } /* terminate list */
+ };
+#undef ENCODE_BUSDEVFN
+ const struct dmi_system_id *dmi = dmi_first_match(sysids);
+ unsigned int val;
+
+ if (!dmi)
+ return false;
+
+ val = (unsigned long)dmi->driver_data;
+
+ return pdev->bus->number == (val >> 8) && pdev->devfn == (val & 0xff);
+}
+
static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{
static int printed_version;
@@ -2788,6 +2830,12 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
"BIOS update required for suspend/resume\n");
}
+ if (ahci_broken_online(pdev)) {
+ pi.link_flags |= ATA_LFLAG_UNK_IS_OFFLINE;
+ dev_info(&pdev->dev,
+ "online status unreliable, applying workaround\n");
+ }
+
/* CAP.NP sometimes indicate the index of the last enabled
* port, at other times, that of the last possible port, so
* determining the maximum port number requires looking at
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 94919ad..cfc98c3 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2595,16 +2595,23 @@ int ata_eh_reset(struct ata_link *link, int classify,
}
if (classify && nr_unknown) {
- if (try < max_tries) {
+ bool unk_is_offline = link->flags & ATA_LFLAG_UNK_IS_OFFLINE;
+
+ if (!unk_is_offline && try < max_tries) {
ata_link_printk(link, KERN_WARNING, "link online but "
"device misclassified, retrying\n");
failed_link = link;
rc = -EAGAIN;
goto fail;
}
- ata_link_printk(link, KERN_WARNING,
- "link online but device misclassified, "
- "device detection might fail\n");
+ if (unk_is_offline)
+ ata_link_printk(link, KERN_INFO,
+ "link online but device misclassified, "
+ "treating as offline\n");
+ else
+ ata_link_printk(link, KERN_WARNING,
+ "link online but device misclassified, "
+ "device detection might fail\n");
}
/* reset successful, schedule revalidation */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 3d501db..934e805 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -172,6 +172,7 @@ enum {
ATA_LFLAG_NO_RETRY = (1 << 5), /* don't retry this link */
ATA_LFLAG_DISABLED = (1 << 6), /* link is disabled */
ATA_LFLAG_SW_ACTIVITY = (1 << 7), /* keep activity stats */
+ ATA_LFLAG_UNK_IS_OFFLINE = (1 << 8), /* treat unknown sig as offline */
/* struct ata_port flags */
ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */
next prev parent reply other threads:[~2009-06-29 10:20 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-11 0:15 SATA: link online but device misclassified Marc Bowes
2009-06-11 4:27 ` Robert Hancock
2009-06-11 9:31 ` Marc Bowes
2009-06-11 19:01 ` James Bottomley
2009-06-11 19:32 ` Marc Bowes
[not found] ` <cfa4e840906160759m31db333cr555104ca0e3c6255@mail.gmail.com>
2009-06-16 15:03 ` Marc Bowes
2009-06-16 15:21 ` James Bottomley
[not found] ` <cfa4e840906160946qc998331p308624ac10f15060@mail.gmail.com>
[not found] ` <1245171448.3965.46.camel@mulgrave.site>
2009-06-16 18:13 ` Marc Bowes
2009-06-19 1:38 ` Robert Hancock
2009-06-19 4:00 ` Tejun Heo
2009-06-19 9:38 ` Marc Bowes
2009-06-19 9:44 ` Marc Bowes
2009-06-20 12:34 ` Tejun Heo
2009-06-20 13:13 ` Marc Bowes
2009-06-25 13:54 ` Tejun Heo
2009-06-29 10:20 ` Tejun Heo [this message]
2009-07-01 8:07 ` Marc Bowes
2009-07-01 23:31 ` Tejun Heo
2009-07-02 9:22 ` Marc Bowes
2009-07-08 4:14 ` Tejun Heo
[not found] <cfa4e840906101331q71532d72v5361a72e9b77ce63@mail.gmail.com>
2009-06-10 20:34 ` Matthew Wilcox
2009-06-10 20:40 ` Marc Bowes
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=4A489562.8080404@gmail.com \
--to=htejun@gmail.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=hancockrwd@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=marcbowes@gmail.com \
/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).