linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH #upstream-fixes] ahci: disable 64bit DMA by default on SB600s
@ 2009-10-03  9:27 Tejun Heo
  2009-10-06  4:23 ` Jeff Garzik
  0 siblings, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2009-10-03  9:27 UTC (permalink / raw)
  To: Jeff Garzik, IDE/ATA development list, Shane Huang, stable,
	balducci, maierp

Till now only one board, ASUS M2A-VM, can do 64bit dma with recent
BIOSen.  Enabling 64bit DMA by default already broke three boards.
Enabling 64bit DMA isn't worth these regressions.  Disable 64bit DMA
by default and enable it only on boards which are known to work.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Gabriele Balducci <balducci@units.it>
Reported-by: maierp@informatik.tu-muenchen.de
Cc: Shane Huang <shane.huang@amd.com>
Cc: stable@kernel.org
---
 drivers/ata/ahci.c |   60 +++++++++++++++++------------------------------------
 1 file changed, 20 insertions(+), 40 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index acd1162..c950159 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -447,7 +447,8 @@ static const struct ata_port_info ahci_port_info[] = {
 	[board_ahci_sb600] =
 	{
 		AHCI_HFLAGS	(AHCI_HFLAG_IGN_SERR_INTERNAL |
-				 AHCI_HFLAG_NO_MSI | AHCI_HFLAG_SECT255),
+				 AHCI_HFLAG_NO_MSI | AHCI_HFLAG_SECT255 |
+				 AHCI_HFLAG_32BIT_ONLY),
 		.flags		= AHCI_FLAG_COMMON,
 		.pio_mask	= ATA_PIO4,
 		.udma_mask	= ATA_UDMA6,
@@ -2650,17 +2651,15 @@ static void ahci_p5wdh_workaround(struct ata_host *host)
 	}
 }
 
-/*
- * SB600 ahci controller on certain boards can't do 64bit DMA with
- * older BIOS.
- */
-static bool ahci_sb600_32bit_only(struct pci_dev *pdev)
+/* only some SB600 ahci controllers can do 64bit DMA */
+static bool ahci_sb600_enable_64bit(struct pci_dev *pdev)
 {
 	static const struct dmi_system_id sysids[] = {
 		/*
 		 * The oldest version known to be broken is 0901 and
 		 * working is 1501 which was released on 2007-10-26.
-		 * Force 32bit DMA on anything older than 1501.
+		 * Enable 64bit DMA on 1501 and anything newer.
+		 *
 		 * Please read bko#9412 for more info.
 		 */
 		{
@@ -2672,48 +2671,29 @@ static bool ahci_sb600_32bit_only(struct pci_dev *pdev)
 			},
 			.driver_data = "20071026",	/* yyyymmdd */
 		},
-		/*
-		 * It's yet unknown whether more recent BIOS fixes the
-		 * problem.  Blacklist the whole board for the time
-		 * being.  Please read the following thread for more
-		 * info.
-		 *
-		 * http://thread.gmane.org/gmane.linux.ide/42326
-		 */
-		{
-			.ident = "Gigabyte GA-MA69VM-S2",
-			.matches = {
-				DMI_MATCH(DMI_BOARD_VENDOR,
-					  "Gigabyte Technology Co., Ltd."),
-				DMI_MATCH(DMI_BOARD_NAME, "GA-MA69VM-S2"),
-			},
-		},
 		{ }
 	};
 	const struct dmi_system_id *match;
+	int year, month, date;
+	char buf[9];
 
 	match = dmi_first_match(sysids);
 	if (pdev->bus->number != 0 || pdev->devfn != PCI_DEVFN(0x12, 0) ||
 	    !match)
 		return false;
 
-	if (match->driver_data) {
-		int year, month, date;
-		char buf[9];
-
-		dmi_get_date(DMI_BIOS_DATE, &year, &month, &date);
-		snprintf(buf, sizeof(buf), "%04d%02d%02d", year, month, date);
-
-		if (strcmp(buf, match->driver_data) >= 0)
-			return false;
+	dmi_get_date(DMI_BIOS_DATE, &year, &month, &date);
+	snprintf(buf, sizeof(buf), "%04d%02d%02d", year, month, date);
 
+	if (strcmp(buf, match->driver_data) >= 0) {
+		dev_printk(KERN_WARNING, &pdev->dev, "%s: enabling 64bit DMA\n",
+			   match->ident);
+		return true;
+	} else {
 		dev_printk(KERN_WARNING, &pdev->dev, "%s: BIOS too old, "
 			   "forcing 32bit DMA, update BIOS\n", match->ident);
-	} else
-		dev_printk(KERN_WARNING, &pdev->dev, "%s: this board can't "
-			   "do 64bit DMA, forcing 32bit\n", match->ident);
-
-	return true;
+		return false;
+	}
 }
 
 static bool ahci_broken_system_poweroff(struct pci_dev *pdev)
@@ -2926,9 +2906,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (board_id == board_ahci_sb700 && pdev->revision >= 0x40)
 		hpriv->flags &= ~AHCI_HFLAG_IGN_SERR_INTERNAL;
 
-	/* apply sb600 32bit only quirk */
-	if (ahci_sb600_32bit_only(pdev))
-		hpriv->flags |= AHCI_HFLAG_32BIT_ONLY;
+	/* only some SB600s can do 64bit DMA */
+	if (ahci_sb600_enable_64bit(pdev))
+		hpriv->flags &= ~AHCI_HFLAG_32BIT_ONLY;
 
 	if ((hpriv->flags & AHCI_HFLAG_NO_MSI) || pci_enable_msi(pdev))
 		pci_intx(pdev, 1);

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

* Re: [PATCH #upstream-fixes] ahci: disable 64bit DMA by default on SB600s
  2009-10-03  9:27 [PATCH #upstream-fixes] ahci: disable 64bit DMA by default on SB600s Tejun Heo
@ 2009-10-06  4:23 ` Jeff Garzik
  2009-10-09 22:02   ` [stable] " Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Garzik @ 2009-10-06  4:23 UTC (permalink / raw)
  To: Tejun Heo; +Cc: IDE/ATA development list, Shane Huang, stable, balducci, maierp

On 10/03/2009 05:27 AM, Tejun Heo wrote:
> Till now only one board, ASUS M2A-VM, can do 64bit dma with recent
> BIOSen.  Enabling 64bit DMA by default already broke three boards.
> Enabling 64bit DMA isn't worth these regressions.  Disable 64bit DMA
> by default and enable it only on boards which are known to work.
>
> Signed-off-by: Tejun Heo<tj@kernel.org>
> Reported-by: Gabriele Balducci<balducci@units.it>
> Reported-by: maierp@informatik.tu-muenchen.de
> Cc: Shane Huang<shane.huang@amd.com>
> Cc: stable@kernel.org
> ---
>   drivers/ata/ahci.c |   60 +++++++++++++++++------------------------------------
>   1 file changed, 20 insertions(+), 40 deletions(-)

applied



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

* Re: [stable] [PATCH #upstream-fixes] ahci: disable 64bit DMA by default on SB600s
  2009-10-06  4:23 ` Jeff Garzik
