From patchwork Tue Jan 24 20:23:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 9535833 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3B3FF6046A for ; Tue, 24 Jan 2017 20:23:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D32B26B41 for ; Tue, 24 Jan 2017 20:23:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1028A26E1A; Tue, 24 Jan 2017 20:23:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D0BB26B41 for ; Tue, 24 Jan 2017 20:23:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750715AbdAXUXG (ORCPT ); Tue, 24 Jan 2017 15:23:06 -0500 Received: from mail.kernel.org ([198.145.29.136]:36144 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750713AbdAXUXG (ORCPT ); Tue, 24 Jan 2017 15:23:06 -0500 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4E5C020421; Tue, 24 Jan 2017 20:23:04 +0000 (UTC) Received: from localhost (unknown [69.55.156.165]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EBE1C2021F; Tue, 24 Jan 2017 20:23:02 +0000 (UTC) Subject: [PATCH] PCI/ASPM: Allow drivers to disable ASPM even without OS ASPM control From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: Mathias Koehrer , Emmanuel Grumbach , Sebastian Andrzej Siewior , Julia Cartwright , Joe Lawrence , linux-kernel@vger.kernel.org, Matthew Garrett , Jeff Kirsher , Colin Ian King , Myron Stowe Date: Tue, 24 Jan 2017 14:23:01 -0600 Message-ID: <20170124202301.20248.7452.stgit@bhelgaas-glaptop.roam.corp.google.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The ACPI FADT has a "PCIe ASPM Controls" bit (ACPI 5.0, sec 5.2.9.3), which means "If set, indicates to OSPM that it must not enable ASPM control on this platform." We have historically interpreted that to mean that the OS should not touch ASPM configuration at all: we leave it as the firmware configured it. However, a driver may know that its device has issues with ASPM and should not have it enabled. The platform firmware, which cannot be expected to know this, may have enabled ASPM. The driver should be able to use pci_disable_link_state() to disable ASPM for its device, even if the firmware set the ACPI_FADT_NO_ASPM bit. Remove the check that prevents pci_disable_link_state() from disabling ASPM for a device. In cases where we previously emitted a message like this and did nothing: e1000e 0000:03:00.0: can't disable ASPM; OS doesn't have ASPM control we'll instead actually disable ASPM on the device. Link: https://bugzilla.kernel.org/show_bug.cgi?id=189951 Reported-by: Mathias Koehrer Signed-off-by: Bjorn Helgaas CC: Matthew Garrett CC: stable@vger.kernel.org --- drivers/pci/pcie/aspm.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 17ac1dce3286..9253ae48d777 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -736,18 +736,10 @@ static void __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) if (!parent || !parent->link_state) return; - /* - * A driver requested that ASPM be disabled on this device, but - * if we don't have permission to manage ASPM (e.g., on ACPI - * systems we have to observe the FADT ACPI_FADT_NO_ASPM bit and - * the _OSC method), we can't honor that request. Windows has - * a similar mechanism using "PciASPMOptOut", which is also - * ignored in this situation. - */ - if (aspm_disabled) { - dev_warn(&pdev->dev, "can't disable ASPM; OS doesn't have ASPM control\n"); - return; - } + dev_info(&pdev->dev, "disabling %sASPM%s%s\n", + (state & PCIE_LINK_STATE_CLKPM) ? "Clock PM " : "", + (state & PCIE_LINK_STATE_L0S) ? " L0s" : "", + (state & PCIE_LINK_STATE_L1) ? " L1" : ""); if (sem) down_read(&pci_bus_sem);