Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1528705pxk; Fri, 2 Oct 2020 11:50:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQnNwppOrOpOpXKEc7I6cf5mDy4C+ii3TF/FAsWCmXMdpXMb314FV5P2hKTBJvQf2fDc9x X-Received: by 2002:a17:906:4c84:: with SMTP id q4mr3754901eju.525.1601664605526; Fri, 02 Oct 2020 11:50:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601664605; cv=none; d=google.com; s=arc-20160816; b=Ugse/8CmCCqpDq6wFFAEl6iTKXtwRkjUnKjW1fAujQKB7TySXUPJ3xJkoGeiV4M7Jc eDGsE5XmaMkOjrCy9oa90jkH2yA8HIuhy7lsoOZB1a7cxCp/X3uLjYx3e6wrBwB3gY+7 Fh49BR68NKXgU1rXlRlU4Vrrm3CU07JjinNaFjatGlGZfMiB0/GZva+MLs7bUPJ7cHRy Wd8cU05CRR2f7Di5vCOaRPHiVhpxHyg1oyC7Keqtyxm8VajsNHLjMJ6OwnJ6EV5FBSNy pqsLq7K2FLndC9FeSA+2jZFtfUSk9u6nq1Hs2xgxFMy0JwX9E3ihNheUqKgBVUFqqsxD WXJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=VzqaRORlnEuUozDef6epiKpVS9HjyrVB/kcqBdBNMb4=; b=O/eo+HoM6TswP9qWC+60LYjCvJv3kQ+PmH7eNz5O9Inxhz+G4sp0QXwCfn7JxyoNBP +Qx9275FmV+DnvbAAtPwHGI3ZcAhH0GUEW0uxSNVJSzNjuSzlJAwkJRYoDrysAEUBDz2 5XaL86+WZ6xsbDMtN7FRkcffAK//a8dhdMdsc5+qC9X/Z7OFOrbL0jDVgxucB9RYqfEP CudFhHFanZAo8x4GZgWbpVkjhSuf3UEepwZOLR6H3OLjW0isfZcHWgKhm1ctA/vjugs0 ZaTTkLPY4RAAtD7v8md5MvjS0exall+shEVigsQLtU+VoaP8u0aSBYTePaGgkb7T27q2 PKUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oregontracks.org header.s=fm1 header.b=aXSPDjhe; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=e+kAEgdJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k13si1578651edv.414.2020.10.02.11.49.43; Fri, 02 Oct 2020 11:50:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oregontracks.org header.s=fm1 header.b=aXSPDjhe; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=e+kAEgdJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388453AbgJBSsX (ORCPT + 99 others); Fri, 2 Oct 2020 14:48:23 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:60891 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388336AbgJBSsL (ORCPT ); Fri, 2 Oct 2020 14:48:11 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id B64C35C014F; Fri, 2 Oct 2020 14:48:10 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 02 Oct 2020 14:48:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= oregontracks.org; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=fm1; bh=VzqaRORlnEuUozDef6epiKpVS9HjyrVB/kcqBdBNMb4=; b=aXSPD jheA7ApwpWlTw1ywXB2zCGx6yJU7ozRRih2Zju3IfBNENeldFYkhQBXN+AMDQrer XhJMIkdtzMMa2amIPhiRJI+ctmsWpK6pnn99eYZ4ik+aqRad2058RxKRNPR4KwSZ L978rN8H5KAWjfEXpMkfpFMm62QrFilSkjCwZcDwvEpBwFLdYzWvCnAOPNvu6y/R CmSiZSP5yohTJ48LZtvRh4PrSvrFmGYukX1hRQ6Uo/fpgxm1s+OcsifkVXCGg3sW dCmQDPiOdHsbkVC65fsr14Wr8ZzWNH2gZ4uHYzbaKk3VUQzb2CJ0aI8jea7uLuiM r1RkteZicvuu718aw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=VzqaRORlnEuUozDef6epiKpVS9HjyrVB/kcqBdBNMb4=; b=e+kAEgdJ 6lw38/wURiwpEBbrIodIIDFNpe3WmsWr4N1nrKk5Cii0qpAnnPmyI8VKW4JFBbwB oP2ZFhq5jVQ4lGLxviTYEd+PdzqQjVBodoM4XJN+SpG/yeCmDOd5huWA1vnyPy5s b1cil9pUrVWnH+iGrxS6RbenKUbdBUHu1mLosrDfFuE6lk7TPj6fCkHnDf0BZx9G +0ktmnixJNuE4wzQW4rw1v/U9erBclDsHc2SRro8Lky+Y1M2+GS4Qc67sp9d0zmd AmoZSemIVGyhZ3U6F0jhp3L/mrpYfrsvzn4G1OzzfecvkfeDtDWPGWRmjSqBXknd GRWsxHPsrZSHlA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrfeeigdduvdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepufgvrghnucggucfmvghllhgvhicuoehsvggrnhhvkhdruggv vhesohhrvghgohhnthhrrggtkhhsrdhorhhgqeenucggtffrrghtthgvrhhnpeehkeffte eiudeiffelkeelvefftdelhfeitdeigeffleeufedvgfegvdefvedtteenucfkphepvdeg rddvtddrudegkedrgeelnecuvehluhhsthgvrhfuihiivgepkeenucfrrghrrghmpehmrg hilhhfrhhomhepshgvrghnvhhkrdguvghvsehorhgvghhonhhtrhgrtghkshdrohhrgh X-ME-Proxy: Received: from arch-ashland-svkelley.hsd1.or.comcast.net (c-24-20-148-49.hsd1.or.comcast.net [24.20.148.49]) by mail.messagingengine.com (Postfix) with ESMTPA id 56736306468B; Fri, 2 Oct 2020 14:48:08 -0400 (EDT) From: Sean V Kelley To: bhelgaas@google.com, Jonathan.Cameron@huawei.com, rafael.j.wysocki@intel.com, ashok.raj@intel.com, tony.luck@intel.com, sathyanarayanan.kuppuswamy@intel.com, qiuxu.zhuo@intel.com Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v8 09/14] PCI/AER: Apply function level reset to RCiEP on fatal error Date: Fri, 2 Oct 2020 11:47:30 -0700 Message-Id: <20201002184735.1229220-10-seanvk.dev@oregontracks.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201002184735.1229220-1-seanvk.dev@oregontracks.org> References: <20201002184735.1229220-1-seanvk.dev@oregontracks.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qiuxu Zhuo Attempt to do a function level reset for an RCiEP on fatal error. Signed-off-by: Qiuxu Zhuo Reviewed-by: Jonathan Cameron --- 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 c4ceca42a3bf..38abd7984996 100644 --- a/drivers/pci/pcie/err.c +++ b/drivers/pci/pcie/err.c @@ -169,6 +169,17 @@ static void pci_walk_bridge(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_DISCONNECT; + + 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_walk_bridge(bridge, report_frozen_detected, &status); if (type == PCI_EXP_TYPE_RC_END) { - pci_warn(dev, "subordinate device 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_walk_bridge(bridge, report_normal_detected, &status); -- 2.28.0