Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp469441lqh; Thu, 28 Mar 2024 07:21:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVXmWBJXnj0tl0aVFl8Ic4G4J2ca1ho3Dye79fTIcuXFB5JuoFK3QI92SYf+bSEthUrYYaa5CH+2UC1TYmo3VfwTnu4l2zGZvj2JOe9yQ== X-Google-Smtp-Source: AGHT+IHTeaEPvQpfSgRcGAibyFHlBJzzNcBWvtHy+iHaoE8pRNNWjbu/B2W/Cz+vVJXeCNPDm2fu X-Received: by 2002:a05:6358:2918:b0:17e:b887:5558 with SMTP id y24-20020a056358291800b0017eb8875558mr3174838rwb.7.1711635692159; Thu, 28 Mar 2024 07:21:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711635692; cv=pass; d=google.com; s=arc-20160816; b=OzsrR/vzGdI1NDjSJcErhmyTUzRNpvNM+y/+zZB8Azdn7M69DHMJ6Cy1KJARBswQb9 IPuPtGf/y97HCEezTH1JxGk0pDsJBgzbkQZ7JFbISxa4/kM1hKiJexoyrcdvTJ4qayd3 N7hxpwvWjZjqxwMlVptt6NBUloduiv81R7OFFea4OE1ugGHQKz9Cl8+eZ68NkHXN+tcp MSJqmaRC1gXONz+z8cUaZGcZbMX6VHLnHf6RXkUc2dofQdqzbbyj13QF4DTu5QlePwQN x/c8AJDWFUV+nO+63xQMkdp/nj0gpUn46HBc/38J+L4pW08HeHyGy2NICvts6ptapjjO RtoA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=edXYgIVAaaFFLX1I6PFKfNqBMXWYBwzLgQtch3JwCNM=; fh=bop/tTsWs7Q29DWvzUynnzPdFlHRChfgkEHJVW2nxSQ=; b=GrDrdHNdgGOK0/Hu9I53FqySoXlcUcGtfK+HpFHnBuyTU3sMi+G9Ud2RSz/6K5VcI6 SCdbBOYfpu2DurpjMi9qHrEsVjN+Zhrr5yrjNgDqZM+hd2N6tYITEa2mV3FNOQF8mKX3 uejH8vRaonPdZvsmsDnKF3PRrfaR5F/D2/R+NTxyTkPkElbgtLNCir+cDvV9gHa5FUAZ dY+5DA1QfN0NihfmdhvQ5XtIaWGXtBuHeXX+pIl63qsgdLOmpE86YGZXDwrs/ySwPxFI 3iYZYAWg6AFDvoGZSM9x6w5vBxL+B8yPyYGK9zyd7MyhHJtQpV3NBA4gtVVOH2+VyECQ Q+fQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bPnho7Ph; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-123061-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123061-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 140-20020a630292000000b005cdde899923si1468794pgc.758.2024.03.28.07.21.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 07:21:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123061-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bPnho7Ph; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-123061-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123061-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id AD84F2975AA for ; Thu, 28 Mar 2024 14:21:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A8AEC81AB1; Thu, 28 Mar 2024 14:20:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="bPnho7Ph" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (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 780A780027; Thu, 28 Mar 2024 14:20:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711635647; cv=none; b=Ptw6tDTASqvbU30qGNFFlbOs0Z6Bx0Ofzoz+I7btGqBIv7xOxOaXWZUgmQXbm0QF+390nCpO+x8Lj69/sKnajrjm1Vmjk5Zt0REklKu5hrT/s908uw4tYGRb5xMRcKcyUZcrdTpwfNbiiwapCn0OFsFZrP4TVAciIIMBJSZ1Tow= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711635647; c=relaxed/simple; bh=RHBQDa4sqkolqdfPMgVVfKoXTaMJUPy5Hr+BBM0MJbQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=pnOivNgoKqAxE6aiRY/ZEjwMXqG9mbfgbylTODyJOKZs+XuGIb12SYgbZMULQRtzmR/24uXrc/Mz7uevatdOOi8O6nTVbb52s7Svuy/2oFgw91SAhYmGnklQnfoN37wJBzMQMmQAgxchJK/vbw8nVEspS6NJQNpmEnTaPknMI8U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=bPnho7Ph; arc=none smtp.client-ip=192.198.163.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711635646; x=1743171646; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=RHBQDa4sqkolqdfPMgVVfKoXTaMJUPy5Hr+BBM0MJbQ=; b=bPnho7PhEEpHaD+dhFpQJ1WsxGe2DYMnn4tCktXs6WctQTQfPB1N1cix wG90aWWoEg2yNdiuzen7f3h1wmeMSvkKNcd4W5XwrvBbzBGWCB0FAAm8Z aOy0sqNyaJmLZ40xHP+NicKI2ex7bGz6ai55jHRckRmPidNSqg12oybmp G9hT4ivNQ7DBjsX2fO/XWEnN5W9FXEk93QUSuKKa3jX50P1Uw6vD+TmaB KY8LhgEMOxklSup1XbQTdkGO7M4LtfGrQup3AVaEh5YlR3Kg/h+863FRQ riDBE/VDJXfc+EYbEFbh7BHFo9ueqsutGxuBpTIJs6lERb0HTJS6cF514 g==; X-CSE-ConnectionGUID: yrPlAn79SDum241O2KdMVA== X-CSE-MsgGUID: vZzb4beyTCW6qUs2vh7CYg== X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="9747664" X-IronPort-AV: E=Sophos;i="6.07,162,1708416000"; d="scan'208";a="9747664" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2024 07:20:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,162,1708416000"; d="scan'208";a="21128607" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO [10.0.2.15]) ([10.252.39.195]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2024 07:20:38 -0700 Message-ID: <5bce008a-8354-4ccd-af1f-b7f2b2caf3bc@intel.com> Date: Thu, 28 Mar 2024 16:20:33 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] mmc: sdhci-msm: pervent access to suspended controller To: Ulf Hansson 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 References: <20240321-sdhci-mmc-suspend-v1-1-fbc555a64400@8devices.com> <2e712cf6-7521-4c0b-b6fd-76bacc309496@intel.com> Content-Language: en-US From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 27/03/24 17:17, Ulf Hansson wrote: > 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? Yes probably case by case, but I will look at it. > > 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, >>