mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Wang <davidwang@zhaoxin.com>
To: <tglx@linutronix.de>, <mingo@redhat.com>, <hpa@zytor.com>,
	<gregkh@linuxfoundation.org>, <x86@kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: <brucechang@via-alliance.com>, <cooperyan@zhaoxin.com>,
	<qiyuanwang@zhaoxin.com>, <benjaminpan@viatech.com>,
	<lukelin@viacpu.com>, <timguo@zhaoxin.com>,
	David Wang <davidwang@zhaoxin.com>
Subject: [PATCH] x86/dma-mapping: override via_no_dac for new VIA PCI bridges
Date: Mon, 16 Apr 2018 17:26:56 +0800	[thread overview]
Message-ID: <1523870816-6214-1-git-send-email-davidwang@zhaoxin.com> (raw)

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@zhaoxin.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

             reply	other threads:[~2018-04-16  9:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-16  9:26 David Wang [this message]
2018-04-16 12:33 ` Christoph Hellwig
2018-04-17  8:44 David Wang
2018-04-17  8:54 ` Thomas Gleixner
2018-04-17 13:00   ` 'Christoph Hellwig'
2018-04-17 13:33     ` Thomas Gleixner

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=1523870816-6214-1-git-send-email-davidwang@zhaoxin.com \
    --to=davidwang@zhaoxin.com \
    --cc=benjaminpan@viatech.com \
    --cc=brucechang@via-alliance.com \
    --cc=cooperyan@zhaoxin.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukelin@viacpu.com \
    --cc=mingo@redhat.com \
    --cc=qiyuanwang@zhaoxin.com \
    --cc=tglx@linutronix.de \
    --cc=timguo@zhaoxin.com \
    --cc=x86@kernel.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

all inboxes | Powered by JetHome®