Commit 79dd9182db2072d63ccf160bb9a3463b1c952723

Authored by Rafael J. Wysocki
Committed by Jesse Barnes
1 parent f1a7bfaf6b

PCI: PCIe: Introduce commad line switch for disabling port services

Introduce kernel command line switch pcie_ports= allowing one to
disable all of the native PCIe port services, so that PCIe ports
are treated like PCI-to-PCI bridges.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>

Showing 4 changed files with 24 additions and 0 deletions Side-by-side Diff

Documentation/kernel-parameters.txt
... ... @@ -2042,6 +2042,10 @@
2042 2042 force Enable ASPM even on devices that claim not to support it.
2043 2043 WARNING: Forcing ASPM on may cause system lockups.
2044 2044  
  2045 + pcie_ports= [PCIE] PCIe ports handling:
  2046 + compat Treat PCIe ports as PCI-to-PCI bridges, disable the PCIe
  2047 + ports driver.
  2048 +
2045 2049 pcie_pme= [PCIE,PM] Native PCIe PME signaling options:
2046 2050 Format: {auto|force}[,nomsi]
2047 2051 auto Use native PCIe PME signaling if the BIOS allows the
drivers/pci/pcie/portdrv.h
... ... @@ -20,6 +20,8 @@
20 20  
21 21 #define get_descriptor_id(type, service) (((type - 4) << 4) | service)
22 22  
  23 +extern bool pcie_ports_disabled;
  24 +
23 25 extern struct bus_type pcie_port_bus_type;
24 26 extern int pcie_port_device_register(struct pci_dev *dev);
25 27 #ifdef CONFIG_PM
drivers/pci/pcie/portdrv_core.c
... ... @@ -494,6 +494,9 @@
494 494 */
495 495 int pcie_port_service_register(struct pcie_port_service_driver *new)
496 496 {
  497 + if (pcie_ports_disabled)
  498 + return -ENODEV;
  499 +
497 500 new->driver.name = (char *)new->name;
498 501 new->driver.bus = &pcie_port_bus_type;
499 502 new->driver.probe = pcie_port_probe_service;
drivers/pci/pcie/portdrv_pci.c
... ... @@ -29,6 +29,18 @@
29 29 MODULE_DESCRIPTION(DRIVER_DESC);
30 30 MODULE_LICENSE("GPL");
31 31  
  32 +/* If this switch is set, PCIe port native services should not be enabled. */
  33 +bool pcie_ports_disabled;
  34 +
  35 +static int __init pcie_port_setup(char *str)
  36 +{
  37 + if (!strncmp(str, "compat", 6))
  38 + pcie_ports_disabled = true;
  39 +
  40 + return 1;
  41 +}
  42 +__setup("pcie_ports=", pcie_port_setup);
  43 +
32 44 /* global data */
33 45  
34 46 static int pcie_portdrv_restore_config(struct pci_dev *dev)
... ... @@ -300,6 +312,9 @@
300 312 static int __init pcie_portdrv_init(void)
301 313 {
302 314 int retval;
  315 +
  316 + if (pcie_ports_disabled)
  317 + return -EACCES;
303 318  
304 319 dmi_check_system(pcie_portdrv_dmi_table);
305 320