From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21A64C77B62 for ; Fri, 31 Mar 2023 05:14:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229508AbjCaFOG (ORCPT ); Fri, 31 Mar 2023 01:14:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229665AbjCaFOF (ORCPT ); Fri, 31 Mar 2023 01:14:05 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FE48EB5E for ; Thu, 30 Mar 2023 22:14:02 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id u11-20020a05600c19cb00b003edcc414997so13101272wmq.3 for ; Thu, 30 Mar 2023 22:14:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680239641; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=pULYDGzh4E8UCXDt/pmSRIwAO6ObDjtZf1sR4LLd8yA=; b=kQkec1O6Ot/vcD84SVGs08IGHNMfIgt8VNpntgMvo9olmArl578NgRYSGwest+DLfL ikqw1LsfzghXhMbJPu2RKiA0keZsUJYqAILUx84/3pc8eRM6pVuD+RVxUWyLce0LlNoC zzKZ0ri2OG8wSFxFW8/vwxuEiE7KtTaXLWQP2DymFV2yvKqYlw6JaTk9XalpcnrzzXVw vpYXKs80XH5PnY9VI79q849BmFoY20Aemh/dKcy9q+uHCeWZrSk9+e3I8VA2SW+Lm4sY 6Kz0JK+MfYeNy51EO3nUzHkIaR6GK8tFEHaX5OsXw9m094E5SBTHZBabVmd4Q0ewSnc5 9qIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680239641; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=pULYDGzh4E8UCXDt/pmSRIwAO6ObDjtZf1sR4LLd8yA=; b=S0R3G1ymlZrAtWy0BZ5e6J3Tv3J5PNHYwzEq8gffV0foIUwNoKnryJyuJT6MfI4lL7 k7QGhd1UDiCvLXkoSJl6lk2q+SFoGv4KnvxFUg8gdcrVjAFoZ9uzwU2TSGx8xvd647Bt 5trkFlqqAQDSue2kv1HKnbt6gRJmmsfZFCAUepDVPCiQ8qXJ3kcYv03Nh6bTB0ViiGCO FKQYwMot4q0yQ2+RuJxeSXXDMX6t6Zmf3T8gPaPZEuiLfdIt2fRsM9+qaZF3EfX1e8kp Tk8Nm3/xJPn74SgFdT8kIfF+hJ3GyhPot4/9ifUGP8jX6h4tg6tbWYDGlsIA2J5HTyjj JcPQ== X-Gm-Message-State: AO0yUKVxG1+2UYwo+h8iDbNhfWjRHrSeTzj3b5cbxhBDxrWV0d1stHpl ++x3krrnZFY0QyoJIO1bbt73GA== X-Google-Smtp-Source: AK7set8+GpaUDXRWjB5QY6Zo9WS9R7HYI+Pvg65VlG7RDva4bJ4tmC4UyBNwr+8bDuf+0i2hFKbHjw== X-Received: by 2002:a7b:c44f:0:b0:3ed:d3a7:7077 with SMTP id l15-20020a7bc44f000000b003edd3a77077mr18364656wmi.40.1680239640856; Thu, 30 Mar 2023 22:14:00 -0700 (PDT) Received: from linaro.org ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id x21-20020a05600c21d500b003ef64affec7sm1349808wmj.22.2023.03.30.22.13.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 22:14:00 -0700 (PDT) Date: Fri, 31 Mar 2023 08:13:58 +0300 From: Abel Vesa To: Eric Biggers 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 5/7] scsi: ufs: ufs-qcom: Switch to the new ICE API Message-ID: References: <20230327134734.3256974-1-abel.vesa@linaro.org> <20230327134734.3256974-6-abel.vesa@linaro.org> <20230327181934.GD1882@sol.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230327181934.GD1882@sol.localdomain> Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On 23-03-27 11:19:34, Eric Biggers wrote: > Hi Abel, > > On Mon, Mar 27, 2023 at 04:47:32PM +0300, Abel Vesa wrote: > > Now that there is a new dedicated ICE driver, drop the ufs-qcom-ice 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, the of_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 > > I am still worried about the ICE clock. Are you sure it is being managed > correctly? With your patch, the ICE clock gets enabled in ufs_qcom_ice_resume > and disabled in ufs_qcom_ice_suspend, which hopefully pair up. But it also gets > enabled in ufs_qcom_ice_enable which isn't paired with anything. Also, this all > happens at a different time from the existing UFS clocks being enabled/disabled. Right, I messed this up since the last version. Sorry about that. What I need to do is to drop the enabling of the clock from qcom_ice_enable and only do it from qcom_ice_resume. As for disabling it, it remains as is, that is, in qcom_ice_disable. Then, I need to enable the clock right before checking the supported version. I'll do that with devm_clk_get_enabled (also optional for the legacy once as I explained in the reply to the 6th patch). > > I wonder if the ICE clock should be enabled/disabled in ufs_qcom_setup_clocks() > instead of what you are doing currently? > > > +static int ufs_qcom_ice_init(struct ufs_qcom_host *host) > > +{ > > + struct ufs_hba *hba = host->hba; > > + struct device *dev = hba->dev; > > + > > + host->ice = of_qcom_ice_get(dev); > > + if (host->ice == ERR_PTR(-EOPNOTSUPP)) { > > + dev_warn(dev, "Disabling inline encryption support\n"); > > + hba->caps &= ~UFSHCD_CAP_CRYPTO; > > + host->ice = NULL; > > + } > > + > > + if (IS_ERR(host->ice)) > > + return PTR_ERR(host->ice); > > + > > + return 0; > > +} > > This is still sometimes leaving UFSHCD_CAP_CRYPTO set in cases where ICE is > unsupported. > > Moving the *setting* of UFSHCD_CAP_CRYPTO into here would fix that. > I'll do exactly that. Thanks. > It is also hard to understand how the -EOPNOTSUPP case differs from the NULL > case. Can you add a comment? Or just consider keeping the original behavior, > which did not distinguish between these cases (as long as MASK_CRYPTO_SUPPORT > was set in REG_CONTROLLER_CAPABILITIES, which was checked first). I believe it makes more sense to return -EOPNOTSUPP when the driver doesn't support a specific version of the HW. If you do not agree, I'll make it return NULL then. > > - Eric