Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp962694lqs; Wed, 6 Mar 2024 02:01:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUKih1wVcJC9MsvwYqf2h3tdxHaiWRpQmT1LM9iq+UkbG9hVDJsRFLwiK5ttMtL49XdW3dPqWGf3MmUZj+XJVAT98lTPZEXFwKaZVIyMA== X-Google-Smtp-Source: AGHT+IHgmHbHc1bzyCuhvzZDo03snVZrWjIHJDMjNnDlsPEkrLYtJTkJ/vqTu5F+XwxQVybtoU/D X-Received: by 2002:a05:6a21:3282:b0:1a1:476b:81a8 with SMTP id yt2-20020a056a21328200b001a1476b81a8mr4366180pzb.6.1709719268658; Wed, 06 Mar 2024 02:01:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709719268; cv=pass; d=google.com; s=arc-20160816; b=F+Cc++sGTj+Y6qcwt+2ZU+V1DrCSQZ9WXTZjFu1jJCQ3OlyNcto2fKMh93kFunI/G/ USPVutq0v19zoRLddlIkyTomix/beQaTNezAQNYbp6NIDJMt78ceSnwvdAGtZxGNj06h tIl5CF0mKWJ/Pr0M2ZVfJKPbWWkpqwCLiKxvxvBZeS5TqKJTfqzw0V7LAlc2kEA4mVhp VPr9geUIlzgV2ww/68puohiDgrUjpPQiwZaCQVMo34rgNZI4yBatdLtxXZXPuJ4MdC9N SWwG8vZ3W29xE5v725g8VW272bl+ymzxvZ+6XSjgjOVnONsrBV4YhUB+fgROFJkAQt0B 7XzQ== 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=jolgEkmIORC41L43w6HIWyr/AOsbDdGo/ofnTs52KIw=; fh=ZRW1OjL+vw4nR3zHw03SqmaugmDx4dJgwazkhUMUovE=; b=qQWlKbebeDrd7xvfje0TqLvA8QIu4DT6nHUlohnP55upbcyQ/hKCjLmxjzzOqBFBV+ uHShe0w5UkpskXpq4690Lj21lyS8wcLYXHSdu8B3cOSd5amoc1uRAmtKOG0lEAKibEIs tFjpsur2w3NQ/oqGKF8Mkne2qRBOA15+nAhZLjntXqiHfP8K6pfMAKUKoYBQX9vX6Mk0 +pYQDxH9PTd34wIl2xfy8sopRuVpsbvidcX3q/CDwfcVRPKqtoBsX7hP8641w+E9u1Si n7Mg503kpWhG+J06DtfmgHhRfHwcgKM2nFztqlxRr+bumCocgbTb3EOfo1IHB9ldU4oc IPcA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=N2QhzLzv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-93692-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93692-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id j29-20020a634a5d000000b005dc95934e54si11543330pgl.52.2024.03.06.02.01.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 02:01:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-93692-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=N2QhzLzv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-93692-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93692-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D4107287E2E for ; Wed, 6 Mar 2024 10:00:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 78EFD60271; Wed, 6 Mar 2024 09:59:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="N2QhzLzv" 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 5392C5F48E; Wed, 6 Mar 2024 09:59:49 +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=1709719189; cv=none; b=JqdcaGappzO1eW8bO20CZMhuGKPryxfwx0kecU0o2HT4+nF2dmvPXOnGx+tOj7cHWuAc132gxFiAJifAkdUCgnqihNCglXBvSgV6IZ/fDAx5XqqMsN7nXAmkbXvQs0YZGyna8xR+HePyLLuMpAN6YOrrk2L9xSZOr6PCAH8jR9w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709719189; c=relaxed/simple; bh=t19IiT6RWlcBi2EkLmBwm6R0bOy4AN3yK/qdKvg3904=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qW24b2l+TiLKyJc1Q9miWs4d9P7ZXQIUmf9AqjAvPKYlFSDij271p6R7k0eQAwZo+T4FX3UZX3qDSJj1yckYUwfIgfqQpe6lcXwvGFEHZNpAzTGiWSAeJERlrYez+o/W5TEnIL63y4C7nE42gQ1frbQPD+LJxdN5/PtIsD10IPw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=N2QhzLzv; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E26B8C433C7; Wed, 6 Mar 2024 09:59:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709719189; bh=t19IiT6RWlcBi2EkLmBwm6R0bOy4AN3yK/qdKvg3904=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N2QhzLzv/eqvbYADTBQNp8scNPrLxqJc3iHNS48UYL02mXSsQWM7MSvJcGGHSmHzW eVVuIzp9luJPJ6b179mzWpLxNecALAkAb/0CziPjiznWozJxRiqijdPruzwJGk9qrj fXojX0xB+jz4yfmsRzHJy130nXQ6uxWzfYVho8+Km7DqVjyyzMaIlpxtOpQOypLIYO mRH274NRnh7YTcV+dRAZ1GOP3G9DfKC8tb84d+35UT12lhT0hh/ANNdDl+0XxdEikf PAhnMsTzFs1xL7j0a5JHIxLOIiS2LE1uixPgQSKQHsL9qvcqZtI7NEnJEZkF5zUJkT tSobSI79sbVIA== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1rho44-000000001b3-3Ftm; Wed, 06 Mar 2024 10:59:56 +0100 From: Johan Hovold To: Bjorn Helgaas , Bjorn Andersson Cc: Konrad Dybcio , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Manivannan Sadhasivam , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH v4 3/5] PCI: qcom: Disable ASPM L0s for sc8280xp, sa8540p and sa8295p Date: Wed, 6 Mar 2024 10:56:49 +0100 Message-ID: <20240306095651.4551-4-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240306095651.4551-1-johan+linaro@kernel.org> References: <20240306095651.4551-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Commit 9f4f3dfad8cf ("PCI: qcom: Enable ASPM for platforms supporting 1.9.0 ops") started enabling ASPM unconditionally when the hardware claims to support it. This triggers Correctable Errors for some PCIe devices on machines like the Lenovo ThinkPad X13s when L0s is enabled, which could indicate an incomplete driver ASPM implementation or that the hardware does in fact not support L0s. This has now been confirmed by Qualcomm to be the case for sc8280xp and its derivate platforms (e.g. sa8540p and sa8295p). Specifically, the PHY configuration used on these platforms is not correctly tuned for L0s and there is currently no updated configuration available. Add a new flag to the driver configuration data and use it to disable ASPM L0s on sc8280xp, sa8540p and sa8295p for now. Note that only the 1.9.0 ops enable ASPM currently. Fixes: 9f4f3dfad8cf ("PCI: qcom: Enable ASPM for platforms supporting 1.9.0 ops") Cc: stable@vger.kernel.org # 6.7 Signed-off-by: Johan Hovold --- drivers/pci/controller/dwc/pcie-qcom.c | 31 ++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 2ce2a3bd932b..9f83a1611a20 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -229,6 +229,7 @@ struct qcom_pcie_ops { struct qcom_pcie_cfg { const struct qcom_pcie_ops *ops; + bool no_l0s; }; struct qcom_pcie { @@ -272,6 +273,26 @@ static int qcom_pcie_start_link(struct dw_pcie *pci) return 0; } +static void qcom_pcie_clear_aspm_l0s(struct dw_pcie *pci) +{ + struct qcom_pcie *pcie = to_qcom_pcie(pci); + u16 offset; + u32 val; + + if (!pcie->cfg->no_l0s) + return; + + offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); + + dw_pcie_dbi_ro_wr_en(pci); + + val = readl(pci->dbi_base + offset + PCI_EXP_LNKCAP); + val &= ~PCI_EXP_LNKCAP_ASPM_L0S; + writel(val, pci->dbi_base + offset + PCI_EXP_LNKCAP); + + dw_pcie_dbi_ro_wr_dis(pci); +} + static void qcom_pcie_clear_hpc(struct dw_pcie *pci) { u16 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); @@ -961,6 +982,7 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie) static int qcom_pcie_post_init_2_7_0(struct qcom_pcie *pcie) { + qcom_pcie_clear_aspm_l0s(pcie->pci); qcom_pcie_clear_hpc(pcie->pci); return 0; @@ -1358,6 +1380,11 @@ static const struct qcom_pcie_cfg cfg_2_9_0 = { .ops = &ops_2_9_0, }; +static const struct qcom_pcie_cfg cfg_sc8280xp = { + .ops = &ops_1_9_0, + .no_l0s = true, +}; + static const struct dw_pcie_ops dw_pcie_ops = { .link_up = qcom_pcie_link_up, .start_link = qcom_pcie_start_link, @@ -1629,11 +1656,11 @@ static const struct of_device_id qcom_pcie_match[] = { { .compatible = "qcom,pcie-ipq8074-gen3", .data = &cfg_2_9_0 }, { .compatible = "qcom,pcie-msm8996", .data = &cfg_2_3_2 }, { .compatible = "qcom,pcie-qcs404", .data = &cfg_2_4_0 }, - { .compatible = "qcom,pcie-sa8540p", .data = &cfg_1_9_0 }, + { .compatible = "qcom,pcie-sa8540p", .data = &cfg_sc8280xp }, { .compatible = "qcom,pcie-sa8775p", .data = &cfg_1_9_0}, { .compatible = "qcom,pcie-sc7280", .data = &cfg_1_9_0 }, { .compatible = "qcom,pcie-sc8180x", .data = &cfg_1_9_0 }, - { .compatible = "qcom,pcie-sc8280xp", .data = &cfg_1_9_0 }, + { .compatible = "qcom,pcie-sc8280xp", .data = &cfg_sc8280xp }, { .compatible = "qcom,pcie-sdm845", .data = &cfg_2_7_0 }, { .compatible = "qcom,pcie-sdx55", .data = &cfg_1_9_0 }, { .compatible = "qcom,pcie-sm8150", .data = &cfg_1_9_0 }, -- 2.43.0