From nobody Tue Apr 7 22:01:46 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 76B213B6C1F for ; Tue, 7 Apr 2026 13:03:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775567012; cv=none; b=XXEsYnbCIaUwau8W4E5vVIUgD77HReEZkszIQwJslAyqcIiHbm2TtMchp8JexJopuFrGm22U/NiPekiRLRHGuJ56ooyhqYRKbM8ZsmELqo/Wy248R40L/Rm/KNgU+mSKA8qL2+g54b+jhw3HCwHkIMX0kVAFAh+S8u/7SkW+BQ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775567012; c=relaxed/simple; bh=77/I314LVY80VJYVakANAJH+wffpPLweMyKMYg0Una4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bAIvcsRRcjgFUiFh7S5hYJiHXwDjkmdC1K9Vcu5L1WiGvzTg154kly/GtxAHE68QycBEe1BfUQNba9/p55/7gHJjkqVfw4zNzlhrak8u/O2TNt7EkSp693J2TCpHYeJMRklXxd6juJWf+8uDvpUhD+8TuQ7cUme00s0HfKFyoXc= 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=IWO+Br8j; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=iCz5pe9i; arc=none smtp.client-ip=205.220.168.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="IWO+Br8j"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="iCz5pe9i" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 637CKTVE2550324 for ; Tue, 7 Apr 2026 13:03:27 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= xkmg3F6NSFziMg5x7zcfPohfxWa2M+zq+HuSXMlQHbo=; b=IWO+Br8juXfi2GMw 0IKkHEoBDywwCfX6efs6+f1+rQqegHIh85G20uAZ0uuoPeRiYz2n40wE5vaCMBXS ar97iG62w1tGd+Dh+yEQGMi67d6zt8x/scdL5surl/JrjnDqd4WVZaoRq7QMg5xx usIhv76hAZYFh7/3l+8ssdpAv0gqZ0qGSEuBsJaKCuFsbrJL65cvqC7nJ654KUmP npN8/89e96MwZqJPhv9tX3AzKEgGbYhKmexXkhG4r39seWlGDFfOTrtyfnj3YC4B WbAq0DdY//I94CsYUXpawV7xoKKXyXCW3nw1GZERMlAnGc4RHw9vEiQ8bult3+qB 7/LClQ== Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dcmreatgc-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 07 Apr 2026 13:03:26 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2b2523e0299so125355485ad.3 for ; Tue, 07 Apr 2026 06:03:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1775567006; x=1776171806; 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=xkmg3F6NSFziMg5x7zcfPohfxWa2M+zq+HuSXMlQHbo=; b=iCz5pe9iLbrG5YtAVN2sTZ7XiukMekq98A+M4TxRugVpnK/rx1ArlvKmJzBeOBqFUA +MIBNSMJU8fj9CVyOtKWUceMtereHeP/3Lp2nUoeUZmNSIH7C2SKKK+x1OQEn0dn+ZCF 9BJo62GOE6Wz1/xiYNy3e38dQc02Rrm/CMwG08TmgDZZiDZl6zHmj7P54DccXP7xqDCA GIPlpgArOdLZWiL900kjS2Aojh9fMEjAuhkWMpoVHq9WKQjomZ7mm86a7Q5KbemI082l h2NcSJi8YiiJ+UdESNdXPiNsUQitYUj4oPM4vGSTPhyy4EO2I1j03modFBd6A6vJbkY4 2w/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775567006; x=1776171806; 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=xkmg3F6NSFziMg5x7zcfPohfxWa2M+zq+HuSXMlQHbo=; b=Ombuuax5iNw09ejXYjBzdsDwj6L7ACnC9uVCEntNPqQSb6Nf5Ii7i0ZGB2Cj5I0wmv FxdHLqbZL78PApBGn+6aik1owZfroF8C0V+qWQEtILWqv9V/+sLpmDgZSggFHan06S14 AZtHkT6VgAjvQIRGESoGojBdAQ3U4ZAOcrBfviULzDs4tLwMmJZHJnGrC2ntImTYf2vH r+QrS+9mcDMaqU5dTbBhwXxv9cstnSg15DSI7o4kjV9mw7RdekxXHtYmCMO3/6Fspes9 yGJh/i2iUV07DSreiglAEMaqG1FI44bwwTvSTSlJ51bRQdZHq34CHZVM74q6DAhtaZ91 5vng== X-Forwarded-Encrypted: i=1; AJvYcCVLCLMOSulHE1BHyRpYi3g9NAHHqmxqAefOZD9O0h5z+zPBDfKyjsOPveQLFzXc9t32Y3y6eswb/2WclX0=@vger.kernel.org X-Gm-Message-State: AOJu0YyPramthcCOEqXLIb9fz68+XIt6/VNcL8X/CepmFTyikduyG9Gp l2zgGf3tTUN6go+7ZIhQ9WxkN9sq+ecbnN3HXkGkqYw7mxQh1KchnT9fBsMJcDNxzyOwqnn9y8m +gDVrXZqHslr7GF+xKVmqVX9UorlftSGEjaekM0FAxVp4T5yoOHEc+81MlwQh2PlVxvY= X-Gm-Gg: AeBDievCWokaGIE5n2RaVls5LCQrqLguljViuUMddVTa86WIWPV1uhy37cMsl7HhCbv zq//wTAdndMcO++hxNbkuACKc4jCCiL/bbmpXRmzkOQ+d1nonOPkkwBd3qzXBS5SWekQEq/7Kfh A/reCFcjzFlGj19TwfIGmeZtzO6A2N+z8tiCB+mSBgVkfUeJW5exhuAtE6D1VVeURwwXM6iColQ WrkPTTKY/59FOdkg5u2d30s6EeV3E9yVGWqO9FFXZBhUKMXmI/DTk72ljgzN/7oiQhxlVxEYJM9 7jixBr/r1KmjScpSVFYYHK3am2queC5v2r3Pd/ETGGkt2UfSTF9K3VXWELfTcnJ7gmnq3ne/voz dAy48Ppq2z7omiDV3iBUR4Z1x8J5If85AWBlP//Tk9W1+WfiXAZeBKa3D X-Received: by 2002:a17:903:910:b0:2b2:4fcc:2687 with SMTP id d9443c01a7336-2b2818014a4mr185891155ad.31.1775567005730; Tue, 07 Apr 2026 06:03:25 -0700 (PDT) X-Received: by 2002:a17:903:910:b0:2b2:4fcc:2687 with SMTP id d9443c01a7336-2b2818014a4mr185890375ad.31.1775567005020; Tue, 07 Apr 2026 06:03:25 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b2749794e8sm181564885ad.53.2026.04.07.06.03.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2026 06:03:24 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Tue, 07 Apr 2026 18:33:08 +0530 Subject: [PATCH v4 1/5] PCI: host-common: Add helper to determine host bridge D3cold eligibility 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: <20260407-d3cold-v4-1-bb171f75b465@oss.qualcomm.com> References: <20260407-d3cold-v4-0-bb171f75b465@oss.qualcomm.com> In-Reply-To: <20260407-d3cold-v4-0-bb171f75b465@oss.qualcomm.com> To: Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Will Deacon Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jonathanh@nvidia.com, bjorn.andersson@oss.qualcomm.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775566994; l=5037; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=77/I314LVY80VJYVakANAJH+wffpPLweMyKMYg0Una4=; b=r1GJebOmyKQ4qtkufVQselEhGDrMwX8o8kZA/JGziIc9JLDm5oPUn77lbC9tpF24nWy2xQMbi 0/q3x7aBMOHBF27p39O+NVYefOdrvXo2B2Lt545T5xRzzwSkpKUXMoR X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Authority-Analysis: v=2.4 cv=OKEXGyaB c=1 sm=1 tr=0 ts=69d5009e cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=EUspDBNiAAAA:8 a=w2i6tlqj-xX_7Oe5WM0A:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 X-Proofpoint-GUID: UZ6xvl7f0zPsCDnofV84vGyZL0V6cDmc X-Proofpoint-ORIG-GUID: UZ6xvl7f0zPsCDnofV84vGyZL0V6cDmc X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDA3MDEyMSBTYWx0ZWRfXwryaM8j2asL1 0TJrS+6135AXAF7EQPt+D30Xj633Ig1m/EUeoPwT/OPuKzkarhIb4Yu+gxlyaottZd2BQr/PZzo IIY8p/UNvs91HXk/NVHwqvLozRBLjIeOuTgAbisuj5IfZ7fnja1yhp1mPaDiM+VE7ZxtzOsLCmb 2KOtiqe4h2Wtg39cw1Omn3goLAnztBySVHUCGxO7iSjtE9zZNYUn/bLQmCfCATUCEbRzvKiS05Q BnR7iSAHX6RWIUZSuSRd5R4dja78/X5VHLsXXiwjvDTvhreItPPLMQBR0jOJMYj4OxkKRUv7Ar4 2BmIrqW0priacWENCSjsKv7HJT4MzOJiNb+mEPURNPwbehcq7EKsv78Y1pBdfaDiIIzvivWqzRr UPgOopUaLQR04AOSq3/1f8ead2LjfSr+bCIYhSHAuJCaULX/Yoi4kAukquAuff4zWWBU8wLug4y HovJdRrrxuTNGNGynuw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-07_02,2026-04-07_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 priorityscore=1501 spamscore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 malwarescore=0 suspectscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604010000 definitions=main-2604070121 Add a common helper, pci_host_common_d3cold_possible(), to determine whether PCIe devices under host bridge can safely transition to D3cold. This helper is intended to be used by PCI host controller drivers to decide whether they may safely put the host bridge into D3cold based on the power state and wakeup capabilities of downstream endpoints. The helper walks all devices on the all bridge buses and only allows the devices to enter D3cold if all PCIe endpoints are already in PCI_D3hot. This ensures that we do not power off the host bridge while any active endpoint still requires the link to remain powered. For devices that may wake the system, the helper additionally requires that the device supports PME wake from D3cold (via WAKE#). Devices that do not have wakeup enabled are not restricted by this check and do not block the devices under host bridge from entering D3cold. Devices without a bound driver and with PCI not enabled via sysfs are treated as inactive and therefore do not prevent the devices under host bridge from entering D3cold. This allows controllers to power down more aggressively when there are no actively managed endpoints. Some devices (e.g. M.2 without auxiliary power) lose PME detection when main power is removed. Even if such devices advertise PME-from-D3cold capability, entering D3cold may break wakeup. So, return PME-from-D3cold capability via an output parameter so PCIe controller drivers can apply platform-specific handling to preserve wakeup functionality. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/pci-host-common.c | 63 ++++++++++++++++++++++++++++= ++++ drivers/pci/controller/pci-host-common.h | 2 + 2 files changed, 65 insertions(+) diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/control= ler/pci-host-common.c index d6258c1cffe5ec480fd2a7e50b3af39ef6ac4c8c..34e4c4c1d8c0fdead3e714525a4= 97b722a41392e 100644 --- a/drivers/pci/controller/pci-host-common.c +++ b/drivers/pci/controller/pci-host-common.c @@ -17,6 +17,9 @@ =20 #include "pci-host-common.h" =20 +#define PCI_HOST_D3COLD_ALLOWED BIT(0) +#define PCI_HOST_PME_D3COLD_CAPABLE BIT(1) + static void gen_pci_unmap_cfg(void *ptr) { pci_ecam_free((struct pci_config_window *)ptr); @@ -106,5 +109,65 @@ void pci_host_common_remove(struct platform_device *pd= ev) } EXPORT_SYMBOL_GPL(pci_host_common_remove); =20 +static int __pci_host_common_d3cold_possible(struct pci_dev *pdev, void *u= serdata) +{ + u32 *flags =3D userdata; + + if (pci_pcie_type(pdev) !=3D PCI_EXP_TYPE_ENDPOINT) + return 0; + + if (!pdev->dev.driver && !pci_is_enabled(pdev)) + return 0; + + if (pdev->current_state !=3D PCI_D3hot) + goto exit; + + if (device_may_wakeup(&pdev->dev)) { + if (!pci_pme_capable(pdev, PCI_D3cold)) + goto exit; + else + *flags |=3D PCI_HOST_PME_D3COLD_CAPABLE; + } + + return 0; + +exit: + *flags &=3D ~PCI_HOST_D3COLD_ALLOWED; + + return -EOPNOTSUPP; +} + +/** + * pci_host_common_d3cold_possible - Determine whether the host bridge can= transition the + * devices into D3Cold. + * + * @bridge: PCI host bridge to check + * @pme_capable: Pointer to update if there is any device which is capable= of generating + * PME from D3cold. + * + * Walk downstream PCIe endpoint devices and determine whether the host br= idge + * is permitted to transition the devices into D3cold. + * + * Devices under host bridge can enter D3cold only if all active PCIe endp= oints are in + * PCI_D3hot and any wakeup-enabled endpoint is capable of generating PME = from D3cold. + * Inactive endpoints are ignored. + * + * The @pme_capable output allows PCIe controller drivers to apply + * platform-specific handling to preserve wakeup functionality. + * + * Return: %true if the host bridge may enter D3cold, otherwise %false. + */ +bool pci_host_common_d3cold_possible(struct pci_host_bridge *bridge, bool = *pme_capable) +{ + u32 flags =3D PCI_HOST_D3COLD_ALLOWED; + + pci_walk_bus(bridge->bus, __pci_host_common_d3cold_possible, &flags); + + *pme_capable =3D !!(flags & PCI_HOST_PME_D3COLD_CAPABLE); + + return !!(flags & PCI_HOST_D3COLD_ALLOWED); +} +EXPORT_SYMBOL_GPL(pci_host_common_d3cold_possible); + MODULE_DESCRIPTION("Common library for PCI host controller drivers"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/pci/controller/pci-host-common.h b/drivers/pci/control= ler/pci-host-common.h index b5075d4bd7eb31fbf1dc946ef1a6afd5afb5b3c6..7eb5599b9ce4feb5c8ba2aa1f2e= 532b0cf3e1c03 100644 --- a/drivers/pci/controller/pci-host-common.h +++ b/drivers/pci/controller/pci-host-common.h @@ -20,4 +20,6 @@ void pci_host_common_remove(struct platform_device *pdev); =20 struct pci_config_window *pci_host_common_ecam_create(struct device *dev, struct pci_host_bridge *bridge, const struct pci_ecam_ops *ops); + +bool pci_host_common_d3cold_possible(struct pci_host_bridge *bridge, bool = *pme_capable); #endif --=20 2.34.1 From nobody Tue Apr 7 22:01:46 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 D8EC13B7B64 for ; Tue, 7 Apr 2026 13:03:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775567014; cv=none; b=ZfT+Txuqn/B5l+hXIb7zVbjxf1ThKVCQfgaXCs5hkCjkMtE+BdGv0cjWOSaQpCfFlBE0Hg8QaZF95Ilp8k4WgT8PiY86Mi5nvH6tvip1OXh6Q3dNu5QyeG7XKWYZYgIkApWcQP1uHB2XXVOCwz6h47PN79zFG5bPZtTcczgTV/4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775567014; c=relaxed/simple; bh=pO8vVScrKCYroJtbrmCEg0jsQAkeOLwy64wLlBodYLo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UBi97vm4+n8IHfmH1joRJ4oG84M/JrdCKWCylV7qaSLkugLC1iLB9/OdQsjal+atn5qx5mEssa5CVgyCiQ+rzy7wNm11xK/OBqwr7tkUbP81CWjWiNcanswDa6fxA+MODbTpZYZr5eEFptSYVdM+st4WlAxLSxKiHk1jJP+pxTE= 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=Lz5ZVzbc; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=UmzI5/XJ; arc=none smtp.client-ip=205.220.168.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="Lz5ZVzbc"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="UmzI5/XJ" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6376wGQ31405882 for ; Tue, 7 Apr 2026 13:03:31 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= RUOhnCtucPISnasSan3rTKScJjVUfYHl/P5qU80U71Y=; b=Lz5ZVzbcPa+zPuxZ 8PAmGhNHX3aP2/zMbFaj1bI/wpj8xPjAKe1HEYaT0kNJRCzj4OvsWI5u5iWUWiEg kooZHIqWKDQcFmsrfU6QA1s3C+0UH6VyXBPyJyczmTvZie8FxxO27xfFxveuHfuk zTtnbAe283gRn5hAQe8OkG6d4LUOKxvol2Xa8I7vN+AfH1fSqgcozZLk5/NHcxv0 9kpqZLSFrB+4//CeUpfRqLHQ4L0H+OmvBRa9kA6m9qRE5yFUzpLadXV/l8pxZtS1 iIiQoE837F6p/DR4h9+2BxuNmjEUcbBLOehZaq1YYLznl3m3zUWA+i9IicSvUgBA oKyf/A== Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dcmratsnh-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 07 Apr 2026 13:03:31 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2b0c96f5d9aso60390825ad.3 for ; Tue, 07 Apr 2026 06:03:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1775567010; x=1776171810; 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=RUOhnCtucPISnasSan3rTKScJjVUfYHl/P5qU80U71Y=; b=UmzI5/XJnruyzKNc8TKTUMf62FbfTNWrtwP0MNkpjIM326q9ffUDXzM8gK1F+8usUu R8qkCebaU5fYB5Hmun4TTOPP4Cpfhu+hzqJ4ZTSP+EOu+01YUXIH1NJ/Kk79ojugAZ6T 57sdbhw+o4TfpwHWOgnCs1qpBJkWWsMuDoGdSCptfqUcZ2hyU67WsthJ83EsJyfS7box zbrEQsP8ZAyONIeMzdHMHAXNBgiqgBg+iJKyJckDXx6xMProkIhZ/sSfLGBL0qa5eLqT Y+3AD9kGEZ7U6AOIaHgNskFBn0rKqAkQBL9iClsswUPmYbU4Wf94ALOimL7Nl20hNxYQ 7g4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775567010; x=1776171810; 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=RUOhnCtucPISnasSan3rTKScJjVUfYHl/P5qU80U71Y=; b=Hv9+sTzqwzmudkJw/CH+3gKpnZ1xQQqyi+yO4hbpraGI88o+5MJLHFQCBiTB40aJYk Q42jsGtI7cXWSQWtRqYx9BhWsTEVtgb/OfQWQHeTTe3dLDncmQc4mxUntPVv3iMj0kif IgKWtnqrDszmaKHQG+VQRcx7hn9V7XTfMA93pfm6uPfVFAlqW12Gl8694uMVr7BUMsJ6 Dw0GN92otqTMxEWbHP+jDmhkFnaVyMtP7r8BjhFELY/MEOi4z+plt8mXvCwfD2P4/QtH IBATbfBemSzCaNZG5Mhk9h/aOpMx9k52DFPAld24BIEeBm7kkL7eDPFacejmsPH6qO0q 00kg== X-Forwarded-Encrypted: i=1; AJvYcCXhbiGQThrv0edI8L5EZQxzBkufkYYaBxd6D0YrX0X0KputMa+t0Qp82mZ3RqOxM5BvX1znGaqQjguIyUY=@vger.kernel.org X-Gm-Message-State: AOJu0YwdKUOLiE7/Ng5OodV0nllt9/gJVhJXnJstDSt32pHkTiHPVRkt o9OTQ47POTnbHhu1v7S+P7tX0KEqOuiVK9aS0zuQ2E7QOu1GMtDtGp9fwg+2CObQKR/qR8RHBrT Gg2sFe8VihypFjA1YXO5x4+M8tx8oY+fS4Cbz1w6GhOoIc6Bqh81Ud++G0I3Xb+0bvpI= X-Gm-Gg: AeBDiespI9kBu0r3Z7tqKlL6wsLcz2ubMlCZi2ymfZd7D5+aE8vmPguRpGMY6bIgc1I 2ZG5LRXgHQ62s3V9eSIkWOIis/1mMs7oFRbrSNhaw9oRQR13Tfkd61nf+epqF3tdrZUu6gPi0CO WDWU7l6i7sa51oMi3TAPNrAOc+RLj0KwGw8gjRVd+6qhP1tZoHQddJY8QqJZ8LRHZLaF9QQCRtJ 4j+ESUmtviqr43jQunfsG+ctk1faeKY3xSBoXqw/pWadeGqB6oOqS2vEc+nNiXCkMl3Rb2VF/wi 54NUprG7l8oE1Nhne/sQ70Ipm6lDvxcj0zjJU6SWiuh4iqroD8MzzM0QzLPS7ppWByCRTzkPPxb VS6nQmJBuuNlmI0FykJK2eW/IhvZRA1zcaAUr2VPHH3F1oGaNQtaFHEKe X-Received: by 2002:a17:903:3904:b0:2b0:c0a8:5000 with SMTP id d9443c01a7336-2b2816ae915mr193383145ad.14.1775567010389; Tue, 07 Apr 2026 06:03:30 -0700 (PDT) X-Received: by 2002:a17:903:3904:b0:2b0:c0a8:5000 with SMTP id d9443c01a7336-2b2816ae915mr193381885ad.14.1775567009563; Tue, 07 Apr 2026 06:03:29 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b2749794e8sm181564885ad.53.2026.04.07.06.03.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2026 06:03:29 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Tue, 07 Apr 2026 18:33:09 +0530 Subject: [PATCH v4 2/5] PCI: qcom: Add .get_ltssm() helper 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: <20260407-d3cold-v4-2-bb171f75b465@oss.qualcomm.com> References: <20260407-d3cold-v4-0-bb171f75b465@oss.qualcomm.com> In-Reply-To: <20260407-d3cold-v4-0-bb171f75b465@oss.qualcomm.com> To: Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Will Deacon Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jonathanh@nvidia.com, bjorn.andersson@oss.qualcomm.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775566995; l=1941; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=pO8vVScrKCYroJtbrmCEg0jsQAkeOLwy64wLlBodYLo=; b=M3puhT4nVYwMiJ7XYXSfcZrmSGJerFMTB6LFXEag8ihvt6K0hDXMWnl/7zCZKMVkQqDUhuKx6 6VZ4rPuVn4qA5/B5oeAe+YY5sgXYSSIlGet2S5d3Rm3zsRU3N9wVOH5 X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: fC8E7QfhkGyvE5i4VKBCkhubJvdY_lY2 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDA3MDEyMSBTYWx0ZWRfX8Xr1HNXbpld0 zjFXTk43Zm8FBBKveHOWbsnkvTf4MGc5+DFDr7fmf8GZbFzp9l+XFTAb1x4azxWUAFmI0sXhpvr Pu0GWt4wyNgk6C9n8R0kB9xWGrCXwZKpaC5qDpBi3e7GXYlOKeEq7wBVsbC2xbk2SOGTu4T+vg3 onw9/srwaAmrgYKfX+MY044j31gLTBRuv0iGUM19JV3T0KeB3QR0L12nxeggBZ7HzL1rp9Q7Q56 EzYFe3EtjiO5AjLL/dXP6Ph1pQ+VISBhVe+jBp2L77krigfOe5RhMCnO0Od6E4u489Anzh0qMxl Xr+aWZWlLXq0WYGiDM1WRyL5dnMlkEVr/yrIn1TI5ivBboef9yYKQdtoRORohViBLjrykBfHgqB XbkpZioXsY+Yrfr0c3QMHXpiYZHW68P8+iKUJGzbSSnMtfCLvm7U20oj3htaIV8rJvxmDdoFnXa 4kNJIHoSi22lNkpLCvg== X-Proofpoint-GUID: fC8E7QfhkGyvE5i4VKBCkhubJvdY_lY2 X-Authority-Analysis: v=2.4 cv=D/d37PRj c=1 sm=1 tr=0 ts=69d500a3 cx=c_pps a=IZJwPbhc+fLeJZngyXXI0A==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=Py5lcOcq67Lbq8UMOfUA:9 a=QEXdDO2ut3YA:10 a=uG9DUKGECoFWVXl0Dc02:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-07_02,2026-04-07_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 malwarescore=0 spamscore=0 phishscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604010000 definitions=main-2604070121 For older targets like sc7280, we see reading DBI after sending PME turn off message is causing NOC error. To avoid unsafe DBI accesses, introduce qcom_pcie_get_ltssm(), which retrieves the LTSSM state from the PARF_LTSSM register instead. This helper is used in place of direct DBI-based link state checks in the D3cold path after sending PME turn-off message, ensuring the LTSSM state can be queried safely even after DBI access is no longer valid. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/pcie-qcom.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index 67a16af69ddc75fca1b123e70715e692a91a9135..b00bf46637a5ff803a845719c5b= 0b5b82739244b 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -131,6 +131,7 @@ =20 /* PARF_LTSSM register fields */ #define LTSSM_EN BIT(8) +#define PARF_LTSSM_STATE_MASK GENMASK(5, 0) =20 /* PARF_NO_SNOOP_OVERRIDE register fields */ #define WR_NO_SNOOP_OVERRIDE_EN BIT(1) @@ -1255,6 +1256,16 @@ static bool qcom_pcie_link_up(struct dw_pcie *pci) return val & PCI_EXP_LNKSTA_DLLLA; } =20 +static enum dw_pcie_ltssm qcom_pcie_get_ltssm(struct dw_pcie *pci) +{ + struct qcom_pcie *pcie =3D to_qcom_pcie(pci); + u32 val; + + val =3D readl(pcie->parf + PARF_LTSSM); + + return (enum dw_pcie_ltssm)FIELD_GET(PARF_LTSSM_STATE_MASK, val); +} + static void qcom_pcie_phy_power_off(struct qcom_pcie *pcie) { struct qcom_pcie_port *port; @@ -1507,6 +1518,7 @@ static const struct qcom_pcie_cfg cfg_fw_managed =3D { static const struct dw_pcie_ops dw_pcie_ops =3D { .link_up =3D qcom_pcie_link_up, .start_link =3D qcom_pcie_start_link, + .get_ltssm =3D qcom_pcie_get_ltssm, }; =20 static int qcom_pcie_icc_init(struct qcom_pcie *pcie) --=20 2.34.1 From nobody Tue Apr 7 22:01:47 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 C99F53B7773 for ; Tue, 7 Apr 2026 13:03:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775567018; cv=none; b=iZj1B7G0xetwP9Wzj5KDxXKIRVh3+DgGoK5C7a47ZqT/nq20o32c6KGOBSNQ0xoYC2UGUxUKKocXYpiTfCjCIxEjNFkssQdSwO9S2WQyKdYUtGj/DXKk0Ltq32CRaQB+HpklfowxAQ6hsTCMp3mYFAsN7Qqqz+5+8JTjGpu+CnI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775567018; c=relaxed/simple; bh=p9k1+/wF5h/48gQ8oI4Nz1vPnqke7I1l9Z0Jkky+eGc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZMt4mVj8CaxQ2ksXXn1Zkir3257QQXN696UamaOlRkr+ec0uaJADvN/Upbitr/aPbMz34OOX1SdiNSBJ/eeoByQ0/utJVPIOcWe7Uhg20jI1h4eDuzYs2/0OBajtSBocATBeSfRpiieXm3JPumXBl6YrIrCtfOPlYr8LULB9WAc= 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=neYlXzff; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Pr2vuRZs; arc=none smtp.client-ip=205.220.168.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="neYlXzff"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Pr2vuRZs" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 637Ctd9L2328170 for ; Tue, 7 Apr 2026 13:03:36 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= n0dWYOeGxguS+2oLFAt3NGnKQOAcHpW8zVfBpqLuOnk=; b=neYlXzffH3/tWdGL BP23zbmQhq3CKOr3rtHAP3Ji+bi/3KtGu97G5CY3SFnDVt8nGg8I30fSmHLF9elC d9Z1h5q3cvKELU2xZv0ObmZ2w0GUhPC/7o+mkJFGi7a7Wu33Xax2R5TjL1SlLrzm fH4uBzVFcenFQr1KGfEz1hzBEZTM9wivgAGYwqlE0gM+CbEhcRZTeXBS4M61bHk6 765AIOAf5ZjTbzkqHSc746Ikw1jw8jlWeiTIwtQvAlXkMWmnr8YrDLVhKqLTp4FC 3SLHHiQhwbmHCh6yLgfbyeQhmaAwZfpaR49e/KcxGcfqign5q1vLq9y+RoM2mQ9s o/2BDg== Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dcms4tst7-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 07 Apr 2026 13:03:35 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-358e95e81aeso11138604a91.0 for ; Tue, 07 Apr 2026 06:03:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1775567015; x=1776171815; 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=n0dWYOeGxguS+2oLFAt3NGnKQOAcHpW8zVfBpqLuOnk=; b=Pr2vuRZs/gsh6Amx4LvjxEJI0BU7269dKUAeSDZ0E1o2BnE80LRzfk8dz+CHacW7e2 qy8kg9KDd4v7uqpNx1+BhiwXwctekPWMkeeCCyToEQoImW5yhG5l0JjjU9QANlvzbTu0 A2bqwi+BnKzkP2oD6N9UjJqm2Tli3rwPPSmpBzcK9ipwPPKtQHmtGnu3c5WoOKSLon4W 6PMOjy7Rha1BN1YR6y3+Q/NjOle5kVW2fYXLE4UP22Y3GBas7TvRkZIpllNP7tPfciKo GY7ujFuVZb0hOVeWOvGMtOAxqcxcWMKA2X7xs7Gi/rxelwYNA/UGqMuShRl7vPlTh1At 5a4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775567015; x=1776171815; 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=n0dWYOeGxguS+2oLFAt3NGnKQOAcHpW8zVfBpqLuOnk=; b=cmzPMjuCMW562oD1OAH2W3qRP1iYQrbJ62rSR1lii2rHCN3Om1QvLkmTYSTCv16PFY wS5jgUdc+sk8mTNDTfvCw2JCKxBi2190LRJKUp1rTjD4mhUELoDwfcijhvWotc/+RGyh KYY9KtbG2wQ/mQ62CHJ5HDErIS8vANQwYZDAUWV0l8Hd5zHaKUQSlJbNvECTJ6craGd9 0WWBLIdyMMRjzjsXAuVpuWCQx1D0fE/PayuJg1VZl0hrJ0F/yA/70efPhYBc9gUvcG1E v/Ycs+kJdhoYNLL/K7P0TtnKTrqyEVOVrqPEyd4+1MFIzVcu7eGVFL2NqZZkIeSKdfz6 lWlQ== X-Forwarded-Encrypted: i=1; AJvYcCWaj20NlQYr2hPRVsauO0eVnVGjpsC7/t7quqrioXGgHHEe7np02a0MgSQjCvXrwqth4OzVOCttlh2J97k=@vger.kernel.org X-Gm-Message-State: AOJu0Yy3ZyJOMbtKCnkLItSHQU6NBt/Mwua765as1gtx8euVShL804fq Nr5LthEr6HI5q8M6oUoiWWtzujhIcZtwtHXf/Fr39Sc2Y1tQxGx5rP7SKCLj1+Ek6eWbtYfMYw/ rEuOdrNVoogMSkTNZyrZlgjb71BJ/WbqyB9huXQdCIdFPa0CaoGkt8+p6RhdAkXJg840= X-Gm-Gg: AeBDieukeqWwPtTXE1ocpxD5QZO29jdlVWDPGfhsRESD3WMXGtA39yhuq3WsUu+c5kF RYMty1u9nun1ghV2jMYlYyohIKgRUIfHlxeEVk+TV4+Nj2GDaJyx+ujZ3NNb6tAPnMZKaaqIEoE EcsVjFX3fC2k56svnj3Jz597Xr66WWQiOez4zqXR1lKjpr0P1Bp3CbJenndCluXphP5Pnghc7re Isxx2x8PsFeH24lCEdtRSP0wM3jdTmDjSWdi7e/0hy4ZIJSKKTTefdQ8CaaUBXmxJO1OuLuPS59 SxOaTMKcdMkjHkji+6cWwKc2/Hw+FZlGeGf2fHPglylU4l+/5GVi7TE9pztfBQKbCBcL3qROl4j GVSmPBkgpKaqfuxToZcRCcTRMnh1L+G9nKGCXJPEKvgv5NGrKIwwldwk9 X-Received: by 2002:a17:903:1a26:b0:2b0:a980:3687 with SMTP id d9443c01a7336-2b281675682mr168863095ad.3.1775567015091; Tue, 07 Apr 2026 06:03:35 -0700 (PDT) X-Received: by 2002:a17:903:1a26:b0:2b0:a980:3687 with SMTP id d9443c01a7336-2b281675682mr168862275ad.3.1775567014367; Tue, 07 Apr 2026 06:03:34 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b2749794e8sm181564885ad.53.2026.04.07.06.03.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2026 06:03:33 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Tue, 07 Apr 2026 18:33:10 +0530 Subject: [PATCH v4 3/5] PCI: qcom: Power down PHY via PARF_PHY_CTRL before disabling rails/clocks 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: <20260407-d3cold-v4-3-bb171f75b465@oss.qualcomm.com> References: <20260407-d3cold-v4-0-bb171f75b465@oss.qualcomm.com> In-Reply-To: <20260407-d3cold-v4-0-bb171f75b465@oss.qualcomm.com> To: Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Will Deacon Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jonathanh@nvidia.com, bjorn.andersson@oss.qualcomm.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775566995; l=4739; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=p9k1+/wF5h/48gQ8oI4Nz1vPnqke7I1l9Z0Jkky+eGc=; b=A/9mrwa1cEZn/665Ty4xv3sS5FQbruMYgdYZxpmFWpzrmLcBwUA+5nbcZx9i8UdCzGN+Mh8Kr 4mLUc8D2izrCNZohAfCFDN0posPPlZAgxsuu+twsHUjGoamViF7SSMd X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDA3MDEyMSBTYWx0ZWRfX+jnmkHedDiAB /uiAfhFIJuumK8jv1EekDQyeRH+OQA+Cbs9OmXJU5EbvFp4C2hnbLsmevq0LJ9dCG4rFTe7OfDZ joALfxdIdbHM1RJCpBDos6DrwixSbeqC4jEg9tprzfVLLegw2joB4gRWTKV/6OnBYdaldQ+0/ug VLxCmvRdVRti4OeQsycv0pIZ7D5+ssWpHg9u/laFLGFvp4d4g5rohuqHj7v0VULUZjw5VT55Wuq zIXSalMIOPl+m5iNlI5AdWRBNAtViWp9LE+9QFGJQu6QRC+ecJgDKfoiz6F9Ay6iN179AzTMfCL tR8rbaGIHIngULwSPuAypZ+4R/kQm3EkDbWCk85EEvESuLExvXXZekzEtLaTdMMsHDKcLgC2JFO /i42CCl1EC5p2U+NBeYdC4fkW19aie+sI3zM4StWy2WbelPFQWumfxTCd+09qvNpSf+1I3nZ8As vk2AlWxU3VqixjRTk6w== X-Proofpoint-ORIG-GUID: jFdR-pakfnwI7sJpZBnAenF4C-qw7v2o X-Authority-Analysis: v=2.4 cv=WNZPmHsR c=1 sm=1 tr=0 ts=69d500a8 cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=EUspDBNiAAAA:8 a=S-wDCh2AgS0RhsWIeBgA:9 a=QEXdDO2ut3YA:10 a=uKXjsCUrEbL0IQVhDsJ9:22 X-Proofpoint-GUID: jFdR-pakfnwI7sJpZBnAenF4C-qw7v2o X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-07_02,2026-04-07_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 phishscore=0 spamscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 malwarescore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604010000 definitions=main-2604070121 Some Qcom PCIe controller variants bring the PHY out of test power-down (PHY_TEST_PWR_DOWN) during init. When the link is later transitioned towards D3cold and the driver disables PCIe clocks and/or regulators without explicitly re-asserting PHY_TEST_PWR_DOWN, the PHY can remain partially powered, leading to avoidable power leakage. Update the init-path comments to reflect that PARF_PHY_CTRL is used to power the PHY on. Also, for controller revisions that enable PHY power in init (2.3.2, 2.3.3, 2.7.0 and 2.9.0), explicitly power the PHY down via PARF_PHY_CTRL in the deinit path before disabling clocks/regulators. This ensures the PHY is put into a defined low-power state prior to removing its supplies, preventing leakage when entering D3cold. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/pcie-qcom.c | 32 +++++++++++++++++++++++++++++-= -- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index b00bf46637a5ff803a845719c5b0b5b82739244b..c14c3eb70f356b6ad8a2ffe48b1= 07327d2babf77 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -513,7 +513,7 @@ static int qcom_pcie_post_init_2_1_0(struct qcom_pcie *= pcie) u32 val; int ret; =20 - /* enable PCIe clocks and resets */ + /* Force PHY out of lowest power state */ val =3D readl(pcie->parf + PARF_PHY_CTRL); val &=3D ~PHY_TEST_PWR_DOWN; writel(val, pcie->parf + PARF_PHY_CTRL); @@ -680,6 +680,12 @@ static int qcom_pcie_get_resources_2_3_2(struct qcom_p= cie *pcie) static void qcom_pcie_deinit_2_3_2(struct qcom_pcie *pcie) { struct qcom_pcie_resources_2_3_2 *res =3D &pcie->res.v2_3_2; + u32 val; + + /* Force PHY to lowest power state*/ + val =3D readl(pcie->parf + PARF_PHY_CTRL); + val |=3D PHY_TEST_PWR_DOWN; + writel(val, pcie->parf + PARF_PHY_CTRL); =20 clk_bulk_disable_unprepare(res->num_clks, res->clks); regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); @@ -712,7 +718,7 @@ static int qcom_pcie_post_init_2_3_2(struct qcom_pcie *= pcie) { u32 val; =20 - /* enable PCIe clocks and resets */ + /* Force PHY out of lowest power state */ val =3D readl(pcie->parf + PARF_PHY_CTRL); val &=3D ~PHY_TEST_PWR_DOWN; writel(val, pcie->parf + PARF_PHY_CTRL); @@ -844,6 +850,12 @@ static int qcom_pcie_get_resources_2_3_3(struct qcom_p= cie *pcie) static void qcom_pcie_deinit_2_3_3(struct qcom_pcie *pcie) { struct qcom_pcie_resources_2_3_3 *res =3D &pcie->res.v2_3_3; + u32 val; + + /* Force PHY to lowest power state */ + val =3D readl(pcie->parf + PARF_PHY_CTRL); + val |=3D PHY_TEST_PWR_DOWN; + writel(val, pcie->parf + PARF_PHY_CTRL); =20 clk_bulk_disable_unprepare(res->num_clks, res->clks); } @@ -899,6 +911,7 @@ static int qcom_pcie_post_init_2_3_3(struct qcom_pcie *= pcie) u16 offset =3D dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); u32 val; =20 + /* Force PHY out of lowest power state */ val =3D readl(pcie->parf + PARF_PHY_CTRL); val &=3D ~PHY_TEST_PWR_DOWN; writel(val, pcie->parf + PARF_PHY_CTRL); @@ -994,7 +1007,7 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie) /* configure PCIe to RC mode */ writel(DEVICE_TYPE_RC, pcie->parf + PARF_DEVICE_TYPE); =20 - /* enable PCIe clocks and resets */ + /* Force PHY out of lowest power state */ val =3D readl(pcie->parf + PARF_PHY_CTRL); val &=3D ~PHY_TEST_PWR_DOWN; writel(val, pcie->parf + PARF_PHY_CTRL); @@ -1065,6 +1078,12 @@ static void qcom_pcie_host_post_init_2_7_0(struct qc= om_pcie *pcie) static void qcom_pcie_deinit_2_7_0(struct qcom_pcie *pcie) { struct qcom_pcie_resources_2_7_0 *res =3D &pcie->res.v2_7_0; + u32 val; + + /* Force PHY to lowest power state */ + val =3D readl(pcie->parf + PARF_PHY_CTRL); + val |=3D PHY_TEST_PWR_DOWN; + writel(val, pcie->parf + PARF_PHY_CTRL); =20 clk_bulk_disable_unprepare(res->num_clks, res->clks); =20 @@ -1169,6 +1188,12 @@ static int qcom_pcie_get_resources_2_9_0(struct qcom= _pcie *pcie) static void qcom_pcie_deinit_2_9_0(struct qcom_pcie *pcie) { struct qcom_pcie_resources_2_9_0 *res =3D &pcie->res.v2_9_0; + u32 val; + + /* Force PHY to lowest power state */ + val =3D readl(pcie->parf + PARF_PHY_CTRL); + val |=3D PHY_TEST_PWR_DOWN; + writel(val, pcie->parf + PARF_PHY_CTRL); =20 clk_bulk_disable_unprepare(res->num_clks, res->clks); } @@ -1209,6 +1234,7 @@ static int qcom_pcie_post_init_2_9_0(struct qcom_pcie= *pcie) u32 val; int i; =20 + /* Force PHY out of lowest power state */ val =3D readl(pcie->parf + PARF_PHY_CTRL); val &=3D ~PHY_TEST_PWR_DOWN; writel(val, pcie->parf + PARF_PHY_CTRL); --=20 2.34.1 From nobody Tue Apr 7 22:01:47 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 A2ECD3B6C16 for ; Tue, 7 Apr 2026 13:03:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775567025; cv=none; b=F8+wWAi+O1IwF2Rc+/mFTxYD9l6+iq/A/koS9iHAh6iVPpr0wOOosD/0VTu/sa3yA4Z4cqiidF7FF49qYOEWVJVKrGVcc1qQoELxqSJv0QC5TQBewSiSknhGjYpOr2zDxc8/frETLC9/U/Ol9piZTX3nDofQ+Zufth+UvMowxvI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775567025; c=relaxed/simple; bh=PWGUXyr+GtnyzoUhMB9V3ekI1oFO0F8QmYYXumVt7Kw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TBt3OagZBNOgh/9Si4J9cb4QokNkJUpL9FcX6bQ+PU2GO0e8iV8Sfv3qwd0Gaeksbrm0Eg4536NxPm0vUym9539720awyc024YKfW6aPiptm+3XBl4eAsJzoGTcyT9hCWlbjoqDZ2rNdUBrcHUoss7KptF2xDJI1On4Sw4/TkVY= 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=ZiIApgK/; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=V+kDmxQz; arc=none smtp.client-ip=205.220.168.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="ZiIApgK/"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="V+kDmxQz" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 637CUajo493331 for ; Tue, 7 Apr 2026 13:03:44 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= 7aQXCO2yyCZ+oTPzSKSvjrummEe0+JiJFnwfrGu6ciE=; b=ZiIApgK/+yc6CkXF zTDxjb5yYtlLxm2mIu3jnHCnxW1Wf7FV8XXSykWVv1VrOcNgsuUOvt8SRdL1PD+k VTlc4TwID0X4zeboZ55PX7JSygwvRMnzYL+2mo096F2JcFPsoqHF1MIkRxfCOzVQ U71PaiBwMVtbzgLLB/M/sGpLSnoC5/api0/wudeOCCivarkAByAFamJaX6xosVlx ctsl7axMgQtM/z/Jsboi4VO1/4pbnsMrSuDDbMlJR9ytKugAC8B1ytE6npAfnJyS lGvVEUSWUfoAG9LcgzWfxNihGPAPb3BaA1+NJjivyb14ddzK8ah5SjDGA1hcbSbs G8VPGQ== Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dcmr8trnn-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 07 Apr 2026 13:03:43 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2b0b0aae381so52530445ad.2 for ; Tue, 07 Apr 2026 06:03:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1775567023; x=1776171823; 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=7aQXCO2yyCZ+oTPzSKSvjrummEe0+JiJFnwfrGu6ciE=; b=V+kDmxQzYNSsksM8qiAOA14erOBvDWy0d0WWD4BJkRBAcM9EuDKmv9r96+Qa6NcOlN KJOwX9JE1Jufa+y+vHk5O5brQ/pZGlq5RnqkPHAY3CVIE0hFlwaNxESqJuziOgLdEP+P 0XHXGlIRXriRG2IKzQjl2PzzpiPMp2yfOUD8aBYRX+L2j0OwUEQvBdRwe5byn9Gt4oLt /e7rX2IinQp8WleXA0WYJLtLS7NMMpfu6AdPx1AAAwqQ+izVNtHW9GMZpZ/nWpm4K7pr iCqisSV7J13wrmaIBfV/FJfwUeRekNg+JpDZs8bid1UJkPYsDCx4glSXGVkNtP5SPaqv 8oHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775567023; x=1776171823; 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=7aQXCO2yyCZ+oTPzSKSvjrummEe0+JiJFnwfrGu6ciE=; b=GAh79clCPxus7Ui8Vo0F9cfR9j/1QrKUjbWNv5k7oD9bjv5sO8eSyBsrcwNH+Hbk+m RUSboPkY3xQjGnG+Au7jH0VcBZnhOSl8RxZWxTusFAvMpRR0liz9VgZHCJKAsb92/twv qLieEaOtbVPgqjP7OnOAzAIiBy+3wC1yySYK3LIoAHmtAKI786F7Rzoz7kJAGScrcFMx EPxRff0wR0NolNjdN90uJes1OVHIlHY/HNKUl915Z/QLpZ6ZZDUYwbdVyuzFvEq0ic2P sff24d3fpqq9NTlXW4Y+UrHafsWQiSd3Zkyuc5GCV+mU24drJvgbP+UcAlh8ONR19wUo wNpg== X-Forwarded-Encrypted: i=1; AJvYcCW3AmaJeXx9sb3X/uPHsoEFMjz+dG7Fs2j9D1dWi7j51kH096NDMnlC7+1d95mW2C6+EDwiHxZvCKCvR6E=@vger.kernel.org X-Gm-Message-State: AOJu0Yz1oUwB0pCWHWceWrNGdn7Yq429Kupm08z0PCFx7goRalTIki+Z b15Fp30Bz1Kymkbakrh9pL5nntOgmCQLyBuORm6wkA32/A84QDfIfLhY9ixP9s2ArEILGV4+yiZ ShWN8jRBTLXhNYl3Xx4+hlNMgCxsEcCAkdM056sFvKU8VLuBC1Vz0xloSMsAU53+XoDI= X-Gm-Gg: AeBDieu4LDW5B2RbTDaXl6C4IFMeOUUgB3FRNisHTbpoSLAyAIttRdaDoqyi5H83DqW fjtM1SNi6C6rQpjcM/AlEXDqDrXE5mx+ule9M6PxDn2ZJEgCqHfbreL1eHNp5yLhr6oWmXGkKw9 YYS1I2/lE80XX7VArnrAbzzL4gpEsba8wrP0y8sMnnD+Tkb7Wi7CSM7IE2vWoniKKPmgmcXmCuR cwNz+C9zfQzloSDZR3EnGLi3nHeqVMNBN18FzUUDYHlJ1/ItIlPDYDA9/8m+IeVEgkHutp9zV7+ pn1+fgZ3i8ixZkcOg7Z1YDDGYPN6eoA4+a8EGkpEBC2bLVhhrrUAV+AuwahGiuhIWqzkXufN+Qh bxQMKjN652lPNXByLUqTEGyouiwKROx+9+0lxP7Mx/tDpoo9KRwPqKJDZ X-Received: by 2002:a17:902:c410:b0:2b2:4862:78e9 with SMTP id d9443c01a7336-2b281687c7fmr191332735ad.15.1775567023092; Tue, 07 Apr 2026 06:03:43 -0700 (PDT) X-Received: by 2002:a17:902:c410:b0:2b2:4862:78e9 with SMTP id d9443c01a7336-2b281687c7fmr191332045ad.15.1775567022518; Tue, 07 Apr 2026 06:03:42 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b2749794e8sm181564885ad.53.2026.04.07.06.03.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2026 06:03:38 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Tue, 07 Apr 2026 18:33:11 +0530 Subject: [PATCH v4 4/5] PCI: dwc: Use common D3cold eligibility helper in suspend path 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: <20260407-d3cold-v4-4-bb171f75b465@oss.qualcomm.com> References: <20260407-d3cold-v4-0-bb171f75b465@oss.qualcomm.com> In-Reply-To: <20260407-d3cold-v4-0-bb171f75b465@oss.qualcomm.com> To: Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Will Deacon Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jonathanh@nvidia.com, bjorn.andersson@oss.qualcomm.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775566995; l=3264; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=PWGUXyr+GtnyzoUhMB9V3ekI1oFO0F8QmYYXumVt7Kw=; b=SYyzydNs/xfRblTu6iPrQSA4fMH41W/iB9N/GrQWpymTxH13o3VAyw2wznzKk6+5Owe6OlR3I qZTMEZWhJEqDsdL6LeSIjDaj91CGvrIy8scrP0kmGcdSnWG7Whu2/lL X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-GUID: UuPFKrd5CrdsSGtmNZzn3DCuMYeVHqFB X-Proofpoint-ORIG-GUID: UuPFKrd5CrdsSGtmNZzn3DCuMYeVHqFB X-Authority-Analysis: v=2.4 cv=c9abhx9l c=1 sm=1 tr=0 ts=69d500af cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=h5qRVDGUHOPEFS6InpEA:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDA3MDEyMSBTYWx0ZWRfXxJ4GsDhMfO2m XfHClMkAPuMx3bkg30Tk9g8NAm67/KwtQoi2l3PF4O9GIO/Jxkc9kBu2ibBgMLcGkC7BitidBGX xvGmDZTHT1w9oAeKwBYaTgTbC8JXNDwwyG2xvlOba6638oxl9utIaQuc6b3SsPooaR5vQeGWowI 62u7pO7SnvGXJaxj1tEcz/LraJpIyXF516edwleLZYOsXyxNXovwW7ztXsUmq9+4IJnXmEhSkDb ZpCJ6cNH1c4s+ZDa9ngO+tsC7E2sYFXU8kyvvxQAyoAMcuwB93iNWFDQEOqI3kl+fSAGK1KoVO8 18VU2SvlOPK5wlwlOctXZaWp9FOz9kPRkosH3kE7wX2Wrg+B8cxXH7boYC80Xm25DuomwKPHIEB ZqCLW4uDWWzkA/kMTsVH4XZZMGjT+k4YgDC54voFUNd9TEsLJ2knZyXdRlZAyMjvdf05CzJhlfZ XO69Ny2mMhs9OCppDvQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-07_02,2026-04-07_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 adultscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 spamscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604010000 definitions=main-2604070121 Previously, the driver skipped putting the link into L2/device state in D3cold whenever L1 ASPM was enabled, since some devices (e.g. NVMe) expect low resume latency and may not tolerate deeper power states. However, such devices typically remain in D0 and are already covered by the new helper's requirement that all endpoints be in D3hot before the devices under host bridge may enter D3cold. So, replace the local L1/L1SS-based check in dw_pcie_suspend_noirq() with the shared pci_host_common_d3cold_possible() helper to decide whether the devices under host bridge can safely transition to D3cold. In addition, propagate PME-from-D3cold capability information from the helper and record it in skip_pwrctrl_off. Some devices (e.g. M.2 cards without auxiliary power) may lose PME detection when main power is removed, even if they advertise PME-from-D3cold support. This allows controller power-off to be skipped when required to preserve wakeup functionality. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/pcie-designware-host.c | 11 +++++------ drivers/pci/controller/dwc/pcie-designware.h | 1 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pc= i/controller/dwc/pcie-designware-host.c index 6ae6189e9b8a9021c99ece17504834650debd86b..ce3093cfd1608f1616001cbf5f5= 41a4dc3eafea5 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -16,9 +16,11 @@ #include #include #include +#include #include #include =20 +#include "../pci-host-common.h" #include "../../pci.h" #include "pcie-designware.h" =20 @@ -1218,18 +1220,14 @@ static int dw_pcie_pme_turn_off(struct dw_pcie *pci) =20 int dw_pcie_suspend_noirq(struct dw_pcie *pci) { - u8 offset =3D dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); + bool pme_capable =3D false; int ret =3D 0; u32 val; =20 if (!dw_pcie_link_up(pci)) goto stop_link; =20 - /* - * If L1SS is supported, then do not put the link into L2 as some - * devices such as NVMe expect low resume latency. - */ - if (dw_pcie_readw_dbi(pci, offset + PCI_EXP_LNKCTL) & PCI_EXP_LNKCTL_ASPM= _L1) + if (!pci_host_common_d3cold_possible(pci->pp.bridge, &pme_capable)) return 0; =20 if (pci->pp.ops->pme_turn_off) { @@ -1269,6 +1267,7 @@ int dw_pcie_suspend_noirq(struct dw_pcie *pci) udelay(1); =20 stop_link: + pci->pp.skip_pwrctrl_off =3D pme_capable; dw_pcie_stop_link(pci); if (pci->pp.ops->deinit) pci->pp.ops->deinit(&pci->pp); diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/con= troller/dwc/pcie-designware.h index ae6389dd9caa5c27690f998d58729130ea863984..0af083018aee29c1f0f4385dacc= 6e878c8d040de 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -447,6 +447,7 @@ struct dw_pcie_rp { bool ecam_enabled; bool native_ecam; bool skip_l23_ready; + bool skip_pwrctrl_off; }; =20 struct dw_pcie_ep_ops { --=20 2.34.1 From nobody Tue Apr 7 22:01:47 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 3A92E3932CE for ; Tue, 7 Apr 2026 13:03:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775567032; cv=none; b=Hn0ye5o+xiZzYJiaeJ9/z8Bk7AQr13DncEEmKzx7gF1dVvZXgFgXPcAA0ujiUSLTjEJOC/su6d33mUTJlpOS13D5VDYuSMdQOb6y0Up58ZDl6KLvvPLqqoFpXounGfW+FKJsrKnNdx/gDfyxagLeoOs1SDJ/6EDJtSXvVX4SH/M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775567032; c=relaxed/simple; bh=W1OhNcEspfBwAlfmZve2ZqD5tZvvm1E8mVApzAXXGuI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GNQQG2BefGX3dPMC3bDaDSugRfGZSDz6EZAR1VvMHYv0Zq/1ZL+fpGDG5uZHSw1dij2YbCzd4amcvSW46cdaV64Jxz99Sl7dKp9oW+EtEF2tyzoTFXibVPW+WbUp1n/aJMWtk6hpXP3D03Dp2567FQ2qCHm0BEhJd5dslBfqg/A= 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=bCnvo+02; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=SBPvjqDH; arc=none smtp.client-ip=205.220.168.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="bCnvo+02"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="SBPvjqDH" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 637Ca1E1492506 for ; Tue, 7 Apr 2026 13:03:50 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= 33isoV0yWVJ9xotd+3ciXf4Msdfdu+7UChBrj+6r8Zg=; b=bCnvo+02LZ73oC4a eqaGfX+dMblgz/tmkFLmUryVC8AsbKahxJw3KkHa49PXG2aIEFG4pyZQBGTAQNqk 54RqPlyHWxE+hWnEP07Gz6MBvzGaTWbyreMmBdoPVRjVSs1NonS/wvoiK1vZjQFi DFcDlMeD+SnxH5B+ZOTLHjfxAqca00CboKsTjcW4f6VDpEerqFRFcuHKosXPQA2+ se4Gzic4JU8h7qKl7kCiLKes/msnmiIkMHgllj4+F4tEHDw/rd371UB6vnxoYwag mtfyotCOoZ9kBllaT3KB9tkG190fFMhiikAAWZ19JT7ZWCNxDI4rvfWTPSgTJzhR c0QwHw== Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dcmr8trpd-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 07 Apr 2026 13:03:49 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2b0c92ff4ebso65794355ad.2 for ; Tue, 07 Apr 2026 06:03:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1775567029; x=1776171829; 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=33isoV0yWVJ9xotd+3ciXf4Msdfdu+7UChBrj+6r8Zg=; b=SBPvjqDHoMwSnVxcv6XOLh4kIhI8YZZroVKIiSz4fTgoqAhd+EIP7GLf8ha3jggtvO 3ovQDtFDH/YxdfO01x4vBJPh7HUG/8dQ0BvFEi6gWAS5r08AR9d8qUV2YLE65sz+70Q+ lMgrwToICoaSGTJ5rdvb41lGCrLs6vt1G1HbMTgm+DcFbZ8WR+mjBvuHdMu3OBwsAokq fn8w9Is012qT3Hb2tC7vivi1pB5LGOG+tO3XXbaL6wRVa/GMJif3UD8CFp8/yGfyr+9P pYY63tb4u6vrWLCJJBFPIULuYL0U/KCPcWUhs8uMjkbAvNi4KrPi5MHJF8D72bBPT6nu bVrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775567029; x=1776171829; 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=33isoV0yWVJ9xotd+3ciXf4Msdfdu+7UChBrj+6r8Zg=; b=l3DmNV+UQ2GKVnPvfYyNWo8xxSr9LTqx+LkqZedjiHbMN4BcVgOhlwyHrzxPAQxxXq xTA415n7NpJrRvPGAwTSZoKt4BdayBZKZXTlJRzoKgKzzWz8mGtUoSN4mGkY3AxRk+Jn TQEK59H42CVLoP8SksMTyNzEDh0dvou2P+0HDWr8kQFnkRWS2K8onYVvoKt9YbqJ0tY5 nmfnP1tLO21p/s5CIz59jJq9i55rOKO6uq9TxiyEPDwnRZc/rAfFpUGWrmc3SPwwN2kb XfUUi8mJEsBxmRAvxGs/PrcSNEIeldL4UrnGwa2P1e20vP6PzwThIbhXo2Jq8Fr/hA32 WjTA== X-Forwarded-Encrypted: i=1; AJvYcCVr/02Ehlnd5ke5n0zYOHaJyrviJ8WBN1eBU9R7tK7UcQS2iFJ4y8kOwuy12NUEoI4+U6UF6+OA1a7y2pE=@vger.kernel.org X-Gm-Message-State: AOJu0Yx3ybSLQ0RYUhDhFccESg+xMTVeuORm03ezwWfMo/bCEAnUtKUe ifF1oDdaIioolEaxfHYG9m7UFu/IjtXxC64MRtKrTLbtXFBzoW9cImjqbAy8w5lOyBeZ6OJ/oRi yrXVny9MJOyBZNCZCDe7B4+0q3FSPD/W1aO7PX7n9Zm++R4wYsjQzYng7fwSTNSAT7jU= X-Gm-Gg: AeBDievstR3BCeETGSfZy5auQ8mbqoqxQw9q0gSfFPvIiGAzyuR2bZNzrg8i9HZqEpY 9G4cHkFvsmTQpIlSQswAf/7mR2DsIl/CkNfrA9j+860iC8lKx9bkq613QzGBHQVCknkuwDNV1/c Je8y32YxDStAkcYrsLFiRJ/WAK/1J88Qit9Ss6zaQRInt4lC0kQzW3FwSkehVn9Fxi64Sm9TxKo 6NLkcJN2mTRSKrBMO8NKIqy+VMD1ZTyn5dF/kLDCPrDM973tiPHuIq5APwUtWLz6zIYPu/Yx6Uu ywyloYd8D3eDyq2vBNXli11Vn1RVH6xBKX7tgo/favO02mUPBV2/J+UvhRBj8b9mHCx3JyoRheS jWn8Wz+WeV/irJ+52yOPLXE4gBfBTMpZr+3sKDMJF0FiVOfpTdAFExncF X-Received: by 2002:a17:903:185:b0:2b0:5be9:f423 with SMTP id d9443c01a7336-2b2819180c5mr167577785ad.43.1775567028698; Tue, 07 Apr 2026 06:03:48 -0700 (PDT) X-Received: by 2002:a17:903:185:b0:2b0:5be9:f423 with SMTP id d9443c01a7336-2b2819180c5mr167577015ad.43.1775567027939; Tue, 07 Apr 2026 06:03:47 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b2749794e8sm181564885ad.53.2026.04.07.06.03.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2026 06:03:47 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Tue, 07 Apr 2026 18:33:12 +0530 Subject: [PATCH v4 5/5] PCI: qcom: Add D3cold 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: <20260407-d3cold-v4-5-bb171f75b465@oss.qualcomm.com> References: <20260407-d3cold-v4-0-bb171f75b465@oss.qualcomm.com> In-Reply-To: <20260407-d3cold-v4-0-bb171f75b465@oss.qualcomm.com> To: Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Will Deacon Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jonathanh@nvidia.com, bjorn.andersson@oss.qualcomm.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775566995; l=7930; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=W1OhNcEspfBwAlfmZve2ZqD5tZvvm1E8mVApzAXXGuI=; b=o5n5mzRCb1hInEwIP9Lo/mkqs1V+NaPD+q4D06Qd+qeyiIvLq3qU775agBpWtloe/QTme7jjR nCXcRkr1zXNBKMFJTclv0uXBflgy6ODXlnpBwnYuu/TuB08Ps/73MqU X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-GUID: roacLmXh3vbrfDqioWiFcyXsbHIFTcaA X-Proofpoint-ORIG-GUID: roacLmXh3vbrfDqioWiFcyXsbHIFTcaA X-Authority-Analysis: v=2.4 cv=c9abhx9l c=1 sm=1 tr=0 ts=69d500b5 cx=c_pps a=IZJwPbhc+fLeJZngyXXI0A==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=3yJ-4rlz3SFKGY1FFUMA:9 a=QEXdDO2ut3YA:10 a=uG9DUKGECoFWVXl0Dc02:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDA3MDEyMSBTYWx0ZWRfX7nbaXx6G/b6h ttfX7ThJoZqHZG2KmNDtawW8sUlJusseT0SE3oTO8eayu+ZCF89MqCmGk0CJ+Z41+KMXWDicM3N Mu/5mjfqfGCouCvWOPcBWjmNBdy0jSIXt7mc0I5bdW9/k5B8sWRFUOri31tZCd6/yKu0gXWh+wo IiAemx9Il3oxt+IBSRMbW3vG1qMsSg622M38XE+fnu1nyOVUULEpRL04AS1FCNdbuPVNXQveBTd OIz4BqfRAnyYZAmPtKWtXYclan+DTodMxfYNdFH9rD1vNj/IgnXnj75h1hDgin+eh+goq0K0KAZ NzG6klPgF2Px9YrhwbHAqtSNYW2YrvFeWWXyPMfR7S9LsqFJNCmuMLs7UkZaCBXO1brwhq543lb bma0V6IpXIfUtd4kqCvdwSetOnSMk++SJJDSrtELkgcnQguAumfArNHy8Y99vjM/48Oo0G+NuUp ebne4YWVEIh5HDhq1aw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-07_02,2026-04-07_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 adultscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 spamscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604010000 definitions=main-2604070121 Add support for transitioning PCIe endpoints under host bridge into D3cold by integrating with the DWC core suspend/resume helpers. Implement PME_TurnOff message generation via ELBI_SYS_CTRL and hook it into the DWC host operations so the controller follows the standard PME_TurnOff-based power-down sequence before entering D3cold. When the device is suspended into D3cold, fully tear down interconnect bandwidth, OPP votes. If D3cold is not entered, retain existing behavior by keeping the required interconnect and OPP votes. Use dw_pcie::skip_pwrctrl_off to avoid powering off devices during suspend to preseve wakeup capability of the devices and also not to power on the devices in the init path. Drop the qcom_pcie::suspended flag and rely on the existing dw_pcie::suspended state, which now drives both the power-management flow and the interconnect/OPP handling. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/pcie-qcom.c | 150 ++++++++++++++++++++---------= ---- 1 file changed, 92 insertions(+), 58 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index c14c3eb70f356b6ad8a2ffe48b107327d2babf77..e8d109c44dd270610272906244d= 1afeec3664f41 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -145,6 +145,7 @@ =20 /* ELBI_SYS_CTRL register fields */ #define ELBI_SYS_CTRL_LT_ENABLE BIT(0) +#define ELBI_SYS_CTRL_PME_TURNOFF_MSG BIT(4) =20 /* AXI_MSTR_RESP_COMP_CTRL0 register fields */ #define CFG_REMOTE_RD_REQ_BRIDGE_SIZE_2K 0x4 @@ -283,7 +284,6 @@ struct qcom_pcie { const struct qcom_pcie_cfg *cfg; struct dentry *debugfs; struct list_head ports; - bool suspended; bool use_pm_opp; }; =20 @@ -1336,13 +1336,17 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *p= p) if (ret) goto err_deinit; =20 - ret =3D pci_pwrctrl_create_devices(pci->dev); - if (ret) - goto err_disable_phy; + if (!pci->suspended) { + ret =3D pci_pwrctrl_create_devices(pci->dev); + if (ret) + goto err_disable_phy; + } =20 - ret =3D pci_pwrctrl_power_on_devices(pci->dev); - if (ret) - goto err_pwrctrl_destroy; + if (!pp->skip_pwrctrl_off) { + ret =3D pci_pwrctrl_power_on_devices(pci->dev); + if (ret) + goto err_pwrctrl_destroy; + } =20 if (pcie->cfg->ops->post_init) { ret =3D pcie->cfg->ops->post_init(pcie); @@ -1386,11 +1390,14 @@ static void qcom_pcie_host_deinit(struct dw_pcie_rp= *pp) =20 qcom_pcie_perst_assert(pcie); =20 - /* - * No need to destroy pwrctrl devices as this function only gets called - * during system suspend as of now. - */ - pci_pwrctrl_power_off_devices(pci->dev); + if (!pci->pp.skip_pwrctrl_off) { + /* + * No need to destroy pwrctrl devices as this function only gets called + * during system suspend as of now. + */ + pci_pwrctrl_power_off_devices(pci->dev); + } + qcom_pcie_phy_power_off(pcie); pcie->cfg->ops->deinit(pcie); } @@ -1404,10 +1411,18 @@ static void qcom_pcie_host_post_init(struct dw_pcie= _rp *pp) pcie->cfg->ops->host_post_init(pcie); } =20 +static void qcom_pcie_host_pme_turn_off(struct dw_pcie_rp *pp) +{ + struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); + + writel(ELBI_SYS_CTRL_PME_TURNOFF_MSG, pci->elbi_base + ELBI_SYS_CTRL); +} + static const struct dw_pcie_host_ops qcom_pcie_dw_ops =3D { .init =3D qcom_pcie_host_init, .deinit =3D qcom_pcie_host_deinit, .post_init =3D qcom_pcie_host_post_init, + .pme_turn_off =3D qcom_pcie_host_pme_turn_off, }; =20 /* Qcom IP rev.: 2.1.0 Synopsys IP rev.: 4.01a */ @@ -2072,53 +2087,51 @@ static int qcom_pcie_suspend_noirq(struct device *d= ev) if (!pcie) return 0; =20 - /* - * Set minimum bandwidth required to keep data path functional during - * suspend. - */ - if (pcie->icc_mem) { - ret =3D icc_set_bw(pcie->icc_mem, 0, kBps_to_icc(1)); - if (ret) { - dev_err(dev, - "Failed to set bandwidth for PCIe-MEM interconnect path: %d\n", - ret); - return ret; - } - } + ret =3D dw_pcie_suspend_noirq(pcie->pci); + if (ret) + return ret; =20 - /* - * Turn OFF the resources only for controllers without active PCIe - * devices. For controllers with active devices, the resources are kept - * ON and the link is expected to be in L0/L1 (sub)states. - * - * Turning OFF the resources for controllers with active PCIe devices - * will trigger access violation during the end of the suspend cycle, - * as kernel tries to access the PCIe devices config space for masking - * MSIs. - * - * Also, it is not desirable to put the link into L2/L3 state as that - * implies VDD supply will be removed and the devices may go into - * powerdown state. This will affect the lifetime of the storage devices - * like NVMe. - */ - if (!dw_pcie_link_up(pcie->pci)) { - qcom_pcie_host_deinit(&pcie->pci->pp); - pcie->suspended =3D true; - } + if (pcie->pci->suspended) { + ret =3D icc_disable(pcie->icc_mem); + if (ret) + dev_err(dev, "Failed to disable PCIe-MEM interconnect path: %d\n", ret); =20 - /* - * Only disable CPU-PCIe interconnect path if the suspend is non-S2RAM. - * Because on some platforms, DBI access can happen very late during the - * S2RAM and a non-active CPU-PCIe interconnect path may lead to NoC - * error. - */ - if (pm_suspend_target_state !=3D PM_SUSPEND_MEM) { ret =3D icc_disable(pcie->icc_cpu); if (ret) dev_err(dev, "Failed to disable CPU-PCIe interconnect path: %d\n", ret); =20 if (pcie->use_pm_opp) dev_pm_opp_set_opp(pcie->pci->dev, NULL); + } else { + /* + * Set minimum bandwidth required to keep data path functional during + * suspend. + */ + if (pcie->icc_mem) { + ret =3D icc_set_bw(pcie->icc_mem, 0, kBps_to_icc(1)); + if (ret) { + dev_err(dev, + "Failed to set bandwidth for PCIe-MEM interconnect path: %d\n", + ret); + return ret; + } + } + + /* + * Only disable CPU-PCIe interconnect path if the suspend is non-S2RAM. + * Because on some platforms, DBI access can happen very late during the + * S2RAM and a non-active CPU-PCIe interconnect path may lead to NoC + * error. + */ + if (pm_suspend_target_state !=3D PM_SUSPEND_MEM) { + ret =3D icc_disable(pcie->icc_cpu); + if (ret) + dev_err(dev, "Failed to disable CPU-PCIe interconnect path: %d\n", + ret); + + if (pcie->use_pm_opp) + dev_pm_opp_set_opp(pcie->pci->dev, NULL); + } } return ret; } @@ -2132,25 +2145,46 @@ static int qcom_pcie_resume_noirq(struct device *de= v) if (!pcie) return 0; =20 - if (pm_suspend_target_state !=3D PM_SUSPEND_MEM) { + if (pcie->pci->suspended) { ret =3D icc_enable(pcie->icc_cpu); if (ret) { dev_err(dev, "Failed to enable CPU-PCIe interconnect path: %d\n", ret); return ret; } - } =20 - if (pcie->suspended) { - ret =3D qcom_pcie_host_init(&pcie->pci->pp); - if (ret) - return ret; + ret =3D icc_enable(pcie->icc_mem); + if (ret) { + dev_err(dev, "Failed to enable PCIe-MEM interconnect path: %d\n", ret); + goto disable_icc_cpu; + } =20 - pcie->suspended =3D false; + /* + * Ignore -ENODEV & -EIO here since it is expected when no endpoint is + * connected to the PCIe link. + */ + ret =3D dw_pcie_resume_noirq(pcie->pci); + if (ret && ret !=3D -ENODEV && ret !=3D -EIO) + goto disable_icc_mem; + } else { + if (pm_suspend_target_state !=3D PM_SUSPEND_MEM) { + ret =3D icc_enable(pcie->icc_cpu); + if (ret) { + dev_err(dev, "Failed to enable CPU-PCIe interconnect path: %d\n", + ret); + return ret; + } + } } =20 qcom_pcie_icc_opp_update(pcie); =20 return 0; +disable_icc_mem: + icc_disable(pcie->icc_mem); +disable_icc_cpu: + icc_disable(pcie->icc_cpu); + + return ret; } =20 static const struct of_device_id qcom_pcie_match[] =3D { --=20 2.34.1