Skip to content

Commit 5f39e67

Browse files
Jon Masontorvalds
authored andcommitted
PCI: Disable MPS configuration by default
Add the ability to disable PCI-E MPS turning and using the BIOS configured MPS defaults. Due to the number of issues recently discovered on some x86 chipsets, make this the default behavior. Also, add the option for peer to peer DMA MPS configuration. Peer to peer DMA is outside the scope of this patch, but MPS configuration could prevent it from working by having the MPS on one root port different than the MPS on another. To work around this, simply make the system wide MPS the smallest possible value (128B). Signed-off-by: Jon Mason <[email protected]> Acked-by: Benjamin Herrenschmidt <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 05faadc commit 5f39e67

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

drivers/pci/pci.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ unsigned long pci_cardbus_mem_size = DEFAULT_CARDBUS_MEM_SIZE;
7777
unsigned long pci_hotplug_io_size = DEFAULT_HOTPLUG_IO_SIZE;
7878
unsigned long pci_hotplug_mem_size = DEFAULT_HOTPLUG_MEM_SIZE;
7979

80-
enum pcie_bus_config_types pcie_bus_config = PCIE_BUS_SAFE;
80+
enum pcie_bus_config_types pcie_bus_config = PCIE_BUS_TUNE_OFF;
8181

8282
/*
8383
* The default CLS is used if arch didn't set CLS explicitly and not
@@ -3568,10 +3568,14 @@ static int __init pci_setup(char *str)
35683568
pci_hotplug_io_size = memparse(str + 9, &str);
35693569
} else if (!strncmp(str, "hpmemsize=", 10)) {
35703570
pci_hotplug_mem_size = memparse(str + 10, &str);
3571+
} else if (!strncmp(str, "pcie_bus_tune_off", 17)) {
3572+
pcie_bus_config = PCIE_BUS_TUNE_OFF;
35713573
} else if (!strncmp(str, "pcie_bus_safe", 13)) {
35723574
pcie_bus_config = PCIE_BUS_SAFE;
35733575
} else if (!strncmp(str, "pcie_bus_perf", 13)) {
35743576
pcie_bus_config = PCIE_BUS_PERFORMANCE;
3577+
} else if (!strncmp(str, "pcie_bus_peer2peer", 18)) {
3578+
pcie_bus_config = PCIE_BUS_PEER2PEER;
35753579
} else {
35763580
printk(KERN_ERR "PCI: Unknown option `%s'\n",
35773581
str);

drivers/pci/probe.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1458,12 +1458,24 @@ static int pcie_bus_configure_set(struct pci_dev *dev, void *data)
14581458
*/
14591459
void pcie_bus_configure_settings(struct pci_bus *bus, u8 mpss)
14601460
{
1461-
u8 smpss = mpss;
1461+
u8 smpss;
14621462

14631463
if (!pci_is_pcie(bus->self))
14641464
return;
14651465

1466+
if (pcie_bus_config == PCIE_BUS_TUNE_OFF)
1467+
return;
1468+
1469+
/* FIXME - Peer to peer DMA is possible, though the endpoint would need
1470+
* to be aware to the MPS of the destination. To work around this,
1471+
* simply force the MPS of the entire system to the smallest possible.
1472+
*/
1473+
if (pcie_bus_config == PCIE_BUS_PEER2PEER)
1474+
smpss = 0;
1475+
14661476
if (pcie_bus_config == PCIE_BUS_SAFE) {
1477+
smpss = mpss;
1478+
14671479
pcie_find_smpss(bus->self, &smpss);
14681480
pci_walk_bus(bus, pcie_find_smpss, &smpss);
14691481
}

include/linux/pci.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,9 @@ struct pci_driver {
621621
extern void pcie_bus_configure_settings(struct pci_bus *bus, u8 smpss);
622622

623623
enum pcie_bus_config_types {
624-
PCIE_BUS_PERFORMANCE,
624+
PCIE_BUS_TUNE_OFF,
625625
PCIE_BUS_SAFE,
626+
PCIE_BUS_PERFORMANCE,
626627
PCIE_BUS_PEER2PEER,
627628
};
628629

0 commit comments

Comments
 (0)