From patchwork Mon Nov 2 05:27:58 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kenji Kaneshige X-Patchwork-Id: 56924 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nA25ScJF010538 for ; Mon, 2 Nov 2009 05:28:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751231AbZKBF2a (ORCPT ); Mon, 2 Nov 2009 00:28:30 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750942AbZKBF2a (ORCPT ); Mon, 2 Nov 2009 00:28:30 -0500 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:47154 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750778AbZKBF23 (ORCPT ); Mon, 2 Nov 2009 00:28:29 -0500 Received: from m5.gw.fujitsu.co.jp ([10.0.50.75]) by fgwmail5.fujitsu.co.jp (Fujitsu Gateway) with ESMTP id nA25SWbJ014449 (envelope-from kaneshige.kenji@jp.fujitsu.com); Mon, 2 Nov 2009 14:28:32 +0900 Received: from smail (m5 [127.0.0.1]) by outgoing.m5.gw.fujitsu.co.jp (Postfix) with ESMTP id 7ED1545DE51; Mon, 2 Nov 2009 14:28:32 +0900 (JST) Received: from s5.gw.fujitsu.co.jp (s5.gw.fujitsu.co.jp [10.0.50.95]) by m5.gw.fujitsu.co.jp (Postfix) with ESMTP id 567CA45DE4E; Mon, 2 Nov 2009 14:28:32 +0900 (JST) Received: from s5.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s5.gw.fujitsu.co.jp (Postfix) with ESMTP id 39E68E1800C; Mon, 2 Nov 2009 14:28:32 +0900 (JST) Received: from m108.s.css.fujitsu.com (m108.s.css.fujitsu.com [10.249.87.108]) by s5.gw.fujitsu.co.jp (Postfix) with ESMTP id C888A1DB803C; Mon, 2 Nov 2009 14:28:31 +0900 (JST) Received: from m108.css.fujitsu.com (m108 [127.0.0.1]) by m108.s.css.fujitsu.com (Postfix) with ESMTP id 8A8DEB68004; Mon, 2 Nov 2009 14:28:31 +0900 (JST) Received: from [127.0.0.1] (unknown [10.124.22.153]) by m108.s.css.fujitsu.com (Postfix) with ESMTP id 0C669428057; Mon, 2 Nov 2009 14:28:30 +0900 (JST) X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.3.1 Received: from KANE-LIFEBOOK[10.124.22.153] by KANE-LIFEBOOK (FujitsuOutboundMailChecker v1.3.1/9992[10.124.22.153]); Mon, 02 Nov 2009 14:28:16 +0900 (JST) Message-ID: <4AEE6DDE.3080106@jp.fujitsu.com> Date: Mon, 02 Nov 2009 14:27:58 +0900 From: Kenji Kaneshige User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Jens Axboe CC: Alex Chiang , Mark Lord , Greg KH , Linux Kernel , jbarnes@virtuousgeek.org, linux-pci@vger.kernel.org Subject: Re: pci-express hotplug References: <20091014081309.GM9228@kernel.dk> <20091020190707.GA25615@ldl.fc.hp.com> <20091026105419.GA10727@kernel.dk> <4AE693D9.3070100@jp.fujitsu.com> <20091027082720.GT10727@kernel.dk> <4AE7E164.80408@jp.fujitsu.com> <20091028092324.GB10727@kernel.dk> <4AE947D3.5070500@jp.fujitsu.com> <20091029085824.GC10727@kernel.dk> <4AE95EFA.7000009@jp.fujitsu.com> <20091029092453.GD10727@kernel.dk> In-Reply-To: <20091029092453.GD10727@kernel.dk> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Index: 20091026/drivers/pci/hotplug/pciehp_ctrl.c =================================================================== --- 20091026.orig/drivers/pci/hotplug/pciehp_ctrl.c +++ 20091026/drivers/pci/hotplug/pciehp_ctrl.c @@ -142,23 +142,9 @@ u8 pciehp_handle_power_fault(struct slot /* power fault */ ctrl_dbg(ctrl, "Power fault interrupt received\n"); - - if (!pciehp_query_power_fault(p_slot)) { - /* - * power fault Cleared - */ - ctrl_info(ctrl, "Power fault cleared on Slot(%s)\n", - slot_name(p_slot)); - event_type = INT_POWER_FAULT_CLEAR; - } else { - /* - * power fault - */ - ctrl_info(ctrl, "Power fault on Slot(%s)\n", slot_name(p_slot)); - event_type = INT_POWER_FAULT; - ctrl_info(ctrl, "Power fault bit %x set\n", 0); - } - + ctrl_err(ctrl, "Power fault on slot %s\n", slot_name(p_slot)); + event_type = INT_POWER_FAULT; + ctrl_info(ctrl, "Power fault bit %x set\n", 0); queue_interrupt_event(p_slot, event_type); return 1; @@ -220,18 +206,17 @@ static int board_added(struct slot *p_sl if (PWR_LED(ctrl)) pciehp_green_led_blink(p_slot); + /* 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)); + retval = -EIO; + goto err_exit; + } + /* Check link training status */ retval = pciehp_check_link_status(ctrl); if (retval) { ctrl_err(ctrl, "Failed to check link status\n"); - set_slot_off(ctrl, p_slot); - return retval; - } - - /* Check for a power fault */ - if (pciehp_query_power_fault(p_slot)) { - ctrl_dbg(ctrl, "Power fault detected\n"); - retval = -EIO; goto err_exit; } Index: 20091026/drivers/pci/hotplug/pciehp_hpc.c =================================================================== --- 20091026.orig/drivers/pci/hotplug/pciehp_hpc.c +++ 20091026/drivers/pci/hotplug/pciehp_hpc.c @@ -514,15 +514,10 @@ int pciehp_power_on_slot(struct slot * s return retval; } } + ctrl->power_fault_detected = 0; slot_cmd = POWER_ON; cmd_mask = PCI_EXP_SLTCTL_PCC; - if (!pciehp_poll_mode) { - /* Enable power fault detection turned off at power off time */ - slot_cmd |= PCI_EXP_SLTCTL_PFDE; - cmd_mask |= PCI_EXP_SLTCTL_PFDE; - } - retval = pcie_write_cmd(ctrl, slot_cmd, cmd_mask); if (retval) { ctrl_err(ctrl, "Write %x command failed!\n", slot_cmd); @@ -531,7 +526,6 @@ int pciehp_power_on_slot(struct slot * s ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__, ctrl->cap_base + PCI_EXP_SLTCTL, slot_cmd); - ctrl->power_fault_detected = 0; return retval; } @@ -586,12 +580,6 @@ int pciehp_power_off_slot(struct slot * slot_cmd = POWER_OFF; cmd_mask = PCI_EXP_SLTCTL_PCC; - if (!pciehp_poll_mode) { - /* Disable power fault detection */ - slot_cmd &= ~PCI_EXP_SLTCTL_PFDE; - cmd_mask |= PCI_EXP_SLTCTL_PFDE; - } - retval = pcie_write_cmd(ctrl, slot_cmd, cmd_mask); if (retval) { ctrl_err(ctrl, "Write command failed!\n"); @@ -840,11 +828,19 @@ int pcie_enable_notification(struct cont { u16 cmd, mask; + /* + * TBD: Power fault detected software notification support. + * + * Power fault detected software notification is not enabled + * now, because it caused power fault detected interrupt storm + * on some machines. On those machines, power fault detected + * bit in the slot status register was set again immediately + * when it is cleared in the interrupt service routine, and + * next power fault detected interrupt was notified again. + */ cmd = PCI_EXP_SLTCTL_PDCE; if (ATTN_BUTTN(ctrl)) cmd |= PCI_EXP_SLTCTL_ABPE; - if (POWER_CTRL(ctrl)) - cmd |= PCI_EXP_SLTCTL_PFDE; if (MRL_SENS(ctrl)) cmd |= PCI_EXP_SLTCTL_MRLSCE; if (!pciehp_poll_mode)