From patchwork Wed Aug 10 06:58:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Shan X-Patchwork-Id: 657614 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3s8MTs3DBZz9t0F for ; Wed, 10 Aug 2016 17:00:01 +1000 (AEST) Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3s8MTs2QZTzDr7Z for ; Wed, 10 Aug 2016 17:00:01 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3s8MSN1K23zDr3C for ; Wed, 10 Aug 2016 16:58:44 +1000 (AEST) Received: by ozlabs.org (Postfix) id 3s8MSN0Mscz9t0F; Wed, 10 Aug 2016 16:58:44 +1000 (AEST) Delivered-To: linuxppc-dev@ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3s8MSM3z4pz9sf9 for ; Wed, 10 Aug 2016 16:58:43 +1000 (AEST) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u7A6s7Fm006516 for ; Wed, 10 Aug 2016 02:58:41 -0400 Received: from e23smtp02.au.ibm.com (e23smtp02.au.ibm.com [202.81.31.144]) by mx0b-001b2d01.pphosted.com with ESMTP id 24qm9u6xge-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 10 Aug 2016 02:58:41 -0400 Received: from localhost by e23smtp02.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 10 Aug 2016 16:58:38 +1000 Received: from d23dlp02.au.ibm.com (202.81.31.213) by e23smtp02.au.ibm.com (202.81.31.208) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 10 Aug 2016 16:58:37 +1000 X-IBM-Helo: d23dlp02.au.ibm.com X-IBM-MailFrom: gwshan@linux.vnet.ibm.com X-IBM-RcptTo: linuxppc-dev@ozlabs.org Received: from d23relay10.au.ibm.com (d23relay10.au.ibm.com [9.190.26.77]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id BA9F72BB0059 for ; Wed, 10 Aug 2016 16:58:36 +1000 (EST) Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay10.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u7A6waP032112822 for ; Wed, 10 Aug 2016 16:58:36 +1000 Received: from d23av02.au.ibm.com (localhost [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u7A6wZFD005768 for ; Wed, 10 Aug 2016 16:58:36 +1000 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u7A6wZQb005762; Wed, 10 Aug 2016 16:58:35 +1000 Received: from bran.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) by ozlabs.au.ibm.com (Postfix) with ESMTP id EB5EAA013E; Wed, 10 Aug 2016 16:58:34 +1000 (AEST) Received: from gwshan (shangw.ozlabs.ibm.com [10.61.2.199]) by bran.ozlabs.ibm.com (Postfix) with ESMTP id D578EE3BD4; Wed, 10 Aug 2016 16:58:34 +1000 (AEST) Received: by gwshan (Postfix, from userid 1000) id 88D64941E1B; Wed, 10 Aug 2016 16:58:34 +1000 (AEST) From: Gavin Shan To: linuxppc-dev@ozlabs.org Subject: [PATCH] PCI/hotplug: Take two seconds as settlement time after power-on Date: Wed, 10 Aug 2016 16:58:33 +1000 X-Mailer: git-send-email 2.1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16081006-0004-0000-0000-00000184A6F4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16081006-0005-0000-0000-0000086F2907 Message-Id: <1470812313-19943-1-git-send-email-gwshan@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-08-10_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608100076 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: shlimeng@cn.ibm.com, Gavin Shan Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The PCI adapter's firmware isn't fully functional when the PCIe bus link is up. 1.8 seconds are needed for the firmware to be completely functional according to the PCI bus settlement time (after reset) we have in EEH code (EEH_PE_RST_SETTLE_TIME). Without the delay, the driver fails to initialize the hot added adapter as observed on the Sumsung NVME card (144d:a821). This takes two seconds, a bit more than 1.8 seconds, as the PCI bus settlement time before PCI scanning in hot add sequence. With this applied, no error reported from driver on the Sumsung NVME adapter. Reported-by: Meng Li Signed-off-by: Gavin Shan --- drivers/pci/hotplug/pnv_php.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c index e6245b0..21f1f9d 100644 --- a/drivers/pci/hotplug/pnv_php.c +++ b/drivers/pci/hotplug/pnv_php.c @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -434,6 +435,12 @@ static int pnv_php_enable(struct pnv_php_slot *php_slot, bool rescan) if (unlikely(ret)) return ret; + /* Take two seconds as settlement time. Otherwise, the firmware + * of PCI adapter behind the PCI slot isn't functional completely + * in time. It causes initializing failure reported from device + * driver as observed on Sumsung NVME adapter (144d:a821). + */ + msleep(2000); scan: if (presence == OPAL_PCI_SLOT_PRESENT) { if (rescan) {