From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DACAC43463 for ; Mon, 21 Sep 2020 11:15:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 025AF207BC for ; Mon, 21 Sep 2020 11:15:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726606AbgIULPj (ORCPT ); Mon, 21 Sep 2020 07:15:39 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2899 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726353AbgIULPg (ORCPT ); Mon, 21 Sep 2020 07:15:36 -0400 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.107]) by Forcepoint Email with ESMTP id 9FFDB116C53DF929762B; Mon, 21 Sep 2020 12:15:34 +0100 (IST) Received: from localhost (10.52.121.13) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 21 Sep 2020 12:15:34 +0100 Date: Mon, 21 Sep 2020 12:13:55 +0100 From: Jonathan Cameron To: Sean V Kelley CC: , , , , , , , Subject: Re: [PATCH v5 05/10] PCI/AER: Apply function level reset to RCiEP on fatal error Message-ID: <20200921121355.00002b77@Huawei.com> In-Reply-To: <20200918204603.62100-6-sean.v.kelley@intel.com> References: <20200918204603.62100-1-sean.v.kelley@intel.com> <20200918204603.62100-6-sean.v.kelley@intel.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.52.121.13] X-ClientProxiedBy: lhreml744-chm.china.huawei.com (10.201.108.194) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 18 Sep 2020 13:45:58 -0700 Sean V Kelley wrote: > From: Qiuxu Zhuo > > Attempt to do function level reset for an RCiEP associated with an > RCEC device on fatal error. I'm not sure the description is correct. Looks like it will do the reset even if not associated with an RCEC. I'd just cut this down to: "Attempt to do a function level reset for an RCiEP on fatal error." I'm not 100% sure doing an flr will actually help in most cass if you've reported a fatal error, but I suppose it does no harm! So with description changed. Reviewed-by: Jonathan Cameron > > Signed-off-by: Qiuxu Zhuo > --- > drivers/pci/pcie/err.c | 31 ++++++++++++++++++++++--------- > 1 file changed, 22 insertions(+), 9 deletions(-) > > diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c > index e575fa6cee63..5380ecc41506 100644 > --- a/drivers/pci/pcie/err.c > +++ b/drivers/pci/pcie/err.c > @@ -169,6 +169,17 @@ static void pci_bridge_walk(struct pci_dev *bridge, int (*cb)(struct pci_dev *, > cb(bridge, userdata); > } > > +static pci_ers_result_t flr_on_rciep(struct pci_dev *dev) > +{ > + if (!pcie_has_flr(dev)) > + return PCI_ERS_RESULT_NONE; > + > + if (pcie_flr(dev)) > + return PCI_ERS_RESULT_DISCONNECT; > + > + return PCI_ERS_RESULT_RECOVERED; > +} > + > pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, > pci_channel_state_t state, > pci_ers_result_t (*reset_subordinate_devices)(struct pci_dev *pdev)) > @@ -195,15 +206,17 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, > if (state == pci_channel_io_frozen) { > pci_bridge_walk(bridge, report_frozen_detected, &status); > if (type == PCI_EXP_TYPE_RC_END) { > - pci_warn(dev, "link reset not possible for RCiEP\n"); > - status = PCI_ERS_RESULT_NONE; > - goto failed; > - } > - > - status = reset_subordinate_devices(bridge); > - if (status != PCI_ERS_RESULT_RECOVERED) { > - pci_warn(dev, "subordinate device reset failed\n"); > - goto failed; > + status = flr_on_rciep(dev); > + if (status != PCI_ERS_RESULT_RECOVERED) { > + pci_warn(dev, "function level reset failed\n"); > + goto failed; > + } > + } else { > + status = reset_subordinate_devices(bridge); > + if (status != PCI_ERS_RESULT_RECOVERED) { > + pci_warn(dev, "subordinate device reset failed\n"); > + goto failed; > + } > } > } else { > pci_bridge_walk(bridge, report_normal_detected, &status);