ANDROID: scsi: ufs: add ->map_sg_crypto() variant op

Add a variant op ->map_sg_crypto() which runs at the end of
ufshcd_map_sg().

This is needed to support inline crypto on nonstandard hardware that
enables and configures crypto in the PRD entries
(struct ufshcd_sg_entry) instead of in the UTRD
(struct utp_transfer_req_desc) which the UFS standard specifies.

Bug: 129991660
Change-Id: I92bb52d0022d2e9de79a40d9888e84db4a8116b3
Signed-off-by: Eric Biggers <ebiggers@google.com>
This commit is contained in:
Eric Biggers
2020-03-19 14:45:18 -07:00
parent bb8c715f7f
commit 63bf2738ec
4 changed files with 18 additions and 1 deletions

View File

@@ -456,6 +456,14 @@ int ufshcd_prepare_lrbp_crypto(struct ufs_hba *hba,
return ufshcd_prepare_lrbp_crypto_spec(hba, cmd, lrbp);
}
int ufshcd_map_sg_crypto(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
{
if (hba->crypto_vops && hba->crypto_vops->map_sg_crypto)
return hba->crypto_vops->map_sg_crypto(hba, lrbp);
return 0;
}
int ufshcd_complete_lrbp_crypto(struct ufs_hba *hba,
struct scsi_cmnd *cmd,
struct ufshcd_lrb *lrbp)

View File

@@ -80,6 +80,8 @@ int ufshcd_prepare_lrbp_crypto(struct ufs_hba *hba,
struct scsi_cmnd *cmd,
struct ufshcd_lrb *lrbp);
int ufshcd_map_sg_crypto(struct ufs_hba *hba, struct ufshcd_lrb *lrbp);
int ufshcd_complete_lrbp_crypto(struct ufs_hba *hba,
struct scsi_cmnd *cmd,
struct ufshcd_lrb *lrbp);
@@ -133,6 +135,12 @@ static inline int ufshcd_prepare_lrbp_crypto(struct ufs_hba *hba,
return 0;
}
static inline int ufshcd_map_sg_crypto(struct ufs_hba *hba,
struct ufshcd_lrb *lrbp)
{
return 0;
}
static inline bool ufshcd_lrbp_crypto_enabled(struct ufshcd_lrb *lrbp)
{
return false;

View File

@@ -2018,7 +2018,7 @@ static int ufshcd_map_sg(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
lrbp->utr_descriptor_ptr->prd_table_length = 0;
}
return 0;
return ufshcd_map_sg_crypto(hba, lrbp);
}
/**

View File

@@ -354,6 +354,7 @@ struct ufs_hba_crypto_variant_ops {
int (*prepare_lrbp_crypto)(struct ufs_hba *hba,
struct scsi_cmnd *cmd,
struct ufshcd_lrb *lrbp);
int (*map_sg_crypto)(struct ufs_hba *hba, struct ufshcd_lrb *lrbp);
int (*complete_lrbp_crypto)(struct ufs_hba *hba,
struct scsi_cmnd *cmd,
struct ufshcd_lrb *lrbp);