kernel: add missing patch
[oweals/openwrt.git] / target / linux / generic / pending-4.9 / 810-pci_disable_common_quirks.patch
1 From: Gabor Juhos <juhosg@openwrt.org>
2 Subject: debloat: add kernel config option to disabling common PCI quirks
3
4 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
5 ---
6  drivers/pci/Kconfig  | 6 ++++++
7  drivers/pci/quirks.c | 6 ++++++
8  2 files changed, 12 insertions(+)
9
10 diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
11 index 6555eb78d91c..120fe3921820 100644
12 --- a/drivers/pci/Kconfig
13 +++ b/drivers/pci/Kconfig
14 @@ -71,6 +71,12 @@ config XEN_PCIDEV_FRONTEND
15            The PCI device frontend driver allows the kernel to import arbitrary
16            PCI devices from a PCI backend to support PCI driver domains.
17  
18 +config PCI_DISABLE_COMMON_QUIRKS
19 +       bool "PCI disable common quirks"
20 +       depends on PCI
21 +       help
22 +         If you don't know what to do here, say N.
23 +
24  config HT_IRQ
25         bool "Interrupts on hypertransport devices"
26         default y
27 diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
28 index 5d8151b43fbb..cb356e78e743 100644
29 --- a/drivers/pci/quirks.c
30 +++ b/drivers/pci/quirks.c
31 @@ -41,6 +41,7 @@ static void quirk_mmio_always_on(struct pci_dev *dev)
32  DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_ANY_ID, PCI_ANY_ID,
33                                 PCI_CLASS_BRIDGE_HOST, 8, quirk_mmio_always_on);
34  
35 +#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS
36  /* The Mellanox Tavor device gives false positive parity errors
37   * Mark this device with a broken_parity_status, to allow
38   * PCI scanning code to "skip" this now blacklisted device.
39 @@ -3038,6 +3039,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65f8, quirk_intel_mc_errata);
40  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65f9, quirk_intel_mc_errata);
41  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65fa, quirk_intel_mc_errata);
42  
43 +#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */
44  
45  /*
46   * Ivytown NTB BAR sizes are misreported by the hardware due to an erratum.  To
47 @@ -3094,6 +3096,8 @@ static void fixup_debug_report(struct pci_dev *dev, ktime_t calltime,
48         }
49  }
50  
51 +#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS
52 +
53  /*
54   * Some BIOS implementations leave the Intel GPU interrupts enabled,
55   * even though no one is handling them (f.e. i915 driver is never loaded).
56 @@ -3128,6 +3132,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq);
57  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq);
58  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0152, disable_igfx_irq);
59  
60 +#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */
61 +
62  /*
63   * PCI devices which are on Intel chips can skip the 10ms delay
64   * before entering D3 mode.
65 -- 
66 2.11.0
67