linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Crispin <john@phrozen.org>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	Gabor Juhos <juhosg@openwrt.org>, John Crispin <john@phrozen.org>
Subject: [PATCH] pci: add kernel config option for disabling common PCI quirks
Date: Wed, 21 Dec 2016 08:53:04 +0100	[thread overview]
Message-ID: <1482306784-29224-1-git-send-email-john@phrozen.org> (raw)

From: Gabor Juhos <juhosg@openwrt.org>

These quirks do not effect small small plastic routers. These routers tend
to have very little flash space. This patch adds a new option that allows
us to build a kernel without including the common quirks, thus saving us
valuable flash space.

When building an image for a MIPS/Ralink router with this option enabled
it will reduce the size of an uncompressed uImage by 12KB.

Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
Hi Bjorn,

This patch has been lingering inside the OpenWrt for some years. I am not
sure if this is the best way to remove the quirks from the build. Let me
know if you prefer a different way of solving this.

	John

 drivers/pci/Kconfig  |   10 ++++++++++
 drivers/pci/quirks.c |    6 ++++++
 2 files changed, 16 insertions(+)

diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
index 6555eb7..967bcd5 100644
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
@@ -71,6 +71,16 @@ config XEN_PCIDEV_FRONTEND
           The PCI device frontend driver allows the kernel to import arbitrary
           PCI devices from a PCI backend to support PCI driver domains.
 
+config PCI_DISABLE_COMMON_QUIRKS
+	bool "PCI disable common quirks"
+	depends on PCI
+        default n
+	help
+	  Say Y here if you do not wish to include the common quirks inside
+	  your kernel This is usefull for devices with scarce memory.
+
+	  If you don't know what to do here, say N.
+
 config HT_IRQ
 	bool "Interrupts on hypertransport devices"
 	default y
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index c232729..afe181e 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -41,6 +41,7 @@ static void quirk_mmio_always_on(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_ANY_ID, PCI_ANY_ID,
 				PCI_CLASS_BRIDGE_HOST, 8, quirk_mmio_always_on);
 
+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS
 /* The Mellanox Tavor device gives false positive parity errors
  * Mark this device with a broken_parity_status, to allow
  * PCI scanning code to "skip" this now blacklisted device.
@@ -3015,6 +3016,7 @@ static void quirk_intel_mc_errata(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65f9, quirk_intel_mc_errata);
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65fa, quirk_intel_mc_errata);
 
+#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */
 
 /*
  * Ivytown NTB BAR sizes are misreported by the hardware due to an erratum.  To
@@ -3071,6 +3073,8 @@ static void fixup_debug_report(struct pci_dev *dev, ktime_t calltime,
 	}
 }
 
+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS
+
 /*
  * Some BIOS implementations leave the Intel GPU interrupts enabled,
  * even though no one is handling them (f.e. i915 driver is never loaded).
@@ -3105,6 +3109,8 @@ static void disable_igfx_irq(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0152, disable_igfx_irq);
 
+#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */
+
 /*
  * PCI devices which are on Intel chips can skip the 10ms delay
  * before entering D3 mode.
-- 
1.7.10.4

             reply	other threads:[~2016-12-21  7:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-21  7:53 John Crispin [this message]
2016-12-21 10:19 ` [PATCH] pci: add kernel config option for disabling common PCI quirks Lukas Wunner
2016-12-21 12:22 ` Christoph Hellwig
2016-12-21 13:11   ` John Crispin
2016-12-21 14:26     ` Christoph Hellwig
2016-12-22  5:54       ` John Crispin
2016-12-22 18:45         ` Bjorn Helgaas

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=1482306784-29224-1-git-send-email-john@phrozen.org \
    --to=john@phrozen.org \
    --cc=bhelgaas@google.com \
    --cc=juhosg@openwrt.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.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;
as well as URLs for NNTP newsgroup(s).