From patchwork Fri Apr 26 06:28:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, LongX" X-Patchwork-Id: 2491001 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 613993FC64 for ; Fri, 26 Apr 2013 06:29:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759225Ab3DZG3F (ORCPT ); Fri, 26 Apr 2013 02:29:05 -0400 Received: from mga02.intel.com ([134.134.136.20]:50180 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759215Ab3DZG3E (ORCPT ); Fri, 26 Apr 2013 02:29:04 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 25 Apr 2013 23:29:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,554,1363158000"; d="scan'208,223";a="302978811" Received: from fmsmsx106.amr.corp.intel.com ([10.19.9.37]) by orsmga001.jf.intel.com with ESMTP; 25 Apr 2013 23:29:02 -0700 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX106.amr.corp.intel.com (10.19.9.37) with Microsoft SMTP Server (TLS) id 14.1.355.2; Thu, 25 Apr 2013 23:29:02 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.1.355.2; Thu, 25 Apr 2013 23:29:01 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.170]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.85]) with mapi id 14.01.0355.002; Fri, 26 Apr 2013 14:28:59 +0800 From: "Zhang, LongX" To: "linasvepstas@gmail.com" , "linux-pci@vger.kernel.org" , "bhelgaas@google.com" , "linux-kernel@vger.kernel.org" CC: "yanmin_zhang@linux.intel.com" , "Joseph.Liu@Emulex.Com" Subject: Subject : [ PATCH ] pci-reset-error_state-to-pci_channel_io_normal-at-report_slot_reset Thread-Topic: Subject : [ PATCH ] pci-reset-error_state-to-pci_channel_io_normal-at-report_slot_reset Thread-Index: Ac5CQUdmhbSX64FbRraxMqZGOLGlLwABCDYw Date: Fri, 26 Apr 2013 06:28:59 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Zhang Long Specific pci device drivers might have many functions to call pci_channel_offline to check device states. When slot_reset happens, drivers' slot_reset callback might call such functions and eventually abort the reset. The patch resets pdev->error_state to pci_channel_io_normal at the begining of report_slot_reset. Thank Liu Joseph for pointing it out. Signed-off-by: Zhang Yanmin Signed-off-by: Zhang Long --- drivers/pci/pcie/aer/aerdrv_core.c | 1 + drivers/pci/pcie/portdrv_pci.c | 12 +++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index 564d97f..c61fd44 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c @@ -286,6 +286,7 @@ static int report_slot_reset(struct pci_dev *dev, void *data) result_data = (struct aer_broadcast_data *) data; device_lock(&dev->dev); + dev->error_state = pci_channel_io_normal; if (!dev->driver || !dev->driver->err_handler || !dev->driver->err_handler->slot_reset) diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index ed4d094..7abefd9 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c @@ -332,13 +332,11 @@ static pci_ers_result_t pcie_portdrv_slot_reset(struct pci_dev *dev) pci_ers_result_t status = PCI_ERS_RESULT_RECOVERED; int retval; - /* If fatal, restore cfg space for possible link reset at upstream */ - if (dev->error_state == pci_channel_io_frozen) { - dev->state_saved = true; - pci_restore_state(dev); - pcie_portdrv_restore_config(dev); - pci_enable_pcie_error_reporting(dev); - } + /* restore cfg space for possible link reset at upstream */ + dev->state_saved = true; + pci_restore_state(dev); + pcie_portdrv_restore_config(dev); + pci_enable_pcie_error_reporting(dev); /* get true return value from &status */ retval = device_for_each_child(&dev->dev, &status, slot_reset_iter);