From 5192a8a20d7e9c7a09acb6f65a6aaa69a48b3560 Mon Sep 17 00:00:00 2001 From: Vaibhav Agrawal Date: Wed, 7 Jul 2021 19:12:17 +0530 Subject: [PATCH] mmc: host: Reprogram keys after enabling cqhci crypto Call cqhci_crypto_recovery_finish() method during cqhci enable in order to reprogram all keys into ice. This is needed to cover the case of mmc reset followed by cqhci recovery, which leads to all keys being cleared. This causes an invalid crypto config error during read/write of data after recovery is done. Test: Verfied by storage team as part of mmc reset and cqhci recovery testing. Change-Id: I8deaf52158af223ec9b9a0a1069340467c7dc48a Signed-off-by: Vaibhav Agrawal --- drivers/mmc/host/cqhci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/cqhci.c b/drivers/mmc/host/cqhci.c index c239ffa7629d..c8a856ebe410 100644 --- a/drivers/mmc/host/cqhci.c +++ b/drivers/mmc/host/cqhci.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only -/* Copyright (c) 2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. */ #include @@ -361,8 +361,10 @@ static int cqhci_enable(struct mmc_host *mmc, struct mmc_card *card) return err; } - if (cqhci_host_is_crypto_supported(cq_host)) + if (cqhci_host_is_crypto_supported(cq_host)) { cqhci_crypto_enable(cq_host); + cqhci_crypto_recovery_finish(cq_host); + } __cqhci_enable(cq_host); @@ -1168,7 +1170,6 @@ static void cqhci_recovery_finish(struct mmc_host *mmc) cqhci_set_irqs(cq_host, CQHCI_IS_MASK); - cqhci_crypto_recovery_finish(cq_host); pr_debug("%s: cqhci: recovery done\n", mmc_hostname(mmc)); mmc_log_string(mmc, "recovery done\n"); }