lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1523870816-6214-1-git-send-email-davidwang@zhaoxin.com>
Date:   Mon, 16 Apr 2018 17:26:56 +0800
From:   David Wang <davidwang@...oxin.com>
To:     <tglx@...utronix.de>, <mingo@...hat.com>, <hpa@...or.com>,
        <gregkh@...uxfoundation.org>, <x86@...nel.org>,
        <linux-kernel@...r.kernel.org>
CC:     <brucechang@...-alliance.com>, <cooperyan@...oxin.com>,
        <qiyuanwang@...oxin.com>, <benjaminpan@...tech.com>,
        <lukelin@...cpu.com>, <timguo@...oxin.com>,
        David Wang <davidwang@...oxin.com>
Subject: [PATCH] x86/dma-mapping: override via_no_dac for new VIA PCI bridges

PCI bridges integrated in new VIA chipset/SoC have no DAC issue.
Enable DAC for the platforms with these chipset/SoC can improve DMA performance about
20% when DRAM size > 4GB.

Signed-off-by: David Wang <davidwang@...oxin.com>
---
 arch/x86/kernel/pci-dma.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index cb9c1fa..6e37b0e 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -47,6 +47,10 @@
 
 extern struct iommu_table_entry __iommu_table[], __iommu_table_end[];
 
+#ifdef CONFIG_PCI
+static int override_via_dac __read_mostly;
+#endif
+
 /* Dummy device used for NULL arguments (normally ISA). */
 struct device x86_dma_fallback_dev = {
 	.init_name = "fallback device",
@@ -279,6 +283,9 @@ static int __init pci_iommu_init(void)
 
 static void via_no_dac(struct pci_dev *dev)
 {
+	if (override_via_dac)
+		return;
+
 	if (forbid_dac == 0) {
 		dev_info(&dev->dev, "disabling DAC on VIA PCI bridge\n");
 		forbid_dac = 1;
@@ -286,4 +293,19 @@ static void via_no_dac(struct pci_dev *dev)
 }
 DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_VIA, PCI_ANY_ID,
 				PCI_CLASS_BRIDGE_PCI, 8, via_no_dac);
+
+static void via_can_dac(struct pci_dev *dev)
+{
+	/*
+	 * New VIA bridges have no issues for DAC.
+	 * Disable the "via_no_dac" fixup code for these new VIA bridges.
+	 */
+	override_via_dac = 1;
+}
+DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_VIA, 0x345B,
+				PCI_CLASS_BRIDGE_ISA, 8, via_can_dac);
+DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_VIA, 0x1001,
+				PCI_CLASS_BRIDGE_ISA, 8, via_can_dac);
+DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_VIA, 0x300A,
+				PCI_CLASS_BRIDGE_ISA, 8, via_can_dac);
 #endif
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