Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3277327rwl; Mon, 27 Mar 2023 11:37:58 -0700 (PDT) X-Google-Smtp-Source: AKy350aVdR6f6ixjA4fa6E8eJD2IkcBUH+OJzub2h8H+W0SaVe+unCjdmQHOegavR+mRFz2msQ1r X-Received: by 2002:a17:906:1ce:b0:931:4285:ea1d with SMTP id 14-20020a17090601ce00b009314285ea1dmr7524742ejj.5.1679942278285; Mon, 27 Mar 2023 11:37:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679942278; cv=none; d=google.com; s=arc-20160816; b=sfDcdy3chbJ/RwymKvJCD2C15EbmtJTuFfmiywiK9A91cC/ZWwjWXOFqNT6XFckkm2 MQgQequ1v/NzcEW/P1EA/I1/xTPVtAov2n6cztzQrAog/Vs1CIk7qnIz2/quM5YXFbtA UO1KnlS2erE+Bf87ezwU9eVYX7SgivIemFSi5WlTEA0VC4DExtIwuD21+mTrhmC3S0Su s1kcdDgAu2/7L2lSaNfKwwhN62Tq0nU4+OKIDczih6XSzoqNSdj3AVUlx19DeJI0PP+l EWqCyjevrhJPc6PK1AMi3nGhOLDHyoDCsm0lAkfCKlgGyXTMgBHO6/5GgA9PN7uOR3D1 Jswg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1roWhbzqzSk61oJPzwJV0kowkMwgf+yf1QbXazKCzks=; b=yFz67ZRKywwY3zczfOlceev50sRI/vS9TyHXaUMUYQ/xaRHTNzh5zauqHJ1C6uIymG IKztvVpu/w8UeQy26fuAU98caODrLfaX3P/Y7MM5zskYkujokZZsUWuwOHxKWh0KNFkn K5ehaRT4h/2WQ76bGQsggQUhahDSr/LGFdKQxBpXOlPCyivICM0c5cdl1l4baBMs4yaT 5C+70efXJks7LloRW9rKt+kShEGy3B1FbYqRmn1f0JR2uDNT9oW9EaoKiUysBJ9KqH30 kthky24GYJQ7WjadmwT5M2qTCOu0xXzjszHqGF4DgGjHtkbZ4Mfe5t4d+7hGh820z9eU Hp4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gBUTmFmV; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc25-20020a056402205900b005020d16209bsi12799353edb.518.2023.03.27.11.37.32; Mon, 27 Mar 2023 11:37:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gBUTmFmV; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229663AbjC0ScS (ORCPT + 99 others); Mon, 27 Mar 2023 14:32:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229606AbjC0ScR (ORCPT ); Mon, 27 Mar 2023 14:32:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BDE030F2; Mon, 27 Mar 2023 11:32:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2325D61476; Mon, 27 Mar 2023 18:32:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE078C433D2; Mon, 27 Mar 2023 18:32:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679941934; bh=+Mk0pjh0wJ3hTFRbtAIuBDh/ZYce47JBxftVw5y2atg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gBUTmFmVbFbSrmJtcmyQERwSPVg1qVIlVtGepAvFbWFOJUtiUTkjDmMUB560hWevI 16gDyl7D6lwnuQhyFYOONKB++0YB5Frd+g9JTfXdgBI38rmtKpz5f1H28XI4lwYXSU 4Rcn5fhZYqfB1HlonoFo3rKH3T9kN/6DNmxoiRnBk5l2/3BHwCRV/+G1GyAhFQA7FY yVKYp0S9SaNrMo+8U0IxZQQ9JWJoYpaZECnNT8opE4J1t1Dd0PgksRkmwRuFgToITm /yD/4LO6pZW/c7VUx95otyo2HGU69vlgnRJCd3xEuEYQsVnNYWWWkE+peaDSOPl2WG i8zju8I4/fQLA== Date: Mon, 27 Mar 2023 11:32:11 -0700 From: Eric Biggers To: Abel Vesa Cc: Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Andy Gross , Bjorn Andersson , Konrad Dybcio , Manivannan Sadhasivam , Alim Akhtar , Avri Altman , Bart Van Assche , Adrian Hunter , "James E . J . Bottomley" , "Martin K . Petersen" , Herbert Xu , "David S . Miller" , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, Linux Kernel Mailing List , linux-arm-msm@vger.kernel.org, linux-crypto@vger.kernel.org, linux-scsi@vger.kernel.org Subject: Re: [PATCH v4 6/7] mmc: sdhci-msm: Switch to the new ICE API Message-ID: <20230327183211.GA73752@sol.localdomain> References: <20230327134734.3256974-1-abel.vesa@linaro.org> <20230327134734.3256974-7-abel.vesa@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230327134734.3256974-7-abel.vesa@linaro.org> X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Mon, Mar 27, 2023 at 04:47:33PM +0300, Abel Vesa wrote: > Now that there is a new dedicated ICE driver, drop the sdhci-msm ICE > implementation and use the new ICE api provided by the Qualcomm soc > driver ice. The platforms that already have ICE support will use the > API as library since there will not be a devicetree node, but instead > they have reg range. In this case, the of_qcom_ice_get will return an > ICE instance created for the consumer's device. But if there are > platforms that do not have ice reg in the consumer devicetree node > and instead provide a dedicated ICE devicetree node, theof_qcom_ice_get > will look up the device based on qcom,ice property and will get the ICE > instance registered by the probe function of the ice driver. > > Signed-off-by: Abel Vesa > --- > > The v3 (RFC) is here: > https://lore.kernel.org/all/20230313115202.3960700-7-abel.vesa@linaro.org/ > > Changes since v3: > * added back the checks for and the setting of MMC_CAP2_CRYPTO > * added enable/resume/suspend implementation for !CONFIG_MMC_CRYPTO > * dropped cfg->crypto_cap_idx argument from qcom_ice_program_key > > Changes since v2: > * added the suspend API call for ICE > * kept old wrappers over ICE API in > > Changes since v1: > * Added a check for supported algorithm and key size > and passed the ICE defined values for algorithm and key size > * Added call to evict function > > drivers/mmc/host/Kconfig | 2 +- > drivers/mmc/host/sdhci-msm.c | 220 +++++++---------------------------- > 2 files changed, 46 insertions(+), 176 deletions(-) > > diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig > index 4745fe217ade..09f837df5435 100644 > --- a/drivers/mmc/host/Kconfig > +++ b/drivers/mmc/host/Kconfig > @@ -549,7 +549,7 @@ config MMC_SDHCI_MSM > depends on MMC_SDHCI_PLTFM > select MMC_SDHCI_IO_ACCESSORS > select MMC_CQHCI > - select QCOM_SCM if MMC_CRYPTO > + select QCOM_INLINE_CRYPTO_ENGINE if MMC_CRYPTO > help > This selects the Secure Digital Host Controller Interface (SDHCI) > support present in Qualcomm SOCs. The controller supports > diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c > index 8ac81d57a3df..1a6e63b7af12 100644 > --- a/drivers/mmc/host/sdhci-msm.c > +++ b/drivers/mmc/host/sdhci-msm.c > @@ -19,6 +19,8 @@ > #include > #include > > +#include > + > #include "sdhci-cqhci.h" > #include "sdhci-pltfm.h" > #include "cqhci.h" > @@ -258,12 +260,14 @@ struct sdhci_msm_variant_info { > struct sdhci_msm_host { > struct platform_device *pdev; > void __iomem *core_mem; /* MSM SDCC mapped address */ > - void __iomem *ice_mem; /* MSM ICE mapped address (if available) */ > int pwr_irq; /* power irq */ > struct clk *bus_clk; /* SDHC bus voter clock */ > struct clk *xo_clk; /* TCXO clk needed for FLL feature of cm_dll*/ > - /* core, iface, cal, sleep, and ice clocks */ > - struct clk_bulk_data bulk_clks[5]; > + /* core, iface, cal and sleep clocks */ > + struct clk_bulk_data bulk_clks[4]; > +#ifdef CONFIG_MMC_CRYPTO > + struct qcom_ice *ice; > +#endif Similarly to the UFS patch, it is not clear that the calls to clk_prepare_enable() and clk_disable_unprepare() on the ICE clock are paired up anymore, with qcom_ice_enable() in particular seeming to be unpaired. Perhaps it should continue to be enabled / disabled at the same time as the other host controller clocks are enabled / disabled? Also, are you sure that the ICE clock is actually being found? drivers/soc/qcom/ice.c does: engine->core_clk = devm_clk_get(dev, NULL); if (IS_ERR(engine->core_clk)) return ERR_CAST(engine->core_clk); It is not clear how that can get the clock named "ice" from the device tree. - Eric