Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp253301lqr; Wed, 5 Jun 2024 05:18:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWBx/NJt7LqxZvQQ//0blLNX3BkS3ndD9ewyTJ0wXL4DtmXVuVCVlDrrHFHLZb/TYxenqR6q98QGDmJkfSz0VZ401/GTMfkcVCYpAhTfw== X-Google-Smtp-Source: AGHT+IEIyFJXkSV4AgX7PECPBAzBIssUHUvlGtAvOVlR8cHyN8UajMdItfs3MHzx1ZDH/KUbf0S/ X-Received: by 2002:a05:6830:1445:b0:6f9:3a42:b8a1 with SMTP id 46e09a7af769-6f94340ed45mr2523856a34.6.1717589883916; Wed, 05 Jun 2024 05:18:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717589883; cv=pass; d=google.com; s=arc-20160816; b=0iQFZhlT8hK0/vcFmb44jJmR1rEXyvzGWchYSxin08cdrTRyZEJYucmQZKR70CNlCp NQ499urArpEgYvkMVN32WV5A6g+PmBj2DaFkw2Q43mvDqIEsALcWvjRRTKjh+fMoWrXc F2weJ0LtwP/jit+HPCOqR2qwgdlNdCAIpRdTwF0snrfLAQscEvM9/lS6CpymZyyvsyib H+XZyHn5R5eo2nTN4UagRCxw/6r2N4KMbTziSLM3hr5xb8w7PnofcwtlMM4UH86TlHO6 4zpC1d7GOhpndUUyPyfMp0e5JjHUkD3VLSW397XT4d6afh+etYvB1hg2R3LQWCZtS1Cl v/2w== 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=wC+UMBw/rzeUkleGB9f86zZ8HpBxvWM9lh2K9pzmCM8=; fh=857QcNzS1gTvTO6ekShKlG9YOg8rS0su/xb+hJDwyPc=; b=Dd1ANWeQbED/ASuaq1IFL8O5MLCQh1M6PjQM9sX/oba7W6GpmAggttfB9GQByzNVDY AxDgF7uejBsu+JWx5zesS+J0n7EFAZ+zU6cXQ4pwpldhrBiqYCORmI45VCpvNmYdtQQ/ egrSHip5ULFPwPc/YNH2cgKP4njkJqH90hfBT++LzIKUWo6pwashUZYlNScqnal7htmZ 1VxdXOdPt7WI3FIND21PL5ay4Rrf9QEU8WUke5pWDHgmQpZDghGBgLYaGJMWdEAtCEJW IDNRiQmXYIb3zk4ELmk+5ja8x8b+/r7aeiQn8S67ZBAP98IasludBPqROAbj43Z/55Fp MD6A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rQNxBAl3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202411-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202411-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-79520376549si258300985a.275.2024.06.05.05.18.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 05:18:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202411-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=@kernel.org header.s=k20201202 header.b=rQNxBAl3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202411-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202411-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 69C1E1C23ADF for ; Wed, 5 Jun 2024 12:18:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 084E1198E9F; Wed, 5 Jun 2024 11:55:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rQNxBAl3" 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 305091B5F0F; Wed, 5 Jun 2024 11:55:11 +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=1717588511; cv=none; b=HOaHOy8fJ1xSgIVMODyS3pZwIV/O0SRd2XR9+bpqdZobNKXOk7jRiURZqmQOrllTvUNsmL3Huyq0MG1B6HYQeAfAMBAp1iEy3HMhzJTDrzWIRQfsCrz+mWRXHgW1mfaunSPCOmlQ1ke2s61I85FD/Wvh1lt81y/GpvBDjZQBl+U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717588511; c=relaxed/simple; bh=ghaJ6hQdbi2GgdV2gtK7tru7aQc6vMTFxyqHR4nedXA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dFTIndLjGgSzHUmLNkBPv7GhwNbV7PuFgqXOmz5p0VG5yFGHgJHujCBwOk/xUWl8SbwgLJHV0T8CCZOOhPZvborgkvTHxOReOpdBs0vnXN8P+tiU37WZqiT2/Ll8EjlP+3yMhpgZVFmdNAcHaMr3wjZ1MeBDI2aTp0VgzHgvuMg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rQNxBAl3; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CD13C32786; Wed, 5 Jun 2024 11:55:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717588511; bh=ghaJ6hQdbi2GgdV2gtK7tru7aQc6vMTFxyqHR4nedXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rQNxBAl3OHFlcsWARoFqgU3ppKqxEuCQISO/EuLmIRDIfK0DQbEvKe/m8KFuct1pp LOfOQKk9PfHztdqJyXNHBXj4ufDsVVdweHVLJsRNVKbko1E/1r3D/lcou5/5+Sb9v1 yiOiEckz6q46YuuVRrXsJAfyBIJvbLEZ8wskBzkJhGdhgSBOYQGqJ67nhLPUE4eeJB J66bLPs5GHVpJE8qwfitUX9C3MahBxkoFHjmF0FkVBZQNkViW3KBKCjVys80PGso86 PGPHpg8rpokIIITwoV0Tn5YRj1uqRgeQXX/D1fuMHOskuOL5LPTBZM0zaalW4hJPw9 BQw+2zPWZctQQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Songyang Li , Thomas Bogendoerfer , Sasha Levin , bhelgaas@google.com, rdunlap@infradead.org, linux-mips@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 4/5] MIPS: Octeon: Add PCIe link status check Date: Wed, 5 Jun 2024 07:54:57 -0400 Message-ID: <20240605115504.2964549-4-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605115504.2964549-1-sashal@kernel.org> References: <20240605115504.2964549-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 5.4.277 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 d919a0d813a17..38de2a9c3cf1a --- 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