Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e82128eb authored by Eric Biggers's avatar Eric Biggers
Browse files

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: default avatarEric Biggers <ebiggers@google.com>
parent ddba2318
Loading
Loading
Loading
Loading
+12799 −12820

File changed.

Preview size limit exceeded, changes collapsed.

+8 −0
Original line number Diff line number Diff line
@@ -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)
+8 −0
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -2176,7 +2176,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);
}

/**
+1 −0
Original line number Diff line number Diff line
@@ -357,6 +357,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);