From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796201059; b=BqY7U+XMzPuTlDBPSbzlMDPrGDscyBjYPs+3Q2JRH54YkbPbGmH7WDSQDILFZGji26mY dNVhrvPKwcC0dkZEnZHY3hamwSzcPQ4o2J2fQHReP8En8BoscHaR/GZbEBGWCEqAdOqjJ 77waBb1agibevhmfAw5RFpyRC3IJ/fc5V1ZWUF6qnMB7idKMSHpjETMiVZVryXsLQ3wdh OtYa9jMojflefPhTZ0QZ/BH7cGDLdFRAwXhWX5SAzQ6KVqj6VQ46+HCktHGLBQ2gXvw7g Mt1BYq8I+W0gRaVuo9iqiAKuyU4/1ExCzXq8yASFqFuBA8TrHDotkr9j+zUizFrNdcQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796201059; h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=JrwxbaPlNiY1dYHYVqDOOP3iRL/q56R0gwRB80wABDI=; b=2WG2X2WICazIcO1O5Rz9fuAp+XfgY/h2LvMFstsm3QJZYrtW4J5wYPXdN3ONVud5nQYk 8nOSXaHicTVmZDwpDdtA7vZBm3npxS6/XhdWg8D08HxhQ7MI9L9orTdY1rjtlUtNGI3VL A9GBO+NpOmbItQge2jzBIjgxiXmM29GfEaFMD0oiiuvDLKV+3LvEfWYp66hPNUHKx3YzJ OZXBY3gbpyO50O+X8DL7NfWjdN3KBPl0BfcRzAa1LNGVGPhzUY8TCXpvLNj4wozhbfdCY BIQ5tutSKXaBCOug8u6H9uCVlOgdQjPiLd6UyAt9iNR5b4KaYHsphUFMDT1timo08UQ== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=A6ccS7vN; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A492B606A327; Wed, 2 Dec 2026 08:44:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=A6ccS7vN Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1796201059; b=EEXdijlDnQ27aZPMwb9WPDZlqWDFiqKR2TVHM7+Um5VRuHhyehwUB374RZkp+zt5xLCd zXx0pUljF+YpZ1CAjTGIRmEzE+gfAPskooF1SRhMxB/8S+60yupcqH7rUtlfVgAO91cr4 IeQg6l7rny8YYK8ifMUOB6iQXEGWJvH9P4ghnHRWG+dK/IBShDQkyL+ypzlQzLYTKSECU AnjZsByaLn5Khkrh/rRiYydiIyMYx8IXX8rS9IAY/dDTyB5ObvaLlL6q4mq3pEsgxfERo vhIzbwusTPh6QXfkX/s/yGLrfJQyvjdhg4T9ynOddTYYe0oOvP1DseYqA9uSd/WeZ5g== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796201059; h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=JrwxbaPlNiY1dYHYVqDOOP3iRL/q56R0gwRB80wABDI=; b=OJcRx4bKpfTTemTUXr/7YodSNE/MjSfwRezoJ0ZZpfD+eEnpBkqJDhJ8QpsHkpVHKlIL 8TUL+jsymtAHKqV0C6CERv+/c+J33ZiL+9ij8W4m7lrBj+mAY8gmOvg1WV/4cR55WfMVo phcZBSP1Wv88OsmdcS8JdCWrdN1CqulJQTKuVDHQ3GA8hEsX9OgwSrIbPAOwUi5qsbBT3 6SgC0nxRfwMUtknae/2X6BYignnXynNgusE/oUrvzJPBYexuWqQ3V/5Krjc2Xjlmz8nWf ymdVtMu3oW58zkshwmggJe+dPTUPjqT97Srqq118EtvUNFPiJkZMKkxMUDIDmat8FMw== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id C897C1F008A0; Wed, 2 Dec 2026 08:44:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796201058; bh=JrwxbaPlNiY1dYHYVqDOOP3iRL/q56R0gwRB80wABDI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=A6ccS7vNU1DT2F+6xT2YfhVJsRYa9sGBE6ZRYn3ono3yL5sEoLqeESfMGf8ngixuo 9ofp1BvZPc0sNDuMh22ntr1Dtt1knzI7WefbW39FmmivfL0KnOtwIoNehpY84TZmBU n7+EwJgpJhvfRj07C7SSJX6teNf078o0xB4aTRhgC556dqU6UlcIiZEubsfl/7i4VV XXA/MVbZzS9cw/ghnBqsvl+iawdKZKJNBYCZQcYo1u1nFSrdGK+Qbz66vBo4kFQmaB pcR/Cyi0M5/GOPsK1XbriTFzubqQfj9Pi0FE/ZaVrxyO2kPXVwzFZlVsRNdSX2ZEAl 19+7myBe/M95A== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 55B774F327; Wed, 2 Dec 2026 08:44:04 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Wed, 02 Dec 2026 09:43:57 +0100 Subject: [PATCH 2/2] bus: mhi: host: pci_generic: Use mhi_pm_suspend_force() for system suspend X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Message-Id: <20261202-mhi-suspend-fix-v1-2-451bdce5733c@oss.qualcomm.com> References: <20261202-mhi-suspend-fix-v1-0-451bdce5733c@oss.qualcomm.com> In-Reply-To: <20261202-mhi-suspend-fix-v1-0-451bdce5733c@oss.qualcomm.com> To: Manivannan Sadhasivam , Jeff Hugo , Loic Poulain Cc: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Abel Vesa , Len Brown , Manivannan Sadhasivam , stable@vger.kernel.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3598; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=q3ifJVit24Sm/Z3Obz85uNlKVkY0bGZ/h7BjLLRgm4I=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBrD9pSjdTJ6Tw5hEShrlkPV95nPZ796FJrvb303 267nhiVzeeJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaw/aUgAKCRBVnxHm/pHO 9eowB/9xPMLIvte/3Jdi0DbNVsgBTFHYcB3wGlx0s2YdGYYCMrDuWfukzB7cEw9VlFM9np2HHC4 W1Yu4tsyt4A9B3wyncCf5nyZj+UK932h6YxMbMrM8Tych9uzQu454VlDUeXHY9hfC2OnGZN0pVu EdWNV0dhsubvEPM5JBeffN+fdYypWKKX0VhRe6ckr8oRGjhQ5EqEgrM3n1eF969mg3oo17GhRxJ 7l26/qgSbYZ+T1pPPlHZzKoghdHRHzlOoBAlMpPVCqyFMcxABoZPNLWzx090xqdSIuUA6n10Moq UgVdmF79WOWnX8TLGTE+y1YwQv27oQaTOBQpIEfaQ6pMUjMc 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 Content-Transfer-Encoding: 7bit From: Manivannan Sadhasivam System suspend reuses the runtime suspend callback, so it inherits the -EBUSY abort of mhi_pm_suspend() when the device has asserted WAKE or has packets pending to be transferred. While aborting works fine for runtime suspend, it is a disaster for system suspend, because a single driver aborting suspend aborts the entire suspend process. This is what happens on Qcom Glymur based laptops and Lenovo Thinkpad T16 laptops, where a failed MHI modem suspend aborts the whole system suspend: mhi-pci-generic 0006:01:00.0: failed to suspend device: -16 mhi-pci-generic 0006:01:00.0: PM: failed to suspend async: error -16 To fix this issue, make use of the new API mhi_pm_suspend_force() during system suspend and continue using mhi_pm_suspend() during runtime suspend. To achieve this, split the common part of the suspend code into __mhi_pci_suspend() helper with the 'force' argument. And set this argument to true during system suspend and false during runtime suspend. If the mhi_pm_suspend_force() API returns an error for any reason, continue the system suspend as there is nothing more the driver can do. Later during resume, the device will be recovered if needed. Reported-by: Len Brown Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220020 Reported-by: Abel Vesa Fixes: d3800c1dce24 ("bus: mhi: pci_generic: Add support for runtime PM") Signed-off-by: Manivannan Sadhasivam Cc: stable@vger.kernel.org --- drivers/bus/mhi/host/pci_generic.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c index b1938c55ffda..9eb7dbb68d2e 100644 --- a/drivers/bus/mhi/host/pci_generic.c +++ b/drivers/bus/mhi/host/pci_generic.c @@ -1694,7 +1694,7 @@ static const struct pci_error_handlers mhi_pci_err_handler = { .reset_done = mhi_pci_reset_done, }; -static int __maybe_unused mhi_pci_runtime_suspend(struct device *dev) +static int __mhi_pci_suspend(struct device *dev, bool force) { struct pci_dev *pdev = to_pci_dev(dev); struct mhi_pci_device *mhi_pdev = dev_get_drvdata(dev); @@ -1714,11 +1714,14 @@ static int __maybe_unused mhi_pci_runtime_suspend(struct device *dev) goto pci_suspend; /* Nothing to do at MHI level */ /* Transition to M3 state */ - err = mhi_pm_suspend(mhi_cntrl); + err = force ? mhi_pm_suspend_force(mhi_cntrl) : mhi_pm_suspend(mhi_cntrl); if (err) { dev_err(&pdev->dev, "failed to suspend device: %d\n", err); - clear_bit(MHI_PCI_DEV_SUSPENDED, &mhi_pdev->status); - return -EBUSY; + /* For system suspend, sleep anyway and recover on resume */ + if (!force) { + clear_bit(MHI_PCI_DEV_SUSPENDED, &mhi_pdev->status); + return -EBUSY; + } } pci_suspend: @@ -1728,6 +1731,11 @@ static int __maybe_unused mhi_pci_runtime_suspend(struct device *dev) return 0; } +static int __maybe_unused mhi_pci_runtime_suspend(struct device *dev) +{ + return __mhi_pci_suspend(dev, false); +} + static int __maybe_unused mhi_pci_runtime_resume(struct device *dev) { struct pci_dev *pdev = to_pci_dev(dev); @@ -1780,7 +1788,7 @@ static int __maybe_unused mhi_pci_runtime_resume(struct device *dev) static int __maybe_unused mhi_pci_suspend(struct device *dev) { pm_runtime_disable(dev); - return mhi_pci_runtime_suspend(dev); + return __mhi_pci_suspend(dev, true); } static int __maybe_unused mhi_pci_resume(struct device *dev) -- 2.43.0