File 0002-fix-cpu-compatibility.patch of Package dpdk-thunderx

From: mvarlese@suse.de

diff -Nuar dpdk-stable-17.11.2/drivers/bus/vdev/vdev.c dpdk-stable-17.11.2.initfix/drivers/bus/vdev/vdev.c
--- dpdk-stable-17.11.2/drivers/bus/vdev/vdev.c	2018-04-19 16:09:22.000000000 +0200
+++ dpdk-stable-17.11.2.initfix/drivers/bus/vdev/vdev.c	2018-07-03 16:12:03.772495019 +0200
@@ -63,7 +63,11 @@
 	TAILQ_HEAD_INITIALIZER(vdev_driver_list);
 
 /* register a driver */
+#if defined(__x86_64__) ||  defined(__i386__)
+void __attribute__((target ("sse2")))
+#else
 void
+#endif
 rte_vdev_register(struct rte_vdev_driver *driver)
 {
 	TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
diff -Nuar dpdk-stable-17.11.2/lib/librte_eal/common/eal_common_bus.c dpdk-stable-17.11.2.initfix/lib/librte_eal/common/eal_common_bus.c
--- dpdk-stable-17.11.2/lib/librte_eal/common/eal_common_bus.c	2018-04-19 16:09:22.000000000 +0200
+++ dpdk-stable-17.11.2.initfix/lib/librte_eal/common/eal_common_bus.c	2018-07-03 16:12:18.988640242 +0200
@@ -41,8 +41,11 @@
 
 struct rte_bus_list rte_bus_list =
 	TAILQ_HEAD_INITIALIZER(rte_bus_list);
-
+#if defined(__x86_64__) ||  defined(__i386__)
+void __attribute__((target ("sse2")))
+#else
 void
+#endif
 rte_bus_register(struct rte_bus *bus)
 {
 	RTE_VERIFY(bus);
diff -Nuar dpdk-stable-17.11.2/lib/librte_eal/common/include/rte_common.h dpdk-stable-17.11.2.initfix/lib/librte_eal/common/include/rte_common.h
--- dpdk-stable-17.11.2/lib/librte_eal/common/include/rte_common.h	2018-04-19 16:09:22.000000000 +0200
+++ dpdk-stable-17.11.2.initfix/lib/librte_eal/common/include/rte_common.h	2018-07-03 16:04:46.708336998 +0200
@@ -111,17 +111,6 @@
 #define RTE_SET_USED(x) (void)(x)
 
 /**
- * Run function before main() with low priority.
- *
- * The constructor will be run after prioritized constructors.
- *
- * @param func
- *   Constructor function.
- */
-#define RTE_INIT(func) \
-static void __attribute__((constructor, used)) func(void)
-
-/**
  * Run function before main() with high priority.
  *
  * @param func
@@ -130,8 +119,30 @@
  *   Priority number must be above 100.
  *   Lowest number is the first to run.
  */
+#if defined(__x86_64__) ||  defined(__i386__)
 #define RTE_INIT_PRIO(func, prio) \
-static void __attribute__((constructor(prio), used)) func(void)
+static void \
+       __attribute__((constructor(prio), used)) \
+       __attribute__((target ("sse2"))) \
+       __attribute__((target ("no-sse3"))) \
+       __attribute__((target ("no-sse4"))) \
+       func(void)
+#else
+#define RTE_INIT_PRIO(func, prio) \
+static void \
+       __attribute__((constructor(prio), used)) \
+       func(void)
+#endif
+/**
+ * Run function before main() with low priority.
+ *
+ * The constructor will be run after prioritized constructors.
+ *
+ * @param func
+ *   Constructor function.
+ */
+#define RTE_INIT(func) \
+	RTE_INIT_PRIO(func, 65535)
 
 /**
  * Force a function to be inlined
openSUSE Build Service is sponsored by