From patchwork Tue May 16 00:17:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 9728227 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 08E6E60386 for ; Tue, 16 May 2017 00:18:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3724289D8 for ; Tue, 16 May 2017 00:18:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7DAE289DD; Tue, 16 May 2017 00:18:19 +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,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI 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 7C43D289D8 for ; Tue, 16 May 2017 00:18:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753336AbdEPASQ (ORCPT ); Mon, 15 May 2017 20:18:16 -0400 Received: from mail-dm3nam03on0082.outbound.protection.outlook.com ([104.47.41.82]:49888 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753363AbdEPARt (ORCPT ); Mon, 15 May 2017 20:17:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=49s1xi3eJikr+vjPNt5E3Jt7LkmdbWcTU0UXsA9zUY8=; b=B5W2qesvqCuHURE/66dQeMu5rNtb8HJFZuOK8XJd/x/B+2sRsljrAmdUl3usAC6faoaXWo1kyMJTJg4kVEeafTkheJMqhW8GIGAww9ZYeM4lw40RbK4HOA3khnnVv9wwq2P/CGJ9omMQbVkEtNO1LZru6yesA2D+riEQWmLVC98= Authentication-Results: google.com; dkim=none (message not signed) header.d=none; google.com; dmarc=none action=none header.from=cavium.com; Received: from ddl.caveonetworks.com (50.233.148.156) by MWHPR07MB3501.namprd07.prod.outlook.com (10.164.192.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1084.16; Tue, 16 May 2017 00:17:45 +0000 From: David Daney To: Bjorn Helgaas , linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jon Masters , Robert Richter , David Daney Subject: [PATCH 1/2] PCI: Allow PCI_DEV_FLAGS_NO_BUS_RESET to be used on bus device. Date: Mon, 15 May 2017 17:17:35 -0700 Message-Id: <20170516001736.4001-2-david.daney@cavium.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170516001736.4001-1-david.daney@cavium.com> References: <20170516001736.4001-1-david.daney@cavium.com> MIME-Version: 1.0 X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: SN1PR0701CA0062.namprd07.prod.outlook.com (10.163.126.30) To MWHPR07MB3501.namprd07.prod.outlook.com (10.164.192.28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9bd26159-6c99-4e7f-d0ba-08d49bf0fa7c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:MWHPR07MB3501; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3501; 3:hjc8bb/A8ppRvU4gHA/2tesaJm1DOjraLzdDkPCieO5CIi2Yx9DOtQApHGBsSuLV8BGNsbKnY7tSY0ISU7iVb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h+1Sp3rhReiT7hKaN+Cc+6200EhnqZ+WaIQ0SwTP522m0/eKjyjQ3F+CZKHOkVfJnKav+qf9La/6LaOClVq+a6eDdUrmDazmWfjulmcegm5wHjrGMbnSVyWBBzTYVDjYwARlAT0EihESfS7Hngo0xxuWXiVh5/3NLpkb3kiQoUONF3tYZ0j89h0XQEC1BfK/I3gPLsYf+H9TS7JpCv0NYl8aXs55+cVZbzxYXANx72mw1iBeY/FzCVP4tKAJCoqFp4TK07Zr+auTLA0+oh7bVZsWJa2bsgTwFzu5/RDp0QWqTdg0QxdHcmFQDdQx7L/zzKhDqEeBBjas7Tsx9PNKZk04NNOR7JmIwaPD9CFWGrSXCktRBIxz7/aSzaqp72L7uzewjc98DneAgpd5R1vCOT/Z+IJDLZhuhGHZnPKZsn/AmJWWmlnTfgGSEYqeoqCr2vOX59aZvYpC1vbPvwsu0PBCWkvj X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(6041248)(20161123558100)(20161123560025)(20161123555025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(6072148); SRVR:MWHPR07MB3501; BCL:0; PCL:0; RULEID:; SRVR:MWHPR07MB3501; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3501; 4:eV0Hhej0oRoSadMU7i+rZvYGZh1mIymvv5NNO2skaw2fJD/032ieRrRpnoIJ4FZTp77Sy9g1iYSQJrl0VwNjTfn2xT2G4Z3A01F+x/SojIb/SuQyfP73cn+mpw8V8T//jasQ5dmoXXBBPsSjbnPDlIO2/BZfAtPCJMu7NEP8Y6zg7G+LVyfJG98Gz5fhu0gFtmaEUF+JEZPvThpeF9ueC9JvU572t5L1GYXM8B3iRDQuvtKOw2PzcwCn5NvD7brCrgEshvXDtsSGmK3GenE8sPvrJDDQ4xElx7BpoxJj6BuE8CrKxnx6o9KKc27O3YCQm5Jtm9L1d6Fi5UdXRmjSxS7kGBqC/O3vKTyJoaRrBm6O7H/KZnPgS3QFJtpYnIA2TNtg9K5p13d5F/jbMHn9INJMptZ/nCz6q9W3CDPduwA7S3yDw7wwMefk3HgbWgeOuYTK+6p1jIZjoiT/knjjMb3Cm4BfPrNgv/DDhz9tOkn7MyULHV43mu2IjQbZqhDl1VnVO2zASa3wos3IR9uJW9LGJiUK6t2hlSYsO0Qv1KJ2XHBWjgVXg3lasAwBHvmYE8tDdg8O8Ti3oH7rvIL4l4O666S28HV89Qet63/fQzbg1dJ+I2bwSf66YrBrVRQzJ0tNTa2/WlR5HyJ4OBd3Rmq7qx8pDAoUnQV24Y+ITeM2vQZTtn7Q8Qq86eVXH26FOuX/B7r1EF9WkBBYj1q92k+GiuyqL3iiiAeRIf+eREfVWHCpuQfYiqmsbNIiobgF2YyKIQZEXzdq26R3elAG2mYGu4Dgic/uSVDOvjopQLI= X-Forefront-PRVS: 03094A4065 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(39840400002)(39400400002)(39410400002)(39850400002)(50226002)(81166006)(25786009)(8676002)(5003940100001)(33646002)(76176999)(50986999)(53416004)(189998001)(6486002)(53936002)(2906002)(6512007)(2950100002)(6666003)(42186005)(110136004)(107886003)(38730400002)(5660300001)(305945005)(7736002)(4326008)(86362001)(47776003)(478600001)(66066001)(1076002)(3846002)(6116002)(54906002)(72206003)(36756003)(50466002)(6506006); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3501; H:ddl.caveonetworks.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR07MB3501; 23:Y8AaAvJbzYspJxamNjRtNpW5DPthipi3wrb+L3kTd?= =?us-ascii?Q?MxbbtfFkgip8QLUjITXF+BaiLDHPKBg/qu0x1G/dGFnvHlf/PkPkk03nVJMm?= =?us-asc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501; 7:4Reuav2qEeklvUjmY/yFGAaPkGYe9U2eyUyIkfD3j030GdlMmnhIb7QtP1la/7PeZiWw9fX+no8TPfHowyncjitl+yFpsUXcqWdxa+pGzycn57uFBU8tltLnJZujX35LSDXTXeRkIa8kyKnwdJ/fdkcC2ox9UmUH4JwmHZHVkLtqAp4dBAGl+zhIMM9rLzn57A81TtuFQvjIZOSfVQeD2PRXm2pd5O86uv/sMDNGLKEoZEmuuV13+1aBdMxA3LhctkHSfHtKnufK1oo/jNToPA4I78bxJSeHjhp9t6u6fwB52eCZPEzNDTd41I+ykUSZwy5pe2XMPqj2+jQRP1PXLA== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2017 00:17:45.5217 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3501 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 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 know 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 --- drivers/pci/pci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index b01bd5b..b64e4d1 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -4318,6 +4318,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)))