From: Andi Kleen <ak@suse.de>
To: torvalds@osdl.org, linux-kernel@vger.kernel.org, patches@x86-64.org
Subject: [PATCH for 2.6.22] [4/10] x86: Disable DAC on VIA bridges
Date: Wed, 20 Jun 2007 12:23:32 +0200 (CEST) [thread overview]
Message-ID: <20070620102332.C160F14AEF@wotan.suse.de> (raw)
In-Reply-To: <200706201223.443613000@suse.de>
Several reports that VIA bridges don't support DAC and corrupt
data. I don't know if it's fixed, but let's just blacklist
them all for now.
It can be overwritten with iommu=usedac
Signed-off-by: Andi Kleen <ak@suse.de>
---
arch/i386/kernel/pci-dma.c | 27 +++++++++++++++++++++++++++
arch/x86_64/kernel/pci-dma.c | 12 ++++++++++++
include/asm-i386/dma-mapping.h | 6 ++++++
3 files changed, 45 insertions(+)
Index: linux/arch/x86_64/kernel/pci-dma.c
===================================================================
--- linux.orig/arch/x86_64/kernel/pci-dma.c
+++ linux/arch/x86_64/kernel/pci-dma.c
@@ -322,5 +322,17 @@ static int __init pci_iommu_init(void)
return 0;
}
+#ifdef CONFIG_PCI
+/* Many VIA bridges seem to corrupt data for DAC. Disable it here */
+
+static __devinit void via_no_dac(struct pci_dev *dev)
+{
+ if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI && forbid_dac == 0) {
+ printk(KERN_INFO "PCI: VIA PCI bridge detected. Disabling DAC.\n");
+ forbid_dac = 1;
+ }
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_ANY_ID, via_no_dac);
+#endif
/* Must execute after PCI subsystem */
fs_initcall(pci_iommu_init);
Index: linux/arch/i386/kernel/pci-dma.c
===================================================================
--- linux.orig/arch/i386/kernel/pci-dma.c
+++ linux/arch/i386/kernel/pci-dma.c
@@ -12,6 +12,7 @@
#include <linux/string.h>
#include <linux/pci.h>
#include <linux/module.h>
+#include <linux/pci.h>
#include <asm/io.h>
struct dma_coherent_mem {
@@ -148,3 +149,29 @@ void *dma_mark_declared_memory_occupied(
return mem->virt_base + (pos << PAGE_SHIFT);
}
EXPORT_SYMBOL(dma_mark_declared_memory_occupied);
+
+#ifdef CONFIG_PCI
+/* Many VIA bridges seem to corrupt data for DAC. Disable it here */
+
+int forbid_dac;
+EXPORT_SYMBOL(forbid_dac);
+
+static __devinit void via_no_dac(struct pci_dev *dev)
+{
+ if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI && forbid_dac == 0) {
+ printk(KERN_INFO "PCI: VIA PCI bridge detected. Disabling DAC.\n");
+ forbid_dac = 1;
+ }
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_ANY_ID, via_no_dac);
+
+static int check_iommu(char *s)
+{
+ if (!strcmp(s, "usedac")) {
+ forbid_dac = -1;
+ return 1;
+ }
+ return 0;
+}
+__setup("iommu=", check_iommu);
+#endif
Index: linux/include/asm-i386/dma-mapping.h
===================================================================
--- linux.orig/include/asm-i386/dma-mapping.h
+++ linux/include/asm-i386/dma-mapping.h
@@ -123,6 +123,8 @@ dma_mapping_error(dma_addr_t dma_addr)
return 0;
}
+extern int forbid_dac;
+
static inline int
dma_supported(struct device *dev, u64 mask)
{
@@ -134,6 +136,10 @@ 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;
}
next prev parent reply other threads:[~2007-06-20 10:24 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-20 10:23 [PATCH for 2.6.22] [0/10] X86 late bug fixes for 2.6.22 Andi Kleen
2007-06-20 10:23 ` [PATCH for 2.6.22] [1/10] i386: bug in i386 MTRR initialization Andi Kleen
2007-06-20 21:16 ` Linus Torvalds
2007-06-20 10:23 ` [PATCH for 2.6.22] [2/10] x86_64: Fix readahead/sync_file_range/fadvise64 compat calls Andi Kleen
2007-06-20 10:23 ` [PATCH for 2.6.22] [3/10] x86_64: Fix eventd/timerfd syscalls Andi Kleen
2007-06-20 10:23 ` Andi Kleen [this message]
2007-06-20 10:23 ` [PATCH for 2.6.22] [5/10] x86_64: Quieten Atari keyboard warnings in Kconfig Andi Kleen
2007-06-20 12:31 ` Roman Zippel
2007-06-20 10:23 ` [PATCH for 2.6.22] [6/10] x86: Only make Macintosh drivers default on Macs Andi Kleen
2007-06-21 17:36 ` Olaf Hering
2007-06-21 17:52 ` Olaf Hering
2007-06-22 6:45 ` Andi Kleen
2007-06-21 17:58 ` Will Schmidt
2007-06-21 18:26 ` Linus Torvalds
2007-06-21 18:54 ` Olaf Hering
2007-06-21 21:09 ` Will Schmidt
2007-06-20 10:23 ` [PATCH for 2.6.22] [7/10] x86: Disable KPROBES with DEBUG_RODATA for now Andi Kleen
2007-06-20 10:23 ` [PATCH for 2.6.22] [8/10] x86: change_page_attr bandaids Andi Kleen
2007-06-20 10:23 ` [PATCH for 2.6.22] [9/10] i386: Disable alternative() patching after boot with DEBUG_RODATA Andi Kleen
2007-06-20 11:55 ` [patches] [PATCH for 2.6.22] [9/10] i386: Disable alternative()patching after boot with DEBUG_RO Jan Beulich
2007-06-20 12:27 ` Andi Kleen
2007-06-20 10:23 ` [PATCH for 2.6.22] [10/10] x86_64: fix link warning between for .text and .init.text Andi Kleen
2007-06-20 12:02 ` [patches] [PATCH for 2.6.22] [10/10] x86_64: fix link warningbetween " Jan Beulich
2007-06-20 12:30 ` Andi Kleen
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=20070620102332.C160F14AEF@wotan.suse.de \
--to=ak@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@x86-64.org \
--cc=torvalds@osdl.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
Powered by JetHome