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 DBC2D3DDAE2 for ; Mon, 6 Jul 2026 13:00:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=205.220.180.131 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783342834; cv=pass; b=BSAw9S28b1DDHl9Npfc6ctox5Im3Q3fOsMMAbHKfAgP+rApUVIogY0z4GPgQZbM+JxVQ+HooxWJZrVBuFH8HPSo7F4p/iN5eviPVVTY0yIOGG0yLoxSCKcEQd52+4g6IOoxH4J5UYVaYlsFrrqi4Aj0FCyz8eRnbze0fFkAtiT4= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783342834; c=relaxed/simple; bh=eiqSJadHp3ISIKl/s1+4iuwWSYrVH6x6p9Y/invwboc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=aNZli+oFUkVQ0N8Q4qRKnxGLi25xW4guSlfb5qWMYyo4HPZiZnkED08OYD08Kiy08Cy7Vr47wpr+VW+y9TcGso292r90f+XgJ23O3s/NNplWEifwdqegMDcqEZS09ssRtNFZ/awd0H+QuOgF7f90eBIZyYfUkI+3w0hA7BP46oE= ARC-Authentication-Results:i=2; 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=R/oRQoK8; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=NGz/gWES; arc=pass 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="R/oRQoK8"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="NGz/gWES" 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 666AxS7X369581 for ; Mon, 6 Jul 2026 13:00: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= 64MqRWRxznl5rkvRwGBg/kpUpb8ntoqeisI46KakmIk=; b=R/oRQoK8O3cMIjVA KRb9SKLzzLMRVTi/01Ri3FyaQK18ZToWGPFhrpjOKYhmKokjP8XGd3VNNvIbEJPF udkFmbM6NcpXMUoGCr8dLY3X/GNNbEPvkSh1j9SRkqmCuhNL+bgghJYVRh4Mp0N2 L0wulUHg/pqzCvI19OEBhtVDY/w/hWD1pYVc+VbKcpxRMiQG3J63Ij38nHQXPmJ9 HBAgRYorwgOSYECOkqLNxIeD5NCmPmRO+j6SFeksrpgttKuhCT0ttLdYrvUz0nJN dIe/2wdjRm/oW4t+hZa2vdjfjMl+mD5zB/H2+VyX9oNXB1CGxPmTyVoKMBOUFsvN a5v56Q== Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4f88h9954j-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 06 Jul 2026 13:00:31 +0000 (GMT) Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-8efe7db1c42so41212796d6.3 for ; Mon, 06 Jul 2026 06:00:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1783342831; cv=none; d=google.com; s=arc-20260327; b=lf2EGzS6YdXT448IjQyQRqrz2FvKVPpUT+sxKDk2qB9gDXa6vmWSC0+KdaCNNypWH9 hK8CPnbamcGS3wJrDVhr8MiYlP8qnCMzwd99NraHY4/bX5Fw+yiDmZoTmkzP22UFSGNy lCcohtczCFtdXDmDyPHQelULY/qsHNabFarcKLU78pcb8t2gTcK9uh2GxnLi/Vt+hcqA DDEDBPuXaw6q9ChR8axtzJgfGcskX9ZU/0pIqkaG+ymyfTJObdFaBpD90YlbB9kjN6M4 a+pcm1NB0tNXWfXeqBEIW7+qLoze8Q8v3EWiCX02KEzy0OBgl6Duo4F8NX0J+0M4miBa X9Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=64MqRWRxznl5rkvRwGBg/kpUpb8ntoqeisI46KakmIk=; fh=HZgPkiZECPPgcw6nJExzwgxvxrvby0rfrPcV6Fcy89c=; b=VgfbzxX41MxiX2Z14vCiRCN5Htiwy4BeR4T6USpwCZDkB0AkoKPEaegktBlK5SCRWb wKcqzMpnYPnD0Zq7EO8vAT0PZoRi6xmWWOM+4IQyu9lXki8URyQiq1Kxn7cx0EvkSbxQ UJRvh0+R7xVyF4jzyRFJJ3OdJ0txqbDDQ4ytr+3PFfIkzfnTjzQrSPRHTYt/UrxPH0RI gcd4v57klymaaz61yb1q1jN5C73TKmq5MCnoahDlB13TmhE9u/qNFx0XZ40sSdNmoMJk vR0VXLsv8msrpuF9k1LCxbsZ3zoPrMGK2pLeGY5CzE5UGi0IGEePgLLsdFmJIZsJcBty qRPA==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1783342831; x=1783947631; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=64MqRWRxznl5rkvRwGBg/kpUpb8ntoqeisI46KakmIk=; b=NGz/gWESPdMzZCuIlSf+HT/E0EllMpuANe7MadRaeKkNnpGKRwWygNE2b+rgZHukaW w3GiVIloiUaGnNU6a5EHqfelVpR2orI+nk9IXoZCTVE8CFVAtD87dMGvT5yROcNJFZA/ 5WlZqIuQDtG8sKBOLmGamlMwxex7x/mOyyJroepLXrJ/XZ8jGAAZR9svze7Xs2KD2/k5 8utdqYdZGn7jRT1/yJu3/6tA1EfS58wj8v6YS7xW2VBs3+hP0Pf636UA0h2aARxYrm28 3gC38IqsJw6p6SU8fNdV849xBLR3o9qF1yl7vMhI6xIGhSgh/QRKs8A6s22CxW666AWU lx7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783342831; x=1783947631; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=64MqRWRxznl5rkvRwGBg/kpUpb8ntoqeisI46KakmIk=; b=actL/Snv4H/OJHxAuZRGFoA9tMEqAWsQLSeg50OnrBCIkvYGBz1gi/8XT3TqU+J3kx KYZRYK2QgFzWzWEE+3S46/GnMm4hUljKHBcQuFcX7NJAfBj6PyBLBGCAw8ojXYCs7daY Rv+FLRqvcAb8ZRx1UzLV9ThZHMvukHXqvvqQQIGWAb6t/aoVN9oUFjmSMYXKgCJqVUA7 abrivZq6s2HUJOJRM0UTamiIv6vFs/kYEN05UBrmzk83zwR3o9DwWMbh6Rey0Lr0q6gh GZnfyXifBXaSdwwP2njgLG8iol5ocGFk7ti+GUAQyChVqwQamn/76+jA0gcDrpuDBM6M h0TA== X-Forwarded-Encrypted: i=1; AHgh+RoGHKu+fpYaQNVSQsVE/yxtmA/4QYxML7YFm5CudYWOWMVknqGbawyEjBkCwS3vq3gM+ruDDqLnsYuvSlk=@vger.kernel.org X-Gm-Message-State: AOJu0Yz9/rGmoni2WSNdx8l+jVOXUUQdluI1W2Afy3jqN1XO4sJwbTRV C5Szhnem2zFf9In30g+C/Yz5CnQJkBMSMMUVuPNF/d4QXoRPnFI1+/d/Rx86qU32wSRzy6sV+tb wC4ypqyKGSK8CwzNFQr/d4jQjVozomN7laW47SA0wsCxm4bFv6aX7DF9fVSsGB+A1dfuOKesqAL CLq+uZstSDl6uNcqkJXaoLAPGokVVHCXqFW4QzJHH9ew== X-Gm-Gg: AfdE7cn+ZRoJp14+ZphQTHOfcsIJyZGOCwbtWbHSYr0n7hwd00Nvwra90N4G/nQyzR9 Uo/H7E2nBthD3BitE0riutkTclEcu3WgHE1ujHLU59navvcJNJ9a2uezx0Z3C3X5UqIl0pHMBQ0 j9Yz9c/2AEz/8feszEsaI5ubOB9PJO+2vUlSqeyuC0RmMeT0bCsdpQ0/aCs6KZSLcwwLre X-Received: by 2002:a05:6214:2683:b0:8f4:6909:2a22 with SMTP id 6a1803df08f44-8fcb54d2d56mr2281986d6.43.1783342826946; Mon, 06 Jul 2026 06:00:26 -0700 (PDT) X-Received: by 2002:a05:6214:2683:b0:8f4:6909:2a22 with SMTP id 6a1803df08f44-8fcb54d2d56mr2276366d6.43.1783342824572; Mon, 06 Jul 2026 06:00:24 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20260116121004.1829223-1-neeraj.soni@oss.qualcomm.com> <20260122011417.GB946159@google.com> <3e04735c-ce0c-b2b6-508d-57ec363b8894@oss.qualcomm.com> <625d16ec-052b-dfb2-61f4-bf0404297f28@oss.qualcomm.com> In-Reply-To: <625d16ec-052b-dfb2-61f4-bf0404297f28@oss.qualcomm.com> From: Ulf Hansson Date: Mon, 6 Jul 2026 15:00:12 +0200 X-Gm-Features: AVVi8CesWqnHpSXsodm3hqYxrbuRIbmHfARMqjYVery7PG9F4Atk71NGD1KkCvg Message-ID: Subject: Re: [PATCH v4] mmc: Avoid reprogram all keys to Inline Crypto Engine for MMC runtime suspend resume To: Neeraj Soni Cc: Ulf Hansson , Eric Biggers , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: l5dbvxQlxQzb7FeKYoj5FgJPazeLYmAK X-Proofpoint-Spam-Info: AW1haW4tMjYwNzA2MDEzMiBTYWx0ZWRfX7NpsGiLSKY5J B6mDRcd1SYHgigI+ZTWhxcB2/0NgBLIAXC9M6DfekOHPmwmTch4Marc20CZ7FHd9KmI9e1uyX4w eZLsARKZSfXrZHg7t6OCIwGUI5hWnoQ= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzA2MDEzMiBTYWx0ZWRfX+r/T5GVr0MuX 2GnCjyiFFVQt54rqNJAL4/8PMJQ+MDt9H8Nmi5/Xmt6R4577gqCEVmNkVdHA2VI61dqDkmwgYRx DQzbQZKOuF7nUOhrZW3UFF+t8yn5xZwX8ni3RT8tZCZcTJXYVsyYDNwHT1yQKgjLmiDdgmHK1R9 g4g2nvmqQffN7NQOAlCJGx2DnIDyqjS4J1Abap3b/C7R2hzmP8Q6J2agtTZ0jlaToywBnWk9+mI s7GnE1oFYLDsO96l95sc+hrNwuUn1QJj8oj2aoL00aRmtCWW61b5Cbn9ANsn/Kw4flY+KdCjQXN hPWbA3onH/aWh4kTfgmhU6VOM/Bv5+7BY6n3E2q0nXSKnoT+nvo9Msazv+sEn19FsnO5nTYrPUR KuA65y89TskaEuwMxp9quwsr/8BX5w+SGZTi331IrO+wuQo/HBX/iUyhEpARKAsaaZfGPgOCt9g tqNiBwPEpetcoo20Ysw== X-Proofpoint-GUID: l5dbvxQlxQzb7FeKYoj5FgJPazeLYmAK X-Authority-Analysis: v=2.4 cv=GulyPE1C c=1 sm=1 tr=0 ts=6a4ba6ef cx=c_pps a=7E5Bxpl4vBhpaufnMqZlrw==:117 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=pEt9RQvNSq73iK8vQlYA:9 a=QEXdDO2ut3YA:10 a=pJ04lnu7RYOZP9TFuWaZ:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-06_01,2026-07-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 adultscore=0 clxscore=1015 malwarescore=0 impostorscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 phishscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607060132 On Wed, May 20, 2026 at 12:50=E2=80=AFPM Neeraj Soni wrote: > > Hello Ulf, > > Can you please help to clarify? If there is no more modifications expecte= d > then wanted to understand when this patch can be picked for mmc-next. Apologize for the delay. See more comments below. > > Regards > Neeraj > > On 5/14/2026 11:26 AM, Neeraj Soni wrote: > > > > > > 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() woul= d > >>>> 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 understo= od > >>>> 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 o= ut 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 t= o > >>> 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 o= n > >>> 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 appropriat= e > >>> 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_initi= al_state()? > > I am sorry i did not follow up and assumed that no more changes are exp= ected in > > the patch but i stil see it is not yet reviewed or approved. There are a couple of things needed to get this merged. 1) Please split up the patch into two pieces. Let the core change be a separate patch preceding the change to sdhci-msm. 2) Clarify in the commit messages that the register context for the crypto profile belongs to the sdhci/cqhci host and not the mmc card, hence re-programming should be managed by the host driver itself. Typically that should be done from the driver's runtime suspend/resume callbacks, even if that isn't needed for sdhci-msm, it seems. 3) To avoid breaking the support for mediatek drivers, I agree that adding MMC_CAP2_CRYPTO_NO_REPROG as proposed, makes sense as an intermediate step. We can look into the mtk-sd driver later on and clean things up properly. 4) The call to blk_crypto_reprogram_all_keys() that's added to sdhci_msm_gcc_reset(), gets called once during ->probe(), is that sufficient then? In any I would prefer that we don't use "#ifdef CONFIG_MMC_CRYPTO" more than needed in the code, so please, either add a new function within the existing section along with a stub function or - if it works, call blk_crypto_reprogram_all_keys() from sdhci_msm_ice_init() directly instead. Kind regards Uffe