From nobody Mon Jun 15 23:18:53 2026 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 8BFB83ED12A; Tue, 14 Apr 2026 16:00:12 +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=1776182412; cv=none; b=g+at8VWfbcBOxS6aN+QjcUoBeFTJJC4d+6aZySzD4T82hXiEskVBZ5jZt/Z1Orxco8+9A0gNmHN2a5KTsLVMHXxKa2h0+Abe6oE2wPoobMEkl9/0QP3eaCOPz28wzMO1is3lW7lTHYnEpwqgYE9o8LpIuIQTRa7peLkx1aTqA28= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776182412; c=relaxed/simple; bh=iAKBGCABkb4xVXmTd/HHowC129P8QPZmpSjEkWgabaM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=f3iWN8RUNWL6Ayuz7nTo7/ymkY94Vrbg7xpUDVgR/LzKwJzObdu3oKONb/ibBDgtUML1bx77wL36fzN7ZV/3uaUqiF8moEQrUODczzIjZxiqQvMunc+Cu8BAItD/00a2Z0Z0kSQPpOIoqbkehzO0c0+2B+fsFgK9Yt4O1QwmsGw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uXKky96s; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uXKky96s" Received: by smtp.kernel.org (Postfix) with ESMTPS id 22753C2BCB3; Tue, 14 Apr 2026 16:00:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776182412; bh=iAKBGCABkb4xVXmTd/HHowC129P8QPZmpSjEkWgabaM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=uXKky96s4f2fZd0xkfLHCZWRm0T+DxsrWxzfjtB7AOPiXXzA5Kyk78F1z4PckZRUx 6dBpazkd8sU1PsIiC8RbU14IDR8+aMY0fwXYekDXJFd3SIrBwU7BZsTHWqMINkqxrD SmU8eOtOQ3kdt0NBCtRM30KnMMbLWl4tmznpDodwjbB1dJPfBswvSPihMfiqcb7eTU 12CVznGksApMcdpekQzScV/6ApRjWtyqmNOPzPuDvm5oTBU39oQdYbFzDrGbtGV2W1 LElrarzAYZ1A3NqJWHSgqlXuej06LBcjoLTQWJGSCWyIcg4Noqs2MObe4ueVtg4o7x 3ZFjpzUkQ+r1g== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15844F9D0DA; Tue, 14 Apr 2026 16:00:12 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Tue, 14 Apr 2026 21:29:39 +0530 Subject: [PATCH 1/4] PCI: Introduce an API to check if RC/platform can retain device context during suspend 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: <20260414-l1ss-fix-v1-1-adbb4555b5ab@oss.qualcomm.com> References: <20260414-l1ss-fix-v1-0-adbb4555b5ab@oss.qualcomm.com> In-Reply-To: <20260414-l1ss-fix-v1-0-adbb4555b5ab@oss.qualcomm.com> To: Bjorn Helgaas , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-nvme@lists.infradead.org, Manivannan Sadhasivam X-Mailer: b4 0.15.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3214; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=dSaPO8AlhFDgfohNEVxN4pE727IFbvTr7L0udrmkbZ4=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBp3mSJQGw7NOXWNlGDoeSfbsV1IadRDRAOlYwji DQFQoP4FhCJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCad5kiQAKCRBVnxHm/pHO 9QAXCACJnEGJZagKmL2MdEaxeZuzF4dIIzTKziQQG5AIPw3Z4UVbWgIj3Zb7SbPKzv/aCmagape iwuDEL0M7cXyE0HwQivolMkYcD4r1gd15o9rmUTnO/V6Bsi5vq0VKiMVZV+/k8ZjPJaw52gAeTA m2lzJvk20/tKA0OAf+V3483lrzls8SnxpHReWcBIljHufXnZo6pnTBbcu2J/4rbWgeuw7qYCXP3 mfW5qvK0FFmPAt+UUVlx6UPvrLXcXtvG71WtlydGXCW2vnYRqwj0kD6exEgFM1QEQUueP4GkgFB Vi8P2tAYTG55YT2bsXz/Z1R46f3iEZKY/M/0gPExjMHiJ5x1 X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam Currently, the PCI endpoint drivers like NVMe checks whether the device context will be retained or not during system suspend, with the help of pm_suspend_via_firmware() API. But it is possible that the device context might be lost due to some platform limitation as well. Having those checks in the endpoint drivers will not scale and will cause a lot of code duplication. So introduce an API that acts as a sole point of truth that the endpoint drivers can rely on to check whether they can expect the device context to be retained or not. If the API returns 'false', then the client drivers need to prepare for context loss by performing actions such as resetting the device, saving the context, shutting it down etc... If it returns 'true', then the drivers do not need to perform any special action and can leave the device in active state. Right now, this API only incorporates the pm_suspend_via_firmware() check. But will be extended in the future commits. Signed-off-by: Manivannan Sadhasivam --- drivers/pci/pci.c | 23 +++++++++++++++++++++++ include/linux/pci.h | 7 +++++++ 2 files changed, 30 insertions(+) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 8479c2e1f74f..211616467a77 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "pci.h" =20 DEFINE_MUTEX(pci_slot_mutex); @@ -2900,6 +2901,28 @@ void pci_config_pm_runtime_put(struct pci_dev *pdev) pm_runtime_put_sync(parent); } =20 +/** + * pci_dev_suspend_retention_supported - Check if the platform can retain = the device + * context during system suspend + * @pdev: PCI device to check + * + * Returns true if the platform can guarantee to retain the device context, + * false otherwise. + */ +bool pci_dev_suspend_retention_supported(struct pci_dev *pdev) +{ + /* + * If the platform firmware (like ACPI) is involved at the end of system + * suspend, device context may not be retained. + */ + if (pm_suspend_via_firmware()) + return false; + + /* Assume that the context is retained by default */ + return true; +} +EXPORT_SYMBOL_GPL(pci_dev_suspend_retention_supported); + static const struct dmi_system_id bridge_d3_blacklist[] =3D { #ifdef CONFIG_X86 { diff --git a/include/linux/pci.h b/include/linux/pci.h index 1c270f1d5123..d9bc7ad4eaa4 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -2080,6 +2080,8 @@ pci_release_mem_regions(struct pci_dev *pdev) pci_select_bars(pdev, IORESOURCE_MEM)); } =20 +bool pci_dev_suspend_retention_supported(struct pci_dev *pdev); + #else /* CONFIG_PCI is not enabled */ =20 static inline void pci_set_flags(int flags) { } @@ -2239,6 +2241,11 @@ pci_alloc_irq_vectors(struct pci_dev *dev, unsigned = int min_vecs, static inline void pci_free_irq_vectors(struct pci_dev *dev) { } + +static inline bool pci_dev_suspend_retention_supported(struct pci_dev *pde= v) +{ + return true; +} #endif /* CONFIG_PCI */ =20 /* Include architecture-dependent settings and functions */ --=20 2.51.0 From nobody Mon Jun 15 23:18:53 2026 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 54D9C3ED11A; Tue, 14 Apr 2026 16:00:12 +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=1776182412; cv=none; b=lXRREoyBEg+p+N/d7BLnmggYBKpn7Kxsxxw27QwPJFnV4/HvVt02NAW0HnMmUn2b9/CKjdaePwelxOCNR9hcYKNubMJ78AU77LW5IkXVflNFDg6Hb77S6POsdZQDpuz1MF7nKISVCelSFHLH9DCCRuK5n2qXC071RQ8SNsWeXMI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776182412; c=relaxed/simple; bh=HWMbqwedOoMw8lw/15aldB8uIf8M+iftPYa/bgkZ12o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TxwdHNfvqdcn6cbF4PHq8UDWo9AU86xDDy6DhlESt//ik9RwHPe7n82fXs81IF4mveRV7v3jnarXjjZAMzoolKeppplJsfXFf6XvxB/SbebrkemoGaX9nee/18jokboZ8/ExBlOfonz4gDPVdeeDOVgReASHA8mUBTgZdxEshhU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AkS2pQfu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AkS2pQfu" Received: by smtp.kernel.org (Postfix) with ESMTPS id 334C1C2BCB8; Tue, 14 Apr 2026 16:00:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776182412; bh=HWMbqwedOoMw8lw/15aldB8uIf8M+iftPYa/bgkZ12o=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=AkS2pQfuVfK9IaoAzE3tAiWiZ57wZP3rJXnVYe7dQ5Yojf5adoXNCU5xnXgnTwy5L D7UDBJyXFVqcyAmWaLgSIMkaICr+Qm8mFKy8Fk5NuLUq0j/ZEaIJaMvITkqsxhW1wz 58590VHwI1AqGHgMm5shcPzo8u4axLZwou6yL26RRQ8pYAQUrW3e7yaLOE5bapapgj yphgvcIQKO5flR6JNasMcq67OOpR8gqikhus6PTlUoDHqlCZ6L3QU3smArEkfx0Rsb luhAX+M8cY5zwukxca11Fm2j1keVNTX+RGGzc0fWvkfBrjCn26tJJQCxubUgZyj/Uw DVnFUIXZbYW4w== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25C80F9D0D3; Tue, 14 Apr 2026 16:00:12 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Tue, 14 Apr 2026 21:29:40 +0530 Subject: [PATCH 2/4] PCI: Indicate context lost if L1ss exit is broken during resume from system suspend 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: <20260414-l1ss-fix-v1-2-adbb4555b5ab@oss.qualcomm.com> References: <20260414-l1ss-fix-v1-0-adbb4555b5ab@oss.qualcomm.com> In-Reply-To: <20260414-l1ss-fix-v1-0-adbb4555b5ab@oss.qualcomm.com> To: Bjorn Helgaas , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-nvme@lists.infradead.org, Manivannan Sadhasivam X-Mailer: b4 0.15.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3305; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=LyQjngZpjyM7atFii62PC/2oWcdYdOsG7s31euB1g4g=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBp3mSJmlZhEN3RfjDf/GEGFtsvDX0Ll8oF+/ind omQnGB3tZqJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCad5kiQAKCRBVnxHm/pHO 9ZQPB/0TFauDo1bNl4OhfXKRCke7aoRExVdAT6cGff+51gC9NlEDUehXTYuzKL5aDTHYH3ze3Ev ff8UzBeyFVUlIkHbaYlWYXMsWfgsT9c+cFuKXMqflurzV6GJZWp6wfJGoEl91gbonS6TDmLwITa Auq6bnsaVRZULioqu2rI37EFXRDXcAZLL6CGooAg7SHcTBHs+08DXbUHuneegTd82hf+KOD81uY CoGr1SLR5WAn4VwxhvlFNQTPH5oPDwNj9kbNQrNtT/tLV1wUrSNbhtArNOVdkPJDGtFuRx35Muz OoYeVIpwIXc6uVTS5uNg88zL70+ulUzFTKjvoG118XKUHMag X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam The PCIe spec v7.0, sec 5.5.3.3.1, states that for exiting L1.2 due to an endpoint asserting CLKREQ# signal, the refclk must be turned on no earlier than TL10_REFCLK_ON, and within the latency advertised in the LTR message. This same behavior applies to L1.1 as well. On some platforms like Qcom, these requirements are satisfied during OS runtime, but not while resuming from the system suspend. This happens because the PCIe RC driver may remove all resource votes and turns off the PHY during suspend to maximize power savings while keeping the link in L1ss. Consequently, when the endpoint asserts CLKREQ# to wake up, the OS must first resume and the RC driver must restore the PHY and enable the refclk. This recovery process exceeds the L1ss exit latency time. And this latency violation results in an L1ss exit timeout, followed by Link Down (LDn). If the endpoint device is used to host the RootFS, it will result in an OS crash. For other endpoints, it may result in a complete device reset/recovery. So to indicate this platform limitation to the client drivers, introduce a new flag 'pci_host_bridge::broken_l1ss_resume' and check it in the pci_dev_suspend_retention_supported() API. If the flag is set by the RC driver, the API will return 'false' indicating the client drivers that the device context may not be retained and the drivers must be prepared for context loss. Signed-off-by: Manivannan Sadhasivam --- drivers/pci/pci.c | 11 +++++++++++ include/linux/pci.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 211616467a77..e871cccf24ae 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -2911,6 +2911,8 @@ void pci_config_pm_runtime_put(struct pci_dev *pdev) */ bool pci_dev_suspend_retention_supported(struct pci_dev *pdev) { + struct pci_host_bridge *bridge =3D pci_find_host_bridge(pdev->bus); + /* * If the platform firmware (like ACPI) is involved at the end of system * suspend, device context may not be retained. @@ -2918,6 +2920,15 @@ bool pci_dev_suspend_retention_supported(struct pci_= dev *pdev) if (pm_suspend_via_firmware()) return false; =20 + /* + * Some host bridges power off the PHY to enter deep low-power modes + * during system suspend. Exiting L1 PM Substates from this condition + * violates strict timing requirements and results in Link Down (LDn). + * On such platforms, the endpoint must be prepared for context loss. + */ + if (bridge && bridge->broken_l1ss_resume) + return false; + /* Assume that the context is retained by default */ return true; } diff --git a/include/linux/pci.h b/include/linux/pci.h index d9bc7ad4eaa4..860d8a774b51 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -658,6 +658,8 @@ struct pci_host_bridge { unsigned int preserve_config:1; /* Preserve FW resource setup */ unsigned int size_windows:1; /* Enable root bus sizing */ unsigned int msi_domain:1; /* Bridge wants MSI domain */ + unsigned int broken_l1ss_resume:1; /* Resuming from L1ss during + system suspend is broken */ =20 /* Resource alignment requirements */ resource_size_t (*align_resource)(struct pci_dev *dev, --=20 2.51.0 From nobody Mon Jun 15 23:18:53 2026 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 8C07A3ED12B; Tue, 14 Apr 2026 16:00:12 +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=1776182412; cv=none; b=dV/S/Env6lyVhsHa7ITWihb9QWBf8cXPShfHdRs4s9Po0lisvNBSYdONne61EvjeNgxGampP5Je0+dptNycn0/LK7rhGzU51+SywYceZVWOwqRGYnAVo/rIAR1khrf2tyB0ZKGd6RZtiF2Hg04ytrBJpMlQgwYR50wiYD0IO8do= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776182412; c=relaxed/simple; bh=pfNTF4MyP7MbmWdaazOq9QG/qOgjWorM7k/pjnsdDnQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Df7JOJ1uBfwwK8h5GstVdzGFShYvjClA+WVmI6wD7O+KRhuLmf4Wws3hHnaS+b0JrSx/v3HA/JA18iljUWWoY3akb8qbCVkIJZ0RIDZEMqJSS3Mm3OjBA8NuvqYEIxqlBnyxPqGBnj6z315M8o/tNfmx6SgpIgI7daXGt6gIC9c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sU694WY8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sU694WY8" Received: by smtp.kernel.org (Postfix) with ESMTPS id 42B45C2BCC4; Tue, 14 Apr 2026 16:00:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776182412; bh=pfNTF4MyP7MbmWdaazOq9QG/qOgjWorM7k/pjnsdDnQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=sU694WY8maCGvpsF2aPpm4jykA3aSkWrASj+i1wx4WXCaMBFa/Zp0bB/AwQCxS+lh QhDNbpEZKsjJO8i14ujORdg0B/cGIq7oQXTua+g4ufmC2XyAZ1gxxaXP8k6iPfmdeg UnWTzjH5eGd7ybatUXh7WFySJ2tFwsSxtMNI2QxdbKJDf1g5Ie7aNUdPx/2qTYAmzh z/ugqtiaApix27pRIyiV1Bp3C+dDpkIkwMRWVK5eOyx7CFjbdsVm/TlUC5xGZFwd/7 NrFsmrkA7jnAjhsu/OGO12rjRDErQDO9q3g17ojFDcXBhzzufJyPnxfqK0F4ffIH1M 9wwhDXd4TJ+Mw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3612FF9D0E4; Tue, 14 Apr 2026 16:00:12 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Tue, 14 Apr 2026 21:29:41 +0530 Subject: [PATCH 3/4] PCI: qcom: Indicate broken L1ss exit during resume from system suspend 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: <20260414-l1ss-fix-v1-3-adbb4555b5ab@oss.qualcomm.com> References: <20260414-l1ss-fix-v1-0-adbb4555b5ab@oss.qualcomm.com> In-Reply-To: <20260414-l1ss-fix-v1-0-adbb4555b5ab@oss.qualcomm.com> To: Bjorn Helgaas , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-nvme@lists.infradead.org, Manivannan Sadhasivam X-Mailer: b4 0.15.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2251; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=4DYEP1zauw4orkCeJPQ0uZzhSR/jxYVrTX9FZ5rhz18=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBp3mSJljvX2vawbgDmc0ySB7J1BxqOQETumjAom wNG3QoD26iJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCad5kiQAKCRBVnxHm/pHO 9bvaB/4oVZcPWtoaiBUEUXLan1VGwV1vrK0hc99d4fh1ddJGcWisR+kxmzUyky+BJJpPBnoT3ef 5PeuljVd9HnNz+Nv+Ik5keS/N+FGKfZr9n7Cu4CLc472+00oPb8wnWxXWpa6/xhNe5G7iqCHSEn 6wYL5AtnXz4CL2zs+oZwk7xAf+DY3EkbrJlhxy6B2W9hBF+0ZK0Zw7zamLuLmgyRvKs07zOtkUf Y2arFkHTFH9deHbELWtMtHckak0wBO+opSqpprijj/g6iEVEpi/mFDIrxjZdwGuIce96deoHSYQ 8K/B2aQnL9YPi9b0KFoTmoCVyuNfaTCdhVKGKaQkMeuEmUeb X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam Qcom PCIe RCs can successfully exit from L1ss during OS runtime. However, during system suspend, the Qcom PCIe RC driver may remove all resource votes and turns off the PHY to maximize power savings. Consequently, when the host is in system suspend with the link in L1ss and the endpoint asserts CLKREQ#, the OS must first wake up and the RC driver must restore the PHY and enable the refclk. This recovery process causes the strict L1ss exit latency time to be exceeded. (If the RC driver were to retain all votes during suspend, L1ss exit would succeed without issue, but at the expense of higher power consumption). This latency violation leads to an L1ss exit timeout, followed by a Link Down (LDn) condition during resume. This LDn can crash the OS if the endpoint hosts the RootFS, and for other types of devices, it may result in a full device reset/recovery. So to ensure that the client drivers can properly handle this scenario, let them know about this platform limitation by setting the 'pci_host_bridge::broken_l1ss_resume' flag. Signed-off-by: Manivannan Sadhasivam --- drivers/pci/controller/dwc/pcie-qcom.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index 67a16af69ddc..01afffd384f2 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -1363,6 +1363,17 @@ static void qcom_pcie_host_post_init(struct dw_pcie_= rp *pp) struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); struct qcom_pcie *pcie =3D to_qcom_pcie(pci); =20 + /* + * During system suspend, the Qcom RC driver may turn off the PHY and + * remove votes to save power. If the endpoint asserts CLKREQ# to + * exit L1ss, the time required to wake the system and restore the + * PHY/refclk exceeds the strict L1ss exit timing, resulting in Link + * Down (LDn). Set this flag to indicate this limitation to client + * drivers so that they will avoid relying on L1ss during system + * suspend. + */ + pp->bridge->broken_l1ss_resume =3D true; + if (pcie->cfg->ops->host_post_init) pcie->cfg->ops->host_post_init(pcie); } --=20 2.51.0 From nobody Mon Jun 15 23:18:53 2026 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 85DD63ED127; Tue, 14 Apr 2026 16:00:12 +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=1776182412; cv=none; b=eMs6MBfZzzEwW7CpabzS1MoiGjEX+Sfeppw0TrchzHBGBj5u15Q6m+ODdldoix9QaU799ZYHRlxYC7vvWFjBL7th4V+tS0pGsTJzJMqiyQHVJr8pwe89OQM+2ecrLT04wkGkhJXzZngMEEivPIO7NVo0WEFTD5B25HKhYLiyWX0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776182412; c=relaxed/simple; bh=gd3NgVMSuig/iZb+VOgR9aExL4jhTOa1kJGPBkl+B4E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=L76imM+V38rSAQrq2OyEgyJ6hpB49y7Q6E+qBphfqQLzQwDi1ARu0GThUKOwr0DE8vjZnilJEcbJW6mILvTVVXkzwWCQlf+tpmbK0caPANzZRl+AnYWTL0hdKvzO46a0CE4HE5mfeUVKy5toed8zJSSjJCT5MeiHnQgvTsOQDEM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HmQ/Rexu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HmQ/Rexu" Received: by smtp.kernel.org (Postfix) with ESMTPS id 4FE79C2BCF4; Tue, 14 Apr 2026 16:00:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776182412; bh=gd3NgVMSuig/iZb+VOgR9aExL4jhTOa1kJGPBkl+B4E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=HmQ/RexuXS6e7g1wNo7tHtonuuuTo03+g/Eyd14XD5eKS7/6BkPKJn+oJSpPq0FXl OEdP9Y3YsR3rjDovyfTcv2qBmZPDU2UHYAhczTL3zQhg/SYygxkUdghjCpnaByYIsD /yWBMcSl5giCTOrr0OwehWFXla7fJCb6gA/S8TCivMNw6E4L3fqgqt34UpXztb94or PBgbVm0c3+zdGdM1uTGJc8mYAOtD3xBKBRZomgc32mVZbulbtMVcmWXkune8SJEKoO 7PYT8aKtR68YsYsPC3miPfIF/Oy2SVPWfMaeGrz+7DM+d/bnLXSc+7GYIYeWi6kSBI N1PmeiFW1pDHg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46739F9D0E2; Tue, 14 Apr 2026 16:00:12 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Tue, 14 Apr 2026 21:29:42 +0530 Subject: [PATCH 4/4] nvme-pci: Use pci_dev_suspend_retention_supported() API during suspend 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: <20260414-l1ss-fix-v1-4-adbb4555b5ab@oss.qualcomm.com> References: <20260414-l1ss-fix-v1-0-adbb4555b5ab@oss.qualcomm.com> In-Reply-To: <20260414-l1ss-fix-v1-0-adbb4555b5ab@oss.qualcomm.com> To: Bjorn Helgaas , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-nvme@lists.infradead.org, Manivannan Sadhasivam X-Mailer: b4 0.15.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2024; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=9iqx3F1OL5ZbjTfr4VDbef+alvPRZcEaJTtZ6g6PO50=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBp3mSJFA22ZzG+uMhc8/mbge/1w0NhLM9MKpWXt fSvM3+00NGJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCad5kiQAKCRBVnxHm/pHO 9bdLB/9BO3ZBbEYnyiWy5OENKpCGj4kWk1d2BmauKwSbNLIdFFAwpmWDLWclzRaGeiY8Ewl95W/ 5QcaDR28JqbVG2Xb7m/MM4m/yPbrcrC/KQLrVfLSrlyU/SIHBG+ilclmFF5SBF2sHa4UoQBcgCQ PuMUkEXCjUvAyN7eaPRXnOKo6q0e+3t0hHoIQjqI67tG2V72hZDSlZ4hSOsitDyT6rJ8eZ6Z5nC g99zGFXbhMUJox8LCXtbGc+4rj5sakJ2AUUf2Mv+l8ony3usLJvWdJS8oLQUFxX1NetE9KqRFTF lKxN2gGnT1QBD0SYUW8s9tb9/GETQmHWQfmpt3ufgFaTTKfI X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam The pci_dev_suspend_retention_supported() API lets PCI client drivers know if the platform can retain the device context during suspend. This is decided based on several factors like: 1. Firmware involvement at the end of suspend 2. Any platform limitation in waking from low power state (L1ss) And this API might also get extended in the future to cover other platform specific issues impacting the device low power mode during system suspend. So use this API instead of checks like pm_suspend_via_firmware(). When this API returns false, then assume that the platform cannot retain the context and shutdown the controller. If it returns true, then assume that the context will be retained and keep the device in low power mode. Signed-off-by: Manivannan Sadhasivam --- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index b78ba239c8ea..19010330469f 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -3915,6 +3915,7 @@ static int nvme_suspend(struct device *dev) * use host managed nvme power settings for lowest idle power if * possible. This should have quicker resume latency than a full device * shutdown. But if the firmware is involved after the suspend or the + * platform has any limitation in waking from low power states or the * device does not support any non-default power states, shut down the * device fully. * @@ -3923,7 +3924,7 @@ static int nvme_suspend(struct device *dev) * down, so as to allow the platform to achieve its minimum low-power * state (which may not be possible if the link is up). */ - if (pm_suspend_via_firmware() || !ctrl->npss || + if (!pci_dev_suspend_retention_supported(pdev) || !ctrl->npss || !pcie_aspm_enabled(pdev) || (ndev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND)) return nvme_disable_prepare_reset(ndev, true); --=20 2.51.0