From 1e2b2709254932e0d4344815520cd44d9b0d28d8 Mon Sep 17 00:00:00 2001 From: Vaibhav Agrawal Date: Tue, 6 Jul 2021 17:31:06 +0530 Subject: [PATCH] mmc: host: Add recovery_finish crypto vops Define recovery_finish crypto vops to support MMC CQE recovery handler path. Test: Initiate CQE recovery, which calls into crypto specific recovery method. If the crypto vops are registered on the device, this flow does not lead to a null pointer dereference with this fix included. Change-Id: I6dfaf52a303b9ffa71b6b65779f8e657d6ca051a Signed-off-by: Vaibhav Agrawal --- drivers/mmc/host/cqhci-crypto-qti.c | 9 ++++++++- drivers/mmc/host/cqhci-crypto-qti.h | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/cqhci-crypto-qti.c b/drivers/mmc/host/cqhci-crypto-qti.c index 5c97d1a56603..37766d13854d 100644 --- a/drivers/mmc/host/cqhci-crypto-qti.c +++ b/drivers/mmc/host/cqhci-crypto-qti.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2020, Linux Foundation. All rights reserved. + * Copyright (c) 2020 - 2021, Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -29,6 +29,7 @@ static struct cqhci_host_crypto_variant_ops __maybe_unused cqhci_crypto_qti_vari .disable = cqhci_crypto_qti_disable, .resume = cqhci_crypto_qti_resume, .debug = cqhci_crypto_qti_debug, + .recovery_finish = cqhci_crypto_qti_recovery_finish, }; static bool ice_cap_idx_valid(struct cqhci_host *host, @@ -317,5 +318,11 @@ int cqhci_crypto_qti_resume(struct cqhci_host *host) return crypto_qti_resume(host->crypto_vops->priv); } +int cqhci_crypto_qti_recovery_finish(struct cqhci_host *host) +{ + keyslot_manager_reprogram_all_keys(host->mmc->ksm); + return 0; +} + MODULE_DESCRIPTION("Vendor specific CQHCI Crypto Engine Support"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/mmc/host/cqhci-crypto-qti.h b/drivers/mmc/host/cqhci-crypto-qti.h index 07300624b6a1..9675a147daa6 100644 --- a/drivers/mmc/host/cqhci-crypto-qti.h +++ b/drivers/mmc/host/cqhci-crypto-qti.h @@ -1,6 +1,6 @@ /* 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. */ #ifndef _UFSHCD_CRYPTO_QTI_H @@ -28,4 +28,6 @@ void cqhci_crypto_qti_set_vops(struct cqhci_host *host) int cqhci_crypto_qti_resume(struct cqhci_host *host); +int cqhci_crypto_qti_recovery_finish(struct cqhci_host *host); + #endif /* _UFSHCD_ICE_QTI_H */