From nobody Mon Feb 9 16:01:54 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 2C0C22EC559 for ; Fri, 9 Jan 2026 07:21:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767943295; cv=none; b=ZE7EmgDIGRWjIlFGrkV/L0O4g7LAvjbHH9gAwBWbId3+gkccW073AyiRyD/0jHf9a7Nynkvqz68OcyxziV5KiQ+oPIOfjPY+l8ymvq5fhRlGyJNtjJSiOGkF3boPYrTAPdJtnmPGbcg4h+PDJOL3UBO+XT0Xvl8dEG/gyvpekjI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767943295; c=relaxed/simple; bh=sATat5gXi+RmClCqAUl81QS783eB44xkTcOkPS41g74=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YYQ1g33ZXcXdfLkhfgK560WQnrhSrSeRETTe50b3+XyfD2/Gli06NRUu7UsJ6trS6bt6EjvAhpE7r6dMGPjg+w8/6B4tR2dMa1MwKM5pkCwGcAmM1PXvadzytu9RoyxUe2rsoESFfb5WuAzsxy0pn+eoAux5tPPgjPQMcd8vS/k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=FdOinPKa; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ShTQDBeS; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="FdOinPKa"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ShTQDBeS" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 608MoqY93218559 for ; Fri, 9 Jan 2026 07:21:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 72S83sFcJLczdJt8oEW24FAL+N/F40XzrhBECgz9llc=; b=FdOinPKaTYDaHT4h fQToOCGUwhBzCHAGgahjXuDn6HqKxW3zHbrFvSl4wuwsfAmtpkcyOpg0gFXeweiy grH6Yg44JTuzVq/mVqGlZ1Kb3aPHZo2b2uNV+y/LlSJTCCrSOXtYgGTFqZUxNbWq 1EuFLO9vFg2HDCEhCi5RuY0+U/NW4YWTvOBC7MP45frAnLDKbdirpS/kh4laBTBh RuOJwRrbb8d805eZvUaOm1Wcy1/RaKTKtNJoNg44iP9YXh5d+Z6H5+gdehM2PSZg f1A5I35RGuUzUAI5TZ9/I7B2p+X7mgYj2yUegnumUiSpu2re8SsrSNdAd2XYDaip IJoukg== Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bjjt0hkfu-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 09 Jan 2026 07:21:32 +0000 (GMT) Received: by mail-pf1-f197.google.com with SMTP id d2e1a72fcca58-81c68fef4d4so3240423b3a.2 for ; Thu, 08 Jan 2026 23:21:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1767943292; x=1768548092; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=72S83sFcJLczdJt8oEW24FAL+N/F40XzrhBECgz9llc=; b=ShTQDBeSOSn5ZTDX0X6R6PaYLQQux+GIdFZldqGsRVkaGDkt7NRzuITdSbTvHpcPoy 6Kf7gu6snLgdDK8R7ysVknpwfIfT0eWif+tIjlTXGGWDFzOYl9x6zRo+QMI1N8Mt0l0S srbtVCn8UDlMkwqFyR9qZzkqWyTRYB4KXCIdaGD7oROW4ehBQSIKLCWXiOMhYOV+uB6f 1JkLSe6YrHfhL7DsC/MdDG94AJLHYru9NDALj8hQLUfBN1G1he2W3K5/VKsf7Rq5Xuoh wXURCyoZj+q3b7fRx6fQDjvbFt9oIn8NHNeJpvvKPpvhqQ1ZvV+SPP3ewMS9UWgzpj/I 5tjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767943292; x=1768548092; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=72S83sFcJLczdJt8oEW24FAL+N/F40XzrhBECgz9llc=; b=VJPtOeUlv0Xht4SBr12t+pj4Ayjna7OiETxoaF0R5+mwJoohsWj5tpogMZOpytzX20 CHNqnilIHriVILtau6Wde1I1MpmxIT2iUECj875879HmWlmY0wWV6mi6bovpuwM7YypU cONwF/SwzkLFV2NP26HVh5wgUuTweVcqH17bxfpdu9lgBPp3P2OYKrsr4p+aSB3p1E44 gVw2hcIghucRYdmyWKrIj+SzPe2DVe3PiKMU+qB/Q2F6dRVKWq0TixfwdthJSqktT+w8 TRh5ce4kNJrqpxjvJbXpQKq8enVxfhCvjDsXMZCNAbtC3bdwB94PnoxdesUpLUJXUDzl 9tdQ== X-Forwarded-Encrypted: i=1; AJvYcCVDNYVC+fsCfNzT/qM4+gOSPLFVvzVGPbzvYf6FZn9yynmJWt15yupf1X7RWNbakYiwdV5z9NxwUd2sUZ8=@vger.kernel.org X-Gm-Message-State: AOJu0YwUSWH2OJ25qAKl/4XE9ATQtX8JawxUm7q09ZEd66yqjpruWVr2 FmVpmB+4OZE5huaIsgscUxTVpi8DUNvErffECmnOhwmPRCMwT4Qq4G2Yp9G5p7u8mwtn0hnBvTC L5HYKbiStmjREiCfR1inr4NoJK2XzZ3LhD210dSVPNXqM8DSiHR+a91OU4ccUlWEzNdnxZguuNH s= X-Gm-Gg: AY/fxX7mUFFVqa6/ATMLA/Pyu0tf8jA1tHSKhdGQBIj+wvChqI2700cbJE4Kgp45XYq IVD6x9VMHpeXOO3vMlXfU/J+buf8NEy3DJ+isZEwO95LNEK6bwl239Dyb8OTIXu9M6Jgb/+axtp +K6p4UQAI3bfobHFEj2XFUCO32Ts8EUwCkdMr2El3uKhtGW6OiZ4aAfXfIiVJ6dKI90csgi97P5 RZDz0uNhMjTsxDmmHoGRxKT0ailmK7xh3gnaccqWMlyJxxl4dL4oYewRReLa4DPSZVUYYzPs0MG 9nts79CUK9Hh0Ytu5NByW5VJGEkgLNHzL/txGA+upuHM77bfuU8Jq+Q2ZzdH8tNN3v49GTcDGSL Kn85DpyQG6V2hIIHF9UBnGniUbzoWgJwa3iNHAFz/AcEJ X-Received: by 2002:a05:6a00:e19:b0:7e8:43f5:bd18 with SMTP id d2e1a72fcca58-81b7f3f1ff7mr7879189b3a.45.1767943291779; Thu, 08 Jan 2026 23:21:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IHBsaYWHr8eZog5Woy39kTSosevSsQ2EU8sshvTGXJv+BXUHaeNfYg7ku/1jVEn99TS7RH7bA== X-Received: by 2002:a05:6a00:e19:b0:7e8:43f5:bd18 with SMTP id d2e1a72fcca58-81b7f3f1ff7mr7879143b3a.45.1767943291246; Thu, 08 Jan 2026 23:21:31 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-819bb4c85bfsm9510369b3a.30.2026.01.08.23.21.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jan 2026 23:21:30 -0800 (PST) From: Krishna Chaitanya Chundru Date: Fri, 09 Jan 2026 12:51:09 +0530 Subject: [PATCH 4/5] PCI: qcom: Add link retention support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260109-link_retain-v1-4-7e6782230f4b@oss.qualcomm.com> References: <20260109-link_retain-v1-0-7e6782230f4b@oss.qualcomm.com> In-Reply-To: <20260109-link_retain-v1-0-7e6782230f4b@oss.qualcomm.com> To: Vinod Koul , Neil Armstrong , Philipp Zabel , Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Krishna Chaitanya Chundru X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1767943270; l=4282; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=sATat5gXi+RmClCqAUl81QS783eB44xkTcOkPS41g74=; b=/zFkBrsSntluR8iQc/wubd+dohrF5L/1t1GC/liOmhwA0+Vxai9BpzHpjhct44yyHtNpaSt6d 70jOpWu4WP0Aofc9GwjUx9bfI/LQXB3Oy5Huej4BYcKA8AjhCv1Naim X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-GUID: OKUPpJ9f6SszfK3hQXfQiotAkw-RDUh5 X-Authority-Analysis: v=2.4 cv=VJzQXtPX c=1 sm=1 tr=0 ts=6960ac7d cx=c_pps a=rEQLjTOiSrHUhVqRoksmgQ==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=S-wDCh2AgS0RhsWIeBgA:9 a=QEXdDO2ut3YA:10 a=2VI0MkxyNR6bbpdq8BZq:22 X-Proofpoint-ORIG-GUID: OKUPpJ9f6SszfK3hQXfQiotAkw-RDUh5 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTA5MDA1MCBTYWx0ZWRfX+F7RUEryxTJx ZghGw13CHQAdAMRRKrnvPhE7Wp24xRinHA4pGL7KDmVrF4EfU5r3D15jNRDSUDYlYlY+l9Be06r T471bzWZB83bLU0ijIM7G5TGe7NFB4K7fnLmo0z1p4m4nPb3CdxRU2A2rIcPHx4G8JBcyQPcL4C uDSz+9NWugUztwmo8gzW8vkgqcabpWg1otiZMuQps8uALz7V2E4TmAJ87tLRpqG28CrB8d1ziSI gCFt+DWNyv9KKvGmMquMclaJ6ZbRysEgEIKk4QtwML0ZSyNrpP1yX9Oug0XaodC1dvdzMZrlDyW tD5woV5nGXSFA1gjOwMvFTuMU6Gu2Hex2PlxGKcpWo3//hOGI5s7CczQRANt8rlWnDJmHCMDPug FqifXPX1vrDqPJ6pjEHs8d6VZoxLDatjb/mjrQj42FHcfd56BbAzkbQ104NxESQsoRAlo/HtpPQ WyUbyhW4oROcGlsRaHA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2026-01-09_02,2026-01-08_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 spamscore=0 phishscore=0 clxscore=1015 priorityscore=1501 adultscore=0 bulkscore=0 lowpriorityscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2601090050 Some platforms keep the PCIe link active across bootloader and kernel handoff. Reinitializing the controller and toggling PERST# in such cases is unnecessary if driver doesn't want to do link training again. Introduce link_retain in both qcom_pcie_cfg and qcom_pcie to indicate when link retention is supported. During initialization, check the LTSSM state, if the link is already in L0 or L1 idle and LTSSM is enabled, set pp.link_retain and skip controller reset, PERST# toggling, and other post-init steps. If there is a devicetree property to restrict PCIe data rate and lane width go with the normal execution instead of link retantion logic. Configure DBI and ATU base in this scenerio, since bootloader DBI & ATU base may differ from HLOS one. So use the DBI & ATU provided from the devicetree. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/pcie-qcom.c | 50 ++++++++++++++++++++++++++++++= ++-- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index 9342f9c75f1c3017b55614069a7aa821a6fb8da7..bdd5bdb462c5f6814c8311be964= 11173456b6b14 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -259,12 +259,14 @@ struct qcom_pcie_ops { * @override_no_snoop: Override NO_SNOOP attribute in TLP to enable cache * snooping * @firmware_managed: Set if the Root Complex is firmware managed + * @link_retain: Set if controller supports link retain from bootloader */ struct qcom_pcie_cfg { const struct qcom_pcie_ops *ops; bool override_no_snoop; bool firmware_managed; bool no_l0s; + bool link_retain; }; =20 struct qcom_pcie_port { @@ -965,6 +967,35 @@ static int qcom_pcie_get_resources_2_7_0(struct qcom_p= cie *pcie) return 0; } =20 +static bool qcom_pcie_check_link_retain(struct qcom_pcie *pcie) +{ + u32 cap, speed, val, ltssm, width; + struct dw_pcie *pci =3D pcie->pci; + u8 offset; + + val =3D readl(pcie->parf + PARF_LTSSM); + ltssm =3D val & 0x1f; + if ((val & LTSSM_EN) && + (ltssm =3D=3D DW_PCIE_LTSSM_L0 || ltssm =3D=3D DW_PCIE_LTSSM_L1_IDLE)= ) { + qcom_pcie_configure_dbi_atu_base(pcie); + + offset =3D dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); + cap =3D dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP); + speed =3D FIELD_GET(PCI_EXP_LNKCAP_SLS, cap); + width =3D dw_pcie_link_get_max_link_width(pci); + + if (pci->max_link_speed > 0 && speed < pci->max_link_speed) + return false; + + if (pci->num_lanes > 0 && width > pci->num_lanes) + return false; + + return true; + } + + return false; +} + static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie) { struct qcom_pcie_resources_2_7_0 *res =3D &pcie->res.v2_7_0; @@ -983,6 +1014,14 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pci= e) if (ret < 0) goto err_disable_regulators; =20 + if (pcie->cfg->link_retain) { + pci->pp.link_retain =3D qcom_pcie_check_link_retain(pcie); + if (pci->pp.link_retain) { + dev_info(dev, "Enabling link retain\n"); + return 0; + } + } + ret =3D reset_control_assert(res->rst); if (ret) { dev_err(dev, "reset assert failed (%d)\n", ret); @@ -1043,6 +1082,9 @@ static int qcom_pcie_post_init_2_7_0(struct qcom_pcie= *pcie) { const struct qcom_pcie_cfg *pcie_cfg =3D pcie->cfg; =20 + if (pcie->pci->pp.link_retain) + return 0; + if (pcie_cfg->override_no_snoop) writel(WR_NO_SNOOP_OVERRIDE_EN | RD_NO_SNOOP_OVERRIDE_EN, pcie->parf + PARF_NO_SNOOP_OVERRIDE); @@ -1300,12 +1342,13 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *p= p) struct qcom_pcie *pcie =3D to_qcom_pcie(pci); int ret; =20 - qcom_ep_reset_assert(pcie); - ret =3D pcie->cfg->ops->init(pcie); if (ret) return ret; =20 + if (!pp->link_retain) + qcom_ep_reset_assert(pcie); + ret =3D qcom_pcie_phy_power_on(pcie); if (ret) goto err_deinit; @@ -1316,7 +1359,8 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *pp) goto err_disable_phy; } =20 - qcom_ep_reset_deassert(pcie); + if (!pp->link_retain) + qcom_ep_reset_deassert(pcie); =20 if (pcie->cfg->ops->config_sid) { ret =3D pcie->cfg->ops->config_sid(pcie); --=20 2.34.1