@ 2009-10-09 22:02   ` Greg KH
  2009-10-12  7:28     ` [PATCH #stable] " Tejun Heo
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2009-10-09 22:02 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Tejun Heo, IDE/ATA development list, balducci, Shane Huang,
	stable, maierp

On Tue, Oct 06, 2009 at 12:23:34AM -0400, Jeff Garzik wrote:
> On 10/03/2009 05:27 AM, Tejun Heo wrote:
> > Till now only one board, ASUS M2A-VM, can do 64bit dma with recent
> > BIOSen.  Enabling 64bit DMA by default already broke three boards.
> > Enabling 64bit DMA isn't worth these regressions.  Disable 64bit DMA
> > by default and enable it only on boards which are known to work.
> >
> > Signed-off-by: Tejun Heo<tj@kernel.org>
> > Reported-by: Gabriele Balducci<balducci@units.it>
> > Reported-by: maierp@informatik.tu-muenchen.de
> > Cc: Shane Huang<shane.huang@amd.com>
> > Cc: stable@kernel.org
> > ---
> >   drivers/ata/ahci.c |   60 +++++++++++++++++------------------------------------
> >   1 file changed, 20 insertions(+), 40 deletions(-)
> 
> applied

This doesn't apply to the 2.6.31-stable tree.

Tejun, could you respin this for the stable release, if you feel it
needs to be there?

thanks,

greg k-h

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

* [PATCH #stable] ahci: disable 64bit DMA by default on SB600s
  2009-10-09 22:02   ` [stable] " Greg KH
@ 2009-10-12  7:28     ` Tejun Heo
  2009-11-05 20:00       ` [stable] " Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2009-10-12  7:28 UTC (permalink / raw)
  To: Greg KH
  Cc: Jeff Garzik, IDE/ATA development list, balducci, Shane Huang,
	stable, maierp

Till now only one board, ASUS M2A-VM, can do 64bit dma with recent
BIOSen.  Enabling 64bit DMA by default already broke three boards.
Enabling 64bit DMA isn't worth these regressions.  Disable 64bit DMA
by default and enable it only on boards which are known to work.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Gabriele Balducci <balducci@units.it>
Reported-by: maierp@informatik.tu-muenchen.de
Cc: Shane Huang <shane.huang@amd.com>
Cc: stable@kernel.org
---
> This doesn't apply to the 2.6.31-stable tree.
> 
> Tejun, could you respin this for the stable release, if you feel it
> needs to be there?

Yeap, here's minimal backport.

Thanks.

 drivers/ata/ahci.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Index: tree0/drivers/ata/ahci.c
===================================================================
--- tree0.orig/drivers/ata/ahci.c
+++ tree0/drivers/ata/ahci.c
@@ -433,7 +433,8 @@ static const struct ata_port_info ahci_p
 	[board_ahci_sb600] =
 	{
 		AHCI_HFLAGS	(AHCI_HFLAG_IGN_SERR_INTERNAL |
-				 AHCI_HFLAG_NO_MSI | AHCI_HFLAG_SECT255),
+				 AHCI_HFLAG_NO_MSI | AHCI_HFLAG_SECT255 |
+				 AHCI_HFLAG_32BIT_ONLY),
 		.flags		= AHCI_FLAG_COMMON,
 		.pio_mask	= ATA_PIO4,
 		.udma_mask	= ATA_UDMA6,
@@ -2608,7 +2609,7 @@ static void ahci_p5wdh_workaround(struct
  * 1501 which was released on 2007-10-26.  Force 32bit DMA on anything
  * older than 1501.  Please read bko#9412 for more info.
  */
-static bool ahci_asus_m2a_vm_32bit_only(struct pci_dev *pdev)
+static bool ahci_asus_m2a_vm_enable_64bit(struct pci_dev *pdev)
 {
 	static const struct dmi_system_id sysids[] = {
 		{
@@ -2639,12 +2640,12 @@ static bool ahci_asus_m2a_vm_32bit_only(
 	if (date && strlen(date) >= 10 && date[2] == '/' && date[5] == '/' &&
 	    (year > 2007 ||
 	     (year == 2007 && strncmp(date, cutoff_mmdd, 5) >= 0)))
-		return false;
+		return true;

 	dev_printk(KERN_WARNING, &pdev->dev, "ASUS M2A-VM: BIOS too old, "
 		   "forcing 32bit DMA, update BIOS\n");

-	return true;
+	return false;
 }

 static bool ahci_broken_system_poweroff(struct pci_dev *pdev)
@@ -2858,8 +2859,8 @@ static int ahci_init_one(struct pci_dev
 		hpriv->flags &= ~AHCI_HFLAG_IGN_SERR_INTERNAL;

 	/* apply ASUS M2A_VM quirk */
-	if (ahci_asus_m2a_vm_32bit_only(pdev))
-		hpriv->flags |= AHCI_HFLAG_32BIT_ONLY;
+	if (ahci_asus_m2a_vm_enable_64bit(pdev))
+		hpriv->flags &= ~AHCI_HFLAG_32BIT_ONLY;

 	if ((hpriv->flags & AHCI_HFLAG_NO_MSI) || pci_enable_msi(pdev))
 		pci_intx(pdev, 1);

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

* Re: [stable] [PATCH #stable] ahci: disable 64bit DMA by default on SB600s
  2009-10-12  7:28     ` [PATCH #stable] " Tejun Heo
@ 2009-11-05 20:00       ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2009-11-05 20:00 UTC (permalink / raw)
  To: Tejun Heo
  Cc: balducci, Shane Huang, Jeff Garzik, IDE/ATA development list,
	maierp, stable

On Mon, Oct 12, 2009 at 04:28:26PM +0900, Tejun Heo wrote:
> Till now only one board, ASUS M2A-VM, can do 64bit dma with recent
> BIOSen.  Enabling 64bit DMA by default already broke three boards.
> Enabling 64bit DMA isn't worth these regressions.  Disable 64bit DMA
> by default and enable it only on boards which are known to work.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Reported-by: Gabriele Balducci <balducci@units.it>
> Reported-by: maierp@informatik.tu-muenchen.de
> Cc: Shane Huang <shane.huang@amd.com>
> Cc: stable@kernel.org
> ---
> > This doesn't apply to the 2.6.31-stable tree.
> > 
> > Tejun, could you respin this for the stable release, if you feel it
> > needs to be there?
> 
> Yeap, here's minimal backport.

Thanks, but it looks like Chuck provided a "more complete" patch for
this, so I've taken his version as you acked it.

greg k-h

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

end of thread, other threads:[~2009-11-05 20:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-03  9:27 [PATCH #upstream-fixes] ahci: disable 64bit DMA by default on SB600s Tejun Heo
2009-10-06  4:23 ` Jeff Garzik
2009-10-09 22:02   ` [stable] " Greg KH
2009-10-12  7:28     ` [PATCH #stable] " Tejun Heo
2009-11-05 20:00       ` [stable] " Greg KH

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