From patchwork Mon Jul 11 01:15:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kenji Kaneshige X-Patchwork-Id: 962872 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6B1Gqh1006379 for ; Mon, 11 Jul 2011 01:16:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753222Ab1GKBQw (ORCPT ); Sun, 10 Jul 2011 21:16:52 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:33293 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753165Ab1GKBQv (ORCPT ); Sun, 10 Jul 2011 21:16:51 -0400 Received: from m2.gw.fujitsu.co.jp (unknown [10.0.50.72]) by fgwmail5.fujitsu.co.jp (Postfix) with ESMTP id 33EAC3EE081 for ; Mon, 11 Jul 2011 10:16:49 +0900 (JST) Received: from smail (m2 [127.0.0.1]) by outgoing.m2.gw.fujitsu.co.jp (Postfix) with ESMTP id 1A7E945DE7F for ; Mon, 11 Jul 2011 10:16:49 +0900 (JST) Received: from s2.gw.fujitsu.co.jp (s2.gw.fujitsu.co.jp [10.0.50.92]) by m2.gw.fujitsu.co.jp (Postfix) with ESMTP id ED66145DE6A for ; Mon, 11 Jul 2011 10:16:48 +0900 (JST) Received: from s2.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s2.gw.fujitsu.co.jp (Postfix) with ESMTP id E064B1DB803C for ; Mon, 11 Jul 2011 10:16:48 +0900 (JST) Received: from m106.s.css.fujitsu.com (m106.s.css.fujitsu.com [10.240.81.146]) by s2.gw.fujitsu.co.jp (Postfix) with ESMTP id AB4D81DB8038 for ; Mon, 11 Jul 2011 10:16:48 +0900 (JST) Received: from m106.css.fujitsu.com (m106 [127.0.0.1]) by m106.s.css.fujitsu.com (Postfix) with ESMTP id 5C6C0A10007; Mon, 11 Jul 2011 10:16:48 +0900 (JST) Received: from [127.0.0.1] (unknown [10.124.101.141]) by m106.s.css.fujitsu.com (Postfix) with ESMTP id D1591A0001E; Mon, 11 Jul 2011 10:16:47 +0900 (JST) X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.3.1 Received: from KANE-LIFEBOOK[10.124.101.141] by KANE-LIFEBOOK (FujitsuOutboundMailChecker v1.3.1/9992[10.124.101.141]); Mon, 11 Jul 2011 10:16:26 +0900 (JST) Message-ID: <4E1A4EC1.8070603@jp.fujitsu.com> Date: Mon, 11 Jul 2011 10:15:45 +0900 From: Kenji Kaneshige User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 MIME-Version: 1.0 To: Jesse Barnes CC: Naoki Yanagimoto , linux-pci@vger.kernel.org Subject: [PATCH] pciehp: change wait time for valid configuration access References: <4E12C4F6.6060301@np.css.fujitsu.com> <4E12CEBE.2090608@jp.fujitsu.com> <4E158E00.1000902@np.css.fujitsu.com> <20110707092502.2cbdaa07@jbarnes-desktop> In-Reply-To: <20110707092502.2cbdaa07@jbarnes-desktop> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Mon, 11 Jul 2011 01:16:53 +0000 (UTC) Jesse, Here is the updated patch. Regards, Kenji Kaneshige Naoki Yanagimoto reported that configuration read on some hot-added PCIe device returns invalid value. This patch fixes this problem. According to the PCIe spec, software must wait for at least 1 second to judge if the hot-added device is broken after Data Link Layer State Changed Event. This patch changes pciehp driver to wait for 1 second after the Data Link Layer State Changed Event is detected before initiating a configuration access instead of 100 ms. Signed-off-by: Kenji Kaneshige Tested-by: Naoki Yanagimoto --- drivers/pci/hotplug/pciehp_ctrl.c | 3 +++ drivers/pci/hotplug/pciehp_hpc.c | 11 ++--------- 2 files changed, 5 insertions(+), 9 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: 20110705/drivers/pci/hotplug/pciehp_ctrl.c =================================================================== --- 20110705.orig/drivers/pci/hotplug/pciehp_ctrl.c +++ 20110705/drivers/pci/hotplug/pciehp_ctrl.c @@ -213,6 +213,9 @@ static int board_added(struct slot *p_sl goto err_exit; } + /* Wait for 1 second after checking link training status */ + msleep(1000); + /* Check for a power fault */ if (ctrl->power_fault_detected || pciehp_query_power_fault(p_slot)) { ctrl_err(ctrl, "Power fault on slot %s\n", slot_name(p_slot)); Index: 20110705/drivers/pci/hotplug/pciehp_hpc.c =================================================================== --- 20110705.orig/drivers/pci/hotplug/pciehp_hpc.c +++ 20110705/drivers/pci/hotplug/pciehp_hpc.c @@ -275,16 +275,9 @@ int pciehp_check_link_status(struct cont * hot-plug capable downstream port. But old controller might * not implement it. In this case, we wait for 1000 ms. */ - if (ctrl->link_active_reporting){ - /* Wait for Data Link Layer Link Active bit to be set */ + if (ctrl->link_active_reporting) pcie_wait_link_active(ctrl); - /* - * We must wait for 100 ms after the Data Link Layer - * Link Active bit reads 1b before initiating a - * configuration access to the hot added device. - */ - msleep(100); - } else + else msleep(1000); retval = pciehp_readw(ctrl, PCI_EXP_LNKSTA, &lnk_status);