From patchwork Mon Jun 19 06:46:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Shan X-Patchwork-Id: 777594 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wrhP54zNXz9s71 for ; Mon, 19 Jun 2017 16:47:37 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3wrhP460htzDqh9 for ; Mon, 19 Jun 2017 16:47:36 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.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 lists.ozlabs.org (Postfix) with ESMTPS id 3wrhNR1dyZzDqgb for ; Mon, 19 Jun 2017 16:47:02 +1000 (AEST) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v5J6iD7t042296 for ; Mon, 19 Jun 2017 02:47:00 -0400 Received: from e23smtp05.au.ibm.com (e23smtp05.au.ibm.com [202.81.31.147]) by mx0b-001b2d01.pphosted.com with ESMTP id 2b64sct2kn-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 19 Jun 2017 02:47:00 -0400 Received: from localhost by e23smtp05.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Jun 2017 16:46:55 +1000 Received: from d23relay06.au.ibm.com (202.81.31.225) by e23smtp05.au.ibm.com (202.81.31.211) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 19 Jun 2017 16:46:53 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay06.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v5J6kqRr6291908 for ; Mon, 19 Jun 2017 16:46:52 +1000 Received: from d23av01.au.ibm.com (localhost [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v5J6kp1H015925 for ; Mon, 19 Jun 2017 16:46:52 +1000 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v5J6kp2S015887; Mon, 19 Jun 2017 16:46:51 +1000 Received: from bran.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) by ozlabs.au.ibm.com (Postfix) with ESMTP id 27308A008E; Mon, 19 Jun 2017 16:46:52 +1000 (AEST) Received: from gwshan.ozlabs.ibm.com (shangw.ozlabs.ibm.com [10.61.2.199]) by bran.ozlabs.ibm.com (Postfix) with ESMTP id 1B7AAE3C84; Mon, 19 Jun 2017 16:46:52 +1000 (AEST) Received: by gwshan.ozlabs.ibm.com (Postfix, from userid 1000) id 12038AC0DF8; Mon, 19 Jun 2017 16:46:52 +1000 (AEST) From: Gavin Shan To: skiboot@lists.ozlabs.org Date: Mon, 19 Jun 2017 16:46:49 +1000 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497854809-26032-1-git-send-email-gwshan@linux.vnet.ibm.com> References: <1497854809-26032-1-git-send-email-gwshan@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17061906-0016-0000-0000-000002501DDE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17061906-0017-0000-0000-000006CF7D6D Message-Id: <1497854809-26032-5-git-send-email-gwshan@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-06-19_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-1703280000 definitions=main-1706190114 Subject: [Skiboot] [PATCH v2 4/4] core/pci: Check PCIe cap version in pci_disable_completion_timeout() X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" When the PCIe capability version is less than 2, the completion timeout isn't supported and no need to disable it at all. Signed-off-by: Gavin Shan --- core/pci.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/pci.c b/core/pci.c index 684c054..cdb5de0 100644 --- a/core/pci.c +++ b/core/pci.c @@ -942,15 +942,21 @@ static int pci_configure_mps(struct phb *phb, static void pci_disable_completion_timeout(struct phb *phb, struct pci_device *pd) { - uint32_t ecap; - uint32_t val; + uint32_t ecap, val; + uint16_t pcie_cap; /* PCIE capability required */ if (!pci_has_cap(pd, PCI_CFG_CAP_ID_EXP, false)) return; - /* Check if it has capability to disable completion timeout */ + /* Check PCIe capability version */ ecap = pci_cap(pd, PCI_CFG_CAP_ID_EXP, false); + pci_cfg_read16(phb, pd->bdfn, + ecap + PCICAP_EXP_CAPABILITY_REG, &pcie_cap); + if ((pcie_cap & PCICAP_EXP_CAP_VERSION) <= 1) + return; + + /* Check if it has capability to disable completion timeout */ pci_cfg_read32(phb, pd->bdfn, ecap + PCIECAP_EXP_DCAP2, &val); if (!(val & PCICAP_EXP_DCAP2_CMPTOUT_DIS)) return;