From patchwork Fri May 13 11:15:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Wunner X-Patchwork-Id: 9090551 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9DFBB9F441 for ; Fri, 13 May 2016 11:17:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C8C4B2021A for ; Fri, 13 May 2016 11:17:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 17F902024C for ; Fri, 13 May 2016 11:17:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752157AbcEMLRZ (ORCPT ); Fri, 13 May 2016 07:17:25 -0400 Received: from mailout1.hostsharing.net ([83.223.95.204]:33094 "EHLO mailout1.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751741AbcEMLRY (ORCPT ); Fri, 13 May 2016 07:17:24 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mailout1.hostsharing.net (Postfix) with ESMTPS id 26C941039814F; Fri, 13 May 2016 13:17:23 +0200 (CEST) Received: from localhost (6-38-90-81.adsl.cmo.de [81.90.38.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by h08.hostsharing.net (Postfix) with ESMTPSA id 14CA9603E03D; Fri, 13 May 2016 13:17:21 +0200 (CEST) X-Mailbox-Line: From 47f9e4a9ca09e854d2d01812a4c05b7c6df02259 Mon Sep 17 00:00:00 2001 Message-Id: <47f9e4a9ca09e854d2d01812a4c05b7c6df02259.1463134231.git.lukas@wunner.de> In-Reply-To: References: From: Lukas Wunner Date: Fri, 13 May 2016 13:15:31 +0200 Subject: [PATCH v2 08/13] PCI: Allow runtime PM for Thunderbolt hotplug ports on Macs To: linux-pci@vger.kernel.org, linux-pm@vger.kernel.org Cc: Andreas Noever Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Thunderbolt controllers have a pin to signal plug events while the controller is powered down. On Macs this pin is wired to the southbridge and causes a GPE to be fired. The OS may then power up the controller to probe the newly connected device. It is thus okay to let Thunderbolt hotplug ports go to D3 on Macs. Signed-off-by: Lukas Wunner --- drivers/pci/pcie/portdrv_pci.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index f75d4b5..7860ab3 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c @@ -224,9 +224,12 @@ static int pcie_portdrv_probe(struct pci_dev *dev, * to enumerate devices behind this port properly (the port is * powered down preventing all config space accesses to the * subordinate devices). We can't be sure for native PCIe hotplug - * either so prevent that as well. + * either so prevent that as well. However Thunderbolt controllers + * on Macs are capable of side-band signaling plug events while + * powered down, so allow them to suspend. */ - if (!dev->is_hotplug_bridge) { + if (!dev->is_hotplug_bridge || + (dev->is_thunderbolt && dmi_match(DMI_SYS_VENDOR, "Apple Inc."))) { /* * Keep the port resumed 10ms to make sure things like * config space accesses from userspace (lspci) will not @@ -243,7 +246,8 @@ static int pcie_portdrv_probe(struct pci_dev *dev, static void pcie_portdrv_remove(struct pci_dev *dev) { - if (!dev->is_hotplug_bridge) { + if (!dev->is_hotplug_bridge || + (dev->is_thunderbolt && dmi_match(DMI_SYS_VENDOR, "Apple Inc."))) { pm_runtime_forbid(&dev->dev); pm_runtime_get_noresume(&dev->dev); pm_runtime_dont_use_autosuspend(&dev->dev);