Inline Encryption Support for UFS
v4 cover Inline Encryption Support for UFS
This patch series adds support for inline encryption to UFS using the inline encryption support in the block layer. It follows the JEDEC UFSHCI v2.1 specification, which defines inline encryption for UFS.
This patch series previously went through a number of iterations as part of the "Inline Encryption Support" patchset (last version was v13:
https://lkml.kernel.org/r/[email protected]).
This patch series is rebased on v5.8-rc4.
Patch 1 introduces the crypto registers and struct definitions defined in the UFSHCI v2.1 spec.
Patch 2 introduces functions to manipulate the UFS inline encryption hardware (again in line with the UFSHCI v2.1 spec) via the block layer keyslot manager. Device specific drivers must set the UFSHCD_CAP_CRYPTO in hba->caps before ufshcd_hba_init_crypto is called to opt-in to inline encryption support.
Patch 3 wires up ufshcd.c with the UFS crypto API introduced in Patch 2.
This patch series has been tested on some Qualcomm chipsets (on the db845c, sm8150-mtp and sm8250-mtp) using some additional patches at
https://lkml.kernel.org/linux-scsi/[email protected]/
and on some Mediatek chipsets using the additional patch in
https://lkml.kernel.org/linux-scsi/[email protected]/.
These additional patches are required because these chipsets need certain additional behaviour not specified within the UFSHCI v2.1 spec.
Thanks a lot to all the folks who tested this out!
Changes v3 => v4:
- fix incorrect patch folding
- some cleanups from Eric
Changes v2 => v3:
- introduce ufshcd_prepare_req_desc_hdr_crypto to clean up code slightly
- split up ufshcd_hba_init_crypto into ufshcd_hba_init_crypto_capabilities and ufshcd_init_crypto. The first function is called from ufshcd_hba_capabilities, and only reads crypto capabilities from device registers and sets up appropriate crypto structures. The second function is called from ufshcd_init, and actually initializes the inline crypto hardware.
Changes v1 => v2
- handle OCS_DEVICE_FATAL_ERROR explicitly in ufshcd_transfer_rsp_status
Satya Tangirala (3):
scsi: ufs: UFS driver v2.1 spec crypto additions
scsi: ufs: UFS crypto API
scsi: ufs: Add inline encryption support to UFS
drivers/scsi/ufs/Kconfig | 9 ++ drivers/scsi/ufs/Makefile | 1 + drivers/scsi/ufs/ufshcd-crypto.c | 238 +++++++++++++++++++++++++++++++ drivers/scsi/ufs/ufshcd-crypto.h | 77 ++++++++++ drivers/scsi/ufs/ufshcd.c | 49 ++++++- drivers/scsi/ufs/ufshcd.h | 24 ++++ drivers/scsi/ufs/ufshci.h | 67 ++++++++- 7 files changed, 456 insertions(+), 9 deletions(-) create mode 100644 drivers/scsi/ufs/ufshcd-crypto.c create mode 100644 drivers/scsi/ufs/ufshcd-crypto.h
Signature · 1 line
2.27.0.212.ge8ba1cc988-goog
PATCH v4 1/3 scsi: ufs: UFS driver v2.1 spec crypto additions
Add the crypto registers and structs defined in v2.1 of the JEDEC UFSHCI specification in preparation to add support for inline encryption to UFS.
--- drivers/scsi/ufs/ufshcd.c | 3 ++ drivers/scsi/ufs/ufshcd.h | 6 ++++ drivers/scsi/ufs/ufshci.h | 67 +++++++++++++++++++++++++++++++++++++-- 3 files changed, 74 insertions(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd.c +3 -0
@@ -4792,6 +4792,9 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)case OCS_MISMATCH_RESP_UPIU_SIZE :case OCS_PEER_COMM_FAILURE :case OCS_FATAL_ERROR : +case OCS_DEVICE_FATAL_ERROR : +case OCS_INVALID_CRYPTO_CONFIG : +case OCS_GENERAL_CRYPTO_ERROR :default : result |=DID_ERROR <<16 ; dev_err(hba->dev,
drivers/scsi/ufs/ufshcd.h +6 -0
@@ -564,6 +564,12 @@ enum ufshcd_caps {* provisioned to be used. This would increase the write performance. */ UFSHCD_CAP_WB_EN =1 <<7 , + +/* +* This capability allows the host controller driver to use the +* inline crypto engine, if it is present +*/ + UFSHCD_CAP_CRYPTO = 1 << 8, }; struct ufs_hba_variant_params {
drivers/scsi/ufs/ufshci.h +65 -2
106 lines not on this page · raw message
Signature · 1 line
2.27.0.212.ge8ba1cc988-goog
PATCH v4 2/3 scsi: ufs: UFS crypto API
In reply to Satya TangiralaIntroduce functions to manipulate UFS inline encryption hardware in line with the JEDEC UFSHCI v2.1 specification and to work with the block keyslot manager.
The UFS crypto API will assume by default that a vendor driver doesn't support UFS crypto, even if the hardware advertises the capability, because a lot of hardware requires some special handling that's not specified in the aforementioned JEDEC spec. Each vendor driver must explicitly set hba->caps |= UFSHCD_CAP_CRYPTO before ufshcd_hba_init_crypto is called to opt-in to UFS crypto support.
--- drivers/scsi/ufs/Kconfig | 9 ++ drivers/scsi/ufs/Makefile | 1 + drivers/scsi/ufs/ufshcd-crypto.c | 238 +++++++++++++++++++++++++++++++ drivers/scsi/ufs/ufshcd-crypto.h | 46 ++++++ drivers/scsi/ufs/ufshcd.h | 12 ++ 5 files changed, 306 insertions(+) create mode 100644 drivers/scsi/ufs/ufshcd-crypto.c create mode 100644 drivers/scsi/ufs/ufshcd-crypto.h
drivers/scsi/ufs/Kconfig +9 -0
@@ -160,3 +160,12 @@ config SCSI_UFS_BSG Select this if you need a bsg device node for your UFS controller. If unsure, say N. + +config SCSI_UFS_CRYPTO + bool "UFS Crypto Engine Support" + depends on SCSI_UFSHCD && BLK_INLINE_ENCRYPTION + help + Enable Crypto Engine Support in UFS. + Enabling this makes it possible for the kernel to use the crypto + capabilities of the UFS device (if present) to perform crypto + operations on data being transferred to/from the device.
drivers/scsi/ufs/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-$(CONFIG_SCSI_UFS_QCOM) += ufs-qcom.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
drivers/scsi/ufs/ufshcd-crypto.c new file +238 -0
238 lines not on this page · raw message
drivers/scsi/ufs/ufshcd-crypto.h new file +46 -0
46 lines not on this page · raw message
drivers/scsi/ufs/ufshcd.h +12 -0
@@ -57,6 +57,7 @@#include <linux/regulator/consumer.h> #include <linux/bitfield.h> #include <linux/devfreq.h> +#include <linux/keyslot-manager.h> #include "unipro.h" #include <asm/irq.h>
@@ -630,6 +631,10 @@ struct ufs_hba_variant_params {* @is_urgent_bkops_lvl_checked: keeps track if the urgent bkops level for * device is known or not. * @scsi_block_reqs_cnt: reference counting for scsi block requests +* @crypto_capabilities: Content of crypto capabilities register (0x100) +* @crypto_cap_array: Array of crypto capabilities +* @crypto_cfg_register: Start of the crypto cfg array +* @ksm: the keyslot manager tied to this hba */ struct ufs_hba {void __iomem *mmio_base;
@@ -752,6 +757,13 @@ struct ufs_hba {bool wb_buf_flush_enabled;bool wb_enabled;struct delayed_work rpm_dev_flush_recheck_work; + +#ifdef CONFIG_SCSI_UFS_CRYPTO +union ufs_crypto_capabilities crypto_capabilities; +union ufs_crypto_cap_entry *crypto_cap_array; +u32 crypto_cfg_register; +struct blk_keyslot_manager ksm; +#endif };/* Returns true if clocks can be gated. Otherwise false */
Signature · 1 line
2.27.0.212.ge8ba1cc988-goog
RE: [PATCH v4 2/3] scsi: ufs: UFS crypto API
Quoted 4 lines
drivers/scsi/ufs/ufshcd-crypto.c new file +4
-0+ +static enum blk_crypto_mode_num +ufshcd_find_blk_crypto_mode (union ufs_crypto_cap_entry cap) +{
drivers/scsi/ufs/ufshcd-crypto.c line 137
Quoted 10 lines
drivers/scsi/ufs/ufshcd-crypto.c new file +10
-0+int i; + +for (i =0 ; i <ARRAY_SIZE (ufs_crypto_algs); i++) { +BUILD_BUG_ON (UFS_CRYPTO_KEY_SIZE_INVALID !=0 ); +if (ufs_crypto_algs[i].ufs_alg == cap.algorithm_id && + ufs_crypto_algs[i].ufs_key_size == cap.key_size) { +return i; + } + } +return BLK_ENCRYPTION_MODE_INVALID ;
BLK_ENCRYPTION_MODE_INVALID is 0, but 0 is a valid mode num?
Quoted 18 lines
drivers/scsi/ufs/ufshcd-crypto.c new file +18
-0+} + +/** +* ufshcd_hba_init_crypto_capabilities - Read crypto capabilities, init crypto +* fields in hba +* @hba: Per adapter instance +* +* Return: 0 if crypto was initialized or is not supported, else a -errno value. +*/ +int ufshcd_hba_init_crypto_capabilities (struct ufs_hba *hba) +{ +int cap_idx; +int err =0 ; +enum blk_crypto_mode_num blk_mode_num; + +/* +* Don't use crypto if either the hardware doesn't advertise the +* standard crypto capability bit *or* if the vendor specific driver
drivers/scsi/ufs/ufshcd-crypto.c line 165
Quoted 10 lines
drivers/scsi/ufs/ufshcd-crypto.c new file +10
-0+* hasn't advertised that crypto is supported. +*/ +if (!(hba->capabilities &MASK_CRYPTO_SUPPORT ) || + !(hba->caps &UFSHCD_CAP_CRYPTO )) + goto out; + + hba->crypto_capabilities.reg_val = +cpu_to_le32 (ufshcd_readl (hba,REG_UFS_CCAP )); + hba->crypto_cfg_register = + (u32 )hba->crypto_capabilities.config_array_ptr *0x100 ;
This deserve a comment, e.g.
UFSHCI says:
The address for entry x of the x-CRYPTOCFG array is calculated as follows:
ADDR (x-CRYPTOCFG) = UFS_HCI_BASE + CFGPTR*100h + x*80h
Re: [PATCH v4 2/3] scsi: ufs: UFS crypto API
Quoted 7 lines · Avri Altman
Quoted 7 lines
drivers/scsi/ufs/ufshcd-crypto.c new file +7
-0+ +static enum blk_crypto_mode_num +ufshcd_find_blk_crypto_mode (union ufs_crypto_cap_entry cap) +{ +int i; + +for (i =0 ; i <ARRAY_SIZE (ufs_crypto_algs); i++) {
Quoted 8 lines
drivers/scsi/ufs/ufshcd-crypto.c line 137
Quoted 7 lines
drivers/scsi/ufs/ufshcd-crypto.c new file +7
-0+BUILD_BUG_ON (UFS_CRYPTO_KEY_SIZE_INVALID !=0 ); +if (ufs_crypto_algs[i].ufs_alg == cap.algorithm_id && + ufs_crypto_algs[i].ufs_key_size == cap.key_size) { +return i; + } + } +return BLK_ENCRYPTION_MODE_INVALID ;
BLK_ENCRYPTION_MODE_INVALIDis 0, but 0 is a valid mode num?
ufs_crypto_algs[] does have to contain an entry for BLK_ENCRYPTION_MODE_INVALID, but it's an empty entry with ufs_key_size == UFS_CRYPTO_KEY_SIZE_INVALID (0). So it will never be selected and the code is correct.
We should probably start iterating at 1 to make this clearer, though note that the code still needs to handle empty entries anyway in case any gaps are ever introduced into the BLK_ENCRYPTION_MODE_* values.
- Eric
PATCH v4 3/3 scsi: ufs: Add inline encryption support to UFS
In reply to Satya TangiralaWire up ufshcd.c with the UFS Crypto API, the block layer inline encryption additions and the keyslot manager.
Many existing inline crypto devices require some additional behaviour not specified in the UFSHCI v2.1 specification - as such the vendor specific drivers will need to be updated where necessary to make it possible to use those devices. Some of these changes have already been proposed upstream, such as for the Qualcomm 845 SoC at
https://lkml.kernel.org/linux-scsi/[email protected]/
and for ufs-mediatek at
https://lkml.kernel.org/linux-scsi/[email protected]/
This patch has been tested on the db845c, sm8150-mtp and sm8250-mtp (which have Qualcomm chipsets) and on some mediatek chipsets using these aforementioned vendor specific driver updates.
--- drivers/scsi/ufs/ufshcd-crypto.h | 31 +++++++++++++++++++++ drivers/scsi/ufs/ufshcd.c | 46 +++++++++++++++++++++++++++----- drivers/scsi/ufs/ufshcd.h | 6 +++++ 3 files changed, 76 insertions(+), 7 deletions(-)
drivers/scsi/ufs/ufshcd-crypto.h +31 -0
@@ -10,6 +10,30 @@#include "ufshcd.h" #include "ufshci.h" +static inline void ufshcd_prepare_lrbp_crypto (struct request *rq, +struct ufshcd_lrb *lrbp) +{ +if (!rq || !rq->crypt_keyslot) { + lrbp->crypto_key_slot =-1 ; +return ; + } + + lrbp->crypto_key_slot =blk_ksm_get_slot_idx (rq->crypt_keyslot); + lrbp->data_unit_num = rq->crypt_ctx->bc_dun[0 ]; +} + +static inline void +ufshcd_prepare_req_desc_hdr_crypto (struct ufshcd_lrb *lrbp,u32 *dword_0, +u32 *dword_1,u32 *dword_3) +{ +if (lrbp->crypto_key_slot >=0 ) { + *dword_0 |=UTP_REQ_DESC_CRYPTO_ENABLE_CMD ; + *dword_0 |= lrbp->crypto_key_slot; + *dword_1 =lower_32_bits (lrbp->data_unit_num); + *dword_3 =upper_32_bits (lrbp->data_unit_num); + } +} +bool ufshcd_crypto_enable (struct ufs_hba *hba);int ufshcd_hba_init_crypto_capabilities (struct ufs_hba *hba);
@@ -23,6 +47,13 @@ void ufshcd_crypto_destroy_keyslot_manager(struct ufs_hba *hba);#else /* CONFIG_SCSI_UFS_CRYPTO */ +static inline void ufshcd_prepare_lrbp_crypto (struct request *rq, +struct ufshcd_lrb *lrbp) { } + +static inline void +ufshcd_prepare_req_desc_hdr_crypto (struct ufshcd_lrb *lrbp,u32 *dword_0, +u32 *dword_1,u32 *dword_3) { } +static inline bool ufshcd_crypto_enable (struct ufs_hba *hba) {return false;
drivers/scsi/ufs/ufshcd.c +39 -7
134 lines not on this page · raw message
drivers/scsi/ufs/ufshcd.h +6 -0
@@ -184,6 +184,8 @@ struct ufs_pm_lvl_states {* @intr_cmd: Interrupt command (doesn't participate in interrupt aggregation) * @issue_time_stamp: time stamp for debug purposes * @compl_time_stamp: time stamp for statistics +* @crypto_key_slot: the key slot to use for inline crypto (-1 if none) +* @data_unit_num: the data unit number for the first block for inline crypto * @req_abort_skip: skip request abort task flag */ struct ufshcd_lrb {
@@ -208,6 +210,10 @@ struct ufshcd_lrb {bool intr_cmd;ktime_t issue_time_stamp;ktime_t compl_time_stamp; +#ifdef CONFIG_SCSI_UFS_CRYPTO +int crypto_key_slot; +u64 data_unit_num; +#endif bool req_abort_skip; };
Signature · 1 line
2.27.0.212.ge8ba1cc988-goog
Quoted 9 lines · Satya Tangirala
This patch series adds support for inline encryption to UFS using the inline encryption support in the block layer. It follows the JEDEC UFSHCI v2.1 specification, which defines inline encryption for UFS.
This patch series previously went through a number of iterations as part of the "Inline Encryption Support" patchset (last version was v13:
https://lkml.kernel.org/r/[email protected]).
This patch series is rebased on v5.8-rc4.
Quoted 8 lines
Patch 1 introduces the crypto registers and struct definitions defined in the UFSHCI v2.1 spec.
Patch 2 introduces functions to manipulate the UFS inline encryption hardware (again in line with the UFSHCI v2.1 spec) via the block layer keyslot manager. Device specific drivers must set the
UFSHCD_CAP_CRYPTOinhba->capsbeforeufshcd_hba_init_cryptois called to opt-in to inline encryption support.
Note that it's now ufshcd_hba_init_crypto_capabilities(), not ufshcd_hba_init_crypto().
Quoted 26 lines
Patch 3 wires up
ufshcd.cwith the UFS crypto API introduced in Patch 2.This patch series has been tested on some Qualcomm chipsets (on the db845c, sm8150-mtp and sm8250-mtp) using some additional patches at
https://lkml.kernel.org/linux-scsi/[email protected]/
and on some Mediatek chipsets using the additional patch in
https://lkml.kernel.org/linux-scsi/[email protected]/.
These additional patches are required because these chipsets need certain additional behaviour not specified within the UFSHCI v2.1 spec.Thanks a lot to all the folks who tested this out!
Changes v3 => v4:
- fix incorrect patch folding
- some cleanups from EricChanges v2 => v3:
- introduceufshcd_prepare_req_desc_hdr_cryptoto clean up code slightly
- split upufshcd_hba_init_cryptointoufshcd_hba_init_crypto_capabilitiesandufshcd_init_crypto. The first function is called fromufshcd_hba_capabilities, and only reads crypto capabilities from device registers and sets up appropriate crypto structures. The second function is called fromufshcd_init, and actually initializes the inline crypto hardware.
Quoted 7 lines
Changes v1 => v2
- handleOCS_DEVICE_FATAL_ERRORexplicitly inufshcd_transfer_rsp_statusSatya Tangirala (3):
scsi: ufs: UFS driver v2.1 spec crypto additions
scsi: ufs: UFS crypto API
scsi: ufs: Add inline encryption support to UFS
These patches look good to me. Avri and Alim, what do you think? We'd like these to be applied for 5.9.
- Eric
Quoted 54 lines · Satya Tangirala
Quoted 9 lines
This patch series adds support for inline encryption to UFS using the inline encryption support in the block layer. It follows the JEDEC UFSHCI v2.1 specification, which defines inline encryption for UFS.
This patch series previously went through a number of iterations as part of the "Inline Encryption Support" patchset (last version was v13:
https://lkml.kernel.org/r/[email protected]).
This patch series is rebased on v5.8-rc4.Quoted 8 lines
Patch 1 introduces the crypto registers and struct definitions defined in the UFSHCI v2.1 spec.
Patch 2 introduces functions to manipulate the UFS inline encryption hardware (again in line with the UFSHCI v2.1 spec) via the block layer keyslot manager. Device specific drivers must set the
UFSHCD_CAP_CRYPTOinhba->capsbeforeufshcd_hba_init_cryptois called to opt-in to inline encryption support.Note that it's now
ufshcd_hba_init_crypto_capabilities(), notufshcd_hba_init_crypto().Quoted 6 lines
Patch 3 wires up
ufshcd.cwith the UFS crypto API introduced in Patch 2.This patch series has been tested on some Qualcomm chipsets (on the db845c, sm8150-mtp and sm8250-mtp) using some additional patches at
https://lkml.kernel.org/linux-scsi/20200501045111.665881-1-Quoted 2 lines
and on some Mediatek chipsets using the additional patch in
https://lkml.kernel.org/linux-scsi/20200304022101.14165-1-Quoted 21 lines
These additional patches are required because these chipsets need certain additional behaviour not specified within the UFSHCI v2.1 spec.
Thanks a lot to all the folks who tested this out!
Changes v3 => v4:
- fix incorrect patch folding
- some cleanups from EricChanges v2 => v3:
- introduceufshcd_prepare_req_desc_hdr_cryptoto clean up code slightly
- split upufshcd_hba_init_cryptointoufshcd_hba_init_crypto_capabilitiesandufshcd_init_crypto. The first function is called fromufshcd_hba_capabilities, and only reads crypto capabilities from device registers and sets up appropriate crypto structures. The second function is called fromufshcd_init, and actually initializes the inline crypto hardware.Changes v1 => v2
- handleOCS_DEVICE_FATAL_ERRORexplicitly inufshcd_transfer_rsp_status
Quoted 7 lines
Quoted 4 lines
Satya Tangirala (3):
scsi: ufs: UFS driver v2.1 spec crypto additions
scsi: ufs: UFS crypto API
scsi: ufs: Add inline encryption support to UFSThese patches look good to me. Avri and Alim, what do you think? We'd like these to be applied for 5.9.
Yes. It looks good to me too.
I've added 2 nits to your 2nd patch - please feel free to ignore them.
Thanks,
Avri
Quoted 2 lines
- Eric
Hi Satya,
Quoted 70 lines
-----Original Message-----
From: Satya Tangirala <[email protected]>
Sent: 07 July 2020 01:34
To: [email protected]; Avri Altman <[email protected]>; Alim Akhtar <[email protected]>
Cc: Barani Muthukumaran <[email protected]>; Kuohong Wang <[email protected]>; Kim Boojin <[email protected]>; Satya Tangirala <[email protected]>
Subject: [PATCH v4 0/3] Inline Encryption Support for UFSThis patch series adds support for inline encryption to UFS using the inline encryption support in the block layer. It follows the JEDEC UFSHCI v2.1 specification, which defines inline encryption for UFS.
This patch series previously went through a number of iterations as part of the "Inline Encryption Support" patchset (last version was v13:
https://lkml.kernel.org/r/[email protected]).
This patch series is rebased on v5.8-rc4.Patch 1 introduces the crypto registers and struct definitions defined in the UFSHCI v2.1 spec.
Patch 2 introduces functions to manipulate the UFS inline encryption hardware (again in line with the UFSHCI v2.1 spec) via the block layer keyslot manager. Device specific drivers must set the
UFSHCD_CAP_CRYPTOinhba->capsbeforeufshcd_hba_init_cryptois called to opt-in to inline encryption support.Patch 3 wires up
ufshcd.cwith the UFS crypto API introduced in Patch 2.This patch series has been tested on some Qualcomm chipsets (on the db845c, sm8150-mtp and sm8250-mtp) using some additional patches at
https://lkml.kernel.org/linux-scsi/20200501045111.665881-1-
[email protected]/
and on some Mediatek chipsets using the additional patch in
https://lkml.kernel.org/linux-scsi/20200304022101.14165-1-
[email protected]/.
These additional patches are required because these chipsets need certain additional behaviour not specified within the UFSHCI v2.1 spec.Thanks a lot to all the folks who tested this out!
Changes v3 => v4:
- fix incorrect patch folding
- some cleanups from EricChanges v2 => v3:
- introduceufshcd_prepare_req_desc_hdr_cryptoto clean up code slightly
- split upufshcd_hba_init_cryptointoufshcd_hba_init_crypto_capabilitiesandufshcd_init_crypto. The first function is called fromufshcd_hba_capabilities, and only reads crypto capabilities from device registers and sets up appropriate crypto structures. The second function is called fromufshcd_init, and actually initializes the inline crypto hardware.Changes v1 => v2
- handleOCS_DEVICE_FATAL_ERRORexplicitly inufshcd_transfer_rsp_statusSatya Tangirala (3):
scsi: ufs: UFS driver v2.1 spec crypto additions
scsi: ufs: UFS crypto API
scsi: ufs: Add inline encryption support to UFSdrivers/scsi/ufs/Kconfig | 9 ++ drivers/scsi/ufs/Makefile | 1 + drivers/scsi/ufs/ufshcd-crypto.c | 238 +++++++++++++++++++++++++++++++ drivers/scsi/ufs/ufshcd-crypto.h | 77 ++++++++++ drivers/scsi/ufs/ufshcd.c | 49 ++++++- drivers/scsi/ufs/ufshcd.h | 24 ++++ drivers/scsi/ufs/ufshci.h | 67 ++++++++- 7 files changed, 456 insertions(+), 9 deletions(-) create mode 100644
Quoted 3 lines
drivers/scsi/ufs/ufshcd-crypto.ccreate mode 100644drivers/scsi/ufs/ufshcd-crypto.h
Looks Good to me.
I don’t have a platform to test this series though. It will be good to get a Tested-by tags for this series.
Quoted 2 lines
--
2.27.0.212.ge8ba1cc988-goog
Eric Biggers
Tested-byQuoted 75 lines · Alim Akhtar
Hi Satya,
Quoted 70 lines
-----Original Message-----
From: Satya Tangirala <[email protected]>
Sent: 07 July 2020 01:34
To: [email protected]; Avri Altman <[email protected]>; Alim Akhtar <[email protected]>
Cc: Barani Muthukumaran <[email protected]>; Kuohong Wang <[email protected]>; Kim Boojin <[email protected]>; Satya Tangirala <[email protected]>
Subject: [PATCH v4 0/3] Inline Encryption Support for UFSThis patch series adds support for inline encryption to UFS using the inline encryption support in the block layer. It follows the JEDEC UFSHCI v2.1 specification, which defines inline encryption for UFS.
This patch series previously went through a number of iterations as part of the "Inline Encryption Support" patchset (last version was v13:
https://lkml.kernel.org/r/[email protected]).
This patch series is rebased on v5.8-rc4.Patch 1 introduces the crypto registers and struct definitions defined in the UFSHCI v2.1 spec.
Patch 2 introduces functions to manipulate the UFS inline encryption hardware (again in line with the UFSHCI v2.1 spec) via the block layer keyslot manager. Device specific drivers must set the
UFSHCD_CAP_CRYPTOinhba->capsbeforeufshcd_hba_init_cryptois called to opt-in to inline encryption support.Patch 3 wires up
ufshcd.cwith the UFS crypto API introduced in Patch 2.This patch series has been tested on some Qualcomm chipsets (on the db845c, sm8150-mtp and sm8250-mtp) using some additional patches at
https://lkml.kernel.org/linux-scsi/20200501045111.665881-1-
[email protected]/
and on some Mediatek chipsets using the additional patch in
https://lkml.kernel.org/linux-scsi/20200304022101.14165-1-
[email protected]/.
These additional patches are required because these chipsets need certain additional behaviour not specified within the UFSHCI v2.1 spec.Thanks a lot to all the folks who tested this out!
Changes v3 => v4:
- fix incorrect patch folding
- some cleanups from EricChanges v2 => v3:
- introduceufshcd_prepare_req_desc_hdr_cryptoto clean up code slightly
- split upufshcd_hba_init_cryptointoufshcd_hba_init_crypto_capabilitiesandufshcd_init_crypto. The first function is called fromufshcd_hba_capabilities, and only reads crypto capabilities from device registers and sets up appropriate crypto structures. The second function is called fromufshcd_init, and actually initializes the inline crypto hardware.Changes v1 => v2
- handleOCS_DEVICE_FATAL_ERRORexplicitly inufshcd_transfer_rsp_statusSatya Tangirala (3):
scsi: ufs: UFS driver v2.1 spec crypto additions
scsi: ufs: UFS crypto API
scsi: ufs: Add inline encryption support to UFSdrivers/scsi/ufs/Kconfig | 9 ++ drivers/scsi/ufs/Makefile | 1 + drivers/scsi/ufs/ufshcd-crypto.c | 238 +++++++++++++++++++++++++++++++ drivers/scsi/ufs/ufshcd-crypto.h | 77 ++++++++++ drivers/scsi/ufs/ufshcd.c | 49 ++++++- drivers/scsi/ufs/ufshcd.h | 24 ++++ drivers/scsi/ufs/ufshci.h | 67 ++++++++- 7 files changed, 456 insertions(+), 9 deletions(-) create mode 100644Quoted 3 lines
drivers/scsi/ufs/ufshcd-crypto.ccreate mode 100644drivers/scsi/ufs/ufshcd-crypto.h
Quoted 6 lines
Looks Good to me.
I don’t have a platform to test this series though. It will be good to get a Tested-by tags for this series.Reviewed-by Alim Akhtar <[email protected]>
There's information about testing in the cover letter and commit messages already. But feel free to also add my Tested-by to all three patches:
- Eric
Martin K. Petersen
AppliedQuoted 10 lines · Satya Tangirala
This patch series adds support for inline encryption to UFS using the inline encryption support in the block layer. It follows the JEDEC UFSHCI v2.1 specification, which defines inline encryption for UFS.
This patch series previously went through a number of iterations as part of the "Inline Encryption Support" patchset (last version was v13:
https://lkml.kernel.org/r/[email protected]).
This patch series is rebased on v5.8-rc4.[...]
Applied to 5.9/scsi-queue, thanks!
[1/3] scsi: ufs: UFS driver v2.1 spec crypto additions
https://git.kernel.org/mkp/scsi/c/5e7341e1f9ec [2/3] scsi: ufs: UFS crypto API https://git.kernel.org/mkp/scsi/c/70297a8ac7a7 [3/3] scsi: ufs: Add inline encryption support to UFS https://git.kernel.org/mkp/scsi/c/df043c745ea1
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering