MLK-23774 crypto: caam - fix SNVS / SECVIO building as module

Configuring both caam/jr and snvs/secvio drivers as modules:
CONFIG_CRYPTO_DEV_FSL_CAAM_JR=m
CONFIG_CRYPTO_DEV_FSL_CAAM_SECVIO=m

fails with:

drivers/crypto/caam/secvio.o: In function `snvs_secvio_driver_init':
drivers/crypto/caam/secvio.c:339: multiple definition of `init_module'
drivers/crypto/caam/jr.o:drivers/crypto/caam/jr.c:854: first defined here
drivers/crypto/caam/secvio.o: In function `snvs_secvio_install_handler':
drivers/crypto/caam/secvio.c:137: multiple definition of `cleanup_module'
drivers/crypto/caam/jr.o:drivers/crypto/caam/jr.c:71: first defined here
scripts/Makefile.build:439: recipe for target 'drivers/crypto/caam/caam_jr.o' failed
make[3]: *** [drivers/crypto/caam/caam_jr.o] Error 1

This is due to trying to link two platform drivers in the same
"composite" object.

Since in fact snvs/secvio driver does not depend on caam/jr
(and should not depend on the other caam drivers in general [*]),
and to keep the fix small [**], avoid linking snvs/secvio with caam/jr.

[*] Currently the only dependency is related to I/O accessors (regs.h)
and endianness detection (ctrl.c).
>From this perspective, it's important for caam controller driver
(ctrl.c) to probe before snvs/secvio driver.

[**] The proper solution would be splitting snvs/secvio from caam
(drivers, DT bindings etc.), since snvs is just a "companion module"
of caam.

Fixes: f8a36c315649 ("MLKU-38-3 crypto: caam - add SNVS / SECVIO support")
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Reviewed-by: Li Yang <leoyang.li@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
This commit is contained in:
Horia Geantă 2020-05-18 12:46:36 +03:00 committed by Xiaobo Xie
parent 8c7539df99
commit ab44d61204
2 changed files with 9 additions and 8 deletions

View File

@ -8,6 +8,14 @@ config CRYPTO_DEV_FSL_CAAM_CRYPTO_API_DESC
config CRYPTO_DEV_FSL_CAAM_AHASH_API_DESC config CRYPTO_DEV_FSL_CAAM_AHASH_API_DESC
tristate tristate
config CRYPTO_DEV_FSL_CAAM_SECVIO
tristate "CAAM/SNVS Security Violation Handler (EXPERIMENTAL)"
depends on ARCH_MXC
help
Enables installation of an interrupt handler with registrable
handler functions which can be specified to act on the consequences
of a security violation.
config CRYPTO_DEV_FSL_CAAM config CRYPTO_DEV_FSL_CAAM
tristate "Freescale CAAM-Multicore platform driver backend" tristate "Freescale CAAM-Multicore platform driver backend"
depends on FSL_SOC || ARCH_MXC || ARCH_LAYERSCAPE depends on FSL_SOC || ARCH_MXC || ARCH_LAYERSCAPE
@ -196,13 +204,6 @@ config CRYPTO_DEV_FSL_CAAM_SM_TEST
stored and recovered secrets can be used for general purpose stored and recovered secrets can be used for general purpose
encryption/decryption. encryption/decryption.
config CRYPTO_DEV_FSL_CAAM_SECVIO
tristate "CAAM/SNVS Security Violation Handler (EXPERIMENTAL)"
help
Enables installation of an interrupt handler with registrable
handler functions which can be specified to act on the consequences
of a security violation.
config CRYPTO_DEV_FSL_CAAM_JR_UIO config CRYPTO_DEV_FSL_CAAM_JR_UIO
tristate "Freescale Job Ring UIO support" tristate "Freescale Job Ring UIO support"
depends on UIO depends on UIO

View File

@ -25,7 +25,7 @@ caam_jr-$(CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API) += caamrng.o
caam_jr-$(CONFIG_CRYPTO_DEV_FSL_CAAM_PKC_API) += caampkc.o pkc_desc.o caam_jr-$(CONFIG_CRYPTO_DEV_FSL_CAAM_PKC_API) += caampkc.o pkc_desc.o
caam_jr-$(CONFIG_CRYPTO_DEV_FSL_CAAM_SM) += sm_store.o caam_jr-$(CONFIG_CRYPTO_DEV_FSL_CAAM_SM) += sm_store.o
obj-$(CONFIG_CRYPTO_DEV_FSL_CAAM_SM_TEST) += sm_test.o obj-$(CONFIG_CRYPTO_DEV_FSL_CAAM_SM_TEST) += sm_test.o
caam_jr-$(CONFIG_CRYPTO_DEV_FSL_CAAM_SECVIO) += secvio.o obj-$(CONFIG_CRYPTO_DEV_FSL_CAAM_SECVIO) += secvio.o
#caam-jr-$(CONFIG_CRYPTO_DEV_FSL_CAAM_TK_API) += tag_object.o #caam-jr-$(CONFIG_CRYPTO_DEV_FSL_CAAM_TK_API) += tag_object.o
caam-$(CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API_QI) += qi.o caam-$(CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API_QI) += qi.o