Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1483384pxk; Fri, 18 Sep 2020 13:52:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBkNw0I0oZIbb67FoMo3ScocU0P7iBg1vk1sBWu70ZSI8lctSfv9V2Cnk/qYUH0m0keukc X-Received: by 2002:a17:906:1c13:: with SMTP id k19mr30019062ejg.384.1600462372916; Fri, 18 Sep 2020 13:52:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600462372; cv=none; d=google.com; s=arc-20160816; b=VhBSUzSrruhDyadorZlAEqFUbUBuFq2lNDfJZWfX4jnS4kkkqpArIgUzhg73jhbFvJ +OXXYNWkRKSs8y3KD6m8zleo4LvecXYrCV9WCrW+kV+VVsVIP8MxUD+O/IblEmRhE67u FFbBje854+LyX3Tlu8TaJW3B+ivGnk3AYwPVze9pgS68uqgVUbHvJz7IkC9eGLEHGW0x 10ppMeOJUmWGxv7CJf4JUOD7MsOFuwYbNcRUp+grDd3H2qYbNFcTkRznGRVdq9wtekvs 8EyfTbuMs7sRxioOFfXxOAiNDkpCkcTnI+9CkHaPeZYmycIrYgNDURLb7LADT6JQ2szX j5dA== 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 :ironport-sdr:ironport-sdr; bh=la5jToBt8q9PRytey4reAvvjJgf9Zx4zizrgsmeICRE=; b=g9GhqS5dvOHH7Mi3hW6NbO4F3o1ixEBbPC5oEmoPjivRRAq8yLJfxN75L07v1FaVAc VwTU3MlEHTCUFwRQKyQClJy4JMpjUk4P8BLJym9+0NwVRQK9xtM0W/6VqBwynYnKsCLc YjUlKiZQJ1LhCB+THQnANESjLHqVZNtxtZk6Fi8JmcJPZ8Ul2CL6J9QecV70UufKF6kq fFjfPmY6Yx+aUcbP2bxTgfCB6fNzewPE4J5TjycTTjI5MMXp7Dvkt5CAFxS2huQYw82q 6Z2K45j4lkFG8EziwrMp2wpsvG4dgKdG3DPHKuvnKbZAw7NBKWnlcadxA+/aqWjlXVe7 SeFg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v2si2893220ejy.65.2020.09.18.13.52.29; Fri, 18 Sep 2020 13:52:52 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726460AbgIRUv3 (ORCPT + 99 others); Fri, 18 Sep 2020 16:51:29 -0400 Received: from mga01.intel.com ([192.55.52.88]:61896 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726250AbgIRUv2 (ORCPT ); Fri, 18 Sep 2020 16:51:28 -0400 IronPort-SDR: V54LbZyadlwHfUPRPumQArHldmbxWTMV31kdkENlQow+I3lcBrQbGafHfSNywhhMFT6Dm2unTE OYXJEvjSacEA== X-IronPort-AV: E=McAfee;i="6000,8403,9748"; a="178120876" X-IronPort-AV: E=Sophos;i="5.77,274,1596524400"; d="scan'208";a="178120876" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2020 13:46:29 -0700 IronPort-SDR: fR54aEQL44WUOiy5BLLp8IW6mnLvtP7GlBlpngPNgp4W1fYKVqzLM5pbxV8vl6GG9YNDFgFj4G 0idIDVWzD3yA== X-IronPort-AV: E=Sophos;i="5.77,274,1596524400"; d="scan'208";a="484366827" Received: from xsunzhou-mobl.amr.corp.intel.com (HELO arch-ashland-svkelley.intel.com) ([10.251.153.106]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2020 13:46:28 -0700 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 v5 05/10] PCI/AER: Apply function level reset to RCiEP on fatal error Date: Fri, 18 Sep 2020 13:45:58 -0700 Message-Id: <20200918204603.62100-6-sean.v.kelley@intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200918204603.62100-1-sean.v.kelley@intel.com> References: <20200918204603.62100-1-sean.v.kelley@intel.com> 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