Re: [RFC PATCH v3 5/7] scsi: ufs: ufs-qcom: Switch to the new ICE API
From: Eric Biggers
Date: Mon Mar 13 2023 - 15:08:52 EST
On Mon, Mar 13, 2023 at 01:52:00PM +0200, Abel Vesa wrote:
> diff --git a/drivers/ufs/host/Makefile b/drivers/ufs/host/Makefile
> index d7c5bf7fa512..081b332fe7ce 100644
> --- a/drivers/ufs/host/Makefile
> +++ b/drivers/ufs/host/Makefile
> @@ -5,7 +5,6 @@ obj-$(CONFIG_SCSI_UFS_DWC_TC_PLATFORM) += tc-dwc-g210-pltfrm.o ufshcd-dwc.o tc-d
> obj-$(CONFIG_SCSI_UFS_CDNS_PLATFORM) += cdns-pltfrm.o
> obj-$(CONFIG_SCSI_UFS_QCOM) += ufs_qcom.o
> ufs_qcom-y += ufs-qcom.o
> -ufs_qcom-$(CONFIG_SCSI_UFS_CRYPTO) += ufs-qcom-ice.o
> obj-$(CONFIG_SCSI_UFS_EXYNOS) += ufs-exynos.o
> obj-$(CONFIG_SCSI_UFSHCD_PCI) += ufshcd-pci.o
> obj-$(CONFIG_SCSI_UFSHCD_PLATFORM) += ufshcd-pltfrm.o
Now that ufs-qcom will be single-file again, maybe this should go back to the
original approach of just:
obj-$(CONFIG_SCSI_UFS_QCOM) += ufs-qcom.o
(Note the dash instead of underscore)
> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
> index a02cd866e2f8..8f8581dbe09a 100644
> --- a/drivers/ufs/host/ufs-qcom.c
> +++ b/drivers/ufs/host/ufs-qcom.c
> @@ -15,6 +15,8 @@
> #include <linux/reset-controller.h>
> #include <linux/devfreq.h>
>
> +#include <soc/qcom/ice.h>
> +
> #include <ufs/ufshcd.h>
> #include "ufshcd-pltfrm.h"
> #include <ufs/unipro.h>
> @@ -55,6 +57,85 @@ static struct ufs_qcom_host *rcdev_to_ufs_host(struct reset_controller_dev *rcd)
> return container_of(rcd, struct ufs_qcom_host, rcdev);
> }
>
> +#ifdef CONFIG_SCSI_UFS_CRYPTO
> +
> +static inline void ufs_qcom_ice_enable(struct ufs_qcom_host *host)
> +{
> + qcom_ice_enable(host->ice);
> +}
> +
> +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 (IS_ERR(host->ice))
> + return PTR_ERR(host->ice);
> +
> + return 0;
> +}
What happens if ICE is not supported? I believe we should continue allowing UFS
to work with crypto support, as was the case before.
Note these lines of code in the original version:
dev_warn(dev, "Disabling inline encryption support\n");
hba->caps &= ~UFSHCD_CAP_CRYPTO;
It's important to clear UFSHCD_CAP_CRYPTO, otherwise the driver will think that
ICE is supported.
- Eric