This driver's crypto algorithms still have a few issues that need addressing which don't currently trigger any self-test failures. For that reason: don't register the algorithms unless the user really wants it. Add a module parameter to the QCE driver that by default causes the driver to *not* register the crypto algorithms. It will only be one if the user explicitly passes the do_register_algos argument as true. The power-management part of the driver is kept as is to allow scaling down of interconnects gating of clocks by runtime PM. Cc: stable@vger.kernel.org Tested-by: Kuldeep Singh Tested-by: Pankaj Patil Tested-by: Birk Skyum # X1E80100, Lenovo Yoga Slim 7x Reviewed-by: Konrad Dybcio Signed-off-by: Bartosz Golaszewski --- drivers/crypto/qce/core.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c index a009c791417b707c5d4e98fc30111863dd8809fa..ddb4df3d227f801e566422491b488c5fcb777717 100644 --- a/drivers/crypto/qce/core.c +++ b/drivers/crypto/qce/core.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -22,6 +23,10 @@ #include "sha.h" #include "aead.h" +static bool do_register_algos; +module_param(do_register_algos, bool, 0444); +MODULE_PARM_DESC(do_register_algos, "Enable registering the crypto algorithms."); + #define QCE_QUEUE_LENGTH 1 #define QCE_DEFAULT_MEM_BANDWIDTH 393600 @@ -259,9 +264,11 @@ static int qce_crypto_probe(struct platform_device *pdev) qce->async_req_enqueue = qce_async_request_enqueue; qce->async_req_done = qce_async_request_done; - ret = devm_qce_register_algs(qce); - if (ret) - return ret; + if (do_register_algos) { + ret = devm_qce_register_algs(qce); + if (ret) + return ret; + } /* Configure autosuspend after successful init */ pm_runtime_set_autosuspend_delay(dev, 100); -- 2.47.3 The self-tests for this driver have been fixed. The crypto algorithms are only registered if the user explicitly requests it with the provided module parameter defaulting to false. There's no reason to further keep it unbuildable with the BROKEN label so revert commit df373d39c6f0 ("crypto: qce - Mark QCE as BROKEN"). While at it: update the Kconfig description by saying this is an "offloader" and not an "accelerator". Cc: stable@vger.kernel.org Fixes: df373d39c6f0 ("crypto: qce - Mark QCE as BROKEN") Tested-by: Kuldeep Singh Tested-by: Pankaj Patil Tested-by: Birk Skyum # X1E80100, Lenovo Yoga Slim 7x Reviewed-by: Konrad Dybcio Signed-off-by: Bartosz Golaszewski --- arch/arm/configs/multi_v7_defconfig | 1 + arch/arm64/configs/defconfig | 1 + drivers/crypto/Kconfig | 22 +++++++++++++--------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index 93144bc1474d9824e16a0801f7a1246746700227..fee64572027ece8a07524db7bcef5a4ccda71339 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig @@ -1305,6 +1305,7 @@ CONFIG_CRYPTO_DEV_ATMEL_AES=m CONFIG_CRYPTO_DEV_ATMEL_TDES=m CONFIG_CRYPTO_DEV_ATMEL_SHA=m CONFIG_CRYPTO_DEV_MARVELL_CESA=m +CONFIG_CRYPTO_DEV_QCE=m CONFIG_CRYPTO_DEV_ROCKCHIP=m CONFIG_CRYPTO_DEV_STM32_HASH=m CONFIG_CRYPTO_DEV_STM32_CRYP=m diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index 898f4f1d595203fa61b2a99473b6ea06ba7abe58..f9179bba64de773886d20cee388293cf9f538ab0 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig @@ -1800,6 +1800,7 @@ CONFIG_CRYPTO_AES_ARM64_CE_CCM=y CONFIG_CRYPTO_DEV_SUN8I_CE=m CONFIG_CRYPTO_DEV_FSL_CAAM=m CONFIG_CRYPTO_DEV_FSL_DPAA2_CAAM=m +CONFIG_CRYPTO_DEV_QCE=m CONFIG_CRYPTO_DEV_TEGRA=m CONFIG_CRYPTO_DEV_ZYNQMP_AES=m CONFIG_CRYPTO_DEV_ZYNQMP_SHA3=m diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index 0189dfdcbbe11098ead0ea194293422a31d8fe65..adcbe15851899917fb3039efe89a77c8fe712bf1 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig @@ -527,17 +527,21 @@ source "drivers/crypto/marvell/Kconfig" source "drivers/crypto/intel/Kconfig" config CRYPTO_DEV_QCE - tristate "Qualcomm crypto engine accelerator" - depends on (BROKEN && ARCH_QCOM) || COMPILE_TEST + tristate "Qualcomm crypto engine offloader" + depends on ARCH_QCOM || COMPILE_TEST depends on HAS_IOMEM help - This driver supports Qualcomm crypto engine accelerator - hardware. To compile this driver as a module, choose M here. The - module will be called qcrypto. - - This driver does not have exclusive access to the - hardware, causing races with the secure world. It - is also slower than the CPU. + This driver supports Qualcomm crypto engine offloader hardware. To + compile this driver as a module, choose M here. The module will be + called qcrypto. + + NOTE: With qcrypto.do_register_algos module parameter set to true, + this driver does not have exclusive access to the hardware, and may + cause races with the secure world. It is also *slower* than the + CPU for the same algorithms. By default it will not register crypto + algorithms and only scale down the interconnect bandwidth and disable + the relevant clocks. Use qcrypto.do_register_algos=1 at your own + risk! config CRYPTO_DEV_QCE_SKCIPHER bool -- 2.47.3