mmc: sdhci-msm-ice: Add Inline Crypto Engine (ICE) support
eMMC controller may have an Inline Crypto Engine (ICE) attached, which can be used to encrypt/decrypt data going to/from eMMC. This patch adds a new client driver sdhci-msm-ice.c which interacts with ICE driver present in (drivers/crypto/msm/) and thus provides an interface to the low-level SDHCI driver to do the data encryption/decryption. mmc: sdhci-msm: Add Inline Crypto Engine (ICE) support Add ICE support to low-level driver sdhci-msm.c. This code is primarily responsible for enabling ICE (if present), managing ICE clocks, managing ICE suspend/resume and also provides a few host->ops for sdhci driver to use ICE functionality. mmc: sdhci: Add Inline Crypto Engine (ICE) support This patch adds ICE support to sdhci driver. It uses the new ICE host->ops like config/reset to configure/reset the ICE HW as appropriate. mmc: cqhci: Add Inline Crypto Engine (ICE) support Add changes to configure ICE for data encryption/decryption using CQE. mmc: cqe: add new crypto_cfg_reset host operation When encryption/decryption is enabled in CQ mode, the legacy commands that are sent in HALT state will use different slot other than slot 0 for crypto configuration information. The slot that is selected depends on the last slot that was used when it is in CQ mode. This is causing the data of legacy commands to be encrypted/decrypted based on the wrong slot usage for crypto config details. Hence, clear the crypto configuration of the slot used in CQ mode whenever it gets completed. mmc: sdhci-msm-ice: Add crypto register dump for debug upon error Dump crypto related register information upon error for debugging purpose. crypto: ice: Make ICE init & reset API synchronous ICE init & reset can be synchronous now because ICE does not need to go to secure side for any ICE configuration. This would simplify interface and make call more efficient. crypto: ice: general driver clean-up * Removed spinlock as it was not locking against anything * Removed conversion of interrupt status to error number as it is not used by API client, and in case several bits are set only 1 error is ever handled and the rest get lost. Instead pass to the client the complete status. * Removed redundant includes, variables * vops structure is returned after performing a lookup in the DTS. There's no need for that as we already know the structure to return. * Other minor corrections mmc: sdhci-msm-ice: Update ice config vop to config_start The config vop of the ice driver has been updated to config_start. Updated the sdhci-ice driver to reflect this change. mmc: sdhci-msm-ice: Enable ICE HCI if supported Check if the SDHC has ICE HCI support. If support is present, enable the cryptoghrapic support inside SDHC. Also ensure that it is re-enabled after SDHC is reset. By default ICE HCI is disabled. mmc: sdhci-msm: Update ICE reset register offset for ICE HCI SDHC v5.0 onwards the ICE reset register offset got updated. Update the register offset based on the SDHC version. mmc: sdhci-msm-ice: Factor out update config from sdhci_msm_ice_cfg Factor out the logic of updating the SDHC ICE config registers from sdhci_msm_ice_cfg(). For ICE3.0, different set of SDHC ICE registers are need to be updated. So having this logic in separate functions, we can have logical separation for ICE2.0 and ICE3.0. mmc: sdhci-mmc-ice: Factor out ice_cfg_start from sdhci_msm_ice_cfg Factor out the logic of getting ice config parameters from sdhci_msm_ice_cfg(). With ICE2.0, same sdhci_msm_ice_cfg function is being called from cmdq and noncq. But with ICE3.0 support, cmdq needs a separate host op. Since this logic of getting ice config is common for noncq and cmdq, by having it in separate function, same can be reused in cmdq host op as-well. mmc: sdhci-msm-ice: Add new sdhci host_op for updating ice config Add new sdhci host_op for updating ice configuration while sending request through cmdq. Adding provision for supporting the ice context configuration for ICE HCI. mmc: cmdq_hci: ice: Changes for supporting ICE HCI in CMDQ mode On SDHC v5.0 onwards, SDHC includes the inline interface for cryptographic operations which is ICE HCI. This patch includes the driver changes for supporting crypto operations with ICE HCI in cmdq mode. Adding support for clearing ice configuration. Once mmc request processing is completed, mmc driver has to call config_end to ensure key information is cleared by ICE driver. This call is optional for FDE but required for FBE. mmc: sdhci-msm-ice: Changes for supporting ICE HCI in non CMDQ mode SDHC v5.0 onwards, SDHC includes the inline interface for cryptographic operations which is ICE HCI. This patch includes the driver changes for supporting crypto operations with ICE HCI in noncq mode. mmc: host: sdhci: Add new host_op for clearing ice configuration Add new host op for clearing ice configuration. This config_end host op need to invoked for clearing ice configuration, once mmc request processing is completed. mmc: sdhci-msm-ice: add support for FBE over F2FS Add support for FBE to work with F2FS filesystem on eMMC based devices. For F2FS+FBE on eMMC, the cryto data unit size (CDU size) should be 4KB as F2FS encrypts/decrypts the data at min. 4KB blocks with (inode|pgidx) as it's corresponding data unit number (DUN). mmc: card: Set INLINECRYPT queue flag based on host capability Set INLINECRYPT queue flag if the host can support h/w based inline encryption. This is needed to let the filesystem know that underlying storage device can support inline encryption so that data encryption/ decryption would be handled at h/w level, not at filesystem. Set inline-crypto support host flag if sdhc controller is capable do performing inline encryption/decryption. mmc: sdhci-msm: get the load notification from clock scaling This is needed to scale up/down the ICE clock during runtime as per the load on eMMC. mmc: block: add req pointer to mmc request This is needed by ICE (Inline Crypto Engine) driver to get the ICE configuration data from the request. Change-Id: Ie69c64f4dc0c31290dec50d905e8b3d436c86d62 Signed-off-by:Veerabhadrarao Badiganti <vbadigan@codeaurora.org> Signed-off-by:
Sahitya Tummala <stummala@codeaurora.org> Signed-off-by:
Venkat Gopalakrishnan <venkatg@codeaurora.org> Signed-off-by:
Ram Prakash Gupta <rampraka@codeaurora.org>
Loading
Please register or sign in to comment