Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 28eb5f27 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Jesse Barnes
Browse files

PCI: PCIe: Ask BIOS for control of all native services at once



After commit 852972ac (ACPI: Disable
ASPM if the platform won't provide _OSC control for PCIe) control of
the PCIe Capability Structure is unconditionally requested by
acpi_pci_root_add(), which in principle may cause problems to
happen in two ways.  First, the BIOS may refuse to give control of
the PCIe Capability Structure if it is not asked for any of the
_OSC features depending on it at the same time.  Second, the BIOS may
assume that control of the _OSC features depending on the PCIe
Capability Structure will be requested in the future and may behave
incorrectly if that doesn't happen.  For this reason, control of
the PCIe Capability Structure should always be requested along with
control of any other _OSC features that may depend on it (ie. PCIe
native PME, PCIe native hot-plug, PCIe AER).

Rework the PCIe port driver so that (1) it checks which native PCIe
port services can be enabled, according to the BIOS, and (2) it
requests control of all these services simultaneously.  In
particular, this causes pcie_portdrv_probe() to fail if the BIOS
refuses to grant control of the PCIe Capability Structure, which
means that no native PCIe port services can be enabled for the PCIe
Root Complex the given port belongs to.  If that happens, ASPM is
disabled to avoid problems with mishandling it by the part of the
PCIe hierarchy for which control of the PCIe Capability Structure
has not been received.

Make it possible to override this behavior using 'pcie_ports=native'
(use the PCIe native services regardless of the BIOS response to the
control request), or 'pcie_ports=compat' (do not use the PCIe native
services at all).

Accordingly, rework the existing PCIe port service drivers so that
they don't request control of the services directly.

Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 75fb60f2
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -2043,18 +2043,17 @@ and is between 256 and 4096 characters. It is defined in the file
			WARNING: Forcing ASPM on may cause system lockups.

	pcie_ports=	[PCIE] PCIe ports handling:
		auto	Ask the BIOS whether or not to use native PCIe services
			associated with PCIe ports (PME, hot-plug, AER).  Use
			them only if that is allowed by the BIOS.
		native	Use native PCIe services associated with PCIe ports
			unconditionally.
		compat	Treat PCIe ports as PCI-to-PCI bridges, disable the PCIe
			ports driver.

	pcie_pme=	[PCIE,PM] Native PCIe PME signaling options:
			Format: {auto|force}[,nomsi]
		auto	Use native PCIe PME signaling if the BIOS allows the
			kernel to control PCIe config registers of root ports.
		force	Use native PCIe PME signaling even if the BIOS refuses
			to allow the kernel to control the relevant PCIe config
			registers.
		nomsi	Do not use MSI for native PCIe PME signaling (this makes
			all PCIe root ports use INTx for everything).
			all PCIe root ports use INTx for all services).

	pcmv=		[HW,PCMCIA] BadgePAD 4

+0 −9
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@
#include <linux/pm_runtime.h>
#include <linux/pci.h>
#include <linux/pci-acpi.h>
#include <linux/pci-aspm.h>
#include <linux/acpi.h>
#include <linux/slab.h>
#include <acpi/acpi_bus.h>
@@ -568,14 +567,6 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
	if (flags != base_flags)
		acpi_pci_osc_support(root, flags);

	flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL;
	status = acpi_pci_osc_control_set(root->device->handle, &flags, flags);

	if (ACPI_FAILURE(status)) {
		printk(KERN_INFO "Unable to assume PCIe control: Disabling ASPM\n");
		pcie_no_aspm();
	}

	pci_acpi_add_bus_pm_notifier(device, root->bus);
	if (device->wakeup.flags.run_wake)
		device_set_run_wake(root->bus->bridge, true);
+1 −3
Original line number Diff line number Diff line
@@ -338,9 +338,7 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *pdev, u32 flags)
	acpi_handle chandle, handle;
	struct acpi_buffer string = { ACPI_ALLOCATE_BUFFER, NULL };

	flags &= (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL |
		  OSC_SHPC_NATIVE_HP_CONTROL |
		  OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
	flags &= OSC_SHPC_NATIVE_HP_CONTROL;
	if (!flags) {
		err("Invalid flags %u specified!\n", flags);
		return -EINVAL;
+0 −12
Original line number Diff line number Diff line
@@ -176,19 +176,7 @@ static inline void pciehp_firmware_init(void)
{
	pciehp_acpi_slot_detection_init();
}

static inline int pciehp_get_hp_hw_control_from_firmware(struct pci_dev *dev)
{
	int retval;
	u32 flags = (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL |
		     OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
	retval = acpi_get_hp_hw_control_from_firmware(dev, flags);
	if (retval)
		return retval;
	return pciehp_acpi_slot_detection_check(dev);
}
#else
#define pciehp_firmware_init()				do {} while (0)
#define pciehp_get_hp_hw_control_from_firmware(dev) 	0
#endif 				/* CONFIG_ACPI */
#endif				/* _PCIEHP_H */
+1 −3
Original line number Diff line number Diff line
@@ -85,9 +85,7 @@ static int __init dummy_probe(struct pcie_device *dev)
	acpi_handle handle;
	struct dummy_slot *slot, *tmp;
	struct pci_dev *pdev = dev->port;
	/* Note: pciehp_detect_mode != PCIEHP_DETECT_ACPI here */
	if (pciehp_get_hp_hw_control_from_firmware(pdev))
		return -ENODEV;

	pos = pci_pcie_cap(pdev);
	if (!pos)
		return -ENODEV;
Loading