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 D421D33123D for ; Fri, 7 Aug 2026 14:19:33 +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=1786112376; cv=none; b=SxO6gYoMWK3JDSzeQ5xYIFpYIelTK+sHRSOcVtwijkWR6Jil5l2eYLSLwB5Q4nmyJORtfRFZQ2oBMFR1lY/2yQewp4x4PcwxKn3ZOK8qFlXfAVHiSvFuyvSDX2LpXYQfNc/3v5a7ouM3ncsxvZIfYvVpykNkFd55wRW3H097qvw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786112376; c=relaxed/simple; bh=PjbNBERILRijrbzsMu7kjL97HuY7hwy+CNHDBDLch4Q=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=miDltXqRtBQBxSbgTydsoAywZIZMaCsjSiSdR/f6hAPcWEpeiMXgf631rAvqthlKfOSJrw2Itk/xLJXykdJAQE8igldJsd1Z0NVkYKTHDSC9d+HGAuswYH74jLHVRoEzsZfpMyVLQgz4mILGY3DxC0A70Wgu2RfM92Up11a5quQ= 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=BP37Ror+; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=jH5Xl7Q9; 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="BP37Ror+"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="jH5Xl7Q9" 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 677DdWVI849472 for ; Fri, 7 Aug 2026 14:19:32 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= xDURwZe3kjAfzG+fLE3IYK+o3OP/hS+nN6qrRLsGiL0=; b=BP37Ror+k0+XhrSI pnbj0RNIm0rG6zC/DgrQebpzUu3qq0RsaRc6SdahGscQYGdicvdcP49JiAIa1Pcx etduJmOb9Mz7I3sNuAjkdWlCq7erjyNBTUpMwyOEPE1g6vd26My8bK3S0DpU4MSs +IznEJrIHMRqirX5dGvzCadfRhm9sXgDQ43NG3MMC2YRLcU8ZqElg5CK9SYPqdsc VauHYzD5spHxQDQbCtIYyKEjEdKrJU9KUvabulWybNc4pPWfA+eORjayzLWE9lnu pcw07YL3H1EQ1F3RbtPxnsZJ7354pvDKdBc6U/9OxyDUiy4KTh99ZmJlNaP4AC0w 1sscPQ== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fwgem850f-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 07 Aug 2026 14:19:32 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2d04908139bso59309685ad.2 for ; Fri, 07 Aug 2026 07:19:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1786112371; x=1786717171; darn=vger.kernel.org; h=content-transfer-encoding:content-language:content-type:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:from:to:cc:subject:date:message-id:reply-to:content-type; bh=xDURwZe3kjAfzG+fLE3IYK+o3OP/hS+nN6qrRLsGiL0=; b=jH5Xl7Q9qXRnxYKMlcIrjZ86ymTSP5hHATQ2Llpl/XoslQ44Qf3qjMxwhvR5YoHQ3L Gh/aZIqNy5VAlbnltV2tlzHSaClSGRYEexxh5h9yFqcisEfPYj74QCaa0KJBi8FPtcG2 C9fiXk/+Ub7R3vX4HyMubguCKlWcG1WoLsApLprNM/aT8/9THXAEoPBKDHai4gsr4jZL SxsOiDp5XaulNG6QOdnIMZEDtwGUKl3vRQi7YX5XBR9l0JNBqVOIsLAUZ+Fx6mEJJopb 5as1ZFmPgSqpVfCKK/xVKRPrTHURcoRXohEln06M/c5ZifwpXbB56KFTDF5jP9usm5YY uT0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786112371; x=1786717171; h=content-transfer-encoding:content-language:content-type:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=xDURwZe3kjAfzG+fLE3IYK+o3OP/hS+nN6qrRLsGiL0=; b=UMIJNEcP0KRNX6c3Vho6XplpaUFlCQnCSbk7KaDpcaZmZek+sc9YSBX1qoVI5Bthd9 8GDYjCUHfDVg7xvT3861NDvnJpHjXFvYRm5tEhH0Jx1iLx8KZVA1U6GFzTzl0rAwSTqz KwsveMRrFvIyBA4MejZ3p1JJZN2L4GooYilttzPNUIdGPA42uDlL2fNq5tafFusmFB39 yB5AU2H2+PqNxrQ/YLreBGAu4+VUU5qLTzUnUa6r1nQEwKtTK2QzUOg+OGcDKL5CK0Z4 1fSYvc0bMhvNpkXRqtBArHgKOvb5k0wvgVkgSBjYN/1L9kEsOmhP6RRl7WE/M3sLu8xr zo5w== X-Forwarded-Encrypted: i=1; AHgh+Rox0SGj5d0kNHcDyl1ZpUQJUIwl1P0e7d+OPMXfcIqQJjCm9X6oCDB0sThYhBfwnLRDwZxANOyjiA84hrk=@vger.kernel.org X-Gm-Message-State: AOJu0YxKpA+KEasguup3+ZyAOmp6bMjP8cMOXc59ZkkPGpTIVfREy8y1 BlJOemwClBQ9+PopAln0S/TuQAami4iqPI0pnRXhR/OtBkKlYAU1jHc8qKv78kFl9TFAzYFSpyl TZWiNgzthjNwYHbpfX+i+KfvODA64Wofsk24COha7lIKtFsWx3tWzdIpviaMR3JwWPyvGnTwy5B I= X-Gm-Gg: AR+sD13Gzj3/E8Nfdv1z7wuPvuFZj6W0PZv5fiHeelwVGYobl84qQorF2rk3bdLETBc stKdNGBcj1Jd5cyoDUlbHK0Dttp8i98EAK+Kk6iYCEyL9LJg7TbBuHPsRbTy/66KAc1G78RJ8cA 9LHKWHmfEXgYrnbq7dxCRGTqsIl54hDRE+qOSG50wYNO8l1GljGh/Ngf8dlr2sCelJXiHRGK2zi D5YZm8OVi6k2HzFdT9ir1QwlYFgMkhFXoSpwETyqwkpmyYK4V6iaHnWjh2TqXuYQRH0BqwY8eDt SeA2WWaabb/ktCJtO6mZLcUGM7M65Qf8BYx5gpK8C0qO1CGdvz85yz42xiXIGZyCfdK4QegPZ1O 0LdiYtcPugViDS7ZAXPPt+NsB2MQ3rQ== X-Received: by 2002:a17:903:19e6:b0:2c8:25c8:85a6 with SMTP id d9443c01a7336-2d0ca712e35mr274619945ad.2.1786112371504; Fri, 07 Aug 2026 07:19:31 -0700 (PDT) X-Received: by 2002:a17:903:19e6:b0:2c8:25c8:85a6 with SMTP id d9443c01a7336-2d0ca712e35mr274619315ad.2.1786112371033; Fri, 07 Aug 2026 07:19:31 -0700 (PDT) Received: from [192.168.29.77] ([49.43.219.187]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d16c4e1182sm9997055ad.72.2026.08.07.07.19.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 07 Aug 2026 07:19:30 -0700 (PDT) Subject: Re: [PATCH v6 2/2] mmc: sdhci-msm: Use pm ops instead of macro to restore crypto keys To: 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, ram.gupta@oss.qualcomm.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> From: Neeraj Soni Message-ID: Date: Fri, 7 Aug 2026 19:49:24 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20260803201803.GB63318@quark> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Proofpoint-ORIG-GUID: 1I0EWVQS7dTGjV8KPCkRQ3u3B7AaGDqt X-Proofpoint-GUID: 1I0EWVQS7dTGjV8KPCkRQ3u3B7AaGDqt X-Proofpoint-Spam-Info: AW1haW4tMjYwODA3MDExMiBTYWx0ZWRfX9iTWPwVBZWwH OoOqeV7CBl8GuaWV685E69D8WLAIXxSYL3r0S5nvHL+rjKvCR8MDEPziLRcrQ1GPB+WuRrnn4SG 5mn8zD9pP1e7+A4/8w/I1QQsCREZcO0= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODA3MDExMiBTYWx0ZWRfX8X1UbTPgJ/oB epYdIngj5pEVPqCK6Inew2bX1J1/pdDYTQkPjFofviC9Rbrj2cNNJUmsyJWJA1hZPAMUBJisLty 1AijH3ef9IU7M+iOYIZLcotnzyJU7/XvDDJAQm7OLtbDVoTRtXzGVXUtGgV7JUVJ7MoA/M/h95N TYYAcrRG3sMCmv0sk/SjkWKad57yZ4qmTBKik8loFypfhWWtq1K54pyEDi0/qCfukdtlkeVrD1q REbsXKrUI294TnkMgJSvgm5Gh7d9YVGbFNw5c360Tq8Io/NSa5dj7M8eKL5E7sJ3m+yYYPBW1cD Ezs8W4zdlMnUfNYUEvhfMJdc5QU6aA62SnzzikWoO2DqrvrMJElPaM5+fpOS9K/SXIWtisEIj/B Y8sR7gfxGxILd2jB9omzSTWaa4NFltY/hNnETgRTZOl/qaBEGVeGvfiBjKuy3fFCnVfrwEPTDWD z0457UHGnW94nd+eQJw== X-Authority-Analysis: v=2.4 cv=X9Ni7mTe c=1 sm=1 tr=0 ts=6a75e974 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=1azyIadIo70wB74QPeCPrg==: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=TGiO4TNcOHy51iCl_lMA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 a=TjNXssC_j7lpFel5tvFf:22 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-07_02,2026-08-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 bulkscore=0 phishscore=0 malwarescore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 impostorscore=0 suspectscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608070112 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 > Regards Neeraj