From patchwork Tue Sep 15 19:18:03 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 33662 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by bilbo.ozlabs.org (Postfix) with ESMTP id 32177B6F20 for ; Wed, 16 Sep 2009 05:20:36 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758478AbZIOTSM (ORCPT ); Tue, 15 Sep 2009 15:18:12 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758382AbZIOTSL (ORCPT ); Tue, 15 Sep 2009 15:18:11 -0400 Received: from hera.kernel.org ([140.211.167.34]:56334 "EHLO hera.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758550AbZIOTSE (ORCPT ); Tue, 15 Sep 2009 15:18:04 -0400 Received: from htj.dyndns.org (IDENT:U2FsdGVkX18oSoC9Ub3JXUbTyzDVnqhYsydmNOGp5k4@localhost [127.0.0.1]) by hera.kernel.org (8.14.2/8.14.2) with ESMTP id n8FJI3KO001600 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 15 Sep 2009 19:18:05 GMT Received: from [127.0.0.2] (htj.dyndns.org [127.0.0.2]) by htj.dyndns.org (Postfix) with ESMTPSA id 7C1AD406C2C82; Wed, 16 Sep 2009 04:18:03 +0900 (KST) Message-ID: <4AAFE86B.5070100@kernel.org> Date: Wed, 16 Sep 2009 04:18:03 +0900 From: Tejun Heo User-Agent: Thunderbird 2.0.0.22 (X11/20090605) MIME-Version: 1.0 To: Jeff Garzik CC: ide , meissner@novell.com Subject: [PATCH REDIFFED 4/4 #upstream] ahci: filter FPDMA non-zero offset enable for Aspire 3810T References: <4A77F6B8.4000000@kernel.org> <4AA702E7.7030905@pobox.com> In-Reply-To: <4AA702E7.7030905@pobox.com> X-Enigmail-Version: 0.95.7 X-Virus-Scanned: ClamAV 0.93.3/9808/Tue Sep 15 15:47:58 2009 on hera.kernel.org X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on hera.kernel.org X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (hera.kernel.org [127.0.0.1]); Tue, 15 Sep 2009 19:18:05 +0000 (UTC) Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Curiously, Aspire 3810T issues many SATA feature enable commands via _GTF, of which one is invalid and another is not supported by the drive. In the process, it also enables FPDMA non-zero offset. However, the feature also needs to be supported and enabled from the controller and it's wrong to enable it from _GTF unless the controller can do it by default. Currently, this ends up enabling FPDMA non-zero offset only on the drive side leading to NCQ command failures and eventual disabling of NCQ. This patch makes libata filter out FPDMA non-zero offset enable for the machine. This was reported by Marcus Meissner in bnc#522790. https://bugzilla.novell.com/show_bug.cgi?id=522790 Reported-by: Marcus Meissner --- This concludes the four patches to work around a device configuration issue caused by strange _GTF. This looks a bit pervasive for #upstream-fixes but the changes should only affect the problematic machine and be fairly safe. Thanks. drivers/ata/ahci.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: ata/drivers/ata/ahci.c =================================================================== --- ata.orig/drivers/ata/ahci.c +++ ata/drivers/ata/ahci.c @@ -2858,6 +2858,50 @@ static bool ahci_broken_online(struct pc return pdev->bus->number == (val >> 8) && pdev->devfn == (val & 0xff); } +static void ahci_gtf_filter_workaround(struct ata_host *host) +{ + static const struct dmi_system_id sysids[] = { + /* + * Aspire 3810T issues a bunch of SATA enable commands + * via _GTF including an invalid one and one which is + * rejected by the device. Among the successful ones + * is FPDMA non-zero offset enable which when enabled + * only on the drive side leads to NCQ command + * failures. Filter it out. + */ + { + .ident = "Aspire 3810T", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), + DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 3810T"), + }, + .driver_data = (void *)ATA_ACPI_FILTER_FPDMA_OFFSET, + }, + { } + }; + const struct dmi_system_id *dmi = dmi_first_match(sysids); + unsigned int filter; + int i; + + if (!dmi) + return; + + filter = (unsigned long)dmi->driver_data; + dev_printk(KERN_INFO, host->dev, + "applying extra ACPI _GTF filter 0x%x for %s\n", + filter, dmi->ident); + + for (i = 0; i < host->n_ports; i++) { + struct ata_port *ap = host->ports[i]; + struct ata_link *link; + struct ata_device *dev; + + ata_for_each_link(link, ap, EDGE) + ata_for_each_dev(dev, link, ALL) + dev->gtf_filter |= filter; + } +} + static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) { static int printed_version; @@ -3023,6 +3067,9 @@ static int ahci_init_one(struct pci_dev /* apply workaround for ASUS P5W DH Deluxe mainboard */ ahci_p5wdh_workaround(host); + /* apply gtf filter quirk */ + ahci_gtf_filter_workaround(host); + /* initialize adapter */ rc = ahci_configure_dma_masks(pdev, hpriv->cap & HOST_CAP_64); if (rc)