Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, Adrian Hunter <adrian.hunter@intel.com>,
	Ulf Hansson <ulfh@kernel.org>,
	Ritesh Harjani <riteshh@codeaurora.org>,
	Georgi Djakov <djakov@kernel.org>,
	Pramod Gurav <pramod.gurav@linaro.org>,
	linux-mmc@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 03/13] mmc: sdhci-msm: Resume runtime PM before accessing registers on remove
Date: Mon, 23 Nov 2026 19:15:47 +0000	[thread overview]
Message-ID: <20261123191703.179283-4-lee@kernel.org> (raw)
In-Reply-To: <20261123191703.179283-1-lee@kernel.org>

During driver unbind, __device_release_driver() drops its temporary
runtime PM reference via pm_runtime_put_sync() immediately before
invoking sdhci_msm_remove().  If the 50 ms autosuspend delay has already
elapsed, sdhci_msm_runtime_suspend() gates msm_host->bulk_clks before
sdhci_msm_remove() is entered.

sdhci_msm_remove() currently reads SDHCI_INT_STATUS and calls
sdhci_remove_host() before waking the device via pm_runtime_get_sync(),
performing MMIO accesses while the controller interface and core clocks
are disabled and triggering a synchronous external abort on Qualcomm
platforms.

Wake the device with pm_runtime_get_sync() and disable runtime PM prior
to reading SDHCI_INT_STATUS and calling sdhci_remove_host(), matching
other SDHCI platform drivers.

Fixes: 67e6db113c90 ("mmc: sdhci-msm: Add pm_runtime and system PM support")
Closes: https://sashiko.dev/#/bug/linux-5ebb28b3-9cdd-4423-bfe8-361008b2aa89
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 drivers/mmc/host/sdhci-msm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index aecd425bf095..f62e942bf9f0 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -2925,15 +2925,15 @@ static void sdhci_msm_remove(struct platform_device *pdev)
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
 	struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
-	int dead = (readl_relaxed(host->ioaddr + SDHCI_INT_STATUS) ==
-		    0xffffffff);
-
-	sdhci_remove_host(host, dead);
+	int dead;
 
 	pm_runtime_get_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_put_noidle(&pdev->dev);
 
+	dead = (readl_relaxed(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);
+	sdhci_remove_host(host, dead);
+
 	clk_bulk_disable_unprepare(ARRAY_SIZE(msm_host->bulk_clks),
 				   msm_host->bulk_clks);
 	if (!IS_ERR(msm_host->bus_clk))
-- 
2.56.1.750.gf70dc682cf-goog


      reply	other threads:[~2026-11-23 19:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 19:15 [PATCH 00/13] mmc: Assorted bug fixes across MMC host drivers Lee Jones
2026-11-23 19:15 ` Lee Jones [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261123191703.179283-4-lee@kernel.org \
    --to=lee@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=djakov@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=pramod.gurav@linaro.org \
    --cc=riteshh@codeaurora.org \
    --cc=stable@vger.kernel.org \
    --cc=ulfh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox