From mboxrd@z Thu Jan 1 00:00:00 1970 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 A6C908801; Tue, 30 Apr 2024 11:18:31 +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=1714475911; cv=none; b=uGHcVetlQfwlu7nNTh3LFAFSNAoDh5HJ9E8sG0UhkAwYV4vzBTiHKUOgFCKFFTrsu7HNE4WinwWbwCgAG2Z3+us4tuSuSg9UDvj7QCR2UF7TL8OrdMNoZMTIG13FhQmLyMClgDz/X/I/2AH58w5w4gp7iqOYGu0gy4rY43Gm3TA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714475911; c=relaxed/simple; bh=yTLQA4ky10UbDWVA9O/nhnHcNeLXCZ77vWH861unfnQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XG+8yKX+9VDtBwOV5gjO+JcLC+P87oz0/v3cZEie7kn4EY8FdUPNo2wtxC6na+85v7uTwG/JK1IVv3xuJQ51bIbyjbKienfpNq6+IK6nzk2SK+/VXjeacqgxAU/aG0USlpsMPm2uhq0pzGr4izRKNB/9pR3NfMhTdf82fcibrB4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LRvlWVMl; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="LRvlWVMl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 304E4C2BBFC; Tue, 30 Apr 2024 11:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1714475911; bh=yTLQA4ky10UbDWVA9O/nhnHcNeLXCZ77vWH861unfnQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LRvlWVMlr81CrUTRwFyL+CdjegO4iIQHPsC/yYXMrPUwnu18U5oQT2DMNOExOJKhr 1swlLnMciKnRcsTmPWu6q9CCJ9sqNGKr4RR8zJ3UuqUzdbY/OrPkUwD15eLrmyBjmu kJSQcnXo5cJKXcPoxx5fJnP2pmgVBIBOiy7QW6iY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mantas Pucka , Adrian Hunter , Ulf Hansson Subject: [PATCH 5.15 56/80] mmc: sdhci-msm: pervent access to suspended controller Date: Tue, 30 Apr 2024 12:40:28 +0200 Message-ID: <20240430103045.073135606@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240430103043.397234724@linuxfoundation.org> References: <20240430103043.397234724@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mantas Pucka commit f8def10f73a516b771051a2f70f2f0446902cb4f upstream. Generic sdhci code registers LED device and uses host->runtime_suspended flag to protect access to it. The sdhci-msm driver doesn't set this flag, which causes a crash when LED is accessed while controller is runtime suspended. Fix this by setting the flag correctly. Cc: stable@vger.kernel.org Fixes: 67e6db113c90 ("mmc: sdhci-msm: Add pm_runtime and system PM support") Signed-off-by: Mantas Pucka Acked-by: Adrian Hunter Link: https://lore.kernel.org/r/20240321-sdhci-mmc-suspend-v1-1-fbc555a64400@8devices.com Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/sdhci-msm.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -2827,6 +2827,11 @@ static __maybe_unused int sdhci_msm_runt struct sdhci_host *host = dev_get_drvdata(dev); struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); + unsigned long flags; + + spin_lock_irqsave(&host->lock, flags); + host->runtime_suspended = true; + spin_unlock_irqrestore(&host->lock, flags); /* Drop the performance vote */ dev_pm_opp_set_rate(dev, 0); @@ -2841,6 +2846,7 @@ static __maybe_unused int sdhci_msm_runt struct sdhci_host *host = dev_get_drvdata(dev); struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); + unsigned long flags; int ret; ret = clk_bulk_prepare_enable(ARRAY_SIZE(msm_host->bulk_clks), @@ -2859,7 +2865,15 @@ static __maybe_unused int sdhci_msm_runt dev_pm_opp_set_rate(dev, msm_host->clk_rate); - return sdhci_msm_ice_resume(msm_host); + ret = sdhci_msm_ice_resume(msm_host); + if (ret) + return ret; + + spin_lock_irqsave(&host->lock, flags); + host->runtime_suspended = false; + spin_unlock_irqrestore(&host->lock, flags); + + return ret; } static const struct dev_pm_ops sdhci_msm_pm_ops = {