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 537D233F361 for ; Thu, 14 May 2026 05:56:38 +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=1778738199; cv=none; b=Bmzl0jWZkXmc3YgVibgtZGl5gVnQcwS9VDUpkbVNmy/EMYjak3b2Z+3QEOPDRt9QkeGsFn2nq2hJChI9pH8VNiIrJaOhUlbD7qusoNsx8p49yzhzQRsowRuUjneAD7srTPNv8aq0T5mPU9zy3F2BSdZ4StIgn8uyTPU9JBggs1Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778738199; c=relaxed/simple; bh=OyvyYG8eVOpfkcYx13oFyb0wTKeRoDELWFxoA5xkHBk=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=t5eaPQkTBnEl9388CL9TuRfF+6k+AgD7pEgaugT5N54x0Yd/hPFioBH5dBhzxXc0D1SH6ru/VH5be13aDBkiilJJKxhiIy4eJvkqaKe1mV/OWBCyZ+E4LnOnM9qdy8/xgiZtdO9R21N6TJ0GZzEDoDhy0C2CDg/lwLB3mKfBvAw= 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=BxKOqD62; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ZYM2BXFG; 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="BxKOqD62"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ZYM2BXFG" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64E30psl3430351 for ; Thu, 14 May 2026 05:56:37 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= nbu8y1N4/izX+twY4zjfchArelElHS5wVuKE8gdKOzk=; b=BxKOqD62fH2UpzLZ +SW7mdu3h6DlZQ5yMmHIPs5lYo1LFg2QtEhtOXVe3A93XFOiVZ/+Gw3p0mtbUiJo cdaz8AAjll4irHuWamsG/PlI51X82p7sAhWyq4AAjG4xQMrsA4HjNDAEdAjwMhhz GqnHOVf3FFjcRKKPo7aIgyWCSZ1qSyMpnHOXMUkX0TVnZxEsp+JAfx9Tg8yPgmTF PJl/e8MSNwExNOUiFpJzc9jiON9LFL3um/gn7/Sd4o/8ILsPfc6HQEGnkMtYV257 vOLcUXKQvggZEucAf3FNwv6uh+FAjlrQoibMVMvgElyAHzZk8XfdHBtLnLHdiYW9 MA1Gsg== Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4e4qmckuys-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 14 May 2026 05:56:37 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-c70ea91bfe1so4638047a12.1 for ; Wed, 13 May 2026 22:56:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1778738196; x=1779342996; darn=vger.kernel.org; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject:from:to:cc :subject:date:message-id:reply-to; bh=nbu8y1N4/izX+twY4zjfchArelElHS5wVuKE8gdKOzk=; b=ZYM2BXFGgeiJj0OkswSl36kNDb1TePnChtX+EHpyRV7zsMs3+vFQifzxNiyN87VQUK L0UGMsbGJOtl6ItkFQf4/AeJRS38I7EtCBVnqY87P7YsmZ7S/UH8to/Ndz0PTlwMdfRX bFt2W5lu19OdQLTCBBVdhrj8KnQJ1niH80R+Mt7DOnuwdJcO9SYSpqf6bvRA2PhXQaUO Q7aIfyZQGidVRLwywv9x9VX+BVS3jQG4/EQIDukKrWEfRhlnE7NLes23LSImbodYVR7b MY516U8iKx1xFdBqfI6Nv2nFrb1npVLQgukYIHoQ2Fr23kPfLi0rQPeUZBPpyQ2j9GU0 G7gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778738196; x=1779342996; h=content-transfer-encoding:content-language: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; bh=nbu8y1N4/izX+twY4zjfchArelElHS5wVuKE8gdKOzk=; b=D1ZvNmbpN8uGUP4vK59cpWt2pLGc3xcZWE8D3fYRck5Ep1Rv1yhYPiLQ1b1MN2RTaM jfc2JoI7C0kpF7KHAM1DznLtmZk3kiz2kqWppzrwMrCfbspO4M79Vu9YCrRJD1lx9+8h JVWwiSHAO4GQqTQEymGKNi9SGDBKeHZs8i6Q/uEnfrJsl7+FVAwJqhmBkaBqrP3KJLfD bqAYQ/mQgQe7V+7qwJJKlpmZlTVyY8jtkBN03rVROz04ELlDAqrpuyZ+LsQ9LBxU89yd nBCtRR2sqyH3CIL/qC5WlVdx/6VavJ29X5JBIB53kq0fxLw2Nl8Oo1ttf7TBEWZRJdjv e7Lw== X-Forwarded-Encrypted: i=1; AFNElJ/T615FMkohzvMIRyYlr7mB2TRRpVVJ5Ipemqj4ggYsrlJrBcs52ZTE08HdMlosXIc8AnxxShJ7l1jlBA8=@vger.kernel.org X-Gm-Message-State: AOJu0Ywr+nNrJFq2EAieY5sx/mdeIXUfeP9x3F/bQZJDjfbpFaCGPJ5Q vXSDtRTWSt9uprYHNuvXoezoyoJOzyFjFV4b4EcmAe43UrHnQ4ApIF5iF9nc0FTtDP0meAbTtH4 NZrmqFgulhwLqqKh/3ik7Vs8J8fS0GkCzmsy5LL9nkOEoVLzHScgef3ERWJrmfjCHXzo= X-Gm-Gg: Acq92OEAawrN3/F/ZsymMbJfc5KjCYZdDPv6Ls4gN3PORsrWUBTN3je6hPa61FVec0t jTSE8bkizC+OU+dDp7n5mzlSt5fFa7R2IdlL5IEouST9IpeXuW+M8kmV5ieFNKRZxyAwX/BSr0y UAs/1PRsoqJSg4GhwAbkEwM2fJeZIW5tMpSvyy/yNulRRZTlIjFJHFfY0XyiL9+cNIo1/9k8Waj ESDupIN2dZp8jiHJ0UDEEcGWLcJMpGOYHYwrckEdbRxLI2sP6fM7zCpCfn12AvaBEh92EB33a5x hvTEjnJmEB5cVFaiTopGSR+vgx1IUEGkIR932IszBZ5rU/kzvYVXyLSKSf9bsevdQ/aQ5w3f57F uUo4ApKzNU9YbsoXDB1/BWZ7HxdizSyK/+HTTIXXRQqJQED/Hxw== X-Received: by 2002:a05:6a20:1589:b0:39b:fad0:6edc with SMTP id adf61e73a8af0-3afaea339e1mr7391327637.6.1778738196219; Wed, 13 May 2026 22:56:36 -0700 (PDT) X-Received: by 2002:a05:6a20:1589:b0:39b:fad0:6edc with SMTP id adf61e73a8af0-3afaea339e1mr7391288637.6.1778738195657; Wed, 13 May 2026 22:56:35 -0700 (PDT) Received: from [10.217.222.63] ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c82bb062a2bsm1288045a12.7.2026.05.13.22.56.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 May 2026 22:56:35 -0700 (PDT) Subject: Re: [PATCH v4] mmc: Avoid reprogram all keys to Inline Crypto Engine for MMC runtime suspend resume To: Ulf Hansson , Eric Biggers Cc: 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: <20260116121004.1829223-1-neeraj.soni@oss.qualcomm.com> <20260122011417.GB946159@google.com> From: Neeraj Soni Message-ID: <3e04735c-ce0c-b2b6-508d-57ec363b8894@oss.qualcomm.com> Date: Thu, 14 May 2026 11:26:30 +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: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Proofpoint-GUID: 2QV9I89mbfGS9fWD24xHfDu_52y-CNpp X-Authority-Analysis: v=2.4 cv=Hu5G3UTS c=1 sm=1 tr=0 ts=6a056415 cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=NGcC8JguVDcA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=4q3zvkj2iR-HDjvw7cgA:9 a=QEXdDO2ut3YA:10 a=bFCP_H2QrGi7Okbo017w:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTE0MDA1NiBTYWx0ZWRfX3JBE/v+k0pfL QAAfeL9AonbKt0dV/6WyW5fYduTLg7man78tWVEXMl5acZAW5ZuG6DhMFpCHZ/qfpF9w+oXGZpq yiIddA6bn3x5AlTXxznPbl4S0pIDUweIdcXqAXjO+pnw4l6bAoQCacgIvIJ912llbfPIdhcnoPg ZrxLr6c5+S7Qh6JptSH8xLtspIytMEdZWDeRJunUo9l7YJs/5f35FrR4tYHxkFr1iVFDhY4Hw3F 1qL+j2hibnvrZE8djp3ijnRaqk5vj9fO15NUbmPNhy8KHOGijHyPgHNVcVI6eLW/fYtAmn3+1N+ QpZXhetD4nAlTXEyWhMuDjSDSaWXavZIh9nJltGPSpu9gq6azTeameUUvdJuPXSt3AuvmKynn4T SYEN6GDbuCfPBCjoc5+s//PxKZ9KQoDBAEzo1bX7ISjv/efYysk8bCBn4ih6UAgFr8TixGucrey dnjhUB4juCwucwfTz3w== X-Proofpoint-ORIG-GUID: 2QV9I89mbfGS9fWD24xHfDu_52y-CNpp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-05-14_01,2026-05-13_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 spamscore=0 clxscore=1015 bulkscore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605050000 definitions=main-2605140056 On 1/22/2026 3:44 PM, Ulf Hansson wrote: > On Thu, 22 Jan 2026 at 02:14, Eric Biggers wrote: >> >> On Wed, Jan 21, 2026 at 03:12:43PM +0100, Ulf Hansson wrote: >>>> diff --git a/drivers/mmc/core/crypto.c b/drivers/mmc/core/crypto.c >>>> index fec4fbf16a5b..a5a90bfc634e 100644 >>>> --- a/drivers/mmc/core/crypto.c >>>> +++ b/drivers/mmc/core/crypto.c >>>> @@ -15,7 +15,7 @@ >>>> void mmc_crypto_set_initial_state(struct mmc_host *host) >>>> { >>>> /* Reset might clear all keys, so reprogram all the keys. */ >>>> - if (host->caps2 & MMC_CAP2_CRYPTO) >>>> + if ((host->caps2 & MMC_CAP2_CRYPTO) && !(host->caps2 & MMC_CAP2_CRYPTO_NO_REPROG)) >>>> blk_crypto_reprogram_all_keys(&host->crypto_profile); >>> >>> As far as I understand, calling blk_crypto_reprogram_all_keys() would >>> only be needed for those mmc hosts that lose their corresponding ICE >>> context during runtime+system suspend, reset and possibly during >>> ->probe(). >>> >>> In other words, calling mmc_crypto_set_initial_state() from >>> mmc_set_initial_state() looks like it's a mistake, as it has really >>> nothing to do with the card's initialization, unless I have understood >>> this wrong!? >>> >>> That said, I would rather make the mtk-sd and sdhci-msm drivers to >>> handle this themselves, by explicitly calling >>> blk_crypto_reprogram_all_keys() when needed - and drop >>> mmc_crypto_set_initial_state() altogether. >>> >>> For the sdhci-msm case, it seems like the only case we need to care >>> about is for the reset. >>> >>> For mtk-sd I don't know what is needed, but possibly Eric can help out here? >> >> The comment for mmc_set_initial_state() says "Set initial state after a >> power cycle or a hw_reset." I relied on that when I added the call to >> mmc_crypto_set_initial_state() back in 2020. In the following thread it >> was also discussed that the code was intended to reprogram the keys on >> reset, not runtime suspend as that shouldn't be needed: >> https://lore.kernel.org/linux-mmc/X7gQ9Y44iIgkiM64@sol.localdomain/T/#u > > The comment in the mmc_set_initial_state() is referring to the card > and not the host controller. There have been some similar > misunderstandings in the past for other functions in the core, sorry. > > In any case, I have been trying to understand where the ICE context > really belongs and recently Neeraj answered that question [1]. > >> >> If that is not what it actually does, it probably would be appropriate >> to replace it with something else. > > I agree, the comment(s) could deserve some clarifications. Hello Ulf. Do you expect modifications in the comment for mmc_set_initial_state()? I am sorry i did not follow up and assumed that no more changes are expected in the patch but i stil see it is not yet reviewed or approved. > >> >> - Eric > > Kind regards > Uffe > > [1] > https://lore.kernel.org/all/e1f689d0-523b-5842-3a6e-10b431d617ce@oss.qualcomm.com/ > Regards, Neeraj