crypto: octeontx2 - Fix objects shared between several modules
cn10k_cpt.o, otx2_cptlf.o and otx2_cpt_mbox_common.o are linked into both rvu_cptpf and rvu_cptvf modules: > scripts/Makefile.build:252: ./drivers/crypto/marvell/octeontx2/Makefile: > cn10k_cpt.o is added to multiple modules: rvu_cptpf rvu_cptvf > scripts/Makefile.build:252: ./drivers/crypto/marvell/octeontx2/Makefile: > otx2_cptlf.o is added to multiple modules: rvu_cptpf rvu_cptvf > scripts/Makefile.build:252: ./drivers/crypto/marvell/octeontx2/Makefile: > otx2_cpt_mbox_common.o is added to multiple modules: rvu_cptpf rvu_cptvf Despite they're build under the same Kconfig option (CONFIG_CRYPTO_DEV_OCTEONTX2_CPT), it's better do link the common code into a standalone module and export the shared functions. Under certain circumstances, this can lead to the same situation as fixed by commit637a642f5c
("zstd: Fixing mixed module-builtin objects"). Plus, those three common object files are relatively big to duplicate them several times. Introduce the new module, rvu_cptcommon, to provide the common functions to both modules. Fixes:19d8e8c7be
("crypto: octeontx2 - add virtual function driver support") Suggested-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Alexander Lobakin <alobakin@pm.me> Reviewed-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
6084466e76
commit
72bc4e71db
|
@ -1,11 +1,10 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
obj-$(CONFIG_CRYPTO_DEV_OCTEONTX2_CPT) += rvu_cptpf.o rvu_cptvf.o
|
||||
obj-$(CONFIG_CRYPTO_DEV_OCTEONTX2_CPT) += rvu_cptcommon.o rvu_cptpf.o rvu_cptvf.o
|
||||
|
||||
rvu_cptcommon-objs := cn10k_cpt.o otx2_cptlf.o otx2_cpt_mbox_common.o
|
||||
rvu_cptpf-objs := otx2_cptpf_main.o otx2_cptpf_mbox.o \
|
||||
otx2_cpt_mbox_common.o otx2_cptpf_ucode.o otx2_cptlf.o \
|
||||
cn10k_cpt.o otx2_cpt_devlink.o
|
||||
rvu_cptvf-objs := otx2_cptvf_main.o otx2_cptvf_mbox.o otx2_cptlf.o \
|
||||
otx2_cpt_mbox_common.o otx2_cptvf_reqmgr.o \
|
||||
otx2_cptvf_algs.o cn10k_cpt.o
|
||||
otx2_cptpf_ucode.o otx2_cpt_devlink.o
|
||||
rvu_cptvf-objs := otx2_cptvf_main.o otx2_cptvf_mbox.o \
|
||||
otx2_cptvf_reqmgr.o otx2_cptvf_algs.o
|
||||
|
||||
ccflags-y += -I$(srctree)/drivers/net/ethernet/marvell/octeontx2/af
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
#include "otx2_cptlf.h"
|
||||
#include "cn10k_cpt.h"
|
||||
|
||||
static void cn10k_cpt_send_cmd(union otx2_cpt_inst_s *cptinst, u32 insts_num,
|
||||
struct otx2_cptlf_info *lf);
|
||||
|
||||
static struct cpt_hw_ops otx2_hw_ops = {
|
||||
.send_cmd = otx2_cpt_send_cmd,
|
||||
.cpt_get_compcode = otx2_cpt_get_compcode,
|
||||
|
@ -19,8 +22,8 @@ static struct cpt_hw_ops cn10k_hw_ops = {
|
|||
.cpt_get_uc_compcode = cn10k_cpt_get_uc_compcode,
|
||||
};
|
||||
|
||||
void cn10k_cpt_send_cmd(union otx2_cpt_inst_s *cptinst, u32 insts_num,
|
||||
struct otx2_cptlf_info *lf)
|
||||
static void cn10k_cpt_send_cmd(union otx2_cpt_inst_s *cptinst, u32 insts_num,
|
||||
struct otx2_cptlf_info *lf)
|
||||
{
|
||||
void __iomem *lmtline = lf->lmtline;
|
||||
u64 val = (lf->slot & 0x7FF);
|
||||
|
@ -68,6 +71,7 @@ int cn10k_cptpf_lmtst_init(struct otx2_cptpf_dev *cptpf)
|
|||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(cn10k_cptpf_lmtst_init, CRYPTO_DEV_OCTEONTX2_CPT);
|
||||
|
||||
int cn10k_cptvf_lmtst_init(struct otx2_cptvf_dev *cptvf)
|
||||
{
|
||||
|
@ -91,3 +95,4 @@ int cn10k_cptvf_lmtst_init(struct otx2_cptvf_dev *cptvf)
|
|||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(cn10k_cptvf_lmtst_init, CRYPTO_DEV_OCTEONTX2_CPT);
|
||||
|
|
|
@ -28,8 +28,6 @@ static inline u8 otx2_cpt_get_uc_compcode(union otx2_cpt_res_s *result)
|
|||
return ((struct cn9k_cpt_res_s *)result)->uc_compcode;
|
||||
}
|
||||
|
||||
void cn10k_cpt_send_cmd(union otx2_cpt_inst_s *cptinst, u32 insts_num,
|
||||
struct otx2_cptlf_info *lf);
|
||||
int cn10k_cptpf_lmtst_init(struct otx2_cptpf_dev *cptpf);
|
||||
int cn10k_cptvf_lmtst_init(struct otx2_cptvf_dev *cptvf);
|
||||
|
||||
|
|
|
@ -145,8 +145,6 @@ int otx2_cpt_send_mbox_msg(struct otx2_mbox *mbox, struct pci_dev *pdev);
|
|||
|
||||
int otx2_cpt_send_af_reg_requests(struct otx2_mbox *mbox,
|
||||
struct pci_dev *pdev);
|
||||
int otx2_cpt_add_read_af_reg(struct otx2_mbox *mbox, struct pci_dev *pdev,
|
||||
u64 reg, u64 *val, int blkaddr);
|
||||
int otx2_cpt_add_write_af_reg(struct otx2_mbox *mbox, struct pci_dev *pdev,
|
||||
u64 reg, u64 val, int blkaddr);
|
||||
int otx2_cpt_read_af_reg(struct otx2_mbox *mbox, struct pci_dev *pdev,
|
||||
|
|
|
@ -19,6 +19,7 @@ int otx2_cpt_send_mbox_msg(struct otx2_mbox *mbox, struct pci_dev *pdev)
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(otx2_cpt_send_mbox_msg, CRYPTO_DEV_OCTEONTX2_CPT);
|
||||
|
||||
int otx2_cpt_send_ready_msg(struct otx2_mbox *mbox, struct pci_dev *pdev)
|
||||
{
|
||||
|
@ -36,14 +37,17 @@ int otx2_cpt_send_ready_msg(struct otx2_mbox *mbox, struct pci_dev *pdev)
|
|||
|
||||
return otx2_cpt_send_mbox_msg(mbox, pdev);
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(otx2_cpt_send_ready_msg, CRYPTO_DEV_OCTEONTX2_CPT);
|
||||
|
||||
int otx2_cpt_send_af_reg_requests(struct otx2_mbox *mbox, struct pci_dev *pdev)
|
||||
{
|
||||
return otx2_cpt_send_mbox_msg(mbox, pdev);
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(otx2_cpt_send_af_reg_requests, CRYPTO_DEV_OCTEONTX2_CPT);
|
||||
|
||||
int otx2_cpt_add_read_af_reg(struct otx2_mbox *mbox, struct pci_dev *pdev,
|
||||
u64 reg, u64 *val, int blkaddr)
|
||||
static int otx2_cpt_add_read_af_reg(struct otx2_mbox *mbox,
|
||||
struct pci_dev *pdev, u64 reg,
|
||||
u64 *val, int blkaddr)
|
||||
{
|
||||
struct cpt_rd_wr_reg_msg *reg_msg;
|
||||
|
||||
|
@ -91,6 +95,7 @@ int otx2_cpt_add_write_af_reg(struct otx2_mbox *mbox, struct pci_dev *pdev,
|
|||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(otx2_cpt_add_write_af_reg, CRYPTO_DEV_OCTEONTX2_CPT);
|
||||
|
||||
int otx2_cpt_read_af_reg(struct otx2_mbox *mbox, struct pci_dev *pdev,
|
||||
u64 reg, u64 *val, int blkaddr)
|
||||
|
@ -103,6 +108,7 @@ int otx2_cpt_read_af_reg(struct otx2_mbox *mbox, struct pci_dev *pdev,
|
|||
|
||||
return otx2_cpt_send_mbox_msg(mbox, pdev);
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(otx2_cpt_read_af_reg, CRYPTO_DEV_OCTEONTX2_CPT);
|
||||
|
||||
int otx2_cpt_write_af_reg(struct otx2_mbox *mbox, struct pci_dev *pdev,
|
||||
u64 reg, u64 val, int blkaddr)
|
||||
|
@ -115,6 +121,7 @@ int otx2_cpt_write_af_reg(struct otx2_mbox *mbox, struct pci_dev *pdev,
|
|||
|
||||
return otx2_cpt_send_mbox_msg(mbox, pdev);
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(otx2_cpt_write_af_reg, CRYPTO_DEV_OCTEONTX2_CPT);
|
||||
|
||||
int otx2_cpt_attach_rscrs_msg(struct otx2_cptlfs_info *lfs)
|
||||
{
|
||||
|
@ -170,6 +177,7 @@ int otx2_cpt_detach_rsrcs_msg(struct otx2_cptlfs_info *lfs)
|
|||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(otx2_cpt_detach_rsrcs_msg, CRYPTO_DEV_OCTEONTX2_CPT);
|
||||
|
||||
int otx2_cpt_msix_offset_msg(struct otx2_cptlfs_info *lfs)
|
||||
{
|
||||
|
@ -202,6 +210,7 @@ int otx2_cpt_msix_offset_msg(struct otx2_cptlfs_info *lfs)
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(otx2_cpt_msix_offset_msg, CRYPTO_DEV_OCTEONTX2_CPT);
|
||||
|
||||
int otx2_cpt_sync_mbox_msg(struct otx2_mbox *mbox)
|
||||
{
|
||||
|
@ -216,3 +225,4 @@ int otx2_cpt_sync_mbox_msg(struct otx2_mbox *mbox)
|
|||
|
||||
return otx2_mbox_check_rsp_msgs(mbox, 0);
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(otx2_cpt_sync_mbox_msg, CRYPTO_DEV_OCTEONTX2_CPT);
|
||||
|
|
|
@ -274,6 +274,8 @@ void otx2_cptlf_unregister_interrupts(struct otx2_cptlfs_info *lfs)
|
|||
}
|
||||
cptlf_disable_intrs(lfs);
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(otx2_cptlf_unregister_interrupts,
|
||||
CRYPTO_DEV_OCTEONTX2_CPT);
|
||||
|
||||
static int cptlf_do_register_interrrupts(struct otx2_cptlfs_info *lfs,
|
||||
int lf_num, int irq_offset,
|
||||
|
@ -321,6 +323,7 @@ free_irq:
|
|||
otx2_cptlf_unregister_interrupts(lfs);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(otx2_cptlf_register_interrupts, CRYPTO_DEV_OCTEONTX2_CPT);
|
||||
|
||||
void otx2_cptlf_free_irqs_affinity(struct otx2_cptlfs_info *lfs)
|
||||
{
|
||||
|
@ -334,6 +337,7 @@ void otx2_cptlf_free_irqs_affinity(struct otx2_cptlfs_info *lfs)
|
|||
free_cpumask_var(lfs->lf[slot].affinity_mask);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(otx2_cptlf_free_irqs_affinity, CRYPTO_DEV_OCTEONTX2_CPT);
|
||||
|
||||
int otx2_cptlf_set_irqs_affinity(struct otx2_cptlfs_info *lfs)
|
||||
{
|
||||
|
@ -366,6 +370,7 @@ free_affinity_mask:
|
|||
otx2_cptlf_free_irqs_affinity(lfs);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(otx2_cptlf_set_irqs_affinity, CRYPTO_DEV_OCTEONTX2_CPT);
|
||||
|
||||
int otx2_cptlf_init(struct otx2_cptlfs_info *lfs, u8 eng_grp_mask, int pri,
|
||||
int lfs_num)
|
||||
|
@ -422,6 +427,7 @@ clear_lfs_num:
|
|||
lfs->lfs_num = 0;
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(otx2_cptlf_init, CRYPTO_DEV_OCTEONTX2_CPT);
|
||||
|
||||
void otx2_cptlf_shutdown(struct otx2_cptlfs_info *lfs)
|
||||
{
|
||||
|
@ -431,3 +437,8 @@ void otx2_cptlf_shutdown(struct otx2_cptlfs_info *lfs)
|
|||
/* Send request to detach LFs */
|
||||
otx2_cpt_detach_rsrcs_msg(lfs);
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(otx2_cptlf_shutdown, CRYPTO_DEV_OCTEONTX2_CPT);
|
||||
|
||||
MODULE_AUTHOR("Marvell");
|
||||
MODULE_DESCRIPTION("Marvell RVU CPT Common module");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
@ -831,6 +831,8 @@ static struct pci_driver otx2_cpt_pci_driver = {
|
|||
|
||||
module_pci_driver(otx2_cpt_pci_driver);
|
||||
|
||||
MODULE_IMPORT_NS(CRYPTO_DEV_OCTEONTX2_CPT);
|
||||
|
||||
MODULE_AUTHOR("Marvell");
|
||||
MODULE_DESCRIPTION(OTX2_CPT_DRV_STRING);
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
|
|
@ -429,6 +429,8 @@ static struct pci_driver otx2_cptvf_pci_driver = {
|
|||
|
||||
module_pci_driver(otx2_cptvf_pci_driver);
|
||||
|
||||
MODULE_IMPORT_NS(CRYPTO_DEV_OCTEONTX2_CPT);
|
||||
|
||||
MODULE_AUTHOR("Marvell");
|
||||
MODULE_DESCRIPTION("Marvell RVU CPT Virtual Function Driver");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
|
Loading…
Reference in New Issue