linux-stable/drivers/scsi/ufs
Eric Biggers df4ec2fa7a scsi: ufs-qcom: Add Inline Crypto Engine support
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>
2020-07-24 22:09:54 -04:00
..
cdns-pltfrm.c scsi: ufs: introduce common function to disable host TX LCC 2020-02-12 19:27:16 -05:00
Kconfig scsi: ufs-qcom: Add Inline Crypto Engine support 2020-07-24 22:09:54 -04:00
Makefile scsi: ufs-qcom: Add Inline Crypto Engine support 2020-07-24 22:09:54 -04:00
tc-dwc-g210-pci.c
tc-dwc-g210-pltfrm.c
tc-dwc-g210.c
tc-dwc-g210.h
ti-j721e-ufs.c scsi: ufs: ti-j721e-ufs: Fix unwinding of pm_runtime changes 2020-05-26 21:33:54 -04:00
ufs-exynos.c scsi: ufs: ufs-exynos: Remove an unnecessary NULL check 2020-06-29 21:33:20 -04:00
ufs-exynos.h scsi: ufs: ufs-exynos: Add UFS host support for Exynos SoCs 2020-06-15 14:04:10 -04:00
ufs-hisi.c scsi: ufs: introduce common function to disable host TX LCC 2020-02-12 19:27:16 -05:00
ufs-hisi.h
ufs-mediatek.c scsi: ufs-mediatek: Add inline encryption support 2020-07-13 23:24:56 -04:00
ufs-mediatek.h scsi: ufs-mediatek: Add inline encryption support 2020-07-13 23:24:56 -04:00
ufs-qcom-ice.c scsi: ufs-qcom: Add Inline Crypto Engine support 2020-07-24 22:09:54 -04:00
ufs-qcom.c scsi: ufs-qcom: Add Inline Crypto Engine support 2020-07-24 22:09:54 -04:00
ufs-qcom.h scsi: ufs-qcom: Add Inline Crypto Engine support 2020-07-24 22:09:54 -04:00
ufs-sysfs.c scsi: ufs: Fix index of attributes query for WriteBooster feature 2020-05-26 21:14:07 -04:00
ufs-sysfs.h
ufs.h scsi: ufs: Add SPDX GPL-2.0 to replace GPL v2 boilerplate 2020-06-15 23:21:04 -04:00
ufs_bsg.c scsi: ufs: Clean up ufs initialization path 2020-06-15 23:17:48 -04:00
ufs_bsg.h
ufs_quirks.h scsi: ufs: Clean up device vendor name and device quirk table 2020-06-15 23:32:02 -04:00
ufshcd-crypto.c scsi: ufs: Add program_key() variant op 2020-07-24 22:09:54 -04:00
ufshcd-crypto.h scsi: ufs: Add inline encryption support to UFS 2020-07-08 01:23:32 -04:00
ufshcd-dwc.c
ufshcd-dwc.h
ufshcd-pci.c scsi: ufs: Add SPDX GPL-2.0 to replace GPL v2 boilerplate 2020-06-15 23:21:04 -04:00
ufshcd-pltfrm.c scsi: ufs: Add SPDX GPL-2.0 to replace GPL v2 boilerplate 2020-06-15 23:21:04 -04:00
ufshcd-pltfrm.h
ufshcd.c scsi: ufs: Fix and simplify setup_xfer_req variant operation 2020-07-13 22:51:56 -04:00
ufshcd.h scsi: ufs: Add program_key() variant op 2020-07-24 22:09:54 -04:00
ufshci-dwc.h
ufshci.h scsi: ufs: UFS driver v2.1 spec crypto additions 2020-07-08 01:21:59 -04:00
unipro.h scsi: ufs: ufs-exynos: Add UFS host support for Exynos SoCs 2020-06-15 14:04:10 -04:00