From nobody Tue Sep 29 06:08:56 2026 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 760F23A6B9D for ; Tue, 11 Aug 2026 15:18:15 +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=1786461497; cv=none; b=QxzHU8Rc+l3RtJP+bijpf6FunwFbqBciYLXplWjSxUV5KE/Z9cK7qy0UfEJ3NqNziT6JowN4RhzVeVrHIVIpBMLhJvoaWy3Op49f0+UWAS/7c9Cvr/VcudderHcQGmXxaUHRAyGkM7XIs26n2d3RVPIGxLdGN3mmr3B/09sLLxw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786461497; c=relaxed/simple; bh=adkMKR1iXVx+DwmZ3065YpyXhuugVWY0+cU+LJwva4U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iK5k6eshaBkBnvCDJbgRCJsZennl5G6xT2GHOTEYraL2PVrvNZ7in+ErTh3PIpfPvB/jJS66Qr42YzQPi6dO415tXzvS0KZfU8Pz8aSBGbq7W2m7i0Amk+b+s2Nw/G4FC5UgHc+m7GNxcltE5I7OwRIBzy51/jq69XHAucWsGZs= 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=DUqyFTET; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=UfxlyPIX; 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="DUqyFTET"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="UfxlyPIX" 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 67BDWtIs462122 for ; Tue, 11 Aug 2026 15:18:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=rb0nIYYamBu gMkUBgoIqbypSuVTrhDhDqU1MT4y2vJo=; b=DUqyFTETmQyHD8vNPyIOTED5LPx itmqBxqa2/5ZK0NqmsapWvXj7Tjmt4E31nhOGfkoOq/z7MuYGLGFn/vMpiPawodT Wuid+/pkzTCUQYdg8W4K7OkIF3kD8t3da1WpW6a6D3ljhUI4pEwurd1tQrhw+c6k 1Z2PKw1ZhZNPbkVXiwodrbSYQzOyz2cLxWajTt7pKajDKYLNHboafYr+bCbfdJp3 8ETARFXFYbS8l3hxMEJtRkaqi78Iv6UJPn2Me1/aWrvKC2JZrpnW39vbP/rrIwHV HuxOH1lYRsM17CGQPmcoKraWPK7NfrGDa/zkUHOfTmgiIfKZRKhjIDTPvlw== Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4g049mgm22-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 11 Aug 2026 15:18:13 +0000 (GMT) Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-84a3514f912so1446925b3a.3 for ; Tue, 11 Aug 2026 08:18:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1786461493; x=1787066293; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=rb0nIYYamBugMkUBgoIqbypSuVTrhDhDqU1MT4y2vJo=; b=UfxlyPIXipfp+9iUQ0xWZywl7ijRe4EwZ9OsPcv3Y8Cu7Baew0hpaygcsFpVsV2sgv TfIObk7UsxDQmG+pFKzo2T2Z7hAf79rp97zIHG/gOBHRTnfcyVVqH2m0JukrrJ3QHH7k JT9mMV4p8kIXf3V+UQ94iDS/gyxnw5xNwEtxPsocMShHBsfV87msLemi84zWWgl0HJC0 f48+pDWsROGvqrtqkc6nohSO2DfkMqpNV6vg4jGzB00wIyAVY2FacCxn3OPWB8c+EUat G1TJVKiNx8s7gGVbQrvujsSi3kyPXMt5ro6jweXpBsjP/6hJYbgEKl97Q+92QbyjpZFk CVYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786461493; x=1787066293; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=rb0nIYYamBugMkUBgoIqbypSuVTrhDhDqU1MT4y2vJo=; b=Ie3iWL5P6OD/v73XbgrU4vSrz8Pnkze/hBNRjIDya7U9XBvXwv/8VlPuG/qeItPKYN x1Y2dz5xzbWVVl1C2BduZ/Oving6Bh4qgA3lavWn9weV0eJwLzHGffXobVxN3l4ac9Wd vFkuVqw9WwwGIRCqgpq89S00Sda6Jcx/aKJC6dPydBPiiWd4AXSl+2Xz17hTi/t1m453 THOhS2uq4OiCvuLKkwKAkmjeD1Ua6rAs8/x6UZxEWUpfaZ/JD2SZysFweRMQHZ4PW0D8 wcGhFrvdcIyTmkuFDBfltmnIMp6FOFlG7+eca3XduYcQBAlzroRb9KpFDocv5V0NZBZ8 1Rpg== X-Forwarded-Encrypted: i=1; AHgh+Ro6SU+fLu76FWEy8X1WY4OmHpXDdI8clf8pr0uLmKXIJeKsUKW0nvsu+p6pZA+pADwmAkDrBUg8JQxB1hk=@vger.kernel.org X-Gm-Message-State: AOJu0YyXmvoRPE9PrkR6EW0sDDNsNBnTQO1Nbdc/2YAhGjW/5bS8Rnu7 DKTzvnjO7BqIYkjMXc0YEvfobWP6Z0+vJ62bY+q2Cxm4qAaaMtQxIV41vIYgFw0xz1i3rjwWXLa 3zOaI20L9z9efGnk2iGsgLEzZEE037blkEgqKtPbVQ29081DC26v9oanSsrxU7tW4nas= X-Gm-Gg: AR+sD12P60atY5/dRdcIUxf2dX8ScTr42v8rx+dI8NuXPyQymVL72RhvD/kW5xURmrJ gjPJCPsWkSSDHdHaYwZlr10RSNY+tqlrTaxVtqPc+R3jU6eXa+eVWjwZcRJUBJUQdobEyPpBZSJ BD+Iab2fP60yhzieeraXa2W2yGjOQYvOtmHHLQyl7vwkEvrP7jIgOqau2Ha6QMKAT1AmNZ5e7/N nAvOb956IZ0rUupC5PmfqqBu5ocnP26fFMwZyWlyqWqxAwUAANi8tp9h0Qs3wMAtzJbDIeFbwTT 3+oRTxMNEwYPCkmoGMQY4fo2QgB0GzBaxKzbxN2fYhnILxiLhsRiXa27gjGld0V7rHL4t4S4rOi LdHLwWMtv1jxGz6vywAWC5y7WrRUKwB0= X-Received: by 2002:a05:6a00:3a24:b0:847:5ec6:3afe with SMTP id d2e1a72fcca58-84fafa1c035mr928001b3a.31.1786461492928; Tue, 11 Aug 2026 08:18:12 -0700 (PDT) X-Received: by 2002:a05:6a00:3a24:b0:847:5ec6:3afe with SMTP id d2e1a72fcca58-84fafa1c035mr927950b3a.31.1786461492483; Tue, 11 Aug 2026 08:18:12 -0700 (PDT) Received: from hu-neersoni-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84fa95261b0sm983727b3a.36.2026.08.11.08.18.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Aug 2026 08:18:12 -0700 (PDT) From: Neeraj Soni To: ebiggers@kernel.org, ulf.hansson@linaro.org, adrian.hunter@intel.com Cc: 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, neeraj.soni@oss.qualcomm.com Subject: [PATCH v7 1/2] mmc: Allow host driver to control the re-programming of crypto keys Date: Tue, 11 Aug 2026 20:47:58 +0530 Message-Id: <20260811151759.1258525-2-neeraj.soni@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260811151759.1258525-1-neeraj.soni@oss.qualcomm.com> References: <20260811151759.1258525-1-neeraj.soni@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: L7-Xkgv1KLb5T3aRQtqPh1Wek3qbXpsV X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODExMDEyOCBTYWx0ZWRfXxnRDNV+dkhXA owj3TShpMySnRKFwDu1l5OzxPG+XvA+n5pKdoKIbngiie/pKva5oLqIk9e6O4OHy3dHlJR5TiRd hAUVjHZL+sVxjUXzS7PXQD2H0TBjQYyHvM08DFup+uydBawvyA0V3lO3uwgwXoxMr2S7o5GqeL3 E4W/SwlZDyeW3JVemAhdNFJweuhE769QgzsNbkvlb4ciTLKmHO3Z+Ktk9DPFMAQ2D4FW4fQOYH9 +5I0+bxd0CEEl8gR6JFua4pJSUmpggExpLWgGJxbRIgCDI/ITXJUifCX0GX1HuS6wYJZFoGUWi1 ldteZSDwNlWqiy66+gca+SDIzhizHNCaOpT7yzs+sUKriQr2XHCiel4ugYM2aYfUTLrscYdIfGV H0WEmSs9Z/ruBzTL5DmgKhfq3035/hyuSJs5qM1cmvqrLGfjrLIn2GmSK9blJndMdPIJqGmZjYm cswMM2jYtdCgqGLZtUw== X-Proofpoint-ORIG-GUID: L7-Xkgv1KLb5T3aRQtqPh1Wek3qbXpsV X-Authority-Analysis: v=2.4 cv=FbkHAp+6 c=1 sm=1 tr=0 ts=6a7b3d36 cx=c_pps a=mDZGXZTwRPZaeRUbqKGCBw==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=Sv0fKeRqtYgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=COk6AnOGAAAA:8 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=gPkh30t4SdGlgi7DwewA:9 a=zc0IvFSfCIW2DFIPzwfm:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwODExMDEyOCBTYWx0ZWRfX40ze5+2CYm7/ 67iYpyiuhkmObNYtY9U7Z0hB7DvBWcHnqH1j1lXmhntbAhtujKbPiMCxRbCj2+ihZg0+If5wf1O P+FtfT9QsCGWMh0I7I7NFLVKtJb0TCY= 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-11_03,2026-08-10_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 clxscore=1015 bulkscore=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 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-2608110128 Content-Type: text/plain; charset="utf-8" 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. Add the flag MMC_CAP2_CRYPTO_NO_REPROG as part of host->caps2 to control reprogramming keys to crypto engine for SoCs which do not require this feature. 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 Reviewed-by: Eric Biggers Signed-off-by: Neeraj Soni --- drivers/mmc/core/crypto.c | 2 +- include/linux/mmc/host.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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); } =20 diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index ba84f02c2a10..3c3c45fdf39b 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -463,6 +463,7 @@ struct mmc_host { #define MMC_CAP2_CRYPTO 0 #endif #define MMC_CAP2_ALT_GPT_TEGRA (1 << 28) /* Host with eMMC that has GPT en= try at a non-standard location */ +#define MMC_CAP2_CRYPTO_NO_REPROG (1 << 29) /* Host handles inline crypto = key reprogramming */ =20 bool uhs2_sd_tran; /* UHS-II flag for SD_TRAN state */ bool uhs2_app_cmd; /* UHS-II flag for APP command */ --=20 2.34.1 From nobody Tue Sep 29 06:08:56 2026 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 C216638D401 for ; Tue, 11 Aug 2026 15:18:21 +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=1786461503; cv=none; b=ubz0Edz9YAoT23vlf+SZrcpmUrKLq+nOFpSbDRiJOKCsOGRJ4B4zxyh6XyHh8QcjEqQl+QTp/7m/xVZk2OR0N5y7FHJ7Sg/XWdDcVWCDtblf3zmWRXoV+vp0ht8XWoPfAW7DMnedxoccBEzILaRBZhLWtkuCtGi9y1+M+OcvFjc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786461503; c=relaxed/simple; bh=NbgGl5cLf0ReGNO3COnwcEwBWeIot0njUhLwUl0O7Qg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eWT293Xbo7qeciywQa2ZulQcw8wdT6h5L8xBJb0nw4rktHL8sFBjJLQfz9EkxhBFIttZTolPD30awmN/ZxHcAAYe2qlbbU3xfeoUMoE94zZXVfDZPUNnTifKHobCm9kzVGKXQqpu0Ju+h/vUWXCh375E405cX0QPEaQ2mPHVCjo= 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=KrgZNspy; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=TOdxc2VR; 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="KrgZNspy"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="TOdxc2VR" 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 67BDWpTk462024 for ; Tue, 11 Aug 2026 15:18:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=vpBZTVyDsH5 y2y67euiXcDCt+is3/E/IpXezT6gqsyk=; b=KrgZNspyNqmWDi1qBQlx+RNFWqT FYkY9pzNNRXBAxoYgPsestSgDu4SyNue3KrOS+KsTlQOT8ClvnPZqRvD0LeR20ky sP8UOsUIpnAndU6mSpjJCqyr3K6CsC48jmVZiLoVsvMhQNGmUYSWa5EGIrqO3/CN 3mhkM3jMZm1EUuDyl4EwRp7HczhwWl0he6zzC4/pkL49ZlOBFTVLtEeNHiiInuWs WEf7dWPc6ymHxAX9FeTeyYBL6Ojsz3j+cgds4DIUteRLuYxiCra9JHQejIsZBVYg AnFpy5wnhPfesXCWO5OrIK9UgM2J6XY9YgEbjbGI/S4PgwQ7AgNimG8cvfw== Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4g049mgm2t-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 11 Aug 2026 15:18:20 +0000 (GMT) Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-84e048a801dso4511693b3a.3 for ; Tue, 11 Aug 2026 08:18:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1786461500; x=1787066300; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=vpBZTVyDsH5y2y67euiXcDCt+is3/E/IpXezT6gqsyk=; b=TOdxc2VRKpmutDxvDSE/ZN0UDGg2QsNF72sfZXpXI904XgH0VlItEhDp6gDOE/RN2T XTHON6PcZ+s1zxcyuBzP/0cxu5Gu6Rk1/nVsAv8kdvmmf+oJSeVewcR96mzi+LAPBkPz l6QTndY5XWQvt842f1LKUA3TPTrtldzpCmoS5fhL8LRvIm1zS1WK5Qb39UBQi2E0PKud 5YUJ1u3JQPSNfsSxEhVisqA4vLcnWVZWxpEhmbo7HS0dm5rUWMveFI7hRAL8t3xYpoyM mQtztXtH15tEgxYwRFl22hMdVMGRIehpWUWvPEzspKKVjXbvBkWFnBswI4ZPO8VurpAY l+uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786461500; x=1787066300; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=vpBZTVyDsH5y2y67euiXcDCt+is3/E/IpXezT6gqsyk=; b=dP4CoP0dxMRBzw0oIyATgJo/donPKMIPRvt+gtWjfx81ohSe0mGPlWJbN/lY2tmncy nDl7nMvJcg4xsFw8O603xIHxroNUADBcRn6m/QR3A+VSmaorBhY318iWFGmlEYKM8ciQ 1QSMA5ktTOrn70R9y8hU5qrgEwTv6l/pAvLz59Hc8EJkrRsIF9InN0R6EU+apAIjU2Yx xzQaGJQzHqlsyewh2Hs9cGv94bOPRPIZDnaIDNzx0J/vHsJpSxocNLW0xLbxN/v1TIHL xycyo4ixB/aaOgyFskmp5a8pQFrZMpIaOKTlkhjzDW/qUk9Jdrq+6DH2vEidp2iGKCB2 ovDg== X-Forwarded-Encrypted: i=1; AHgh+RoZ6+VTX+1v57JUpaNkYywMBaLBmBIVLULsgb7KzqdTKlA8Wiqpmn3HYgWQy2r99eTbVHZEYfDPhczfqBk=@vger.kernel.org X-Gm-Message-State: AOJu0YwAbu8MjOGzCWP/at5tv8DFS5DQt1MTVmv+wwEdqMG1SJSo8IIg GpdNRgp+EAkwc/6eOgPapY+xkBefewvP1E/geRUlJKxeG1TJ74NC3IAqbHoUmvpUg98OnUFvR3G UD+cSm2aP77gNVdISiI8i65qG0RhoZt6mlltUTzm/A5QhXep5299D+GZFywblUanVcOI= X-Gm-Gg: AR+sD11sQTE/EzZpc4sdtSv1qCj5R4j3xhl9/CLA36WQDYUV3+SY17527hbJ6QEgkR0 027p1MiC26/OBKX0YUHgDMooJ1UY9ZrrO+1neepHF10/g+ZAmDXGwqqT7vUWdtOL/HtUhoeSisr 4+1d+VCxdbxFl4LySm1chgwFWXC5OzA5vZytH7G8oMGhZRz4PBP0CSSfXq03UcznWtJN0qTXCHL WVYrUZvEQ+t2mp5EmleuqEFOboneUmynj/meDUndTCx9s/dS1JDjVNnxcGYjlewDMpSx/7sA+Qf IxPmi9BH229RoLOJzCU2D2t1dWyHFjuTPWKcWJGABWTLlKgNkVEp9N4krCHwwWEfSDenNxBv3xF p2nRmcA3hL3mwh6CKftVqtyvQbh5qOzg= X-Received: by 2002:a05:6a00:3305:b0:84e:2f2e:8c4b with SMTP id d2e1a72fcca58-84fa88435c5mr4657647b3a.32.1786461499454; Tue, 11 Aug 2026 08:18:19 -0700 (PDT) X-Received: by 2002:a05:6a00:3305:b0:84e:2f2e:8c4b with SMTP id d2e1a72fcca58-84fa88435c5mr4657544b3a.32.1786461498900; Tue, 11 Aug 2026 08:18:18 -0700 (PDT) Received: from hu-neersoni-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84fa95261b0sm983727b3a.36.2026.08.11.08.18.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Aug 2026 08:18:17 -0700 (PDT) From: Neeraj Soni To: ebiggers@kernel.org, ulf.hansson@linaro.org, adrian.hunter@intel.com Cc: 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, neeraj.soni@oss.qualcomm.com Subject: [PATCH v7 2/2] mmc: sdhci-msm: Use pm ops instead of macro to restore crypto keys Date: Tue, 11 Aug 2026 20:47:59 +0530 Message-Id: <20260811151759.1258525-3-neeraj.soni@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260811151759.1258525-1-neeraj.soni@oss.qualcomm.com> References: <20260811151759.1258525-1-neeraj.soni@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: _hJbhir2od_ZvdEobwGwZSJmHQ2ZterN X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODExMDEyOCBTYWx0ZWRfX6KfCbbfghfW/ A1BjPOALa7qtFuHOyN1QomTvCRn2wD3nXUHTriiS9jX4XEKcHBI2gYekQjggecKltQiAqWHrIst NJ/50uHffNdBDn1vo38KdqaGT3c3p5A0pz+Q+dFP63O+MnTJ+mJCnEwf5Doc5jS7j+oXODK0R2F 99hqL96gxBe3u0Neyq2MGguAVysPKaiMXf+DZ8p1wb2XS1gXqC4T3T2L7MEoACzMLpW7muONip+ DoxXIA89LSvFF9qLi0W67N3vXGKirCvS6EOIguSxDjnE8FuAP67MYrz4K5eA5l8jKocRcffePNV 4W2UvSmAuzN/2JBd5vQfWweZzonGcaIU8hQN00+6btAkYrPtPKLVF3sCGrZYZaWFgq9JCIOAWi3 AVhL5bAgke5PIoiPDZcSeICdkdcuVoGVNedQwQGLP2P5w/W6+4cIhUMYDw0aA4gyrJrxNzhOg5E oeag0K3+IAJrN3LvBhQ== X-Proofpoint-ORIG-GUID: _hJbhir2od_ZvdEobwGwZSJmHQ2ZterN X-Authority-Analysis: v=2.4 cv=FbkHAp+6 c=1 sm=1 tr=0 ts=6a7b3d3c cx=c_pps a=WW5sKcV1LcKqjgzy2JUPuA==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 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=y6BdAlClqxV26XkKDfUA:9 a=OpyuDcXvxspvyRM73sMx:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwODExMDEyOCBTYWx0ZWRfXzrvJfGOQ5V7s ICThZq5uFPjv/2E/vm00Ax4H3WzZBuQbRvkb/ZesOnwJ5cwKeYEkabv38NJPRqEKGkNjp2JOSyP QJqnBwqm7Wz/X3umFlDbzEzq8nDN23w= 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-11_03,2026-08-10_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 clxscore=1015 bulkscore=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 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-2608110128 Content-Type: text/plain; charset="utf-8" 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 | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index 4aff965f0e2e..460994164d2d 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, } =20 mmc->caps2 |=3D MMC_CAP2_CRYPTO; + mmc->caps2 |=3D MMC_CAP2_CRYPTO_NO_REPROG; return 0; } =20 @@ -2055,6 +2056,12 @@ static int sdhci_msm_ice_prepare_key(struct blk_cryp= to_profile *profile, return qcom_ice_prepare_key(msm_host->ice, lt_key, lt_key_size, eph_key); } =20 +static void sdhci_msm_ice_restore(struct sdhci_host *host) +{ + if (host->mmc->caps2 & MMC_CAP2_CRYPTO) + blk_crypto_reprogram_all_keys(&host->mmc->crypto_profile); +} + static void sdhci_msm_non_cqe_ice_init(struct sdhci_host *host) { struct sdhci_pltfm_host *pltfm_host =3D sdhci_priv(host); @@ -2149,6 +2156,10 @@ sdhci_msm_ice_suspend(struct sdhci_msm_host *msm_hos= t) { return 0; } + +static inline void sdhci_msm_ice_restore(struct sdhci_host *host) +{ +} #endif /* !CONFIG_MMC_CRYPTO */ =20 /*************************************************************************= ****\ @@ -2983,9 +2994,28 @@ static int sdhci_msm_runtime_resume(struct device *d= ev) return ret; } =20 +static int sdhci_msm_restore(struct device *dev) +{ + struct sdhci_host *host =3D dev_get_drvdata(dev); + int ret; + + ret =3D pm_runtime_force_resume(dev); + if (ret) + return ret; + + sdhci_msm_ice_restore(host); + + return ret; +} + static const struct dev_pm_ops sdhci_msm_pm_ops =3D { - 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 =3D pm_sleep_ptr(pm_runtime_force_suspend), + .resume =3D pm_sleep_ptr(pm_runtime_force_resume), + .freeze =3D pm_sleep_ptr(pm_runtime_force_suspend), + .restore =3D pm_sleep_ptr(sdhci_msm_restore), + .thaw =3D pm_sleep_ptr(pm_runtime_force_resume), + .poweroff =3D pm_sleep_ptr(pm_runtime_force_suspend), }; =20 static struct platform_driver sdhci_msm_driver =3D { --=20 2.34.1