From patchwork Mon May 1 12:06:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Wunner X-Patchwork-Id: 757149 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3wGjt63Nl3z9s2G for ; Mon, 1 May 2017 22:10:22 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423978AbdEAMKV (ORCPT ); Mon, 1 May 2017 08:10:21 -0400 Received: from mailout1.hostsharing.net ([83.223.95.204]:49605 "EHLO mailout1.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1165096AbdEAMKV (ORCPT ); Mon, 1 May 2017 08:10:21 -0400 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 mailout1.hostsharing.net (Postfix) with ESMTPS id D1AB41019265C; Mon, 1 May 2017 14:09:08 +0200 (CEST) Received: from localhost (5-38-90-81.adsl.cmo.de [81.90.38.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by h08.hostsharing.net (Postfix) with ESMTPSA id 17D98603E052; Mon, 1 May 2017 14:10:18 +0200 (CEST) X-Mailbox-Line: From 6535c2f2caaa88fc7e0be14884c816b58ec1c674 Mon Sep 17 00:00:00 2001 Message-Id: <6535c2f2caaa88fc7e0be14884c816b58ec1c674.1493631639.git.lukas@wunner.de> In-Reply-To: References: From: Lukas Wunner Date: Mon, 1 May 2017 14:06:39 +0200 Subject: [PATCH 4/5] PCI: pciehp: Remain in D0 if poll mode is enabled To: Bjorn Helgaas , linux-pci@vger.kernel.org, Ashok Raj , Yinghai Lu Cc: "Rafael J. Wysocki" , Mika Westerberg , Erik Veijola , Keith Busch , Krishna Dhulipala , Wei Zhang Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The slot status is polled from a timer, i.e. in softirq context, and pm_runtime_get_sync() may sleep. Hence it's not an option to runtime resume the port whenever its slot status is polled. It would also be silly to continuously switch back and forth between D0 and D3hot, so keep it runtime active if poll mode is enabled. Cc: Rafael J. Wysocki Cc: Mika Westerberg Cc: Erik Veijola Cc: Ashok Raj Cc: Keith Busch Cc: Yinghai Lu Cc: Krishna Dhulipala Cc: Wei Zhang Signed-off-by: Lukas Wunner --- drivers/pci/hotplug/pciehp_hpc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 70dd9ae4c097..20170bcf9862 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -86,6 +86,7 @@ static inline int pciehp_request_irq(struct controller *ctrl) if (pciehp_poll_mode) { init_timer(&ctrl->poll_timer); start_int_poll_timer(ctrl, 10); + pm_runtime_get(&ctrl->pcie->port->dev); return 0; } @@ -99,9 +100,10 @@ static inline int pciehp_request_irq(struct controller *ctrl) static inline void pciehp_free_irq(struct controller *ctrl) { - if (pciehp_poll_mode) + if (pciehp_poll_mode) { del_timer_sync(&ctrl->poll_timer); - else + pm_runtime_put(&ctrl->pcie->port->dev); + } else free_irq(ctrl->pcie->irq, ctrl); }