From patchwork Fri Sep 16 20:06:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 9336611 X-Patchwork-Delegate: bhelgaas@google.com 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 01F466089F for ; Fri, 16 Sep 2016 20:07:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6D8A2A001 for ; Fri, 16 Sep 2016 20:07:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DBC6F2A094; Fri, 16 Sep 2016 20:07:01 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 8D8262A091 for ; Fri, 16 Sep 2016 20:07:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965457AbcIPUG6 (ORCPT ); Fri, 16 Sep 2016 16:06:58 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:46763 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965392AbcIPUGu (ORCPT ); Fri, 16 Sep 2016 16:06:50 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 6AE98617C4; Fri, 16 Sep 2016 20:06:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1474056409; bh=Z6HGsYdZc7fz6O/3A/IPixxulGoiaTd5aSwCsnUP4Cg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iuGQAOsX3XdutaSXCPFdqv0MZpdK/WOFbPSNDabYqvyJMdfR42fo4j5AKCwUeqMAU THY/wMD7IEUQjBllaykyVbwP0n3ijtO0mh+iPVhfLfgeiKk8TR1Icaw6b3NCRa2126 Z2yRWjURqW23lrOodPYOwrUJWYfjwwdUuFa7PuvQ= Received: from drakthul.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id CEBAE61817; Fri, 16 Sep 2016 20:06:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1474056408; bh=Z6HGsYdZc7fz6O/3A/IPixxulGoiaTd5aSwCsnUP4Cg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A2FS/+2zx9xY/kurWukCr1h9r3C/2FvDGTtuSHm7wDKyin5M1eaMUJhRzM2kE/8gs jfndhw/hAXRt2x5KOXOeA5k9IFuQoHMKuYfQW4p6bDaKQZuZJBe0Wc45+nWpqYjerT yLwd1tPpBYXxaaFf7cM343ox4hpknuajztCc+nPk= DMARC-Filter: OpenDMARC Filter v1.3.1 smtp.codeaurora.org CEBAE61817 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=pass smtp.mailfrom=okaya@codeaurora.org From: Sinan Kaya To: linux-pci@vger.kernel.org, timur@codeaurora.org, cov@codeaurora.org, alex.williamson@redhat.com, vikrams@codeaurora.org Cc: linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sinan Kaya , linux-kernel@vger.kernel.org Subject: [PATCH V2 3/5] PCI: save and restore bus on parent bus reset Date: Fri, 16 Sep 2016 16:06:32 -0400 Message-Id: <1474056395-21843-4-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1474056395-21843-1-git-send-email-okaya@codeaurora.org> References: <1474056395-21843-1-git-send-email-okaya@codeaurora.org> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Device states on the bus are saved and restored for all bus resets except the one initiated through pci_dev_reset. Filling the hole. Signed-off-by: Sinan Kaya --- drivers/pci/pci.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index aab9d51..8aecab1 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -51,6 +51,10 @@ static void pci_pme_list_scan(struct work_struct *work); static LIST_HEAD(pci_pme_list); static DEFINE_MUTEX(pci_pme_list_mutex); static DECLARE_DELAYED_WORK(pci_pme_work, pci_pme_list_scan); +static void pci_dev_lock(struct pci_dev *dev); +static void pci_dev_unlock(struct pci_dev *dev); +static void pci_bus_save_and_disable(struct pci_bus *bus); +static void pci_bus_restore(struct pci_bus *bus); struct pci_pme_device { struct list_head list; @@ -3888,8 +3892,18 @@ static int pci_parent_bus_reset(struct pci_dev *dev, int probe) if (probe) return 0; + if (!probe) { + pci_dev_unlock(dev); + pci_bus_save_and_disable(dev->bus); + } + pci_reset_bridge_secondary_bus(dev->bus->self); + if (!probe) { + pci_bus_restore(dev->bus); + pci_dev_lock(dev); + } + return 0; }