From patchwork Tue Jun 14 09:08:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Wunner X-Patchwork-Id: 9175263 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 ECFF86048C for ; Tue, 14 Jun 2016 09:08:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD7931FE7B for ; Tue, 14 Jun 2016 09:08:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D25B22824A; Tue, 14 Jun 2016 09:08:28 +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=unavailable 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 8CBC628236 for ; Tue, 14 Jun 2016 09:08:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751901AbcFNJIZ (ORCPT ); Tue, 14 Jun 2016 05:08:25 -0400 Received: from mailout3.hostsharing.net ([176.9.242.54]:54419 "EHLO mailout3.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751834AbcFNJIY (ORCPT ); Tue, 14 Jun 2016 05:08: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 mailout3.hostsharing.net (Postfix) with ESMTPS id 55015101E366B; Tue, 14 Jun 2016 11:08:21 +0200 (CEST) Received: from localhost (4-38-90-81.adsl.cmo.de [81.90.38.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by h08.hostsharing.net (Postfix) with ESMTPSA id 2C202604CCF0; Tue, 14 Jun 2016 11:08:19 +0200 (CEST) X-Mailbox-Line: From cb74f780fd66e499aff6e6e229d58f03318810c4 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: <47f9e4a9ca09e854d2d01812a4c05b7c6df02259.1463134231.git.lukas@wunner.de> References: <47f9e4a9ca09e854d2d01812a4c05b7c6df02259.1463134231.git.lukas@wunner.de> From: Lukas Wunner Date: Tue, 14 Jun 2016 11:08:49 +0200 Subject: [PATCH v2 08/13 REBASED] 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-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 dc73a54..08761b8 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 100ms to make sure things like * config space accesses from userspace (lspci) will not @@ -244,7 +247,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);