Skip to contentSkip to conversation

drivers/crypto: fix gcc 10 no-common errors

PATCH In review [email protected] 5 participants 6 messages May 13, 2020 – May 15, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/crypto: fix gcc 10 no-common errors

From: Akhil Goyal <[email protected]>

gcc 10 defaults to -fno-common and as a result when linking with crypto drivers:

drivers/librte_pmd_dpaa_sec.a(crypto_dpaa_sec_dpaa_sec.c.o):
(.bss+0x4): multiple definition of `rta_sec_era'; drivers/librte_pmd_caam_jr.a(crypto_caam_jr_caam_jr.c.o):
(.bss+0x0): first defined here

drivers/librte_pmd_dpaa2_sec.a(crypto_dpaa2_sec_dpaa2_sec_dpseci.c.o):
(.data+0x0): multiple definition of `rta_sec_era'; drivers/librte_pmd_caam_jr.a(crypto_caam_jr_caam_jr.c.o):
(.bss+0x0): first defined here

This patch fixes the blunt workaround in the following commit.

Fixes 50b03f3b8eaf ("drivers/crypto: disable gcc 10 no-common errors")

Bugzilla ID: 469
Cc: [email protected]

---
This patch is not tested on GCC 10.
@kevin Please verify on your setup if it is fixing the GCC 10 compilation.

 drivers/common/dpaax/Makefile                    |  3 ++-
 drivers/common/dpaax/caamflib.c                  | 16 ++++++++++++++++
 drivers/common/dpaax/meson.build                 |  4 +++-
 .../common/dpaax/rte_common_dpaax_version.map    |  4 ++++
 drivers/crypto/caam_jr/Makefile                  |  7 -------
 drivers/crypto/caam_jr/caam_jr.c                 |  2 --
 drivers/crypto/caam_jr/meson.build               |  5 -----
 drivers/crypto/dpaa2_sec/Makefile                |  7 -------
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c      |  4 ++--
 drivers/crypto/dpaa2_sec/meson.build             |  5 -----
 drivers/crypto/dpaa_sec/Makefile                 |  7 -------
 drivers/crypto/dpaa_sec/dpaa_sec.c               |  2 --
 drivers/crypto/dpaa_sec/meson.build              |  5 -----
 13 files changed, 27 insertions(+), 44 deletions(-)
 create mode 100644 drivers/common/dpaax/caamflib.c
drivers/common/dpaax/Makefile +2 -1
index 15b0b38d0..2f4b924fd 100644
@@ -15,6 +15,7 @@ CFLAGS += -Wno-pointer-arith
 CFLAGS += -Wno-cast-qual
 
 CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax/caamflib
 
 # versioning export map
 EXPORT_MAP := rte_common_dpaax_version.map
@@ -22,7 +23,7 @@ EXPORT_MAP := rte_common_dpaax_version.map
 #
 # all source are stored in SRCS-y
 #
-SRCS-y += dpaax_iova_table.c dpaa_of.c
+SRCS-y += dpaax_iova_table.c dpaa_of.c caamflib.c
 
 LDLIBS += -lrte_eal
 
drivers/common/dpaax/caamflib.c new file +16 -0
new file mode 100644
index 000000000..55e20281c
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+ *
+ * Copyright 2020 NXP
+ *
+ */
+
+#include <rta.h>
+
+/*
+ * SEC HW block revision.
+ *
+ * This *must not be confused with SEC version*:
+ * - SEC HW block revision format is "v"
+ * - SEC revision format is "x.y"
+ */
+enum rta_sec_era rta_sec_era;
drivers/common/dpaax/meson.build +3 -1
index ff2d1a507..0b8bf7bd5 100644
@@ -6,7 +6,9 @@ if not is_linux
 	reason = 'only supported on linux'
 endif
 
-sources = files('dpaax_iova_table.c', 'dpaa_of.c')
+sources = files('dpaax_iova_table.c', 'dpaa_of.c', 'caamflib.c')
+
+includes += include_directories('caamflib')
 
 cflags += ['-D_GNU_SOURCE']
 if cc.has_argument('-Wno-cast-qual')
