public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: "linux-kernel" <linux-kernel@vger.kernel.org>
Cc: vojtech@suse.cz, muli@il.ibm.com, jdmason@kudzu.us,
	tglx@linutronix.de, mingo@redhat.com
Subject: [PATCH RFC] x86: Fix 64-bit DMA masks on VIA
Date: Wed, 23 Apr 2008 20:55:12 +0200	[thread overview]
Message-ID: <200804232055.13102.mb@bu3sch.de> (raw)

This untested patch is supposed to fix DMAing on some VIA boards.
Currently the DMA subsystem returns an error, if the driver does
tell that it supports a 64bit DMA mask. So the driver probing
would fail in that case. This happens for some b43 cards with
64bit DMA engines on VIA boards.
Instead of failing the dma_supported() check, simply strip off the
high 32bits.

Signed-off-by: Michael Buesch <mb@bu3sch.de>

---

This is not tested, due to the lack of hardware.


Index: wireless-testing/arch/x86/kernel/pci-dma_64.c
===================================================================
--- wireless-testing.orig/arch/x86/kernel/pci-dma_64.c	2008-04-01 15:53:17.000000000 +0200
+++ wireless-testing/arch/x86/kernel/pci-dma_64.c	2008-04-23 20:49:42.000000000 +0200
@@ -173,11 +173,8 @@ int dma_supported(struct device *dev, u6
 {
 #ifdef CONFIG_PCI
 	if (mask > 0xffffffff && forbid_dac > 0) {
-
-
-
 		printk(KERN_INFO "PCI: Disallowing DAC for device %s\n", dev->bus_id);
-		return 0;
+		/* We strip off the high 32 bits in dma_set_mask() */
 	}
 #endif
 
@@ -215,6 +212,10 @@ int dma_set_mask(struct device *dev, u64
 {
 	if (!dev->dma_mask || !dma_supported(dev, mask))
 		return -EIO;
+
+	if (forbid_dac > 0)
+		mask &= 0xffffffff;
+
 	*dev->dma_mask = mask;
 	return 0;
 }
Index: wireless-testing/include/asm-x86/dma-mapping_32.h
===================================================================
--- wireless-testing.orig/include/asm-x86/dma-mapping_32.h	2008-02-16 19:08:15.000000000 +0100
+++ wireless-testing/include/asm-x86/dma-mapping_32.h	2008-04-23 20:46:12.000000000 +0200
@@ -137,10 +137,6 @@ dma_supported(struct device *dev, u64 ma
         if(mask < 0x00ffffff)
                 return 0;
 
-	/* Work around chipset bugs */
-	if (forbid_dac > 0 && mask > 0xffffffffULL)
-		return 0;
-
 	return 1;
 }
 
@@ -150,6 +146,10 @@ dma_set_mask(struct device *dev, u64 mas
 	if(!dev->dma_mask || !dma_supported(dev, mask))
 		return -EIO;
 
+	/* Work around chipset bugs */
+	if (forbid_dac > 0)
+		mask &= 0xffffffffULL;
+
 	*dev->dma_mask = mask;
 
 	return 0;

-- 
Greetings Michael.

             reply	other threads:[~2008-04-23 18:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-23 18:55 Michael Buesch [this message]
2008-04-24 13:43 ` [PATCH RFC] x86: Fix 64-bit DMA masks on VIA Andi Kleen
2008-04-24 14:06   ` Michael Buesch
2008-04-24 14:12     ` Andi Kleen
2008-04-24 14:18     ` David Miller
2008-04-24 14:32     ` Alan Cox
2008-04-24 15:19       ` Michael Buesch
2008-04-28 16:53       ` Ingo Molnar
2008-04-28 17:04         ` Jesse Barnes
2008-04-28 21:48           ` Michael Buesch

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=200804232055.13102.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=jdmason@kudzu.us \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=muli@il.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=vojtech@suse.cz \
    /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