1 diff -rupN linux-3.15.old/Documentation/kernel-parameters.txt linux-3.15/Documentation/kernel-parameters.txt
2 --- linux-3.15.old/Documentation/kernel-parameters.txt 2014-06-08 15:19:54.000000000 -0300
3 +++ linux-3.15/Documentation/kernel-parameters.txt 2014-06-09 18:05:31.744055580 -0300
4 @@ -2554,6 +2554,16 @@ bytes respectively. Such letter suffixes
5 nomsi Do not use MSI for native PCIe PME signaling (this makes
6 all PCIe root ports use INTx for all services).
9 + [PCIE] Override missing PCIe ACS support for:
11 + All downstream ports - full ACS capabilties
13 + All multifunction devices - multifunction ACS subset
15 + Specfic device - full ACS capabilities
16 + Specified as vid:did (vendor/device ID) in hex
18 pcmv= [HW,PCMCIA] BadgePAD 4
21 diff -rupN linux-3.15.old/drivers/pci/quirks.c linux-3.15/drivers/pci/quirks.c
22 --- linux-3.15.old/drivers/pci/quirks.c 2014-06-08 15:19:54.000000000 -0300
23 +++ linux-3.15/drivers/pci/quirks.c 2014-06-09 18:06:36.688743183 -0300
24 @@ -3384,6 +3384,107 @@ struct pci_dev *pci_get_dma_source(struc
25 return pci_dev_get(dev);
28 +static bool acs_on_downstream;
29 +static bool acs_on_multifunction;
31 +#define NUM_ACS_IDS 16
33 + unsigned short vendor;
34 + unsigned short device;
36 +static struct acs_on_id acs_on_ids[NUM_ACS_IDS];
37 +static u8 max_acs_id;
39 +static __init int pcie_acs_override_setup(char *p)
45 + if (!strncmp(p, "downstream", 10))
46 + acs_on_downstream = true;
47 + if (!strncmp(p, "multifunction", 13))
48 + acs_on_multifunction = true;
49 + if (!strncmp(p, "id:", 3)) {
54 + if (max_acs_id >= NUM_ACS_IDS - 1) {
55 + pr_warn("Out of PCIe ACS override slots (%d)\n",
61 + snprintf(opt, 5, "%s", p);
62 + ret = kstrtol(opt, 16, &val);
64 + pr_warn("PCIe ACS ID parse error %d\n", ret);
67 + acs_on_ids[max_acs_id].vendor = val;
69 + p += strcspn(p, ":");
71 + pr_warn("PCIe ACS invalid ID\n");
76 + snprintf(opt, 5, "%s", p);
77 + ret = kstrtol(opt, 16, &val);
79 + pr_warn("PCIe ACS ID parse error %d\n", ret);
82 + acs_on_ids[max_acs_id].device = val;
86 + p += strcspn(p, ",");
91 + if (acs_on_downstream || acs_on_multifunction || max_acs_id)
92 + pr_warn("Warning: PCIe ACS overrides enabled; This may allow non-IOMMU protected peer-to-peer DMA\n");
96 +early_param("pcie_acs_override", pcie_acs_override_setup);
98 +static int pcie_acs_overrides(struct pci_dev *dev, u16 acs_flags)
102 + /* Never override ACS for legacy devices or devices with ACS caps */
103 + if (!pci_is_pcie(dev) ||
104 + pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ACS))
107 + for (i = 0; i < max_acs_id; i++)
108 + if (acs_on_ids[i].vendor == dev->vendor &&
109 + acs_on_ids[i].device == dev->device)
112 + switch (pci_pcie_type(dev)) {
113 + case PCI_EXP_TYPE_DOWNSTREAM:
114 + case PCI_EXP_TYPE_ROOT_PORT:
115 + if (acs_on_downstream)
118 + case PCI_EXP_TYPE_ENDPOINT:
119 + case PCI_EXP_TYPE_UPSTREAM:
120 + case PCI_EXP_TYPE_LEG_END:
121 + case PCI_EXP_TYPE_RC_END:
122 + if (acs_on_multifunction && dev->multifunction)
130 * AMD has indicated that the devices below do not support peer-to-peer
131 * in any system where they are found in the southbridge with an AMD
132 @@ -3483,6 +3584,7 @@ static int pci_quirk_intel_pch_acs(struc
133 return acs_flags & ~flags ? 0 : 1;
137 static const struct pci_dev_acs_enabled {
140 @@ -3495,6 +3597,7 @@ static const struct pci_dev_acs_enabled
141 { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_quirk_intel_pch_acs },
142 { 0x19a2, 0x710, pci_quirk_mf_endpoint_acs }, /* Emulex BE3-R */
143 { 0x10df, 0x720, pci_quirk_mf_endpoint_acs }, /* Emulex Skyhawk-R */
144 + { PCI_ANY_ID, PCI_ANY_ID, pcie_acs_overrides },