From patchwork Wed Aug 30 14:24:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Glauber X-Patchwork-Id: 9929787 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 88EA560309 for ; Wed, 30 Aug 2017 14:27:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B2B228681 for ; Wed, 30 Aug 2017 14:27:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FAA828686; Wed, 30 Aug 2017 14:27:42 +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=-2.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 01BE128681 for ; Wed, 30 Aug 2017 14:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=vLdvbyzfhWJAkt35Y2sqsm7z7sRhMVc+4FsNEO79X0U=; b=X+A5+l4gvbzYvPO9tkFPpSPSsI n1Q9RehepOL+7qLNF9HIJHiCQjrKkERZXMMZyMRzDhryyRxMfdLwU69uLbJo3cSQDF7fTf40Nlx7G k7pCQyUtuH0hmixk8DPfXtbutWjFPKca5pEd7OLQLuIOIl3Wo0LoZ6ZoImiFNqIoYTfSuKCHJ4Ku4 NW7JCDzwoHmHIai9VMQSF4fOyR8Tky3Fc+H0GZZd07Pkb0qTih34T4/kPhZiXhegu640/UmVsXWyT AoNaBUN2xpz1nYXJuK+Vp4v5RpfjkMTO1Kh84tcgjSLGCsb/9fPQ1vyMhEoMVrLMH5/LbiI+1McSA o/qMjb2A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dn3xt-0000CF-O5; Wed, 30 Aug 2017 14:27:33 +0000 Received: from mail-wm0-f66.google.com ([74.125.82.66]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dn3vw-0005Xi-1d for linux-arm-kernel@lists.infradead.org; Wed, 30 Aug 2017 14:25:44 +0000 Received: by mail-wm0-f66.google.com with SMTP id i76so1969184wme.3 for ; Wed, 30 Aug 2017 07:25:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qaphwBHb+zU3ev3NVN7TOSSreMynoGbonAUKptoAR3s=; b=eqf5wf2Ru8jZsc9nA+pHdy8pbOQGrzvS4WUStMH9T9HvNwBHGZ04HU9zYnAAssBN20 Sy2kFNzMmpGcR+UoyGmYk9VSrQxY0O4onAcWxlc2ECwRDf6NFErXRTv1rM/zbAkOAELg +E8rRnmUgAKsDAQNC2en9VnCAdQXmILyZYr3i3tM7QljWpEPbsjDOi/kqPL1lBjNCUKd xoQhVNbKcFuoSSml3rVNqwtkmvIyiBdeB8J2LloS1A2geIL92cVkDXa0iGQfe8jbzGZV EDoOMFScWu1DJL4nLcrYKaw07WoPBijFWjXCn3hMV+ctHNQi2B9q+vI3WxthzcD8aFoH wa6Q== X-Gm-Message-State: AHYfb5jFX/zBMDSzKz6mXKUvoVVnBhVLKoU5DxNGSbWEahUAD46QhFM0 y8THU2WYbVCuag== X-Received: by 10.28.157.19 with SMTP id g19mr1312673wme.42.1504103109598; Wed, 30 Aug 2017 07:25:09 -0700 (PDT) Received: from hc.fritz.box (HSI-KBW-46-223-66-184.hsi.kabel-badenwuerttemberg.de. [46.223.66.184]) by smtp.gmail.com with ESMTPSA id p105sm97012wrc.64.2017.08.30.07.25.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Aug 2017 07:25:09 -0700 (PDT) From: Jan Glauber To: Bjorn Helgaas Subject: [PATCH v3 1/3] PCI: Allow PCI_DEV_FLAGS_NO_BUS_RESET to be used on bus device Date: Wed, 30 Aug 2017 16:24:52 +0200 Message-Id: <20170830142454.10971-2-jglauber@cavium.com> X-Mailer: git-send-email 2.9.0.rc0.21.g7777322 In-Reply-To: <20170830142454.10971-1-jglauber@cavium.com> References: <20170830142454.10971-1-jglauber@cavium.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170830_072532_778374_714D6B6C X-CRM114-Status: GOOD ( 10.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, david.daney@cavium.com, linux-pci@vger.kernel.org, Jan Glauber , Robert Richter , linux-kernel@vger.kernel.org, Alex Williamson , Jon Masters , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: David Daney When checking to see if a PCI bus can safely be reset, we check to see if any of the children have their PCI_DEV_FLAGS_NO_BUS_RESET flag set. As these devices are known not to behave well after a bus reset. Some PCIe root port bridges also do not behave well after a bus reset, sometimes causing the devices behind the bridge to become unusable. Add a check for the PCI_DEV_FLAGS_NO_BUS_RESET flag being set in the bridge device to allow these bridges to be flagged, and prevent their buses from being reset. A follow on patch will add a quirk for this type of bridge. Signed-off-by: David Daney [jglauber@cavium.com: fixed typo] Signed-off-by: Jan Glauber --- drivers/pci/pci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index af0cc34..d9abbc9 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -4290,6 +4290,10 @@ static bool pci_bus_resetable(struct pci_bus *bus) { struct pci_dev *dev; + + if (bus->self && (bus->self->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET)) + return false; + list_for_each_entry(dev, &bus->devices, bus_list) { if (dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET || (dev->subordinate && !pci_bus_resetable(dev->subordinate)))