From patchwork Mon Apr 25 09:53:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Westerberg X-Patchwork-Id: 8924921 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 A2A919F66C for ; Mon, 25 Apr 2016 09:53:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BF7C4200E7 for ; Mon, 25 Apr 2016 09:53:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A38C5201E4 for ; Mon, 25 Apr 2016 09:53:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754235AbcDYJxb (ORCPT ); Mon, 25 Apr 2016 05:53:31 -0400 Received: from mga14.intel.com ([192.55.52.115]:55193 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752383AbcDYJxa (ORCPT ); Mon, 25 Apr 2016 05:53:30 -0400 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP; 25 Apr 2016 02:53:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,532,1455004800"; d="scan'208";a="91363014" Received: from black.fi.intel.com ([10.237.72.93]) by fmsmga004.fm.intel.com with ESMTP; 25 Apr 2016 02:53:26 -0700 Received: by black.fi.intel.com (Postfix, from userid 1001) id B40E11AA; Mon, 25 Apr 2016 12:53:24 +0300 (EEST) From: Mika Westerberg To: Bjorn Helgaas , "Rafael J. Wysocki" Cc: Qipeng Zha , Qi Zheng , Dave Airlie , Mathias Nyman , Greg Kroah-Hartman , Lukas Wunner , Andreas Noever , Mika Westerberg , linux-pci@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v4 3/4] ACPI / hotplug / PCI: Runtime resume bridge before rescan Date: Mon, 25 Apr 2016 12:53:23 +0300 Message-Id: <1461578004-129094-4-git-send-email-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 2.8.0.rc3 In-Reply-To: <1461578004-129094-1-git-send-email-mika.westerberg@linux.intel.com> References: <1461578004-129094-1-git-send-email-mika.westerberg@linux.intel.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.9 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 If a PCI bridge (or PCIe port) that is runtime suspended gets an ACPI hotplug event, such as BUS_CHECK we need to make sure it is resumed before devices below the bridge are re-scanned. Otherwise the devices behind the port are not accessible and will be treated as hot-unplugged. To fix this, resume PCI bridges from runtime suspend while rescanning. Signed-off-by: Mika Westerberg Acked-by: Rafael J. Wysocki --- drivers/pci/hotplug/acpiphp_glue.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index fa49f9143b80..d64ce8aa99b3 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -756,8 +756,10 @@ static void hotplug_event(u32 type, struct acpiphp_context *context) acpi_lock_hp_context(); bridge = context->bridge; - if (bridge) + if (bridge) { get_bridge(bridge); + pm_runtime_get_sync(&bridge->pci_dev->dev); + } acpi_unlock_hp_context(); @@ -797,8 +799,10 @@ static void hotplug_event(u32 type, struct acpiphp_context *context) } pci_unlock_rescan_remove(); - if (bridge) + if (bridge) { + pm_runtime_put(&bridge->pci_dev->dev); put_bridge(bridge); + } } static int acpiphp_hotplug_notify(struct acpi_device *adev, u32 type)