Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4258873pxk; Tue, 22 Sep 2020 14:47:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxe/d+X3qMWaJ0XhtmJ9TJJxxeSkc4QMI85vxRhYAAaR8Ezn76fc62LBt+vtkJir8Oo85xP X-Received: by 2002:a17:906:e4c:: with SMTP id q12mr6983548eji.425.1600811258612; Tue, 22 Sep 2020 14:47:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600811258; cv=none; d=google.com; s=arc-20160816; b=TfX7uFbw99PEJ9u1m3QngePQR7RFtfC6n+UHpe+/2gOSqTNYi6wpGONH3yBmAnAM1E /8SH6NwOt7ZTfYKfl6aMH5jIuPAEuvqZ3Eoc6LdgDrDXHlJZAmpq5cr2wKzKoSiqZgL9 XjF+cF2HldV4pw+XeELVDQ3tiVEzEZyYp18KZDa5X2M6yG6PkGrST4Wc21thES8btVpu fKwalQZsuMeyGiS81ABCM3bKkjZH0QgdYg6tXyZBNR+o/WfA+ZhpuFZAxH/XYUALqYHh ZCEhANVT/WG2p3E+gREQ7db8z3mnBq4B0ISwQVqPp5eqM2SHRksESDE9WwwJo0hZVaab qhMw== 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=la5jToBt8q9PRytey4reAvvjJgf9Zx4zizrgsmeICRE=; b=KqcynNbUfcUwfPzvA6hy/XVw7u1BmjDJyWYXEiBDfeshEQ4PDZXJph5uwjy7GbMPSX itO/uWBKghTcy05PYDgfgpmQxB7kRT0D1G2AdpRIamFOhNMw//Krnyb+0PpKUu+FR7TQ MDZNxqpV615gtu6vv//ABn0HcoMYiAtv4syViaROlzU8RkbVK4t4qc9nl0yfHj8TxpW+ n8bAmcn4t05pH9qMJ8dPR2RmDoyah/LnjsK4Pxnz834q4tldlFl1WvjcLy5uYblnhzTW miaAkZxMWvnwMCMjg8Eaeo8m/LmrVcH0nwGrZk1+hzuuemV1SFSQZR8FoYqI/ta7muMN aGPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oregontracks.org header.s=fm1 header.b="C/aSgxU3"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=D8AwpIuo; 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 a4si11780761edb.358.2020.09.22.14.47.15; Tue, 22 Sep 2020 14:47:38 -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="C/aSgxU3"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=D8AwpIuo; 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 S1726825AbgIVVqE (ORCPT + 99 others); Tue, 22 Sep 2020 17:46:04 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:37203 "EHLO out5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726763AbgIVVpu (ORCPT ); Tue, 22 Sep 2020 17:45:50 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 1AC0F5C0185; Tue, 22 Sep 2020 17:39:15 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 22 Sep 2020 17:39:15 -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=la5jToBt8q9PRytey4reAvvjJgf9Zx4zizrgsmeICRE=; b=C/aSg xU3HwJ7ZJ1wJub1rRyt2Haly0I6dNpGMsiioRC/BUfUt1g7qggIZxPxaB0Esju/1 QgB6IZ4zBlwNUp32hhhr9Jz6zPfwIVsXJmyjuPZJTs5qTS52VGMMxPH5J4Ck2yEX DBpExLCvSedXF7jDzmuEvIhnXb982iMRM+9omDX4E4FHBNBpBvopnhSFM6Afmu9o 7SW0BuEs21mWzxaOiv2JGeL3utdLVxWFiHJTc7Q+FVGv7885sn9/dnrssGavTIyw P9PI/0kRbKcqJ0Q9HgsdaP8iIUJDgvj4VWARB8IKjZXU9qutu1cfpd5FhwsYIjKT hVLzFU9aqIfNIESIQ== 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=la5jToBt8q9PRytey4reAvvjJgf9Zx4zizrgsmeICRE=; b=D8AwpIuo K9jxMnfmDIINZisJsTjpgpr5yDEBCZ1VCpP4nT40qoNYBPjWOYzuqnMm/MQMfKSP UO+xWRAqruBxfPgTP9KGRf+j//8WvlDW8HyGc2xTNrZKzBS9d1cnHEUlIED7iXqi pOddSQlGVRbJlK2fWXbKWXdWRceQj6yWeRI828UV7bQ3l6e6OFMt7mtVkigFoQsm TO1Mv29U6eoW2yxg+0HADQpWmAoMTLSBbLGof3LAvUzh1FRb+46HX/RGI3fDk3ml 9BWnqQBhfrs+uXty+72VjmHpNA/H+jXgBJK0GdxffyyI/ImHSfD85eRlPAEeZqlk 2hScY+wGP3Ty/w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudeggdduieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepufgvrghnucggucfmvghllhgvhicuoehsvggrnhhvkhdruggv vhesohhrvghgohhnthhrrggtkhhsrdhorhhgqeenucggtffrrghtthgvrhhnpeehkeffte eiudeiffelkeelvefftdelhfeitdeigeffleeufedvgfegvdefvedtteenucfkphepvdeg rddvtddrudegkedrgeelnecuvehluhhsthgvrhfuihiivgepgeenucfrrghrrghmpehmrg 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 41170306467D; Tue, 22 Sep 2020 17:39:13 -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 v6 05/10] PCI/AER: Apply function level reset to RCiEP on fatal error Date: Tue, 22 Sep 2020 14:38:54 -0700 Message-Id: <20200922213859.108826-6-seanvk.dev@oregontracks.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200922213859.108826-1-seanvk.dev@oregontracks.org> References: <20200922213859.108826-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 function level reset for an RCiEP associated with an RCEC device on fatal error. 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); -- 2.28.0