lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZCZsFjKItcIS+U/b@linaro.org>
Date:   Fri, 31 Mar 2023 08:13:58 +0300
From:   Abel Vesa <abel.vesa@...aro.org>
To:     Eric Biggers <ebiggers@...nel.org>
Cc:     Ulf Hansson <ulf.hansson@...aro.org>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Andy Gross <agross@...nel.org>,
        Bjorn Andersson <andersson@...nel.org>,
        Konrad Dybcio <konrad.dybcio@...aro.org>,
        Manivannan Sadhasivam <mani@...nel.org>,
        Alim Akhtar <alim.akhtar@...sung.com>,
        Avri Altman <avri.altman@....com>,
        Bart Van Assche <bvanassche@....org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        "James E . J . Bottomley" <jejb@...ux.ibm.com>,
        "Martin K . Petersen" <martin.petersen@...cle.com>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        "David S . Miller" <davem@...emloft.net>,
        linux-mmc@...r.kernel.org, devicetree@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-arm-msm@...r.kernel.org, linux-crypto@...r.kernel.org,
        linux-scsi@...r.kernel.org
Subject: Re: [PATCH v4 5/7] scsi: ufs: ufs-qcom: Switch to the new ICE API

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 <abel.vesa@...aro.org>
> 
> 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