From patchwork Fri Sep 8 08:10:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Glauber X-Patchwork-Id: 9943393 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 71E296034B for ; Fri, 8 Sep 2017 08:12:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62DD828550 for ; Fri, 8 Sep 2017 08:12:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5764728567; Fri, 8 Sep 2017 08:12:38 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED 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 CFFC228550 for ; Fri, 8 Sep 2017 08:12:37 +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=eupSuRmRGcqemKWxbIHpaY6G8J1/1tSsc3is5aruvJc=; b=tGVWm9Qky2fngaDG1pTRXIPKnC xtFC/5ODvOOiSppkPPRVOylTa1ibyZ4u/XFoTjqMWBNUOqHubBkCJmo7LRQltFvSuvBvuUyoB2bzc xCofTcZEb7M5EGRrkqCCapvVJiHAQZq5m/uJUQ/Wkj2p4/t2J6I9q74auJWAQHAvTHoSV+mOnMBiR B31J7KoOprrPj3SjIC9/+7Rhj0JGmSbRclMyJ8roaeaU1zoHN723sy2F7hDEhRQa0cKffxeN+G1al Vur1uQjAUXBsDYUQ/V09O/nTGsvXyvl6AW/KAOmZBwjnbBtDlE8VBWZR+9tElE/v553XCZCG9k62N 1vZEr0NA==; 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 1dqEOf-0003wC-8T; Fri, 08 Sep 2017 08:12:17 +0000 Received: from mail-wr0-f196.google.com ([209.85.128.196]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dqENg-0002yu-VA for linux-arm-kernel@lists.infradead.org; Fri, 08 Sep 2017 08:11:20 +0000 Received: by mail-wr0-f196.google.com with SMTP id p37so881805wrb.5 for ; Fri, 08 Sep 2017 01:10:56 -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=5OTDzmflPp/CT2VkRWR63Gn1g2nSBvk6jKRetKEFMEk=; b=hZwEPiJSwsncxXJEW69kVWHFnuzgnmMXyze9zub0nkuOhbrmFcAMmfpMsOnim8bYV0 07kjVDiFH1sCbbqBbHHFAkbEQ6D3wBepCe4YqZTnyKCuw9i7zYExOq6pbhKfu85cL7bv cvgB3JNTRsTHPbizeYjTSzHvxfY+R5kkbFQUig70ls0qzYV3AGRIsi0JlY9fHpI0obU/ FRfv7BpNpWtgh0rEOGdB+HsQnQk0DwPBDUaIRFseeISdwIoheoLH6a5XFmvWcTL3kz1j J39l8S+LuTJBkSGunjZPI3VEACm9R9HOffqgue92nRH6UK2XfvG4/208P9kphqfwbjpB MCUg== X-Gm-Message-State: AHPjjUh6dgqZGDeOHP5bLs7rulbqYpzS3dm8/IS198Uo5bKCBJk3WGNl vL3hGYdlhZnF/Q== X-Google-Smtp-Source: ADKCNb4fibfE2e+smADfbTGmDs5flxwuLfrydbez7375NSOgW+Svw5N/aEd9NLMdk9aVS/tIbtAELw== X-Received: by 10.223.164.13 with SMTP id d13mr1361346wra.48.1504858255146; Fri, 08 Sep 2017 01:10:55 -0700 (PDT) Received: from hc.fritz.box (HSI-KBW-46-223-156-13.hsi.kabel-badenwuerttemberg.de. [46.223.156.13]) by smtp.gmail.com with ESMTPSA id r14sm1600805wra.97.2017.09.08.01.10.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Sep 2017 01:10:54 -0700 (PDT) From: Jan Glauber To: Bjorn Helgaas Subject: [PATCH v4 3/3] PCI: Avoid slot reset if bus reset is not possible Date: Fri, 8 Sep 2017 10:10:33 +0200 Message-Id: <20170908081033.3025-4-jglauber@cavium.com> X-Mailer: git-send-email 2.9.0.rc0.21.g7777322 In-Reply-To: <20170908081033.3025-1-jglauber@cavium.com> References: <20170908081033.3025-1-jglauber@cavium.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170908_011117_273414_BB10FD61 X-CRM114-Status: UNSURE ( 9.79 ) X-CRM114-Notice: Please train this message. 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 When checking to see if a PCI slot can safely be reset, we check to see if any of the children have their PCI_DEV_FLAGS_NO_BUS_RESET flag set. Some PCIe root port bridges do not behave well after a slot reset, and may cause the device in the slot to become unusable. Add a check for the PCI_DEV_FLAGS_NO_BUS_RESET flag being set in the bridge device to prevent the slot from being reset. 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 b2a46ca7f133..45a086fc3592 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -4393,6 +4393,10 @@ static bool pci_slot_resetable(struct pci_slot *slot) { struct pci_dev *dev; + if (slot->bus->self && + (slot->bus->self->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET)) + return false; + list_for_each_entry(dev, &slot->bus->devices, bus_list) { if (!dev->slot || dev->slot != slot) continue;