forked from Minki/linux
df4ec2fa7a
Add support for Qualcomm Inline Crypto Engine (ICE) to ufs-qcom. The standards-compliant parts, such as querying the crypto capabilities and enabling crypto for individual UFS requests, are already handled by ufshcd-crypto.c, which itself is wired into the blk-crypto framework. However, ICE requires vendor-specific init, enable, and resume logic, and it requires that keys be programmed and evicted by vendor-specific SMC calls. Make the ufs-qcom driver handle these details. I tested this on Dragonboard 845c, which is a publicly available development board that uses the Snapdragon 845 SoC and runs the upstream Linux kernel. This is the same SoC used in the Pixel 3 and Pixel 3 XL phones. This testing included (among other things) verifying that the expected ciphertext was produced, both manually using ext4 encryption and automatically using a block layer self-test I've written. I've also tested that this driver works nearly as-is on the Snapdragon 765 and Snapdragon 865 SoCs. And others have tested it on Snapdragon 850, Snapdragon 855, and Snapdragon 865 (see the Tested-by tags). This is based very loosely on the vendor-provided driver in the kernel source code for the Pixel 3, but I've greatly simplified it. Also, for now I've only included support for major version 3 of ICE, since that's all I have the hardware to test with the mainline kernel. Plus it appears that version 3 is easier to use than older versions of ICE. For now, only allow using AES-256-XTS. The hardware also declares support for AES-128-XTS, AES-{128,256}-ECB, and AES-{128,256}-CBC (BitLocker variant). But none of these others are really useful, and they'd need to be individually tested to be sure they worked properly. This commit also changes the name of the loadable module from "ufs-qcom" to "ufs_qcom", as this is necessary to compile it from multiple source files (unless we were to rename ufs-qcom.c). Link: https://lore.kernel.org/r/20200710072013.177481-6-ebiggers@kernel.org Tested-by: Steev Klimaszewski <steev@kali.org> # Lenovo Yoga C630 Tested-by: Thara Gopinath <thara.gopinath@linaro.org> # db845c, sm8150-mtp, sm8250-mtp Reviewed-by: Avri Altman <avri.altman@wdc.com> Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
19 lines
876 B
Makefile
19 lines
876 B
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
# UFSHCD makefile
|
|
obj-$(CONFIG_SCSI_UFS_DWC_TC_PCI) += tc-dwc-g210-pci.o ufshcd-dwc.o tc-dwc-g210.o
|
|
obj-$(CONFIG_SCSI_UFS_DWC_TC_PLATFORM) += tc-dwc-g210-pltfrm.o ufshcd-dwc.o tc-dwc-g210.o
|
|
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) += ufshcd-core.o
|
|
ufshcd-core-y += ufshcd.o ufs-sysfs.o
|
|
ufshcd-core-$(CONFIG_SCSI_UFS_BSG) += ufs_bsg.o
|
|
ufshcd-core-$(CONFIG_SCSI_UFS_CRYPTO) += ufshcd-crypto.o
|
|
obj-$(CONFIG_SCSI_UFSHCD_PCI) += ufshcd-pci.o
|
|
obj-$(CONFIG_SCSI_UFSHCD_PLATFORM) += ufshcd-pltfrm.o
|
|
obj-$(CONFIG_SCSI_UFS_HISI) += ufs-hisi.o
|
|
obj-$(CONFIG_SCSI_UFS_MEDIATEK) += ufs-mediatek.o
|
|
obj-$(CONFIG_SCSI_UFS_TI_J721E) += ti-j721e-ufs.o
|