From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 1C55B3AFD11 for ; Sun, 23 Aug 2026 19:48:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787514484; cv=none; b=iUFNLVTSlgqM3aqNQzFLRTvx/MIhlxs5XB5ANC/N+HW9JB1Otcsmrq970bpoC83go/OMtbWB4ApU4ieUVDxuSvNILI4lfuckMTPsUZvh0aDJMSXq9KIFr2miV94XZ7fTd6vYwVHZFxIXBerZNgEXf6ArwBxKCWdkHVfsGuy0JA4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787514484; c=relaxed/simple; bh=gWTcQ2XEzDFY0k81S5RiN8Z8bxM3mkFS9yIkZIw67Js=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=n37sIbIp2YwX6mvAMtDl1rPBlSU1MQ8MQ7+4llJI1PcVgS7QA00wJme6bgbKZpVpbTIJnEAVAsPWbkCHYy9IUtj5JioyeU72gXciyUT/mFPniD6OmmTlxOvsgxYhKT688BmDRzZ3jDZXNbYA0oLfFH2+pFvIfUiEx14t6jGDT+k= 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=eeVwaun9; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=FGhhgQhz; arc=none smtp.client-ip=205.220.168.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="eeVwaun9"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="FGhhgQhz" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67NIR64f1233654 for ; Sun, 23 Aug 2026 19:47:59 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= LKlVcGWgJkDfbVp+WF3KzIUdL8c8AJrsPsM7RduI1+4=; b=eeVwaun9MIrnVxtv ffuENyvCvT5XqyDyy2RK5I4ZHo9Vs7up6lFqVTNVLlMJCSCA+AqBNnFX/j1Lmqum Uo5G69F07Zw9R+0KqrUHcF533qhxnF7fWTGEsXLaFF67P/QS0Fs7G0DBEy2VB4me ITPufWFzPzVr74YjR4c62APsyFuJcIDI94pFZvOxFnlTgn9Gh7zFtnXOvFieW6dg 5qOyatLqA+NbStBkGoi7xHzBJi1MI0S9VXMtK5SoqQy4v/7bjmnEJQAhHPjABVGg aJHBp8xE7Xk7IYkxR/IJmjcSZ36eElritqUiJkq7fUtFvcT58a5F2Sm4mxSdjElL ZJwpqg== Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4g744wv7hc-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sun, 23 Aug 2026 19:47:59 +0000 (GMT) Received: by mail-pg1-f200.google.com with SMTP id 41be03b00d2f7-cbee57593baso1876053a12.3 for ; Sun, 23 Aug 2026 12:47:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1787514478; x=1788119278; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=LKlVcGWgJkDfbVp+WF3KzIUdL8c8AJrsPsM7RduI1+4=; b=FGhhgQhz3FilwCEe/v9LR8c069+xsD6uok1MGVO8hWzQ9buwhU8B20ufUAZXhd+zP2 DqlrpisDwO+vOi4W+cBnuPtWRvjpdxuwnbyFsRdxkP2VY1ZTwt5kKpVgQCJifO2l5Jrs 0SaGhCW2kYGL3AFEiE8BVT2RcL+DCnnzZrYlHnpGs5mxeU6jBbLyzQgfn8rfz62O0BmW W9z34xHkkxZRi/5VZ6Gbff3VAHgMucLdmkOISGB+2O2vTOrdHkyuuWUGRKo2H5oCYVt3 pENACDpW6MpEyjEhmLGuwgkwMwKEOgKRUwUssCR2dDpaJTjZ/K9nd/W6U1MBDaqhTOY2 TKOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787514478; x=1788119278; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=LKlVcGWgJkDfbVp+WF3KzIUdL8c8AJrsPsM7RduI1+4=; b=noJue31hJZsHPLpQVaTdswfILbUvTvURSbGojyiIPOyKOG3kpCIyjIt+61TAd+l+vd 3+11JE1Bh85H3XKjsObASUoKexoc9CYv40YBPnNbg6PB1v9/Q9a63YW662pvE/UJzJLC ik/7Jz0CeVBVr9XN4IqOuSyoPswJcqX3sahD4RSG4CF0Uk3kzfpystce7P/jiwaWbpyx f5bUcKx2dybSvYSOnpjMzOrhmW2/pqZvMIs3A8C0+oEDRPP+HrBbyAzua1yDauORuVeF K6Px5hxPC9XREK8FyUE4cyqoSubutKXRI9qTDCYor9IVv6WUB+ftRFRb8XcTn+2NGgGw LPMA== X-Forwarded-Encrypted: i=1; AHgh+RrXoFp2/vy9pjYA6ctpNoSQ9gKoAnRgTfEs9CLIIexET2+qwxrqkKk0iblINQ3w+MbTmRisZoPfB/ysCWY=@vger.kernel.org X-Gm-Message-State: AFuF++lEquuODJ6K/dmmhPq+lzRbZrCuUDevZppwfPtx+KrF+trruJAF pE/zJzd0KW9u+8tbx+SJQQJFuEUA89r6jBzwtoTV2+EhQz1VgpWD+NBELKca464Y2rPzgHp1UFy +ECplUfwPitv9VkxEWy2JTGDPLVc98sRsIEDh3bQvKUwO/z2RyhUbjm6Xl3JGmjqXEts= X-Gm-Gg: AR+sD11wN2YpJbgXFgFyzsuFjBZRLlGQtx3wIkJGtthOM1g4Cye5qtD0l/XU5lDCoAV /gVV0z8swMowgLJeFrO2N3kXtvyOF+AgNOysAaDpOXW2qQo5QWKOf546rl08EuPtzs4EP6U3HnR YU+7qsxjgcLKKqcfSrieMgJ4frOKteKkDT2hTQOKnOvZGrEz+QGdvYzVXjyE9TMkUJBGW3BD5tw w/SjdIWkSMRG/zqR6363CAR/JF7ndqMV0NbyKTmJfoFk00uPjQ0SEMT6JKOPqo6bMQSqkgr/TSC CGJrDsutz+8Sj3MLTxfpNCzHmUL4hICLB2bDgyi6tBRDZlCTrIssUGJkeRnuQzxSuRZWtQhrJG7 f2soJHp01Ow/aSjeoyy8HbuMImJb34z0nIcq0qg== X-Received: by 2002:a05:6a21:710f:b0:3cb:d156:d362 with SMTP id adf61e73a8af0-3cd2fdae771mr40720121637.3.1787514478381; Sun, 23 Aug 2026 12:47:58 -0700 (PDT) X-Received: by 2002:a05:6a21:710f:b0:3cb:d156:d362 with SMTP id adf61e73a8af0-3cd2fdae771mr40720074637.3.1787514477928; Sun, 23 Aug 2026 12:47:57 -0700 (PDT) Received: from hu-arakshit-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-327f925190fsm32321623eec.31.2026.08.23.12.47.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Aug 2026 12:47:57 -0700 (PDT) From: Abhinaba Rakshit Date: Mon, 24 Aug 2026 01:17:39 +0530 Subject: [PATCH v12 2/6] ufs: host: Add ICE clock scaling during UFS clock changes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260824-enable-ice-clock-scaling-v12-2-09271f583dc6@oss.qualcomm.com> References: <20260824-enable-ice-clock-scaling-v12-0-09271f583dc6@oss.qualcomm.com> In-Reply-To: <20260824-enable-ice-clock-scaling-v12-0-09271f583dc6@oss.qualcomm.com> To: Bjorn Andersson , Konrad Dybcio , Manivannan Sadhasivam , "James E.J. Bottomley" , "Martin K. Petersen" , Adrian Hunter , Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Neeraj Soni , Harshal Dev , Kuldeep Singh Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, Abhinaba Rakshit X-Mailer: b4 0.14.2 X-Proofpoint-ORIG-GUID: AnmzI7TEAu0pNdSjyLcOknUGmvtd-2E3 X-Proofpoint-GUID: AnmzI7TEAu0pNdSjyLcOknUGmvtd-2E3 X-Authority-Analysis: v=2.4 cv=KuF9H2WN c=1 sm=1 tr=0 ts=6a8b4e6f cx=c_pps a=oF/VQ+ItUULfLr/lQ2/icg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Sv0fKeRqtYgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=yPCof4ZbAAAA:8 a=4vEl8bdWBwuQafGpEzkA:9 a=QEXdDO2ut3YA:10 a=3WC7DwWrALyhR5TkjVHa:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODIzMDE4MSBTYWx0ZWRfX/P4U+YGJY2l6 iR0M/y2h1rrPx2Ns6EYYFrk2pO7yYi8Zxe94R1HTIzm4OKsTZ8/6JEWycSp9pr40gOjHiXARgst 4oeXloQVC+mmt53O/KLhUA2IgW+N3ewIycqHw5xY63lyEWxq0t46rClKz5d9Oy2dxXpW+P41T7u KvFOcduaeybrHxsU6ENb4kbleUOGEJEJ7gRGN8ZS/H3t+MtSDyT5IAM3rTqR3lg+8BTfRn0f3qn GFHdiWsErznWOY65a+mElmgpiRgkNUnU4FIrqBWAT7MTmIE0Tk7NzyoQhg3pJA1HGr27BFY1x6z tiuccUllU75zEiDby0E1a8sc2dnoXK1ipsSMilWaIBpaxW9nGIuzeHfJuZFBk1MLDtEGcfKCksD Sc0XIR8j6F0rJJlNU0vD4XMq9vbxfADJWDWAbeFi3g9F/utD/5CDOS/qu2aDO2yXTsFCgovJAjn +XhZ1h2QMuKoX9b73QQ== X-Proofpoint-Spam-Info: AW1haW4tMjYwODIzMDE4MSBTYWx0ZWRfXxluHe9+jQtbC VACU15vUaY92FeCrITofZi9XHD8ms4m40N7eqPpe7Hh+01127+PyXwe8kQNJJmZflHeGGDH5Ch8 c5Fdi7SkGwgz+MLYr2vh1uxdMF09c5k= 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-23_06,2026-08-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 malwarescore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 impostorscore=0 bulkscore=0 suspectscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608230181 Implement ICE (Inline Crypto Engine) clock scaling in sync with UFS controller clock scaling. This ensures that the ICE operates at an appropriate frequency when the UFS clocks are scaled up or down, improving performance and maintaining stability for crypto operations. For scale_up operation ensure to pass ~round_ceil (round_floor) and vice-versa for scale_down operations. In case of OPP scaling is not supported by ICE, ensure to not prevent devfreq for UFS, as ICE OPP-table is optional. Acked-by: Manivannan Sadhasivam Reviewed-by: Harshal Dev Acked-by: Martin K. Petersen Signed-off-by: Abhinaba Rakshit --- drivers/ufs/host/ufs-qcom.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 291c4344876481461ab958f3048db5405bbead62..dc15d7806c7b677d6890cd4b077cae4f4d5c9a41 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -306,6 +306,15 @@ static int ufs_qcom_ice_prepare_key(struct blk_crypto_profile *profile, return qcom_ice_prepare_key(host->ice, lt_key, lt_key_size, eph_key); } +static int ufs_qcom_ice_scale_clk(struct ufs_qcom_host *host, unsigned long target_freq, + bool round_ceil) +{ + if (host->hba->caps & UFSHCD_CAP_CRYPTO) + return qcom_ice_scale_clk(host->ice, target_freq, round_ceil); + + return 0; +} + static const struct blk_crypto_ll_ops ufs_qcom_crypto_ops = { .keyslot_program = ufs_qcom_ice_keyslot_program, .keyslot_evict = ufs_qcom_ice_keyslot_evict, @@ -340,6 +349,12 @@ static void ufs_qcom_config_ice_allocator(struct ufs_qcom_host *host) { } +static int ufs_qcom_ice_scale_clk(struct ufs_qcom_host *host, unsigned long target_freq, + bool round_ceil) +{ + return 0; +} + #endif static void ufs_qcom_disable_lane_clks(struct ufs_qcom_host *host) @@ -1946,6 +1961,12 @@ static int ufs_qcom_clk_scale_notify(struct ufs_hba *hba, bool scale_up, return err; } + err = ufs_qcom_ice_scale_clk(host, target_freq, !scale_up); + if (err && err != -EOPNOTSUPP) { + ufshcd_uic_hibern8_exit(hba); + return err; + } + ufs_qcom_icc_update_bw(host); ufshcd_uic_hibern8_exit(hba); } -- 2.34.1