From patchwork Wed Oct 11 12:34:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddharth Vadapalli X-Patchwork-Id: 13417348 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 661D2CD6E5D for ; Wed, 11 Oct 2023 12:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ye2dmsJQirCj1RCllZ/QPcm0nVQKjmR3cx+xTBcdeOg=; b=nc3OI1c0z7vNc4 BrMw9aZCXBYOCbweEHbym8h4wey/UDnG2OrNcYs1FXbDuE/LRtzYup3Qd++qDHdV631NWhK707VSi XaBHFY2VtDGRi8HhqtZ6cbYOkFM6LtqjFympue7QQiDnE0L0+Onc2ntC1NlfWkk1HmMVcxQDTLrKl Zuj5gXGKydDE6i5glS7DZHaIBRAmxTYyBo2y8ItwTBJgZongC2mJ+88PslhrvVx5OyeMJQNf9FAED ZoTT+HpiODyjJGHDKftL9QHneohsE6gjnAJt3ijA+xDF9d9o1UVBWV1VfDgDok3oeRieHDtO04HWB TPQ4hdmsygfW27KraXgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qqYQl-00Frkd-14; Wed, 11 Oct 2023 12:35:15 +0000 Received: from fllv0015.ext.ti.com ([198.47.19.141]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qqYQh-00Frjs-1s for linux-arm-kernel@lists.infradead.org; Wed, 11 Oct 2023 12:35:13 +0000 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 39BCYtnb064043; Wed, 11 Oct 2023 07:34:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1697027695; bh=u7XL/tD7jBNy4Mf5LMc4cpgvoGhfSpXlJeuIF3bc84w=; h=From:To:CC:Subject:Date; b=wsmGMhx1UCGi1Lyebwn3dqqIq5R75oBcDVWJ0nAGZq5qEIVONM1xcBXdzt4obMEFX /n3eBiulwSqZu0V9DTlHWWj68svXpB4qKMaPsn2XKjjwZazQIymw3CSJt3QacCWfI8 /HB02ZANCrpOWpIXgu0xNT+5yiklGW5HL74iRWs8= Received: from DFLE101.ent.ti.com (dfle101.ent.ti.com [10.64.6.22]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 39BCYtQE079026 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 11 Oct 2023 07:34:55 -0500 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Wed, 11 Oct 2023 07:34:55 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Wed, 11 Oct 2023 07:34:55 -0500 Received: from uda0492258.dhcp.ti.com (ileaxei01-snat.itg.ti.com [10.180.69.5]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 39BCYpQG066928; Wed, 11 Oct 2023 07:34:52 -0500 From: Siddharth Vadapalli To: , , , CC: , , , , , Subject: [PATCH] PCI: keystone: Don't enable BAR0 if link is not detected Date: Wed, 11 Oct 2023 18:04:51 +0530 Message-ID: <20231011123451.34827-1-s-vadapalli@ti.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231011_053511_780349_D266DC52 X-CRM114-Status: GOOD ( 14.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Since the function dw_pcie_host_init() ignores the absence of link under the assumption that link can come up later, it is possible that the pci_host_probe(bridge) function is invoked even when no endpoint device is connected. In such a situation, the ks_pcie_v3_65_add_bus() function configures BAR0 when the link is not up, resulting in Completion Timeouts during the MSI configuration performed later by the PCI Express Port driver to setup AER, PME and other services. Thus, leave BAR0 disabled if link is not yet detected when the ks_pcie_v3_65_add_bus() function is invoked. Signed-off-by: Siddharth Vadapalli --- Hello, This patch is based on linux-next tagged next-20231011. Regards, Siddharth. drivers/pci/controller/dwc/pci-keystone.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c index 49aea6ce3e87..ac2ad112d616 100644 --- a/drivers/pci/controller/dwc/pci-keystone.c +++ b/drivers/pci/controller/dwc/pci-keystone.c @@ -459,7 +459,8 @@ static int ks_pcie_v3_65_add_bus(struct pci_bus *bus) struct dw_pcie *pci = to_dw_pcie_from_pp(pp); struct keystone_pcie *ks_pcie = to_keystone_pcie(pci); - if (!pci_is_root_bus(bus)) + /* Don't enable BAR0 if link is not yet up at this point */ + if (!pci_is_root_bus(bus) || !dw_pcie_link_up(pci)) return 0; /* Configure and set up BAR0 */