Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2576101rdb; Mon, 12 Feb 2024 09:05:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVGazmCO359f2+z/u6VagF6ngGSjwz0/OjVwWQ8fQv2twdwLLy6IV5sFjvdZ+CLpyPHpLyRXxAn2RafQqBi1zePkdiKFMfmk3WuZa7gYw== X-Google-Smtp-Source: AGHT+IGKjyQn17ZlG7pEpiEon7JQyRBnYq+6mzSyI37mwQo912tZ2IyKd/zjrU6fSFtrEa9N4Lff X-Received: by 2002:a17:902:c412:b0:1db:2ad2:eff5 with SMTP id k18-20020a170902c41200b001db2ad2eff5mr285438plk.60.1707757520380; Mon, 12 Feb 2024 09:05:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707757520; cv=pass; d=google.com; s=arc-20160816; b=GqABo8hkeUWAYRCCJDEtGRKg3ZMWuUxuXaxL1U6fsuitbhUra3Gv121fQidmc7KHsM lchL4vKuZuBTTbwmQN25PFCFnIUwneNF+nyCNAXQttYnfD1R35uR1K6XQewl+VB8/QJD vz9IilkiYE+KQHxMvuL1EsfqgVwa8/3LoQazMPjD7eGjmvuZddjfiePNUJaMFQxPko8j zKu01A8p/72yOcIgjR8/rmLYB/tOe9+ZrtG149UbUGu7rtcb+yIP/sl8flJ5mr8OvQYq 0cPiT2VApAfMEOIk4tgR4Tm/Z/mwOENdiCYbiBGjHKRIsQWM9lo+LnuiSMgb8bWsuEmh sp3Q== 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=U2UW47qceNmlc6LDcki5GA6JcjIPuB/699NdbnKKxmI=; fh=4wVMY6E7NGMF4WZzZwPWWWCXchneNhU8dUuCYrlM120=; b=U8WeMO2UweXdJaJJCDUoyV3BenKWGRh70ssH4mvWV7dPqdJZl4o+SClvTLVKkUfIB3 2GWgRr4/cHOeOmUG4BhnGLWfBPQ8PoaFT4/AlZThenJxDFMtiP3kMR5yMdic8r+lN25r l0J+anyePUWoyI0Gu8/9Vgsx0CK0awUOEQTP1mXZxaYn6/Ev6+uCkTGZYSzhATYWo1Cg h5XRDkrh8TWVFnVkPOIWqA5xt7IoKZIP/UwGkBl24KTs28VGpXBGc8n/KNradX721GsC mnbXywtITTMTAQjpr4DuiHAc86WKYGl8RwG+rJKp10V+FewZjrFJEwE2qF9TZoV7eAw/ CQKA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iJeVWBXD; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-62016-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62016-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCUwoHEc2USt/wSQzooVZJ9WMnyeqX4i7xeeKsBuGG8vgKaG3+rExd4TliZwdffp7K8KyyOsOVkxHc13cJCAdcLCWiLHmp0u7lgW3fVccw== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z14-20020a170903018e00b001d72fa74bc4si498997plg.341.2024.02.12.09.05.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 09:05:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62016-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iJeVWBXD; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-62016-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62016-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 F1C5FB24219 for ; Mon, 12 Feb 2024 16:54:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A9EF3F9FC; Mon, 12 Feb 2024 16:53:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iJeVWBXD" 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 28AE93D3A5; Mon, 12 Feb 2024 16:53:38 +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=1707756819; cv=none; b=C8mddkwkVKSIEbSon21BfDqO9+WJR4S7DHmQd6NOunZoBzOtLxIX0VrTz4hLHTV+h9yyrcDS2kxe+61vF2hRRqKMBRuRAUwzUX4uvEE9Rd/vJRcdRiDcCapHci9iJkFcLX51saLDmPq4dvVnpTaf5zPTYE4LalMlo8SzRy8l7/Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707756819; c=relaxed/simple; bh=FW7pWyR6CDbZpSvqQAnPnh3O0BgUJoHXgLMGGLsnOac=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P7sYFh9FF82DjIwARA6I6b7ruy7MAuULifm2rwrXOl/Y6b/pEW1Dsru9U9wKY04iIJmGF0KVotqY6Fc1I495PyCOc4b+i7e+D+SBkZaVFWkaTuujPYZ1pkHVwlyt9wWmYt6qV9KohznLk4sIScXkryXEd+VNuO+sbeRZDMDa2cI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iJeVWBXD; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3619C43390; Mon, 12 Feb 2024 16:53:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707756818; bh=FW7pWyR6CDbZpSvqQAnPnh3O0BgUJoHXgLMGGLsnOac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iJeVWBXDa0zorvvqAbyrlHXWCaGRup8RZbadOxfQrtGqDt/6zQKGpjvLuZbVoZLjK MnZNItAjt20yVUEilA7r5PXQ3hS4M7BBFZc0egOrZ7d3mU+mXl+ENkQuvqMpTXva97 GDao5hw2Ns9PmMpJ2Nd7/LLTQApVIco45bkwmGctYJ6TECGYEAwf1yBz+CFYabZ5E7 reXZoLV+xf3V4ZGFJCmUPp2Mf1uV6YlNSqgmQUkkxRrNeBhYtKcbMjZLdHOWd9XDJF +GgCspH9nSSzWMJO3qP96ZWpp8fLhakLFmtwaIOemQ52rbrg7ycLHnQCGMoIPR+IzJ +aQBu6xTozjkQ== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1rZZZ2-000000007ND-3qOe; Mon, 12 Feb 2024 17:53:52 +0100 From: Johan Hovold To: Bjorn Andersson , Bjorn Helgaas 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 Subject: [RFC 08/10] PCI: qcom: Add support for disabling ASPM L0s in devicetree Date: Mon, 12 Feb 2024 17:50:41 +0100 Message-ID: <20240212165043.26961-9-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240212165043.26961-1-johan+linaro@kernel.org> References: <20240212165043.26961-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 A recent commit 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, which could indicate an incomplete driver ASPM implementation or that the hardware does in fact not support L0s. Add support for disabling ASPM L0s in the devicetree when it is not supported on a particular machine and controller. Note that only the 1.9.0 ops enable ASPM currently. Fixes: a9a023c05697 ("PCI: qcom: Add support for disabling ASPM L0s in devicetree") Signed-off-by: Johan Hovold --- drivers/pci/controller/dwc/pcie-qcom.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 2455decc574a..071741b81644 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -273,6 +273,25 @@ static int qcom_pcie_start_link(struct dw_pcie *pci) return 0; } +static void qcom_pcie_clear_aspm_l0s(struct dw_pcie *pci) +{ + u16 offset; + u32 val; + + if (!of_property_read_bool(pci->dev->of_node, "aspm-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); @@ -962,6 +981,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; -- 2.43.0