From 4bb35a89f8fe277df99386910a1afecdce4c07a7 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Thu, 21 Oct 2021 11:49:31 -0700 Subject: [PATCH] Revert "ONHOLD: ANDROID: scsi: ufs: allow overriding the blk_keyslot_manager" This temporarily reverts ONHOLD-ANDROID-scsi-ufs-allow-overriding-the-blk_keyslot_manager.patch because it needs to be reworked due to upstream refactoring. Bug: 162257402 Change-Id: Ieef7e8388d0332f32b921cbce80f4001a9aa4148 Signed-off-by: Eric Biggers --- drivers/scsi/ufs/ufshcd-crypto.c | 12 ++++-------- drivers/scsi/ufs/ufshcd.h | 9 --------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd-crypto.c b/drivers/scsi/ufs/ufshcd-crypto.c index 468389a5780d..00f02f634a9e 100644 --- a/drivers/scsi/ufs/ufshcd-crypto.c +++ b/drivers/scsi/ufs/ufshcd-crypto.c @@ -120,8 +120,7 @@ bool ufshcd_crypto_enable(struct ufs_hba *hba) return false; /* Reset might clear all keys, so reprogram all the keys. */ - if (hba->ksm.num_slots) - blk_ksm_reprogram_all_keys(&hba->ksm); + blk_ksm_reprogram_all_keys(&hba->ksm); if (hba->quirks & UFSHCD_QUIRK_BROKEN_CRYPTO_ENABLE) return false; @@ -162,9 +161,6 @@ int ufshcd_hba_init_crypto_capabilities(struct ufs_hba *hba) int err = 0; enum blk_crypto_mode_num blk_mode_num; - if (hba->quirks & UFSHCD_QUIRK_CUSTOM_KEYSLOT_MANAGER) - return 0; - /* * Don't use crypto if either the hardware doesn't advertise the * standard crypto capability bit *or* if the vendor specific driver @@ -233,9 +229,9 @@ void ufshcd_init_crypto(struct ufs_hba *hba) if (!(hba->caps & UFSHCD_CAP_CRYPTO)) return; - /* Clear all keyslots */ - for (slot = 0; slot < hba->ksm.num_slots; slot++) - hba->ksm.ksm_ll_ops.keyslot_evict(&hba->ksm, NULL, slot); + /* Clear all keyslots - the number of keyslots is (CFGC + 1) */ + for (slot = 0; slot < hba->crypto_capabilities.config_count + 1; slot++) + ufshcd_clear_keyslot(hba, slot); } void ufshcd_crypto_setup_rq_keyslot_manager(struct ufs_hba *hba, diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index af0bb52d0044..a51f277e613d 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -589,15 +589,6 @@ enum ufshcd_quirks { */ UFSHCD_QUIRK_ALIGN_SG_WITH_PAGE_SIZE = 1 << 14, - /* - * This quirk needs to be enabled if the host controller supports inline - * encryption, but it needs to initialize the crypto capabilities in a - * nonstandard way and/or it needs to override blk_ksm_ll_ops. If - * enabled, the standard code won't initialize the blk_keyslot_manager; - * ufs_hba_variant_ops::init() must do it instead. - */ - UFSHCD_QUIRK_CUSTOM_KEYSLOT_MANAGER = 1 << 20, - /* * This quirk needs to be enabled if the host controller supports inline * encryption, but the CRYPTO_GENERAL_ENABLE bit is not implemented and