Introduce 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_capabilities() is called to opt-in to UFS crypto support. Link: https://lore.kernel.org/r/20200706200414.2027450-3-satyat@google.com Reviewed-by: Eric Biggers <ebiggers@google.com> Reviewed-by: Stanley Chu <stanley.chu@mediatek.com> Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Satya Tangirala <satyat@google.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
47 lines
1.0 KiB
C
47 lines
1.0 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright 2019 Google LLC
|
|
*/
|
|
|
|
#ifndef _UFSHCD_CRYPTO_H
|
|
#define _UFSHCD_CRYPTO_H
|
|
|
|
#ifdef CONFIG_SCSI_UFS_CRYPTO
|
|
#include "ufshcd.h"
|
|
#include "ufshci.h"
|
|
|
|
bool ufshcd_crypto_enable(struct ufs_hba *hba);
|
|
|
|
int ufshcd_hba_init_crypto_capabilities(struct ufs_hba *hba);
|
|
|
|
void ufshcd_init_crypto(struct ufs_hba *hba);
|
|
|
|
void ufshcd_crypto_setup_rq_keyslot_manager(struct ufs_hba *hba,
|
|
struct request_queue *q);
|
|
|
|
void ufshcd_crypto_destroy_keyslot_manager(struct ufs_hba *hba);
|
|
|
|
#else /* CONFIG_SCSI_UFS_CRYPTO */
|
|
|
|
static inline bool ufshcd_crypto_enable(struct ufs_hba *hba)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
static inline int ufshcd_hba_init_crypto_capabilities(struct ufs_hba *hba)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline void ufshcd_init_crypto(struct ufs_hba *hba) { }
|
|
|
|
static inline void ufshcd_crypto_setup_rq_keyslot_manager(struct ufs_hba *hba,
|
|
struct request_queue *q) { }
|
|
|
|
static inline void ufshcd_crypto_destroy_keyslot_manager(struct ufs_hba *hba)
|
|
{ }
|
|
|
|
#endif /* CONFIG_SCSI_UFS_CRYPTO */
|
|
|
|
#endif /* _UFSHCD_CRYPTO_H */
|