From mboxrd@z Thu Jan 1 00:00:00 1970 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 D2ECE2931CE for ; Wed, 26 Aug 2026 07:16:53 +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=1787728615; cv=none; b=gE5YrqPLSXnsr0cHt4AOERKREauI2tC6Mhhwug+YrxQ3NWbpIIdvU8XX4jXauZFDCjYoWa1b69rPb6zUwZGZ1WVcK6eKq9utG7gYI+y3RG1QgoBtMTjLM9QVXeVJgYQhsV/YTKMBZkLQsdR+zki6LnNnFUJ0gqpWggGvfcxdQTU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787728615; c=relaxed/simple; bh=QaDNHFhsRuNshSwZDCtwX2GUA1cVlFCDBWc1R+rzGV8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IvefnzSZ/1dx+i0dnTArL0BG+6MjsLOe8MzJpMZlKyMgRiAf88ml5BvJZYG9l8hcPUSrYnLR2Bckq97hsnADEIostxwZrZ6sopTgYZ/ckik6vFs3NUFWVzTu+PYCxmWPjITELjOg8tGd8NrstDjG8sdQhvlaa7X8SfShL6s9Gb0= 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=NdSKn84h; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=JY7IJFnd; 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="NdSKn84h"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="JY7IJFnd" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67Q6S6nE4189901 for ; Wed, 26 Aug 2026 07:16:52 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= p6A1ycTpZigj2dUH9VB0U/4YPCbwh3lqf4lFC3kKxXU=; b=NdSKn84hzZeNSiLO +IeGsrq53tNNfs2VpnY/4Az0JsspGjmEMx8ohu8V93kCRTBgK+szzjBazX6bOJMe MI1mb6YyCB6sRk4qpu+1yXCZO2IujJ9LFztwnmmfpBGWF4138g3GBCAe9iJuGSkI DYIvSGPCoqe86XuWI30CaSgLUh/kMnZXve9EhoN9ZzxUUmoXnOYXKIzkJznrQzTj OgF+rya83TGl9Yv/+9LU9sdBYNb0mnv42c/VOYBf0imbv1ItAVmj1FC1UEtQ5vtn H7JLZm1qSTQVCR7bKfVB2FsjxO7CkRMcMgmGOwVN+dZ/GOmMs1rPnb6KJlxPqwBu tY5mag== Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4g9cgpugm9-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 26 Aug 2026 07:16:52 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-cbee6bb8408so815268a12.3 for ; Wed, 26 Aug 2026 00:16:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1787728612; x=1788333412; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=p6A1ycTpZigj2dUH9VB0U/4YPCbwh3lqf4lFC3kKxXU=; b=JY7IJFndaK7ESwitKRgRzn+rjr/u8Uz5nwizadXpUUuA9EAjtqh75Oa/dqv2qfGdJA ZwAillFa+1EiCAYXmL1BDp1hM/MYvceT7RpeDy7gNNBs3eqhR/jwarZvSTZLi95GnB2z i5XnMs73m6tK4I7FS7FpPaajGhUAALG29FmFcDEejLfwTqHys2nPx9MQbM938v0RgVKF YPX0yOxG026HasxLEy6MYbAljN6kfuD1bxiy6yyu8VFk8SNGe/ZnTPEZsiKXjnqyouSf hBqnMbNSKNZgGl6piRVWNaUjIeHnHbpiy8Y/k7urvQEAHH5GYVQx2ZkavVr9z0U4Q1/E eX6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787728612; x=1788333412; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=p6A1ycTpZigj2dUH9VB0U/4YPCbwh3lqf4lFC3kKxXU=; b=fqCeqot1wD+4By0BDaPwocoiNHDD4LpYsHjlxt6s/UdEMZHi7Fz+BOoAITIBYpaO0m J6EqM3lv6dfvAQHqe2G8uFTbLmz51N9GReItLp5tXHhiNluCU+Qgk/2NEFTNJympMT6A 2Dhqfp0f/oxJq08U9mNnNdqxPO7i1cTZuU8691M1UYQKAtfFk6ZElBnH8v9LbwVFEgCn HRlyVRjJ7L62RbzecBvFPxTaiOg7YRmOkejy54tpjrn9xOJdIGKy9pc7nj5oLnygU+cX cfcO9eCzaFhI+7DQqJcNohs46YEXvclcuBJJ9AYzI6mY6WZbqgGfzL+WPPtpdmpdrdBS +sjg== X-Forwarded-Encrypted: i=1; AHgh+RrMflES0RK465vwYkamMiAJ2JAYBc9DngRDB9ztRxPTP+JN4HTLqv3OR4UXwHs7ATn/l1ANGzktygPYRr4=@vger.kernel.org X-Gm-Message-State: AFuF++l1E9jsyHF8zsrWqGOfXbut7Pxre6Lu8TT0VtmKDuAZ2K2Iw7yx EFSh9kEXOiOsL3n+FzrVH4/xR3qgsxFcgiS7Y8/jpbJcLmvXQHoUp9m1tVl9M7QLSQiH0EB8qHh oQSHwAqqOYLVB9HcB7MJhUyp5wXgcGWDLahDHIlnwpH7YVbKB6FdXtB3kolhjQz/TGl0= X-Gm-Gg: AR+sD10QVkemOUg/Bk0MxN4XB2MpDW1QjPrFoS0l0vFUUusACu2kIibFDXLcpNAxlnI 2y51mNkFP8bniQsAh1Z2MqxtAPe9TIn//a0PEEZV7C7pWcYgMRMsNfKsQdfVQOfO4TdwMtxgmw3 wTv7MAV0a7Tq+a9zEwwqg3YBDjNFer51G41i3TK3s/JgsKllF25fVrFNeGpHEHdo7l0FyFwVNW4 hOJcTkjgcRHWBpCG1LcCBcFOToHFvEHCkQ6BbIH+ZsJc3TaHotO/iOA8IFlFuP8Pafi6Auw4CRM sQN2QrrBghndLbRLj71i0YEJHwevyz8TDcEUZyPBX1Lbr8kLb6uimdovknXMyadPN+JNHlm+Mdn h3tsK9diHA5JdrnOIudj2/vmNHLQI8oAbBng= X-Received: by 2002:a05:6a21:6191:b0:3cc:ad3e:bd7e with SMTP id adf61e73a8af0-3cf8465a5cemr9891348637.14.1787728611544; Wed, 26 Aug 2026 00:16:51 -0700 (PDT) X-Received: by 2002:a05:6a21:6191:b0:3cc:ad3e:bd7e with SMTP id adf61e73a8af0-3cf8465a5cemr9891217637.14.1787728611028; Wed, 26 Aug 2026 00:16:51 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3283d8dc465sm5553772eec.24.2026.08.26.00.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 00:16:50 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Wed, 26 Aug 2026 12:46:30 +0530 Subject: [PATCH v4 1/2] PCI: dwc: Force L2 link entry on shutdown/reboot without D3cold check 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: 7bit Message-Id: <20260826-shutdown-v4-1-eb5fe9d454ae@oss.qualcomm.com> References: <20260826-shutdown-v4-0-eb5fe9d454ae@oss.qualcomm.com> In-Reply-To: <20260826-shutdown-v4-0-eb5fe9d454ae@oss.qualcomm.com> To: Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas Cc: konrad.dybcio@oss.qualcomm.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Krishna Chaitanya Chundru X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1787728602; l=2803; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=QaDNHFhsRuNshSwZDCtwX2GUA1cVlFCDBWc1R+rzGV8=; b=9JusIyhY3VXQ7BPp2DnSEQR2LUQSqA++Bhx8M543ZR2IzPxVhpM/M3jQSEJWvLyKiQ9tdmT4V 2EPixcLaxhVBm44t7F7fQ7mvwlQCbbcpYdYYnTdYao0jt/9/t17ch6v X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-GUID: qDXQcLOm9tApl7VIvhBYOmxrfomfDpGW X-Proofpoint-ORIG-GUID: qDXQcLOm9tApl7VIvhBYOmxrfomfDpGW X-Authority-Analysis: v=2.4 cv=I+NVgtgg c=1 sm=1 tr=0 ts=6a8e92e4 cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=Sv0fKeRqtYgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=yeOUdISH2rptVKx3L3YA:9 a=QEXdDO2ut3YA:10 a=bFCP_H2QrGi7Okbo017w:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODI2MDA1OSBTYWx0ZWRfX3CwOZGWGFFuh D/8WVKBvfVq0vwKbYB4FLb3wmxkpsFnappS3qBRUOd34KiQi/kCPYFi7X3HtJGTwInaWl/4Pd4R QCYbVD1RN/L16led41yWkFbqCWjWwtXqtrlv8NbxkvUuf2XvGhzRYIJYan6atzSEmVd7HFiOJhO 3R0N7JSF4E9sMVyqqQJN+7Z+cFwvoqpRipyl1xnfyRLJuoTnF4w182VKQah4qG42QYeJ+q4A+YO vwxwZ904VlL9BJ5y4qZhGa3jKMkFjW3SJcv9+mceV6I5hsmCEX1GfByjVo690I+QzwiFor8vV/S 9bsb0HXOxTnCDVeBTr60PS/J32TGxkp4ma5nFqFv/sShz7q8emf5ULER+YLWMeqs5cjEpSWhFz6 irc/8GAASAbj4hSEkACsW7QSMhg8iHGDv4NByPX1ggQFHRQauL/51sn9eGAIENFaWHT0V3Ss7lz Wqj/zxYzsZogRa8krNQ== X-Proofpoint-Spam-Info: AW1haW4tMjYwODI2MDA1OSBTYWx0ZWRfX/N7FPWzEdTgr POi//o0B+rEAWhf/tedkLRKHjYcSxpoZLqMZCnuHJKVkfuSHkZFG/KL9MxdpS6nhJHyi9tCAHwE 5d6XMEqzt99Tlf/vzlu6Z6kM26RPNW4= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-26_02,2026-08-24_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 bulkscore=0 suspectscore=0 malwarescore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 adultscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608260059 dw_pcie_suspend_noirq() normally calls pci_host_common_d3cold_possible() to check whether every downstream endpoint can be put into D3cold before bothering to move the link to L2. If no endpoint supports it, the function returns early and leaves the link up. Querying D3cold support during shutdown is actively harmful, not just slow: pci_host_common_d3cold_possible() requires every active endpoint to already be in PCI_D3hot, and returns false otherwise. If any endpoint is still in D0 -- which is common, since endpoint drivers aren't guaranteed to have suspended by the time the host's shutdown path runs the check fails and dw_pcie_suspend_noirq() returns early without ever moving the link to L2, leaving it up right up to the point where the system cuts power/clocks to the controller. Detect the shutdown/reboot case via system_state. Still call pci_host_common_d3cold_possible() unconditionally, since it's also how "pme_capable" gets set, but ignore its return value when shutting down and force L2 entry regardless. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/pcie-designware-host.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index f5a38e6fd8d7..5d07a742faa1 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -1224,14 +1225,25 @@ static int dw_pcie_pme_turn_off(struct dw_pcie *pci) int dw_pcie_suspend_noirq(struct dw_pcie *pci) { - bool pme_capable = false; + bool shutdown = system_state == SYSTEM_HALT || + system_state == SYSTEM_POWER_OFF || + system_state == SYSTEM_RESTART; + bool d3cold, pme_capable = false; int ret = 0; u32 val; if (!dw_pcie_link_up(pci)) goto stop_link; - if (!pci_host_common_d3cold_possible(pci->pp.bridge, &pme_capable)) + /* + * During reboot/halt/poweroff the link is going away regardless, so + * force L2 entry without checking whether endpoints have transitioned + * to D3hot -- there's no point walking the bus to find out. Call + * pci_host_common_d3cold_possible() anyway (ignoring its return value + * in the shutdown case) since it's also how "pme_capable" gets set. + */ + d3cold = pci_host_common_d3cold_possible(pci->pp.bridge, &pme_capable); + if (!d3cold && !shutdown) return 0; if (pci->pp.ops->pme_turn_off) { -- 2.34.1