From: Ten Gao <gaoyankaigeren@gmail.com>
To: Alim Akhtar <alim.akhtar@samsung.com>,
Avri Altman <avri.altman@wdc.com>,
Bart Van Assche <bvanassche@acm.org>,
"James E . J . Bottomley" <jejb@linux.ibm.com>,
Bean Huo <beanhuo@micron.com>,
Adrian Hunter <adrian.hunter@intel.com>
Cc: "Martin K . Petersen" <martin.petersen@oracle.com>,
Mike Snitzer <snitzer@redhat.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
Eric Biggers <ebiggers@google.com>,
Kiwoong Kim <kwmad.kim@samsung.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] ufs: core: remove encrypt when no data transfer
Date: Tue, 11 Oct 2022 15:21:26 +0800 [thread overview]
Message-ID: <20221011072126.30802-1-gaoyankaigeren@gmail.com> (raw)
From: Ten Gao <ten.gao@unisoc.com>
when there is no data transmission, ufs is unnecessary to encrypt.
We need to adjust scsi crypto relation.
Signed-off-by: Ten Gao <ten.gao@unisoc.com>
---
drivers/ufs/core/ufshcd-crypto.h | 10 ++++++----
include/ufs/ufshci.h | 2 ++
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/ufs/core/ufshcd-crypto.h b/drivers/ufs/core/ufshcd-crypto.h
index 504cc841540b..5bc2a0cbdfa6 100644
--- a/drivers/ufs/core/ufshcd-crypto.h
+++ b/drivers/ufs/core/ufshcd-crypto.h
@@ -30,10 +30,12 @@ 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);
+ if ((*dword_0 & UTRD_DIRECTION) != UTP_NO_DATA_TRANSFER) {
+ *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);
+ }
}
}
diff --git a/include/ufs/ufshci.h b/include/ufs/ufshci.h
index f525566a0864..7dbfeecaa36c 100644
--- a/include/ufs/ufshci.h
+++ b/include/ufs/ufshci.h
@@ -387,6 +387,8 @@ enum {
UTP_DEVICE_TO_HOST = 0x04000000,
};
+#define UTRD_DIRECTION 0x6000000
+
/* Overall command status values */
enum utp_ocs {
OCS_SUCCESS = 0x0,
--
2.17.1
next reply other threads:[~2022-10-11 7:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-11 7:21 Ten Gao [this message]
2022-10-11 16:57 ` Eric Biggers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221011072126.30802-1-gaoyankaigeren@gmail.com \
--to=gaoyankaigeren@gmail.com \
--cc=adrian.hunter@intel.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=ebiggers@google.com \
--cc=jejb@linux.ibm.com \
--cc=kwmad.kim@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=snitzer@redhat.com \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®