drivers/common/dpaax/rte_common_dpaax_version.map +4 -0
index f72eba761..837ce01af 100644
@@ -21,3 +21,7 @@ DPDK_20.0 {
 
 	local: *;
 };
+
+INTERNAL {
+	rta_sec_era;
+};
drivers/crypto/caam_jr/Makefile +0 -7
index 10848884c..89d323817 100644
@@ -14,13 +14,6 @@ CFLAGS += -D _GNU_SOURCE
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
-# FIXME: temporary solution for Bugzilla 469
-ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
-ifeq ($(shell test $(GCC_VERSION) -ge 100 && echo 1), 1)
-CFLAGS += -fcommon
-endif
-endif
-
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/include
 CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax/caamflib/
drivers/crypto/caam_jr/caam_jr.c +0 -2
index 5a29dd169..45003ba25 100644
@@ -37,8 +37,6 @@
 static uint8_t cryptodev_driver_id;
 int caam_jr_logtype;
 
-enum rta_sec_era rta_sec_era;
-
 /* Lists the states possible for the SEC user space driver. */
 enum sec_driver_state_e {
 	SEC_DRIVER_STATE_IDLE,		/* Driver not initialized */
drivers/crypto/caam_jr/meson.build +0 -5
index 551b13632..f8b5250a9 100644
@@ -12,11 +12,6 @@ sources = files('caam_jr_capabilities.c',
 		'caam_jr_uio.c',
 		'caam_jr.c')
 
-# FIXME: temporary solution for Bugzilla 469
-if (toolchain == 'gcc' and cc.version().version_compare('>=10.0.0'))
-	cflags += '-fcommon'
-endif
-
 includes += include_directories('../../bus/dpaa/include/')
 includes += include_directories('../../common/dpaax/')
 includes += include_directories('../../common/dpaax/caamflib/')
drivers/crypto/dpaa2_sec/Makefile +0 -7
index 8ce637db6..a0a279557 100644
@@ -19,13 +19,6 @@ CFLAGS += -Wno-implicit-fallthrough
 endif
 endif
 
-# FIXME: temporary solution for Bugzilla 469
-ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
-ifeq ($(shell test $(GCC_VERSION) -ge 100 && echo 1), 1)
-CFLAGS += -fcommon
-endif
-endif
-
 CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax/caamflib
 CFLAGS += -I$(RTE_SDK)/drivers/crypto/dpaa2_sec/
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +2 -2
index fe34e644c..6459a025b 100644
@@ -56,8 +56,6 @@
 #define SEC_FLC_DHR_OUTBOUND	-114
 #define SEC_FLC_DHR_INBOUND	0
 
-enum rta_sec_era rta_sec_era = RTA_SEC_ERA_8;
-
 static uint8_t cryptodev_driver_id;
 
 int dpaa2_logtype_sec;
@@ -3870,6 +3868,8 @@ cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv __rte_unused,
 
 	if (dpaa2_svr_family == SVR_LX2160A)
 		rta_set_sec_era(RTA_SEC_ERA_10);
+	else
+		rta_set_sec_era(RTA_SEC_ERA_8);
 
 	DPAA2_SEC_INFO("2-SEC ERA is %d", rta_get_sec_era());
 
drivers/crypto/dpaa2_sec/meson.build +0 -5
index 505ad9414..cb1c2d049 100644
@@ -10,9 +10,4 @@ deps += ['security', 'mempool_dpaa2']
 sources = files('dpaa2_sec_dpseci.c',
 		'mc/dpseci.c')
 
-# FIXME: temporary solution for Bugzilla 469
-if (toolchain == 'gcc' and cc.version().version_compare('>=10.0.0'))
-	cflags += '-fcommon'
-endif
-
 includes += include_directories('mc', '../../common/dpaax', '../../common/dpaax/caamflib')
drivers/crypto/dpaa_sec/Makefile +0 -7
index 6cf392cb3..ea266962a 100644
@@ -13,13 +13,6 @@ LIB = librte_pmd_dpaa_sec.a
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
-# FIXME: temporary solution for Bugzilla 469
-ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
-ifeq ($(shell test $(GCC_VERSION) -ge 100 && echo 1), 1)
-CFLAGS += -fcommon
-endif
-endif
-
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/include
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/base/qbman
drivers/crypto/dpaa_sec/dpaa_sec.c +0 -2
index 25dcbd259..a9bfb8685 100644
@@ -43,8 +43,6 @@
 #include <dpaa_sec_log.h>
 #include <dpaax_iova_table.h>
 
-enum rta_sec_era rta_sec_era;
-
 int dpaa_logtype_sec;
 
 static uint8_t cryptodev_driver_id;
drivers/crypto/dpaa_sec/meson.build +0 -5
index f5e660457..7d422d8d5 100644
@@ -9,11 +9,6 @@ endif
 deps += ['bus_dpaa', 'mempool_dpaa', 'security']
 sources = files('dpaa_sec.c')
 
-# FIXME: temporary solution for Bugzilla 469
-if (toolchain == 'gcc' and cc.version().version_compare('>=10.0.0'))
-	cflags += '-fcommon'
-endif
-
 includes += include_directories('../../bus/dpaa/include')
 includes += include_directories('../../common/dpaax')
 includes += include_directories('../../common/dpaax/caamflib/')
Signature · 1 line
2.17.1
Tested-by on v1 1/1
#1 lore raw
Quoted 19 lines · On 13/05/2020 14:50, [email protected] wrote:

From: Akhil Goyal <[email protected]>

gcc 10 defaults to -fno-common and as a result when linking with crypto drivers:

drivers/librte_pmd_dpaa_sec.a(crypto_dpaa_sec_dpaa_sec.c.o):
(.bss+0x4): multiple definition of `rta_sec_era'; drivers/librte_pmd_caam_jr.a(crypto_caam_jr_caam_jr.c.o):
(.bss+0x0): first defined here

drivers/librte_pmd_dpaa2_sec.a(crypto_dpaa2_sec_dpaa2_sec_dpseci.c.o):
(.data+0x0): multiple definition of `rta_sec_era'; drivers/librte_pmd_caam_jr.a(crypto_caam_jr_caam_jr.c.o):
(.bss+0x0): first defined here

This patch fixes the blunt workaround in the following commit.

Fixes 50b03f3b8eaf ("drivers/crypto: disable gcc 10 no-common errors")
Quoted 9 lines

Bugzilla ID: 469
Cc: [email protected]

---
This patch is not tested on GCC 10.
@kevin Please verify on your setup if it is fixing the GCC 10 compilation.

Passing with gcc 10 on my setup. Internal symbol part looks ok to me, but might be best to get review from Ray.

Quoted 236 lines
 drivers/common/dpaax/Makefile                    |  3 ++-
 drivers/common/dpaax/caamflib.c                  | 16 ++++++++++++++++
 drivers/common/dpaax/meson.build                 |  4 +++-
 .../common/dpaax/rte_common_dpaax_version.map    |  4 ++++
 drivers/crypto/caam_jr/Makefile                  |  7 -------
 drivers/crypto/caam_jr/caam_jr.c                 |  2 --
 drivers/crypto/caam_jr/meson.build               |  5 -----
 drivers/crypto/dpaa2_sec/Makefile                |  7 -------
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c      |  4 ++--
 drivers/crypto/dpaa2_sec/meson.build             |  5 -----
 drivers/crypto/dpaa_sec/Makefile                 |  7 -------
 drivers/crypto/dpaa_sec/dpaa_sec.c               |  2 --
 drivers/crypto/dpaa_sec/meson.build              |  5 -----
 13 files changed, 27 insertions(+), 44 deletions(-)
 create mode 100644 drivers/common/dpaax/caamflib.c
drivers/common/dpaax/Makefile +2 -1
index 15b0b38d0..2f4b924fd 100644
@@ -15,6 +15,7 @@ CFLAGS += -Wno-pointer-arith
 CFLAGS += -Wno-cast-qual
 
 CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax/caamflib
 
 # versioning export map
 EXPORT_MAP := rte_common_dpaax_version.map
@@ -22,7 +23,7 @@ EXPORT_MAP := rte_common_dpaax_version.map
 #
 # all source are stored in SRCS-y
 #
-SRCS-y += dpaax_iova_table.c dpaa_of.c
+SRCS-y += dpaax_iova_table.c dpaa_of.c caamflib.c
 
 LDLIBS += -lrte_eal
 
drivers/common/dpaax/caamflib.c new file +16 -0
new file mode 100644
index 000000000..55e20281c
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+ *
+ * Copyright 2020 NXP
+ *
+ */
+
+#include <rta.h>
+
+/*
+ * SEC HW block revision.
+ *
+ * This *must not be confused with SEC version*:
+ * - SEC HW block revision format is "v"
+ * - SEC revision format is "x.y"
+ */
+enum rta_sec_era rta_sec_era;
drivers/common/dpaax/meson.build +3 -1
index ff2d1a507..0b8bf7bd5 100644
@@ -6,7 +6,9 @@ if not is_linux
 	reason = 'only supported on linux'
 endif
 
-sources = files('dpaax_iova_table.c', 'dpaa_of.c')
+sources = files('dpaax_iova_table.c', 'dpaa_of.c', 'caamflib.c')
+
+includes += include_directories('caamflib')
 
 cflags += ['-D_GNU_SOURCE']
 if cc.has_argument('-Wno-cast-qual')
drivers/common/dpaax/rte_common_dpaax_version.map +4 -0
index f72eba761..837ce01af 100644
@@ -21,3 +21,7 @@ DPDK_20.0 {
 
 	local: *;
 };
+
+INTERNAL {
+	rta_sec_era;
+};
drivers/crypto/caam_jr/Makefile +0 -7
index 10848884c..89d323817 100644
@@ -14,13 +14,6 @@ CFLAGS += -D _GNU_SOURCE
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
-# FIXME: temporary solution for Bugzilla 469
-ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
-ifeq ($(shell test $(GCC_VERSION) -ge 100 && echo 1), 1)
-CFLAGS += -fcommon
-endif
-endif
-
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/include
 CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax/caamflib/
drivers/crypto/caam_jr/caam_jr.c +0 -2
index 5a29dd169..45003ba25 100644
@@ -37,8 +37,6 @@
 static uint8_t cryptodev_driver_id;
 int caam_jr_logtype;
 
-enum rta_sec_era rta_sec_era;
-
 /* Lists the states possible for the SEC user space driver. */
 enum sec_driver_state_e {
 	SEC_DRIVER_STATE_IDLE,		/* Driver not initialized */
drivers/crypto/caam_jr/meson.build +0 -5
index 551b13632..f8b5250a9 100644
@@ -12,11 +12,6 @@ sources = files('caam_jr_capabilities.c',
 		'caam_jr_uio.c',
 		'caam_jr.c')
 
-# FIXME: temporary solution for Bugzilla 469
-if (toolchain == 'gcc' and cc.version().version_compare('>=10.0.0'))
-	cflags += '-fcommon'
-endif
-
 includes += include_directories('../../bus/dpaa/include/')
 includes += include_directories('../../common/dpaax/')
 includes += include_directories('../../common/dpaax/caamflib/')
drivers/crypto/dpaa2_sec/Makefile +0 -7
index 8ce637db6..a0a279557 100644
@@ -19,13 +19,6 @@ CFLAGS += -Wno-implicit-fallthrough
 endif
 endif
 
-# FIXME: temporary solution for Bugzilla 469
-ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
-ifeq ($(shell test $(GCC_VERSION) -ge 100 && echo 1), 1)
-CFLAGS += -fcommon
-endif
-endif
-
 CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax/caamflib
 CFLAGS += -I$(RTE_SDK)/drivers/crypto/dpaa2_sec/
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +2 -2
index fe34e644c..6459a025b 100644
@@ -56,8 +56,6 @@
 #define SEC_FLC_DHR_OUTBOUND	-114
 #define SEC_FLC_DHR_INBOUND	0
 
-enum rta_sec_era rta_sec_era = RTA_SEC_ERA_8;
-
 static uint8_t cryptodev_driver_id;
 
 int dpaa2_logtype_sec;
@@ -3870,6 +3868,8 @@ cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv __rte_unused,
 
 	if (dpaa2_svr_family == SVR_LX2160A)
 		rta_set_sec_era(RTA_SEC_ERA_10);
+	else
+		rta_set_sec_era(RTA_SEC_ERA_8);
 
 	DPAA2_SEC_INFO("2-SEC ERA is %d", rta_get_sec_era());
 
drivers/crypto/dpaa2_sec/meson.build +0 -5
index 505ad9414..cb1c2d049 100644
@@ -10,9 +10,4 @@ deps += ['security', 'mempool_dpaa2']
 sources = files('dpaa2_sec_dpseci.c',
 		'mc/dpseci.c')
 
-# FIXME: temporary solution for Bugzilla 469
-if (toolchain == 'gcc' and cc.version().version_compare('>=10.0.0'))
-	cflags += '-fcommon'
-endif
-
 includes += include_directories('mc', '../../common/dpaax', '../../common/dpaax/caamflib')
drivers/crypto/dpaa_sec/Makefile +0 -7
index 6cf392cb3..ea266962a 100644
@@ -13,13 +13,6 @@ LIB = librte_pmd_dpaa_sec.a
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
-# FIXME: temporary solution for Bugzilla 469
-ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
-ifeq ($(shell test $(GCC_VERSION) -ge 100 && echo 1), 1)
-CFLAGS += -fcommon
-endif
-endif
-
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/include
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/base/qbman
drivers/crypto/dpaa_sec/dpaa_sec.c +0 -2
index 25dcbd259..a9bfb8685 100644
@@ -43,8 +43,6 @@
 #include <dpaa_sec_log.h>
 #include <dpaax_iova_table.h>
 
-enum rta_sec_era rta_sec_era;
-
 int dpaa_logtype_sec;
 
 static uint8_t cryptodev_driver_id;
drivers/crypto/dpaa_sec/meson.build +0 -5
index f5e660457..7d422d8d5 100644
@@ -9,11 +9,6 @@ endif
 deps += ['bus_dpaa', 'mempool_dpaa', 'security']
 sources = files('dpaa_sec.c')
 
-# FIXME: temporary solution for Bugzilla 469
-if (toolchain == 'gcc' and cc.version().version_compare('>=10.0.0'))
-	cflags += '-fcommon'
-endif
-
 includes += include_directories('../../bus/dpaa/include')
 includes += include_directories('../../common/dpaax')
 includes += include_directories('../../common/dpaax/caamflib/')
Acked-by
#2 lore raw

Tidy solution.

Quoted 262 lines · Kevin Traynor
Quoted 19 lines · On 13/05/2020 14:50, [email protected] wrote:

From: Akhil Goyal <[email protected]>

gcc 10 defaults to -fno-common and as a result when linking with crypto drivers:

drivers/librte_pmd_dpaa_sec.a(crypto_dpaa_sec_dpaa_sec.c.o):
(.bss+0x4): multiple definition of `rta_sec_era'; drivers/librte_pmd_caam_jr.a(crypto_caam_jr_caam_jr.c.o):
(.bss+0x0): first defined here

drivers/librte_pmd_dpaa2_sec.a(crypto_dpaa2_sec_dpaa2_sec_dpseci.c.o):
(.data+0x0): multiple definition of `rta_sec_era'; drivers/librte_pmd_caam_jr.a(crypto_caam_jr_caam_jr.c.o):
(.bss+0x0): first defined here

This patch fixes the blunt workaround in the following commit.

Fixes 50b03f3b8eaf ("drivers/crypto: disable gcc 10 no-common errors")
Quoted 9 lines

Bugzilla ID: 469
Cc: [email protected]

---
This patch is not tested on GCC 10.
@kevin Please verify on your setup if it is fixing the GCC 10 compilation.

Passing with gcc 10 on my setup. Internal symbol part looks ok to me, but might be best to get review from Ray.

Quoted 227 lines
 drivers/common/dpaax/Makefile                    |  3 ++-
 drivers/common/dpaax/caamflib.c                  | 16 ++++++++++++++++
 drivers/common/dpaax/meson.build                 |  4 +++-
 .../common/dpaax/rte_common_dpaax_version.map    |  4 ++++
 drivers/crypto/caam_jr/Makefile                  |  7 -------
 drivers/crypto/caam_jr/caam_jr.c                 |  2 --
 drivers/crypto/caam_jr/meson.build               |  5 -----
 drivers/crypto/dpaa2_sec/Makefile                |  7 -------
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c      |  4 ++--
 drivers/crypto/dpaa2_sec/meson.build             |  5 -----
 drivers/crypto/dpaa_sec/Makefile                 |  7 -------
 drivers/crypto/dpaa_sec/dpaa_sec.c               |  2 --
 drivers/crypto/dpaa_sec/meson.build              |  5 -----
 13 files changed, 27 insertions(+), 44 deletions(-)
 create mode 100644 drivers/common/dpaax/caamflib.c
drivers/common/dpaax/Makefile +2 -1
index 15b0b38d0..2f4b924fd 100644
@@ -15,6 +15,7 @@ CFLAGS += -Wno-pointer-arith
 CFLAGS += -Wno-cast-qual
 
 CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax/caamflib
 
 # versioning export map
 EXPORT_MAP := rte_common_dpaax_version.map
@@ -22,7 +23,7 @@ EXPORT_MAP := rte_common_dpaax_version.map
 #
 # all source are stored in SRCS-y
 #
-SRCS-y += dpaax_iova_table.c dpaa_of.c
+SRCS-y += dpaax_iova_table.c dpaa_of.c caamflib.c
 
 LDLIBS += -lrte_eal
 
drivers/common/dpaax/caamflib.c new file +16 -0
new file mode 100644
index 000000000..55e20281c
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+ *
+ * Copyright 2020 NXP
+ *
+ */
+
+#include <rta.h>
+
+/*
+ * SEC HW block revision.
+ *
+ * This *must not be confused with SEC version*:
+ * - SEC HW block revision format is "v"
+ * - SEC revision format is "x.y"
+ */
+enum rta_sec_era rta_sec_era;
drivers/common/dpaax/meson.build +3 -1
index ff2d1a507..0b8bf7bd5 100644
@@ -6,7 +6,9 @@ if not is_linux
 	reason = 'only supported on linux'
 endif
 
-sources = files('dpaax_iova_table.c', 'dpaa_of.c')
+sources = files('dpaax_iova_table.c', 'dpaa_of.c', 'caamflib.c')
+
+includes += include_directories('caamflib')
 
 cflags += ['-D_GNU_SOURCE']
 if cc.has_argument('-Wno-cast-qual')
drivers/common/dpaax/rte_common_dpaax_version.map +4 -0
index f72eba761..837ce01af 100644
@@ -21,3 +21,7 @@ DPDK_20.0 {
 
 	local: *;
 };
+
+INTERNAL {
+	rta_sec_era;
+};
drivers/crypto/caam_jr/Makefile +0 -7
index 10848884c..89d323817 100644
@@ -14,13 +14,6 @@ CFLAGS += -D _GNU_SOURCE
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
-# FIXME: temporary solution for Bugzilla 469
-ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
-ifeq ($(shell test $(GCC_VERSION) -ge 100 && echo 1), 1)
-CFLAGS += -fcommon
-endif
-endif
-
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/include
 CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax/caamflib/
drivers/crypto/caam_jr/caam_jr.c +0 -2
index 5a29dd169..45003ba25 100644
@@ -37,8 +37,6 @@
 static uint8_t cryptodev_driver_id;
 int caam_jr_logtype;
 
-enum rta_sec_era rta_sec_era;
-
 /* Lists the states possible for the SEC user space driver. */
 enum sec_driver_state_e {
 	SEC_DRIVER_STATE_IDLE,		/* Driver not initialized */
drivers/crypto/caam_jr/meson.build +0 -5
index 551b13632..f8b5250a9 100644
@@ -12,11 +12,6 @@ sources = files('caam_jr_capabilities.c',
 		'caam_jr_uio.c',
 		'caam_jr.c')
 
-# FIXME: temporary solution for Bugzilla 469
-if (toolchain == 'gcc' and cc.version().version_compare('>=10.0.0'))
-	cflags += '-fcommon'
-endif
-
 includes += include_directories('../../bus/dpaa/include/')
 includes += include_directories('../../common/dpaax/')
 includes += include_directories('../../common/dpaax/caamflib/')
drivers/crypto/dpaa2_sec/Makefile +0 -7
index 8ce637db6..a0a279557 100644
@@ -19,13 +19,6 @@ CFLAGS += -Wno-implicit-fallthrough
 endif
 endif
 
-# FIXME: temporary solution for Bugzilla 469
-ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
-ifeq ($(shell test $(GCC_VERSION) -ge 100 && echo 1), 1)
-CFLAGS += -fcommon
-endif
-endif
-
 CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax/caamflib
 CFLAGS += -I$(RTE_SDK)/drivers/crypto/dpaa2_sec/
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +2 -2
index fe34e644c..6459a025b 100644
@@ -56,8 +56,6 @@
 #define SEC_FLC_DHR_OUTBOUND	-114
 #define SEC_FLC_DHR_INBOUND	0
 
-enum rta_sec_era rta_sec_era = RTA_SEC_ERA_8;
-
 static uint8_t cryptodev_driver_id;
 
 int dpaa2_logtype_sec;
@@ -3870,6 +3868,8 @@ cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv __rte_unused,
 
 	if (dpaa2_svr_family == SVR_LX2160A)
 		rta_set_sec_era(RTA_SEC_ERA_10);
+	else
+		rta_set_sec_era(RTA_SEC_ERA_8);
 
 	DPAA2_SEC_INFO("2-SEC ERA is %d", rta_get_sec_era());
 
drivers/crypto/dpaa2_sec/meson.build +0 -5
index 505ad9414..cb1c2d049 100644
@@ -10,9 +10,4 @@ deps += ['security', 'mempool_dpaa2']
 sources = files('dpaa2_sec_dpseci.c',
 		'mc/dpseci.c')
 
-# FIXME: temporary solution for Bugzilla 469
-if (toolchain == 'gcc' and cc.version().version_compare('>=10.0.0'))
-	cflags += '-fcommon'
-endif
-
 includes += include_directories('mc', '../../common/dpaax', '../../common/dpaax/caamflib')
drivers/crypto/dpaa_sec/Makefile +0 -7
index 6cf392cb3..ea266962a 100644
@@ -13,13 +13,6 @@ LIB = librte_pmd_dpaa_sec.a
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
-# FIXME: temporary solution for Bugzilla 469
-ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
-ifeq ($(shell test $(GCC_VERSION) -ge 100 && echo 1), 1)
-CFLAGS += -fcommon
-endif
-endif
-
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/include
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/base/qbman
drivers/crypto/dpaa_sec/dpaa_sec.c +0 -2
index 25dcbd259..a9bfb8685 100644
@@ -43,8 +43,6 @@
 #include <dpaa_sec_log.h>
 #include <dpaax_iova_table.h>
 
-enum rta_sec_era rta_sec_era;
-
 int dpaa_logtype_sec;
 
 static uint8_t cryptodev_driver_id;
drivers/crypto/dpaa_sec/meson.build +0 -0
index f5e660457..7d422d8d5 100644
@@ -9,11 +9,6 @@ endif
 deps += ['bus_dpaa', 'mempool_dpaa', 'security']
 sources = files('dpaa_sec.c')
 
Quoted 10 lines

drivers/crypto/dpaa_sec/meson.build endif · line 14

Quoted 9 lines
drivers/crypto/dpaa_sec/meson.build +0 -5
-# FIXME: temporary solution for Bugzilla 469
-if (toolchain == 'gcc' and cc.version().version_compare('>=10.0.0'))
-	cflags += '-fcommon'
-endif
-
 includes += include_directories('../../bus/dpaa/include')
 includes += include_directories('../../common/dpaax')
 includes += include_directories('../../common/dpaax/caamflib/')
Reviewed-by on v1 1/1
#4 lore raw
In reply to [email protected]
Quoted 15 lines · On 5/13/2020 2:50 PM, [email protected] wrote:

From: Akhil Goyal <[email protected]>

gcc 10 defaults to -fno-common and as a result when linking with crypto drivers:

drivers/librte_pmd_dpaa_sec.a(crypto_dpaa_sec_dpaa_sec.c.o):
(.bss+0x4): multiple definition of `rta_sec_era'; drivers/librte_pmd_caam_jr.a(crypto_caam_jr_caam_jr.c.o):
(.bss+0x0): first defined here

drivers/librte_pmd_dpaa2_sec.a(crypto_dpaa2_sec_dpaa2_sec_dpseci.c.o):
(.data+0x0): multiple definition of `rta_sec_era'; drivers/librte_pmd_caam_jr.a(crypto_caam_jr_caam_jr.c.o):
(.bss+0x0): first defined here

Quoted 8 lines

This patch fixes the blunt workaround in the following commit.

Fixes 50b03f3b8eaf ("drivers/crypto: disable gcc 10 no-common errors")

Bugzilla ID: 469
Cc: [email protected]

+1, this is better approach, and tested with gcc10.

Instead of having 3 seperate global variables for three seperate PMDs, now there is a single global variable.
In static build these three variables were already used as single variable, that is why we are getting fcommon warning, so I assume there is no use case to use multiple of these PMDs at the same time, but previously this was fine (each PMD has its own variable) when built as shared library, now shared library is also using single variable.
It can be good to verify with PMD maintainers that this is OK, and these PMDs won't be used at the same time in a platform.

Acked-by Hemant Agrawal
#5 lore raw
Quoted 23 lines · On 5/13/2020 2:50 PM, [email protected] wrote:
Quoted 20 lines

From: Akhil Goyal <[email protected]>

gcc 10 defaults to -fno-common and as a result when linking with crypto drivers:

drivers/librte_pmd_dpaa_sec.a(crypto_dpaa_sec_dpaa_sec.c.o):
(.bss+0x4): multiple definition of `rta_sec_era'; drivers/librte_pmd_caam_jr.a(crypto_caam_jr_caam_jr.c.o):
(.bss+0x0): first defined here

drivers/librte_pmd_dpaa2_sec.a(crypto_dpaa2_sec_dpaa2_sec_dpseci.c.o):
(.data+0x0): multiple definition of `rta_sec_era'; drivers/librte_pmd_caam_jr.a(crypto_caam_jr_caam_jr.c.o):
(.bss+0x0): first defined here

This patch fixes the blunt workaround in the following commit.

Fixes 50b03f3b8eaf ("drivers/crypto: disable gcc 10 no-common

errors")

Quoted 9 lines
Quoted 4 lines

Bugzilla ID: 469
Cc: [email protected]

+1, this is better approach, and tested with gcc10.

Quoted 10 lines

Instead of having 3 seperate global variables for three seperate PMDs, now there is a single global variable.
In static build these three variables were already used as single variable, that is why we are getting fcommon warning, so I assume there is no use case to use multiple of these PMDs at the same time, but previously this was fine (each PMD has its own variable) when built as shared library, now shared library is also using single variable.
It can be good to verify with PMD maintainers that this is OK, and these PMDs won't be used at the same time in a platform.

[Hemant] This variable represent the SEC HW revision for a given platform. So it will not be different irrespective of drivers being used. Yes, for a given platform, only one PMD will be used at a given time.