Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp457532lqb; Fri, 24 May 2024 03:58:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWYhv2JGAjiazQ9uNj+h8diaDUxnOZWB+3JCrcBwsl7bcTBN9uh3HLH9f6rSWIJ+2WBlLIFqJ2/mmPue6PVUeD35LtqDN6Zqjhw4w1+jQ== X-Google-Smtp-Source: AGHT+IFoPzlOtDwM/66L6NBKKtnEUUdm7GU6r05/zfmN72VEMZiw1W+DjdFT8lOLCiBetopLwZhU X-Received: by 2002:a37:f50e:0:b0:792:bc86:2d21 with SMTP id af79cd13be357-794ab10f892mr168908185a.57.1716548313964; Fri, 24 May 2024 03:58:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716548313; cv=pass; d=google.com; s=arc-20160816; b=fdbgzw7Gj1NRVHBn41ljqCKDdz3PokHXxHl03dbvgOOBvifAcI4evV5285qa+3Dlio CDF88O99+H7trQR4qsnhGZH2KDNfu1tk/cahxh6n5KXNFfucLjRtH/ptDtdrpzBYxzbL QWbMzgxTokZpEkpOkGvVFulj9uT66QY8pP4RBiglhIFVRARlFwTnKe2HofJIA6Ok8JUo K4SP4BHN94ZcvnXHjTnswjjgKLf3ZhUbqWEss5dmNaK9NVZXjh7nbF4+I3JALqHBD0GO 1C93x4GnWKgayNLawaJDrw1SsEY57NU6sVFJllLUUPDaWXHbiysHVTKZxyPz4fLNX0b0 XdxA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=oAxDy7HRzkzyrAajDGbOIZ7VyO0W++qJINz2lTGFPco=; fh=HF1f7uOyk4kXRzrNzD/RzvZlZ0mze/byt5ChGD3YNR8=; b=YDijwK/9aqnSZbasUBX1DugQlZK+jLl0mFcGav6EEQLK6/7mUKDdWYCCkLJhlvRHKJ XUJutTaUt3Fr2CJMXoZv2/MLl1DlAUX9IoSduudmZgnAoTE2c4Jxor5Bv85hGMDpdyuz QaA3uHMkHQqvNCx58SGhnz/GLxVRVbpaYGq+Z9NJHDqcC9v8c6ua36gHtzGNkXFA0nvC ROjBSsRXBCm/0AUmRo5lu1CSQwZuTyQm3V5zSHDZrBSpjxbt7OwF3TSHJWR/sGCDuWJD pTHODHOXOWmdHlEy1cAhlMgm4AFTiUiRgz6F04cULet76nBYzHPcFCL+66+V5fPrBmts OhMg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=A9+BSXlB; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-188625-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188625-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-794abd3c2cfsi124970585a.408.2024.05.24.03.58.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 03:58:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188625-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=A9+BSXlB; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-188625-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188625-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id AFC1C1C20F90 for ; Fri, 24 May 2024 10:58:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C7E286120; Fri, 24 May 2024 10:58:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="A9+BSXlB" Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E9A7785C58; Fri, 24 May 2024 10:57:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716548281; cv=none; b=gsZpA1MI5wWvUGp/gB+Rm6IMmdEZJAjsq8tDPX/0FnVYLSHasB5ax4XVgj7AwHIUZkOeVWXsjf0OO2vXHsYEs4NYxPVpl1sJbnBjs+Iiu44YqbgTDPGwxMhhktJ594g/WhK4nVvEbsaVNWwVDF3tDTnjB/tHTWeee04FAzYHyE4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716548281; c=relaxed/simple; bh=+tGHaaXA/o+PcEWpkVJfOIRNHuU+e2wPnmxnU44WR5s=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Zo+Q3gxzTky33UZGlf2WXdY1DqraGtJo1UXjbpsm0rTj1C2RlVXG9UHoOKiZhxQT0uED1piD6yLvTr/MY+tckWcwelWurUeYarpneep5FwNZfIsZVfIQPHckiqJVgDg3qcPMQojzgug6SbWlk19RvLtOHt8+d5vIoaTt3z+B4dA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=A9+BSXlB; arc=none smtp.client-ip=198.47.23.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 44OAvTFY056814; Fri, 24 May 2024 05:57:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1716548249; bh=oAxDy7HRzkzyrAajDGbOIZ7VyO0W++qJINz2lTGFPco=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=A9+BSXlBOhx1TAmOU96P2XHek96O/xk+nOzNEpSNTep++dnl6X1t3n6KatGRqv6bi rloF0zLQxtkSMuCaHh/OCw7gXgJBAk7w8JBzcLpbRf2zn+p7OAlT8QFbZIHisKiPrZ qtZvZwyocV54FIk80sVYPr8Chc+BfAHRDJSzVEQI= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 44OAvTVZ037425 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 24 May 2024 05:57:29 -0500 Received: from DLEE102.ent.ti.com (157.170.170.32) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 24 May 2024 05:57:29 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE102.ent.ti.com (157.170.170.32) 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; Fri, 24 May 2024 05:57:29 -0500 Received: from uda0492258.dhcp.ti.com (uda0492258.dhcp.ti.com [172.24.227.9]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 44OAvFvF049802; Fri, 24 May 2024 05:57:25 -0500 From: Siddharth Vadapalli To: , , , , , , , , , CC: , , , , Subject: [PATCH v2 2/2] PCI: keystone: Add link up check in ks_child_pcie_ops.map_bus() Date: Fri, 24 May 2024 16:27:14 +0530 Message-ID: <20240524105714.191642-3-s-vadapalli@ti.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240524105714.191642-1-s-vadapalli@ti.com> References: <20240524105714.191642-1-s-vadapalli@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 From: Kishon Vijay Abraham I K2G forwards the error triggered by a link-down state (e.g., no connected endpoint device) on the system bus for PCI configuration transactions; these errors are reported as an SError at system level, which is fatal and hangs the system. So fix it similar to how it was done in designware core driver commit 15b23906347c ("PCI: dwc: Add link up check in dw_child_pcie_ops.map_bus()") Fixes: 10a797c6e54a ("PCI: dwc: keystone: Use pci_ops for config space accessors") Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Siddharth Vadapalli --- drivers/pci/controller/dwc/pci-keystone.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c index 3184546ba3b6..ca476fa584e7 100644 --- a/drivers/pci/controller/dwc/pci-keystone.c +++ b/drivers/pci/controller/dwc/pci-keystone.c @@ -430,6 +430,17 @@ static void __iomem *ks_pcie_other_map_bus(struct pci_bus *bus, struct keystone_pcie *ks_pcie = to_keystone_pcie(pci); u32 reg; + /* + * Checking whether the link is up here is a last line of defense + * against platforms that forward errors on the system bus as + * SError upon PCI configuration transactions issued when the link + * is down. This check is racy by definition and does not stop + * the system from triggering an SError if the link goes down + * after this check is performed. + */ + if (!dw_pcie_link_up(pci)) + return NULL; + reg = CFG_BUS(bus->number) | CFG_DEVICE(PCI_SLOT(devfn)) | CFG_FUNC(PCI_FUNC(devfn)); if (!pci_is_root_bus(bus->parent)) -- 2.40.1