stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Neil Horman <nhorman@tuxdriver.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Yinghai Lu <yinghai@kernel.org>, Len Brown <lenb@kernel.org>,
	"Rafael J. Wysocki" <rjw@sisk.pl>
Subject: [ 036/117] PCI/ACPI: Fix _OSC ordering to allow PCIe hotplug use when available
Date: Tue, 24 Sep 2013 17:18:22 -0700	[thread overview]
Message-ID: <20130925001744.776358223@linuxfoundation.org> (raw)
In-Reply-To: <20130925001740.833541979@linuxfoundation.org>

3.11-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Neil Horman <nhorman@tuxdriver.com>

commit 3dc48af310709b85d07c8b0d3aa8f1ead02829d3 upstream.

This fixes the problem of acpiphp claiming slots that should be managed
by pciehp, which may keep ExpressCard slots from working.

The acpiphp driver claims PCIe slots unless the BIOS has granted us
control of PCIe native hotplug via _OSC.  Prior to v3.10, the acpiphp
.add method (add_bridge()) was always called *after* we had requested
native hotplug control with _OSC.

But after 3b63aaa70e ("PCI: acpiphp: Do not use ACPI PCI subdriver
mechanism"), which appeared in v3.10, acpiphp initialization is done
during the bus scan via the pcibios_add_bus() hook, and this happens
*before* we request native hotplug control.

Therefore, acpiphp doesn't know yet whether the BIOS will grant control,
and it claims slots that we should be handling with native hotplug.

This patch requests native hotplug control earlier, so we know whether
the BIOS granted it to us before we initialize acpiphp.

To avoid reintroducing the ASPM issue fixed by b8178f130e ('Revert
"PCI/ACPI: Request _OSC control before scanning PCI root bus"'), we run
_OSC earlier but defer the actual ASPM calls until after the bus scan is
complete.

Tested successfully by myself.

[bhelgaas: changelog, mark for stable]
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=60736
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
CC: Len Brown <lenb@kernel.org>
CC: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/acpi/pci_root.c |   62 +++++++++++++++++++++++++++++-------------------
 1 file changed, 38 insertions(+), 24 deletions(-)

--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -378,6 +378,7 @@ static int acpi_pci_root_add(struct acpi
 	struct acpi_pci_root *root;
 	u32 flags, base_flags;
 	acpi_handle handle = device->handle;
+	bool no_aspm = false, clear_aspm = false;
 
 	root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL);
 	if (!root)
@@ -437,27 +438,6 @@ static int acpi_pci_root_add(struct acpi
 	flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT;
 	acpi_pci_osc_support(root, flags);
 
-	/*
-	 * TBD: Need PCI interface for enumeration/configuration of roots.
-	 */
-
-	/*
-	 * Scan the Root Bridge
-	 * --------------------
-	 * Must do this prior to any attempt to bind the root device, as the
-	 * PCI namespace does not get created until this call is made (and
-	 * thus the root bridge's pci_dev does not exist).
-	 */
-	root->bus = pci_acpi_scan_root(root);
-	if (!root->bus) {
-		dev_err(&device->dev,
-			"Bus %04x:%02x not present in PCI namespace\n",
-			root->segment, (unsigned int)root->secondary.start);
-		result = -ENODEV;
-		goto end;
-	}
-
-	/* Indicate support for various _OSC capabilities. */
 	if (pci_ext_cfg_avail())
 		flags |= OSC_EXT_PCI_CONFIG_SUPPORT;
 	if (pcie_aspm_support_enabled()) {
@@ -471,7 +451,7 @@ static int acpi_pci_root_add(struct acpi
 		if (ACPI_FAILURE(status)) {
 			dev_info(&device->dev, "ACPI _OSC support "
 				"notification failed, disabling PCIe ASPM\n");
-			pcie_no_aspm();
+			no_aspm = true;
 			flags = base_flags;
 		}
 	}
@@ -503,7 +483,7 @@ static int acpi_pci_root_add(struct acpi
 				 * We have ASPM control, but the FADT indicates
 				 * that it's unsupported. Clear it.
 				 */
-				pcie_clear_aspm(root->bus);
+				clear_aspm = true;
 			}
 		} else {
 			dev_info(&device->dev,
@@ -512,7 +492,14 @@ static int acpi_pci_root_add(struct acpi
 				acpi_format_exception(status), flags);
 			dev_info(&device->dev,
 				 "ACPI _OSC control for PCIe not granted, disabling ASPM\n");
-			pcie_no_aspm();
+			/*
+			 * We want to disable ASPM here, but aspm_disabled
+			 * needs to remain in its state from boot so that we
+			 * properly handle PCIe 1.1 devices.  So we set this
+			 * flag here, to defer the action until after the ACPI
+			 * root scan.
+			 */
+			no_aspm = true;
 		}
 	} else {
 		dev_info(&device->dev,
@@ -520,6 +507,33 @@ static int acpi_pci_root_add(struct acpi
 			 "(_OSC support mask: 0x%02x)\n", flags);
 	}
 
+	/*
+	 * TBD: Need PCI interface for enumeration/configuration of roots.
+	 */
+
+	/*
+	 * Scan the Root Bridge
+	 * --------------------
+	 * Must do this prior to any attempt to bind the root device, as the
+	 * PCI namespace does not get created until this call is made (and
+	 * thus the root bridge's pci_dev does not exist).
+	 */
+	root->bus = pci_acpi_scan_root(root);
+	if (!root->bus) {
+		dev_err(&device->dev,
+			"Bus %04x:%02x not present in PCI namespace\n",
+			root->segment, (unsigned int)root->secondary.start);
+		result = -ENODEV;
+		goto end;
+	}
+
+	if (clear_aspm) {
+		dev_info(&device->dev, "Disabling ASPM (FADT indicates it is unsupported)\n");
+		pcie_clear_aspm(root->bus);
+	}
+	if (no_aspm)
+		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);



  parent reply	other threads:[~2013-09-25  0:18 UTC|newest]

Thread overview: 128+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-25  0:17 [ 000/117] 3.11.2-stable review Greg Kroah-Hartman
2013-09-25  0:17 ` [ 001/117] ARC: SMP failed to boot due to missing IVT setup Greg Kroah-Hartman
2013-09-25  0:17 ` [ 002/117] ipc/msg.c: Fix lost wakeup in msgsnd() Greg Kroah-Hartman
2013-09-25  0:17 ` [ 003/117] xtensa: Fix broken allmodconfig build Greg Kroah-Hartman
2013-09-25  0:17 ` [ 004/117] SCSI: Allow MPT Fusion SAS 3.0 driver to be built into the kernel Greg Kroah-Hartman
2013-09-25  0:17 ` [ 005/117] drm/i915: make user mode sync polarity setting explicit Greg Kroah-Hartman
2013-10-02 17:30   ` Sven Joachim
2013-10-02 21:11     ` Daniel Vetter
2013-10-02 21:24       ` Greg Kroah-Hartman
2013-09-25  0:17 ` [ 006/117] firmware loader: fix pending_fw_head list corruption Greg Kroah-Hartman
2013-09-25  0:17 ` [ 007/117] zram: fix invalid memory access Greg Kroah-Hartman
2013-09-25  0:17 ` [ 008/117] zram: dont grab mutex in zram_slot_free_noity Greg Kroah-Hartman
2013-09-25  0:17 ` [ 009/117] UBI: Fix PEB leak in wear_leveling_worker() Greg Kroah-Hartman
2013-09-25  0:17 ` [ 010/117] SCSI: sd: Fix potential out-of-bounds access Greg Kroah-Hartman
2013-09-25  0:17 ` [ 011/117] crypto: api - Fix race condition in larval lookup Greg Kroah-Hartman
2013-09-25  0:17 ` [ 012/117] s390/bpf,jit: fix address randomization Greg Kroah-Hartman
2013-09-25  0:17 ` [ 013/117] powerpc: Handle unaligned ldbrx/stdbrx Greg Kroah-Hartman
2013-09-25  0:18 ` [ 014/117] powerpc: Default arch idle could cede processor on pseries Greg Kroah-Hartman
2013-09-25  0:18 ` [ 015/117] xen-gnt: prevent adding duplicate gnt callbacks Greg Kroah-Hartman
2013-09-25  0:18 ` [ 016/117] ARM: xen: only set pm function ptrs for Xen guests Greg Kroah-Hartman
2013-09-25  0:18 ` [ 017/117] cpuidle: coupled: abort idle if pokes are pending Greg Kroah-Hartman
2013-09-25  0:18 ` [ 018/117] cpuidle: coupled: fix race condition between pokes and safe state Greg Kroah-Hartman
2013-09-25  0:18 ` [ 019/117] arm64: perf: fix group validation when using enable_on_exec Greg Kroah-Hartman
2013-09-25  0:18 ` [ 020/117] arm64: perf: fix ARMv8 EVTYPE_MASK to include NSH bit Greg Kroah-Hartman
2013-09-25  0:18 ` [ 021/117] ARM: PCI: versatile: Fix map_irq function to match hardware Greg Kroah-Hartman
2013-09-25  0:18 ` [ 022/117] ARM: PCI: versatile: Fix PCI I/O Greg Kroah-Hartman
2013-09-25  0:18 ` [ 023/117] ARM: PCI: versatile: Fix SMAP register offsets Greg Kroah-Hartman
2013-09-25  0:18 ` [ 024/117] KVM: PPC: Book3S: Fix compile error in XICS emulation Greg Kroah-Hartman
2013-09-25  0:18 ` [ 025/117] xhci-plat: Dont enable legacy PCI interrupts Greg Kroah-Hartman
2013-09-25  0:18 ` [ 026/117] usb: xhci: Disable runtime PM suspend for quirky controllers Greg Kroah-Hartman
2013-09-25  0:18 ` [ 027/117] xhci: fix port BESL LPM capability checking Greg Kroah-Hartman
2013-09-25  0:18 ` [ 028/117] usb: dwc3: gadget: dont request IRQs in atomic Greg Kroah-Hartman
2013-09-25  0:18 ` [ 029/117] tty: disassociate_ctty() sends the extra SIGCONT Greg Kroah-Hartman
2013-09-25  0:18 ` [ 030/117] cifs: ensure that srv_mutex is held when dealing with ssocket pointer Greg Kroah-Hartman
2013-09-25  0:18 ` [ 031/117] CIFS: Fix a memory leak when a lease break comes Greg Kroah-Hartman
2013-09-25  0:18 ` [ 032/117] CIFS: Fix missing lease break Greg Kroah-Hartman
2013-09-25  0:18 ` [ 033/117] USB: OHCI: Allow runtime PM without system sleep Greg Kroah-Hartman
2013-09-25  0:18 ` [ 034/117] regmap: debugfs: Fix continued read from registers file Greg Kroah-Hartman
2013-09-25  0:18 ` [ 035/117] staging: comedi: dt282x: dt282x_ai_insn_read() always fails Greg Kroah-Hartman
2013-09-25  0:18 ` Greg Kroah-Hartman [this message]
2013-09-25  0:18 ` [ 037/117] ACPI / LPSS: dont crash if a device has no MMIO resources Greg Kroah-Hartman
2013-09-25  0:18 ` [ 038/117] USB: mos7720: use GFP_ATOMIC under spinlock Greg Kroah-Hartman
2013-09-25  0:18 ` [ 039/117] USB: mos7720: fix big-endian control requests Greg Kroah-Hartman
2013-09-25  0:18 ` [ 040/117] usb: ehci-mxc: check for pdata before dereferencing Greg Kroah-Hartman
2013-09-25  0:18 ` [ 041/117] USB: cdc-wdm: fix race between interrupt handler and tasklet Greg Kroah-Hartman
2013-09-25  0:18 ` [ 042/117] usb: gadget: uvc: Fix error handling in uvc_queue_buffer() Greg Kroah-Hartman
2013-09-25  0:18 ` [ 043/117] usb: Dont fail port power resume on device disconnect Greg Kroah-Hartman
2013-09-25  0:18 ` [ 044/117] USB: fix build error when CONFIG_PM_SLEEP isnt enabled Greg Kroah-Hartman
2013-09-25  0:18 ` [ 045/117] usb: config->desc.bLength may not exceed amount of data returned by the device Greg Kroah-Hartman
2013-09-25  0:18 ` [ 046/117] USB: handle LPM errors during device suspend correctly Greg Kroah-Hartman
2013-09-25  0:18 ` [ 047/117] usb: dont check pm qos NO_POWER_OFF flag in usb_port_suspend() Greg Kroah-Hartman
2013-09-25  0:18 ` [ 048/117] rculist: list_first_or_null_rcu() should use list_entry_rcu() Greg Kroah-Hartman
2013-09-25  0:18 ` [ 049/117] ASoC: wm8960: Fix PLL register writes Greg Kroah-Hartman
2013-09-25  0:18 ` [ 050/117] ASoC: mc13783: add spi errata fix Greg Kroah-Hartman
2013-09-25  0:18 ` [ 051/117] x86, smap: Handle csum_partial_copy_*_user() Greg Kroah-Hartman
2013-09-25  0:18 ` [ 052/117] Introduce [compat_]save_altstack_ex() to unbreak x86 SMAP Greg Kroah-Hartman
2013-09-25  0:18 ` [ 053/117] pci_ids: Add PCI device ID functions 3 and 4 for newer F15h models Greg Kroah-Hartman
2013-09-25  0:18 ` [ 054/117] x86, amd_nb: Clarify F15h, model 30h GART and L3 support Greg Kroah-Hartman
2013-09-25  0:18 ` [ 055/117] x86/mce: Pay no attention to F bit in MCACOD when parsing UC errors Greg Kroah-Hartman
2013-09-25  0:18 ` [ 056/117] sched/x86: Optimize switch_mm() for multi-threaded workloads Greg Kroah-Hartman
2013-09-25  0:18 ` [ 057/117] ALSA: hda - Re-setup HDMI pin and audio infoframe on stream switches Greg Kroah-Hartman
2013-09-25  0:18 ` [ 058/117] ALSA: hda - hdmi: Fallback to ALSA allocation when selecting CA Greg Kroah-Hartman
2013-09-25  0:18 ` [ 059/117] ALSA: hda - Add Toshiba Satellite C870 to MSI blacklist Greg Kroah-Hartman
2013-09-25  0:18 ` [ 060/117] pinctrl: at91: fix get_pullup/down function return Greg Kroah-Hartman
2013-09-25  0:18 ` [ 061/117] ext4: move test whether extent to map can be extended to one place Greg Kroah-Hartman
2013-09-25  0:18 ` [ 062/117] ext4: fix ext4_writepages() in presence of truncate Greg Kroah-Hartman
2013-09-29 23:07   ` Ben Hutchings
2013-09-29 23:52     ` Dave Jones
2013-09-30  9:23     ` Jan Kara
2013-09-25  0:18 ` [ 063/117] ext4: simplify truncation code in ext4_setattr() Greg Kroah-Hartman
2013-09-25  0:18 ` [ 064/117] mac80211: ignore (E)CSA in probe response frames Greg Kroah-Hartman
2013-09-25  0:18 ` [ 065/117] brcmsmac: Fix WARNING caused by lack of calls to dma_mapping_error() Greg Kroah-Hartman
2013-09-25  0:18 ` [ 066/117] ath9k: always clear ps filter bit on new assoc Greg Kroah-Hartman
2013-09-25  0:18 ` [ 067/117] ath9k: fix rx descriptor related race condition Greg Kroah-Hartman
2013-09-25  0:18 ` [ 068/117] ath9k: avoid accessing MRC registers on single-chain devices Greg Kroah-Hartman
2013-09-25  0:18 ` [ 069/117] net: mvneta: properly disable HW PHY polling and ensure adjust_link() works Greg Kroah-Hartman
2013-09-25  0:18 ` [ 070/117] HID: Correct the USB IDs for the new Macbook Air 6 Greg Kroah-Hartman
2013-09-25  0:18 ` [ 071/117] HID: pantherlord: validate output report details Greg Kroah-Hartman
2013-09-25  0:18 ` [ 072/117] HID: kye: Add report fixup for Genius Gx Imperator Keyboard Greg Kroah-Hartman
2013-09-25  0:18 ` [ 073/117] HID: wiimote: work around broken DRM_KAI on GEN10 Greg Kroah-Hartman
2013-09-25  0:19 ` [ 074/117] HID: Fix Speedlink VAD Cezanne support for some devices Greg Kroah-Hartman
2013-09-25  0:19 ` [ 075/117] HID: sensor-hub: validate feature report details Greg Kroah-Hartman
2013-09-25  0:19 ` [ 076/117] HID: validate HID report id size Greg Kroah-Hartman
2013-09-25  0:19 ` [ 077/117] HID: picolcd_core: validate output report details Greg Kroah-Hartman
2013-09-25  0:19 ` [ 078/117] HID: ntrig: validate feature " Greg Kroah-Hartman
2013-09-25  0:19 ` [ 079/117] HID: picolcd: Prevent NULL pointer dereference on _remove() Greg Kroah-Hartman
2013-09-25  0:19 ` [ 080/117] HID: battery: dont do DMA from stack Greg Kroah-Hartman
2013-09-25  0:19 ` [ 081/117] HID: hidraw: correctly deallocate memory on device disconnect Greg Kroah-Hartman
2013-09-25  0:19 ` [ 082/117] HID: check for NULL field when setting values Greg Kroah-Hartman
2013-09-25  0:19 ` [ 083/117] HID: usbhid: quirk for N-Trig DuoSense Touch Screen Greg Kroah-Hartman
2013-09-25  0:19 ` [ 084/117] media: exynos4-is: Fix fimc-lite bayer formats Greg Kroah-Hartman
2013-09-25  0:19 ` [ 085/117] media: exynos-gsc: Register v4l2 device Greg Kroah-Hartman
2013-09-25  0:19 ` [ 086/117] media: exynos4-is: Fix entity unregistration on error path Greg Kroah-Hartman
2013-09-25  0:19 ` [ 087/117] media: cx88: Fix regression: CX88_AUDIO_WM8775 cant be 0 Greg Kroah-Hartman
2013-09-25  0:19 ` [ 088/117] media: mb86a20s: Fix TS parallel mode Greg Kroah-Hartman
2013-09-25  0:19 ` [ 089/117] media: siano: fix divide error on 0 counters Greg Kroah-Hartman
2013-09-25  0:19 ` [ 090/117] Btrfs: dont allow the replace procedure on read only filesystems Greg Kroah-Hartman
2013-09-25  0:19 ` [ 091/117] uprobes: Fix utask->depth accounting in handle_trampoline() Greg Kroah-Hartman
2013-09-25  0:19 ` [ 092/117] leds: wm831x-status: Request a REG resource Greg Kroah-Hartman
2013-09-25  0:19 ` [ 093/117] MIPS: ath79: Fix ar933x watchdog clock Greg Kroah-Hartman
2013-09-25  0:19 ` [ 094/117] target: Fix >= v3.9+ regression in PR APTPL + ALUA metadata write-out Greg Kroah-Hartman
2013-09-25  0:19 ` [ 095/117] intel-iommu: Fix leaks in pagetable freeing Greg Kroah-Hartman
2013-09-25  0:19 ` [ 096/117] pidns: Fix hang in zap_pid_ns_processes by sending a potentially extra wakeup Greg Kroah-Hartman
2013-09-25  0:19 ` [ 097/117] pidns: fix vfork() after unshare(CLONE_NEWPID) Greg Kroah-Hartman
2013-09-25  0:19 ` [ 098/117] ocfs2: fix the end cluster offset of FIEMAP Greg Kroah-Hartman
2013-09-25  0:19 ` [ 099/117] memcg: fix multiple large threshold notifications Greg Kroah-Hartman
2013-09-25  0:19 ` [ 100/117] mm/huge_memory.c: fix potential NULL pointer dereference Greg Kroah-Hartman
2013-09-25  0:19 ` [ 101/117] proc: Restrict mounting the proc filesystem Greg Kroah-Hartman
2013-09-25  0:19 ` [ 102/117] isofs: Refuse RW mount of the filesystem instead of making it RO Greg Kroah-Hartman
2013-09-25  0:19 ` [ 103/117] amd64_edac: Fix single-channel setups Greg Kroah-Hartman
2013-09-25  0:19 ` [ 104/117] drm/edid: add quirk for Medion MD30217PG Greg Kroah-Hartman
2013-09-25  0:19 ` [ 105/117] um: Implement probe_kernel_read() Greg Kroah-Hartman
2013-09-25  0:19 ` [ 106/117] libceph: unregister request in __map_request failed and nofail == false Greg Kroah-Hartman
2013-09-25  0:19 ` [ 107/117] libceph: use pg_num_mask instead of pgp_num_mask for pg.seed calc Greg Kroah-Hartman
2013-09-25  0:19 ` [ 108/117] ceph: Dont forget the up_read(&osdc->map_sem) if met error Greg Kroah-Hartman
2013-09-25  0:19 ` [ 109/117] rbd: fix I/O error propagation for reads Greg Kroah-Hartman
2013-09-25  0:19 ` [ 110/117] mmc: tmio_mmc_dma: fix PIO fallback on SDHI Greg Kroah-Hartman
2013-09-25  0:19 ` [ 111/117] of: Fix missing memory initialization on FDT unflattening Greg Kroah-Hartman
2013-09-25  0:19 ` [ 112/117] mtd: nand: fix NAND_BUSWIDTH_AUTO for x16 devices Greg Kroah-Hartman
2013-09-25  0:19 ` [ 113/117] clk: wm831x: Initialise wm831x pointer on init Greg Kroah-Hartman
2013-09-25  0:19 ` [ 114/117] fuse: postpone end_page_writeback() in fuse_writepage_locked() Greg Kroah-Hartman
2013-09-25  0:19 ` [ 115/117] fuse: invalidate inode attributes on xattr modification Greg Kroah-Hartman
2013-09-25  0:19 ` [ 116/117] fuse: hotfix truncate_pagecache() issue Greg Kroah-Hartman
2013-09-25  0:19 ` [ 117/117] fuse: readdir: check for slash in names Greg Kroah-Hartman
2013-09-25  4:09 ` [ 000/117] 3.11.2-stable review Guenter Roeck
2013-09-26  1:09   ` Greg Kroah-Hartman
2013-09-26  2:26 ` Shuah Khan
2013-09-26  2:45   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130925001744.776358223@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=bhelgaas@google.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=rjw@sisk.pl \
    --cc=stable@vger.kernel.org \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).