From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 5D08F394E91 for ; Mon, 10 Aug 2026 08:03:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786349029; cv=none; b=r7/P8zql7bb2eSqdwzSumcYbpLdP3AldJOttAmLTbLAfiCQaW+PIiKuRGXlUMFRuPuwRdrdFvrSLE6spfF5Y6R3ZDxtdMAPZmn/vrJMcVwBwre6YMKyQCyt4DpI7gw7rkjjSQCauz/trLOlv2rCRC9jVXbCIjumb2NhAJ75eS8U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786349029; c=relaxed/simple; bh=foWs9e24w9qPUIsKEA7/suDgVJil5cRHU69ADdNXgR4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=E4c1RPvm31FOJX6adUBDLuN5m/AcxhSfzkn2twSQGoOia2uAx2UwzQ7WwogXZM58q2MvLrGQF+8fCHYi+drEb5d/CaEAxXI8Xy1A+fZg+i8bGRSfwOU/oz+d0V3McrLrX18hVvuJXdGKaXD183nektBwqWpGgdE3UNY7ANJyrg8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=gdTnpVyV; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=IEYjOHLP; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="gdTnpVyV"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="IEYjOHLP" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67A5pH6Z402784 for ; Mon, 10 Aug 2026 08:03:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= JxKtSuEy3P4FHpzR9BO4tWVvzdjxxUd1uxUCq5FcQ4Q=; b=gdTnpVyV1nzijyYt CZqYZ3Ul4Fc2P1pm/QB4FlX/pxzxNSKwIuWKzp3S+WvUShL9DhYIRnwtQjNt8XrC kUy4sLeNk/dGiZyPBjFLvSgRqiXjfINqpzNC9v7CBUWiXWOER5uJsgsiWirbwcbt XMon4SpKAmT0q1+Wi9zmsnGiMi1PfCOSmAcgSNbGYmsXaqqQfkZ53eec6s/aup/V qZUbZqPUsCu/Auj6nr3LQ//ZjMPrTk4nI8nI+lMDD4pMxVFdmN3MiNFPiojYEEMu AQ503uAreeK+P6AsAWbjp6x60hfnGD0UV5sQ42j5lcftsTp/n5VnZU2oreABEtSW +mEQeg== Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fy8v48cyq-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 10 Aug 2026 08:03:45 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-38e1118e4abso2875604a91.0 for ; Mon, 10 Aug 2026 01:03:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1786349020; x=1786953820; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=JxKtSuEy3P4FHpzR9BO4tWVvzdjxxUd1uxUCq5FcQ4Q=; b=IEYjOHLP7uq+h3agamktqQe08eHVDA8MyBUs31adICL81kzEOb70TeVOVYjHkSlu6p Juhcw43gziN6Avfofc3Va7SOh9G3uDLssb4mmHxD3iFRiv8lfJnpQxwEEKgv9XOUulmv wDH90EukSE6HdhQ+NaX+aJcK/92YNiYewOh52r9oPEYmXWuclth2Git14pY3RJrKv9qJ mxhfYrOfSfrfmLKJV6TqOBUiPKydqElVPWt7GP+32/pcs7rXVbKHCVw30umb2jxN6jvY i6eyqQXdU4K6rpkEvaHwVpmihayb7LK8IsfxMoTCek8kd3Od9w6VAZ3VSNouZ70sJrsn Kpiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786349020; x=1786953820; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=JxKtSuEy3P4FHpzR9BO4tWVvzdjxxUd1uxUCq5FcQ4Q=; b=ITEbjNyumT8uKyVLHbXOtezc6pWCYcJSFk2EzwnL84knKHbSYVFxHwJkD/aK0SLcHF qVH7hqtR4Ge7GS+ysVRLE06bqfurXfFxf/qzk+ncdvAzA/Ke8Y9peGjaYu9CEO99RqWx R2j85ZHuEwxWzGC2HcunGwb55sm2MRj0fx4qjHbZTRNXPR1LJrGiMKwrGCX/OPZCPgUH duxsfqSd70/Id3sGKYZZ5qxVg2creJkMBv+5FGuSLcR9uxAlQmdw+PDepYEmeJCL45Ib JRHL8xByvHkqcw8FuJorw00A3YkINoB9rvp7pnmWzeRpfyL8GP6BmV4bXfkO+tMok0aK XRTA== X-Forwarded-Encrypted: i=1; AHgh+RqcGhnjzPHUFAH4+I2vibCTWOtCVobFESq1xD87PI4gNg0HeZ1QBSMClYpa/kgmIZncvREJDOPVopfyGik=@vger.kernel.org X-Gm-Message-State: AOJu0YwSnGAwYVsxYxMWJCLVrEIoBylu89AZR2QMDJrDKRzI+dWyfwEU MEkPdCQiYY8FMggVB4nxD3WEUmSbaFs3gG5s3+URQY6lLZrR+zE0HdKsJsufaRpW6jXnZfmZv76 9SnIl457UgkcGnFIiNF5SLFvoNnwy8EJXt3sBxrDeux7WWpxFj7s3dNEuXcUV0P0wpw== X-Gm-Gg: AR+sD12EDB04IOgRul2e996sbmyZNKCa/BH3yAvOfYFfkP2afuJC3JSe9uqReixJXw2 DPM62SCD6FY4K0vQ0eRugk4WPSzTIpOSG7LpRAigBfCBxohm19aDSCcoSE2E5WqWB07LQAEenzm ZI4jpU8FwHz11ZXBzusQRSa5xUQdWAsmQV0VJQp1NiUrvL35/4U9V6iMnyKTX/5J6vUC5obJWEe VsPBF6TfS+7AF4AqSNj27zhPrqH938N7kIoMFFkTG57LV6a1ekrWlKAl8vYoJpirndpdN5Fun8x WXZKo5G/ZqEC6/18xLvZOeeQ7aMWellc+aXezfPKVFb2TuN/YqwAWhpajcbDyQiulceXd701j5W OrRK2DyVWeCOmnv2L1TQpfjti0A== X-Received: by 2002:a17:90b:4f81:b0:38c:e9e9:e7ce with SMTP id 98e67ed59e1d1-392822bf6abmr15056752a91.3.1786349020410; Mon, 10 Aug 2026 01:03:40 -0700 (PDT) X-Received: by 2002:a17:90b:4f81:b0:38c:e9e9:e7ce with SMTP id 98e67ed59e1d1-392822bf6abmr15056694a91.3.1786349019895; Mon, 10 Aug 2026 01:03:39 -0700 (PDT) Received: from [192.168.0.102] ([49.204.22.130]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3925fc6c13asm11501889a91.2.2026.08.10.01.03.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Aug 2026 01:03:39 -0700 (PDT) Message-ID: Date: Mon, 10 Aug 2026 13:33:32 +0530 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 v6 2/2] mmc: sdhci-msm: Use pm ops instead of macro to restore crypto keys To: Neeraj Soni , Eric Biggers Cc: ulf.hansson@linaro.org, adrian.hunter@intel.com, quic_dmukhopa@quicinc.com, quic_rampraka@quicinc.com, quic_nitirawa@quicinc.com, quic_sachgupt@quicinc.com, quic_bhaskarv@quicinc.com, quic_gaurkash@quicinc.com, quic_sartgarg@quicinc.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org References: <20260803163123.1802005-1-neeraj.soni@oss.qualcomm.com> <20260803163123.1802005-3-neeraj.soni@oss.qualcomm.com> <20260803201803.GB63318@quark> Content-Language: en-US From: Ram Prakash Gupta In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-ORIG-GUID: n951ZjXqohntdwD9sAmEsVijScr9DkNs X-Proofpoint-Spam-Info: AW1haW4tMjYwODEwMDA2OCBTYWx0ZWRfX+SNt+Io+BjUZ c4RQM0cY++20gEIAXjdTnVLFfhYSQR7xGlJ5KW+G1R3nQ5xhvBqwEAMxZ7tLQnfw4N07kNFh7XC 01ygCcSOs4kY1bDIv8VExy8d0Noelqk= X-Authority-Analysis: v=2.4 cv=W5EIkxWk c=1 sm=1 tr=0 ts=6a7985e1 cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=wB/OwOWguG3OqMiIzyR4iQ==:17 a=IkcTkHD0fZMA:10 a=Sv0fKeRqtYgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=COk6AnOGAAAA:8 a=RJ2Gkk4ao1b7OKlePUwA:9 a=QEXdDO2ut3YA:10 a=uKXjsCUrEbL0IQVhDsJ9:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODEwMDA2OCBTYWx0ZWRfX0SQH8OqMp/tS 9D6JgFj0a49udshwKyRtbsv57rjmvtbuC7sdOkzFfk6pvpfDToF+VxZ6YhNKGstTkrnDUxOHlmN EsWCrZqhhFLW3bATz/V1+fz7xlvFoMTDU+FrHAD0tJthpqyQ0kWP1oAYKuAtqQJbaJKFZcvkgwb dzRnYkb6spmWdg5OJYg+sZSkHckhWIP+0+MnrUpCEIlR3yNCpa1hg3KIin8njakzcLTX3Xkpxgh gzh2ffz/fesTKymC0r21BLbcT2KNcOrm0Fdxat7Ah8WEuivSw2hAERlhz3JBda2WcCWf02hc97V gTplkOQFOD+GGRKq2MTEi5x3xYE73ZdZMNElMJtibhxhbzkbvRdNWnRPuAsTJqWl3qBm0VsOKFi wU/lVisoLxiD/TwCbEMRll8TX1ZjQ+16WNMlxozpXrP4EBI2IpDqg0Eo9e7MqnBZJIo268mtk1h dqQQmNf9fR+WxNNNoVQ== X-Proofpoint-GUID: n951ZjXqohntdwD9sAmEsVijScr9DkNs X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-10_01,2026-08-07_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 phishscore=0 clxscore=1015 adultscore=0 bulkscore=0 spamscore=0 impostorscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608100068 On 8/7/2026 7:49 PM, Neeraj Soni wrote: > > > On 8/4/2026 1:48 AM, Eric Biggers wrote: >> On Mon, Aug 03, 2026 at 10:01:23PM +0530, Neeraj Soni wrote: >>> From: Ram Prakash Gupta >>> >>> Inline Crypto Engine (ICE) keys are lost after hibernation entry and this >>> needs to be restored when hibernation exits. ICE keys are re-programmed >>> during sdhci_msm_ice_init() but it may not cover cases where the >>> hibernation image is already restored. >>> >>> Unwrap the pm ops and use directly in driver to add the call to restore >>> Inline Crypto Engine (ICE) keys. This ensures that ICE is brought into >>> same state as before hibernation. >>> >>> Also set MMC_CAP2_CRYPTO_NO_REPROG to indicate that re-programming of ICE >>> keys is not needed during MMC runtime suspend/resume. >>> >>> Signed-off-by: Ram Prakash Gupta >>> Signed-off-by: Seshu Madhavi Puppala >>> Co-developed-by: Ram Prakash Gupta >>> Signed-off-by: Ram Prakash Gupta >>> Co-developed-by: Sarthak Garg >>> Signed-off-by: Sarthak Garg >>> Signed-off-by: Debraj Mukhopadhyay >>> Signed-off-by: Neeraj Soni >>> --- >>> drivers/mmc/host/sdhci-msm.c | 23 ++++++++++++++++++++++- >>> 1 file changed, 22 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c >>> index 4aff965f0e2e..f64788a70309 100644 >>> --- a/drivers/mmc/host/sdhci-msm.c >>> +++ b/drivers/mmc/host/sdhci-msm.c >>> @@ -1959,6 +1959,7 @@ static int sdhci_msm_ice_init(struct sdhci_msm_host *msm_host, >>> } >>> >>> mmc->caps2 |= MMC_CAP2_CRYPTO; >>> + mmc->caps2 |= MMC_CAP2_CRYPTO_NO_REPROG; >>> return 0; >>> } >>> >>> @@ -2983,9 +2984,29 @@ static int sdhci_msm_runtime_resume(struct device *dev) >>> return ret; >>> } >>> >>> +static int sdhci_msm_restore(struct device *dev) >>> +{ >>> + struct sdhci_host *host = dev_get_drvdata(dev); >>> + int ret; >>> + >>> + ret = pm_runtime_force_resume(dev); >>> + if (ret) >>> + return ret; >>> + >>> + if (host->mmc->caps2 & MMC_CAP2_CRYPTO) >>> + blk_crypto_reprogram_all_keys(&host->mmc->crypto_profile); >>> + >>> + return ret; >>> +} >> >> Sorry, it looks like this actually does need an #ifdef because the >> crypto_profile field is conditional. It doesn't need to be a new #ifdef >> though, as you could add a function sdhci_msm_ice_restore() within the >> existing CONFIG_MMC_CRYPTO section of this file (along with a no-op stub >> in the !CONFIG_MMC_CRYPTO section), then call it from here. Similar to >> how the existing sdhci_msm_ice_resume() works, for example. >> > But MMC_CPA2_CRYPTO=0 if !CONFIG_MMC_CRYPTO so crypto_profile field is > not accessed if !CONFIG_MMC_CRYPTO. Does it need encapsulation? > >>> static const struct dev_pm_ops sdhci_msm_pm_ops = { >>> - SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) >>> RUNTIME_PM_OPS(sdhci_msm_runtime_suspend, sdhci_msm_runtime_resume, NULL) >>> + .suspend = pm_runtime_force_suspend, >>> + .resume = pm_runtime_force_resume, >>> + .freeze = pm_runtime_force_suspend, >>> + .restore = sdhci_msm_restore, >>> + .thaw = pm_runtime_force_resume, >>> + .poweroff = pm_runtime_force_suspend, >> >> Should these use pm_sleep_ptr() to allow dead code elimination when >> !CONFIG_PM_SLEEP? >> > Ram can you please check this. Looks valid to me. > >> - Eric Agree with this, we will update this in next patchset using pm_sleep_ptr(). >> > Regards > Neeraj