Received: by 2002:ab2:6991:0:b0:1f2:fff1:ace7 with SMTP id v17csp166053lqo; Wed, 27 Mar 2024 09:35:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWQpAzYg5thcBTZJQpCCM3ZMkfU2AnW74yt1dQX5Qk3NiPb5IDX1m/e/ssijfHCMyB14j1bA5m14LixiOEuDGBsJlGojP7hIL0jnEocTQ== X-Google-Smtp-Source: AGHT+IFVc+dNSfoVw3z/aY/HPG+miaJ9P9orZq/PGknJx2FaUJlRt3LZPeuri2MqSkU8SWBLGywm X-Received: by 2002:a05:6358:52ce:b0:17c:2b72:3b7e with SMTP id z14-20020a05635852ce00b0017c2b723b7emr2638405rwz.4.1711557323431; Wed, 27 Mar 2024 09:35:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711557323; cv=pass; d=google.com; s=arc-20160816; b=kmXJwtOHTW9mtkbZCS2+2lIaETPmNTrFsZWlmPxHrI3bc4fGnNmLHMX0PzVoqmq1av DY4xH+rUSK8pfdyKnch5yCheeZlDRw1aYgzGF5Cxrj+KYZJkudk0rEtPk+RJXLvVOFFF ZFnieAzBp55X4DSwUvKSdYOwXCv/E0I6VYZNxdL2/oQYmiWU8w1cNvx2e6NdKg2PMiE/ QNAullWEgi3si82tCGq96g8ujKAwJVmY51IXptLHyOQdR3qqw6qCBcRW9CzSTAOEXv7T b54Vl1ghbipsEyi0QgaRB6JS7cVEmdxPddZ//zrE8vsbJU5oaK/Nt81/Lq7n10YdWoPI Hkig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=hJujr9RimFfO2QmiTRr7usgxHtS2vMpREAuBqxXSA/M=; fh=WLsajXNlKq7YaIECi8vZQVf2pdF5dhZvyV0l9/Din54=; b=hDsHZPKLG3KHpWtKCWUA6m1rL/D8HROTz1O7/qpbdAyR3JUXsGFQjrtZ1LPmGHiBPM nLtarUseTEphzx96sJc9z9i4lz/5Lywv644Q3fFTTtBPfH58aRfeIQlbyyUp2PCLb8zL kacknlVqLERmjh7pnablp+I2Qxyr80/29xddmjDEdpOGa44g0sw5TFtFFARgBwhOl0YV dBfuYudU/DZNF11ePe8QYE3+E3lYauKaWX6hE5HHIFwHzuGkUgQhLO25DHCtVRIeV05+ ifGfj25CjkjNaV4dtM6InAakT0Ou6G/lm8vYCLi8uZf/+N8Xl043MxRkXW920HpuIz5O 4Rnw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xORqEnHL; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-121488-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121488-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 189-20020a6300c6000000b005c279da45f1si2114344pga.566.2024.03.27.09.35.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 09:35:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-121488-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xORqEnHL; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-121488-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121488-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2C2F7B328DA for ; Wed, 27 Mar 2024 15:25:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 929C11304A2; Wed, 27 Mar 2024 15:18:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xORqEnHL" Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9792312E1D2 for ; Wed, 27 Mar 2024 15:18:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711552703; cv=none; b=ZKuTufT8eKia1boSSKOMzCf+U3yNSFzNPo1qP2NzReJFWPxusBRcYlM6o48lNhhoMOz63pQASWawTr6UTE2hqOIjROj8+ETQ3rHlai/CKkkonuM6UqLRziGy599QMBvkFs7Mdj1aZzaDD7JEnaMvUkXgwcJo0a7oVLrTn+6LTH4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711552703; c=relaxed/simple; bh=HoUmdYuyO4TXhHzYOArK1IfW06wpBYBpTZDoyHjEXK8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=EdcoeWqLq4MXaohfd9fBdmx9HPJVZR0KlYgKz2GfiwqQ86RvohIr4/ipbScctALrTvKCCJHc4CuVHZ/Z10vrmUxu1yHcXjSV+JJ0AiHUGCCw714KjA2xiREvIBVg4APcrlYvLXxQ7aqHmK7y7+onAvSTDVqTj1D5xaIs1mPjUPQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=xORqEnHL; arc=none smtp.client-ip=209.85.219.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yb1-f178.google.com with SMTP id 3f1490d57ef6-dc74435c428so6750492276.2 for ; Wed, 27 Mar 2024 08:18:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711552699; x=1712157499; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=hJujr9RimFfO2QmiTRr7usgxHtS2vMpREAuBqxXSA/M=; b=xORqEnHL/grCqbSkfRzqkD4cK+nGyyodJjbAQVfzprUeDOe2/fw5+Xan3qzdgFlRCe 9H0rmqsYoSlfmIMqKOTJZV3w2NeIqt5boCwEEa7yrz25cDICmbMeidrEHb+NbFS5nswl 8UnCOGrXPHCECYey6WLvFgzKN9konNQHb+cV3eUZ3q5YWWudMasU98ULmClLZNreZRAk t5snH3EISOraWPKu3BhhkA63MyODfxyngQhisgG66FwqgMF8oExlSinuNyvYK2VswwXm SI7hEEZdTK4n4tjzJvHb1LDChGc0fEuraWCu0MyT74sPYlKZZHeGNRTPkjN6VM7/jisn ZucQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711552699; x=1712157499; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hJujr9RimFfO2QmiTRr7usgxHtS2vMpREAuBqxXSA/M=; b=DV3kOk9Y9GAg7dmuRNeUmXdzmXpoFL1PVQOH85w1lGK+NteCUgdmrb6FyAvnhltFeP hg6DZvF0XtAK42S0AzNI68SxX+9mEAuDOqOgDnGVbccsoIeAUJ9nKwE7AB9GnTkGYXKU hXP86UHhoxaIOuJQBEFAIgf8POGFEcx4wlzOeVEBTyWN6NWY5bbddDhi+BHe9Cfuhd5j 3NFWGDRR4Pj4xb35wE53rs3ey0PQgalkcnqCD9s0QwqtNmNMsPIxy2I0jaMpILpT7gfw c/5JrGdRZHF2Nx2lOP+h7JQV4Nzen/WLvZP8CL7jhkFU4Co70xs8o/q/2jwG260TY+7/ qsKA== X-Forwarded-Encrypted: i=1; AJvYcCWk7yp8yhIKpL8rlFNSZQZ+yBURPr4F6purslKjIG5PwOHEnlDoPAqmoxYNVfwjkP3LxjWhSzq4XJdKV8JMRABCd5qmgp3uRbrhZr21 X-Gm-Message-State: AOJu0YzLgXvfxpYJOU9Jno8cWwxbNciBsMz//zcVFTtXDuQVh0bjPIgF Ig0Zzp2nwlINSp9pg02F8//gjCSbcRC16byjUdGmaboX4t0nYbK5eSXVcuPtAUd3E48Scirvx/b bxJ6FGqXBW+fGe9oEhRqUiPRrfLC8qC118dj5Iw== X-Received: by 2002:a5b:509:0:b0:dc7:4859:6f1 with SMTP id o9-20020a5b0509000000b00dc7485906f1mr99707ybp.33.1711552699663; Wed, 27 Mar 2024 08:18:19 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240321-sdhci-mmc-suspend-v1-1-fbc555a64400@8devices.com> <2e712cf6-7521-4c0b-b6fd-76bacc309496@intel.com> In-Reply-To: <2e712cf6-7521-4c0b-b6fd-76bacc309496@intel.com> From: Ulf Hansson Date: Wed, 27 Mar 2024 16:17:43 +0100 Message-ID: Subject: Re: [PATCH] mmc: sdhci-msm: pervent access to suspended controller To: Adrian Hunter Cc: Mantas Pucka , Bjorn Andersson , Konrad Dybcio , Georgi Djakov , Pramod Gurav , Ritesh Harjani , linux-mmc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Tue, 26 Mar 2024 at 11:25, Adrian Hunter wrote: > > On 21/03/24 16:30, Mantas Pucka wrote: > > 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 Looks like this problem may exist for other sdhci drivers too. In particular for those that enables runtime PM, don't set SDHCI_QUIRK_NO_LED and don't use sdhci_runtime|suspend_resume_host(). Don't know if there is a better way to address this, if not on a case by case basis. Do you have any thoughts about this? Kind regards Uffe > > > --- > > drivers/mmc/host/sdhci-msm.c | 16 +++++++++++++++- > > 1 file changed, 15 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c > > index 668e0aceeeba..e113b99a3eab 100644 > > --- a/drivers/mmc/host/sdhci-msm.c > > +++ b/drivers/mmc/host/sdhci-msm.c > > @@ -2694,6 +2694,11 @@ static __maybe_unused int sdhci_msm_runtime_suspend(struct device *dev) > > 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); > > @@ -2708,6 +2713,7 @@ static __maybe_unused int sdhci_msm_runtime_resume(struct device *dev) > > 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), > > @@ -2726,7 +2732,15 @@ static __maybe_unused int sdhci_msm_runtime_resume(struct device *dev) > > > > 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 = { > > > > --- > > base-commit: e8f897f4afef0031fe618a8e94127a0934896aba > > change-id: 20240321-sdhci-mmc-suspend-34f4af1d0286 > > > > Best regards, >