From patchwork Sun Jan 8 08:41:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Wunner X-Patchwork-Id: 9503341 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 583D660710 for ; Sun, 8 Jan 2017 08:42:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 452702621D for ; Sun, 8 Jan 2017 08:42:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34D1D282ED; Sun, 8 Jan 2017 08:42:41 +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,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 BF9B328210 for ; Sun, 8 Jan 2017 08:42:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S942034AbdAHImi (ORCPT ); Sun, 8 Jan 2017 03:42:38 -0500 Received: from mailout3.hostsharing.net ([176.9.242.54]:51385 "EHLO mailout3.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933387AbdAHIme (ORCPT ); Sun, 8 Jan 2017 03:42:34 -0500 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mailout3.hostsharing.net (Postfix) with ESMTPS id 0FDEC100B0049; Sun, 8 Jan 2017 09:42:33 +0100 (CET) Received: from localhost (3-38-90-81.adsl.cmo.de [81.90.38.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by h08.hostsharing.net (Postfix) with ESMTPSA id 8C8CA6042B93; Sun, 8 Jan 2017 09:42:31 +0100 (CET) X-Mailbox-Line: From 7ddaaa371101208db7b8bc4dcc2f44c056645923 Mon Sep 17 00:00:00 2001 Message-Id: <7ddaaa371101208db7b8bc4dcc2f44c056645923.1483806825.git.lukas@wunner.de> In-Reply-To: References: From: Lukas Wunner Date: Sun, 8 Jan 2017 09:41:45 +0100 Subject: [PATCH v4 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, Chen Yu , Tomas Winkler , Amir Levy , Bjorn Helgaas , Mika Westerberg , "Rafael J. Wysocki" Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: Mika Westerberg Cc: Rafael J. Wysocki Cc: Andreas Noever Cc: Tomas Winkler Cc: Amir Levy Signed-off-by: Lukas Wunner Reviewed-by: Mika Westerberg --- 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 a881c0d..8ed098d 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; }