From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751467AbdAOUEk (ORCPT ); Sun, 15 Jan 2017 15:04:40 -0500 Received: from mailout2.hostsharing.net ([83.223.90.233]:47697 "EHLO mailout2.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751270AbdAOUEi (ORCPT ); Sun, 15 Jan 2017 15:04:38 -0500 X-Mailbox-Line: From 14d64f19bc1b1ea67371b8336dca618edddc0b52 Mon Sep 17 00:00:00 2001 Message-Id: <14d64f19bc1b1ea67371b8336dca618edddc0b52.1484486499.git.lukas@wunner.de> In-Reply-To: References: From: Lukas Wunner Date: Sun, 15 Jan 2017 21:03:45 +0100 Subject: [PATCH v5 2/8] PCI: Allow runtime PM on Thunderbolt ports To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Cc: Andreas Noever , linux-pci@vger.kernel.org, linux-pm@vger.kernel.org, Bjorn Helgaas , "Rafael J. Wysocki" , Mika Westerberg Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently PCIe ports are only allowed to go to D3 if the BIOS is dated 2015 or newer to avoid potential issues with old chipsets. However for Thunderbolt we know that even the oldest controller, Light Ridge (2010), is able to suspend its ports to D3 just fine. We're about to add runtime PM for Thunderbolt on the Mac. Apple has released two EFI security updates in 2015 which encompass all machines with Thunderbolt, but the achieved power saving should be made available to users even if they haven't updated their BIOS. To this end, special-case Thunderbolt in pci_bridge_d3_possible(). This allows the Thunderbolt controller to power down but the root port to which the Thunderbolt controller is attached remains in D0 unless the EFI update is installed. Users can pass pcie_port_pm=force on the kernel command line if they cannot install the EFI update but still want to benefit from the additional power saving of putting the root port into D3. In practice, root ports can be suspended to D3 without issues at least on 2012 Ivy Bridge machines. If the BIOS cut-off date is ever lowered to 2010, the Thunderbolt special case can be removed. Cc: Rafael J. Wysocki Cc: Andreas Noever Cc: Tomas Winkler Cc: Amir Levy Reviewed-by: Mika Westerberg Signed-off-by: Lukas Wunner --- drivers/pci/pci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index a881c0d3d2e8..8ed098db82e1 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -2224,7 +2224,7 @@ void pci_config_pm_runtime_put(struct pci_dev *pdev) * @bridge: Bridge to check * * This function checks if it is possible to move the bridge to D3. - * Currently we only allow D3 for recent enough PCIe ports. + * Currently we only allow D3 for recent enough PCIe ports and Thunderbolt. */ bool pci_bridge_d3_possible(struct pci_dev *bridge) { @@ -2258,6 +2258,11 @@ bool pci_bridge_d3_possible(struct pci_dev *bridge) year >= 2015) { return true; } + + /* Even the oldest 2010 Thunderbolt controller supports D3. */ + if (bridge->is_thunderbolt) + return true; + break; } -- 2.11.0