Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp250683lqr; Wed, 5 Jun 2024 05:13:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVuW5wx00M5PB1F7sllfZZuUyLzR3jVnHr3QDQEUtckjB3YcCAplpzqwkUve0v3EU+Qcp+ZOI5sh0v3x93Fu7ZNLUj7sA8yP0SQBjODLQ== X-Google-Smtp-Source: AGHT+IHW/bucn/EG/TVPr4nfI4UzAKGfudfPPYGV0zEnEyRwN3x8VUoRqtXybDdwR6T+YhdqkFqf X-Received: by 2002:a05:6a00:811:b0:702:72dd:476b with SMTP id d2e1a72fcca58-703e5a0baf7mr2572775b3a.32.1717589627491; Wed, 05 Jun 2024 05:13:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717589627; cv=pass; d=google.com; s=arc-20160816; b=Ug62ZilQeIVfJ97Y1L8pncuc0UnKG7cEJpM+JN6kKeqtVms/32LmYDMCxut/xzG9Np q+aIIDuhPiYoiTjJ2bVEUPh2+F6eEy+wNl/EEewbmAJNZPufL2ObdVS69am2BtWm3nOU 5/dToFv4WVqioQV4ano+acQKCbkcPilUCcaoogOEmLmwgF1Jp7EpTHtm56MoAFfGacUN yTHrTSaoGFAPg7t/UabzKzE8siya6t5e9WHNvrABmLExLZ76O6pMHUofjATuTdLByKWS ndU1OxJkZ9ldOHpJtiU+mCrNKX6TIPMgZTYzUSvdaU56bc21UhHhbalvdjtZMv3MbeWC jBUA== 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=fwsNMYd2Cj/RNAF+hp23+jSMykpgcRU8sh8YoniFxnc=; fh=raGbazaj5wbroZyp+ZtGw7AXwHT3mr5QbsQOh80jeLQ=; b=aPEQKd4F2yYqVvP4IfSPKdgXcys6gDGndtJRsevCuAOPFTO/BRzM0XfdZHVo9csjGD pjZp+BciR6QkpttnZf7QYNr7no2U3UKZLE5xlhIKPpeC6KVu5GwqEKljq/0XqaThygtd Pg52O28It7/mBp+tggcPpcZFDr6noGSjZ3Y028gm+kiyyNO8iDe56J/o9Rsjmyv3msCX yCaJWNUHsbeTmDM9HNkDt3iNRfN+7eLU3XAdBHeCOz4Ghnm4p/3Ap5sg0lDvuA7tfH6Q C6DXEIRIKHp7exu8S7DWfCEP9z4tmyvpTHSOVIGn+7/2G3jhUoMk8PYtO4Y63VL0JK2b iSqA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BTpc8MZz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202342-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202342-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35af459d3si2846854a12.439.2024.06.05.05.13.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 05:13:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202342-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BTpc8MZz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202342-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202342-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 43E3EB23407 for ; Wed, 5 Jun 2024 12:00:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C0F211922E0; Wed, 5 Jun 2024 11:51:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BTpc8MZz" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B9B6E19FA94; Wed, 5 Jun 2024 11:51:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717588284; cv=none; b=r81RTwHRj2XG1ZKSO7XfcrHkL9KRTVlFvLQLdHH/hkR3C/MKJe9Xu1sUZuqfOVuOglfWFeq+PW/49KKi/jVAp1ZDDN7dfKlFyfeLguU1/B2dUD8hS6QsUoB1xJY+PF/FUnxuLpdpGlkm1sVrBY+DS63YWCxj4VSZ6zVlVdAHFvU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717588284; c=relaxed/simple; bh=QEYKIRsy6u5hKLiEKLK0lf/JlhZ9x4bPSHioXsk9Fqw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HAE6P5TsYofcmOuP54ba5/HL5LNUi2YeGaq4PRgTRrVD6vnJrajuwBaZKFpSxOyxrizxIWL2k7mBI3ycSEB+I/J/mnJJPKnT99XpIDRY5m+aEZgZdZf6i653gkpy8TWqbbZN+NqoFfOGLpLxCpobnPyXsXz/utsesL2k9nDLZAQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BTpc8MZz; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B25C5C3277B; Wed, 5 Jun 2024 11:51:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717588284; bh=QEYKIRsy6u5hKLiEKLK0lf/JlhZ9x4bPSHioXsk9Fqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BTpc8MZz4Bhnq5LNFElMhXvSvY/QOSmwwEStwLo39N6joJyRmHnqaenzhplTnzBLC TlNbRE/SabtB5TYNbXjkNRhveC9NdTIP3dqL4gCHcDJvzZHp1R4WPFbqDk9Yw+D+QU J01x/wkXgIps8mjeHgT22wrcIfAxmyc0j3yZva51YGRG4vygSmWFFJIsRcxxKjENo/ 1iB9tgK+BThuzbJGU6VbLxsx8fz82pIKYoJ51bQJ7mBPXSPZ/1YTKfDUDRynTDHAar JsXBUlfyQ3nDJvZJmCzVj5KQlKr7giO7DO2JfOk4mzlYxbmY1DZRi4SM/w3f3vI3f7 v3Rax0tkJHRGw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Songyang Li , Thomas Bogendoerfer , Sasha Levin , rdunlap@infradead.org, bhelgaas@google.com, linux-mips@vger.kernel.org Subject: [PATCH AUTOSEL 6.8 11/24] MIPS: Octeon: Add PCIe link status check Date: Wed, 5 Jun 2024 07:50:21 -0400 Message-ID: <20240605115101.2962372-11-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605115101.2962372-1-sashal@kernel.org> References: <20240605115101.2962372-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.8.12 Content-Transfer-Encoding: 8bit From: Songyang Li [ Upstream commit 29b83a64df3b42c88c0338696feb6fdcd7f1f3b7 ] The standard PCIe configuration read-write interface is used to access the configuration space of the peripheral PCIe devices of the mips processor after the PCIe link surprise down, it can generate kernel panic caused by "Data bus error". So it is necessary to add PCIe link status check for system protection. When the PCIe link is down or in training, assigning a value of 0 to the configuration address can prevent read-write behavior to the configuration space of peripheral PCIe devices, thereby preventing kernel panic. Signed-off-by: Songyang Li Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/pci/pcie-octeon.c | 6 ++++++ 1 file changed, 6 insertions(+) mode change 100644 => 100755 arch/mips/pci/pcie-octeon.c diff --git a/arch/mips/pci/pcie-octeon.c b/arch/mips/pci/pcie-octeon.c old mode 100644 new mode 100755 index 2583e318e8c6b..b080c7c6cc463 --- a/arch/mips/pci/pcie-octeon.c +++ b/arch/mips/pci/pcie-octeon.c @@ -230,12 +230,18 @@ static inline uint64_t __cvmx_pcie_build_config_addr(int pcie_port, int bus, { union cvmx_pcie_address pcie_addr; union cvmx_pciercx_cfg006 pciercx_cfg006; + union cvmx_pciercx_cfg032 pciercx_cfg032; pciercx_cfg006.u32 = cvmx_pcie_cfgx_read(pcie_port, CVMX_PCIERCX_CFG006(pcie_port)); if ((bus <= pciercx_cfg006.s.pbnum) && (dev != 0)) return 0; + pciercx_cfg032.u32 = + cvmx_pcie_cfgx_read(pcie_port, CVMX_PCIERCX_CFG032(pcie_port)); + if ((pciercx_cfg032.s.dlla == 0) || (pciercx_cfg032.s.lt == 1)) + return 0; + pcie_addr.u64 = 0; pcie_addr.config.upper = 2; pcie_addr.config.io = 1; -- 2.43.0