[v3,09/10] net/virtio: use global AVX-512 variables

Message ID 20241008165258.2802099-10-bruce.richardson@intel.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series centralize AVX-512 feature detection |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Bruce Richardson Oct. 8, 2024, 4:52 p.m. UTC
Replace per-driver checks for AVX-512 with the standard variables from
config/x86.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/virtio/meson.build | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)
  

Patch

diff --git a/drivers/net/virtio/meson.build b/drivers/net/virtio/meson.build
index ef016c1566..02742da5c2 100644
--- a/drivers/net/virtio/meson.build
+++ b/drivers/net/virtio/meson.build
@@ -24,23 +24,21 @@  sources += files(
 deps += ['kvargs', 'bus_pci']
 
 if arch_subdir == 'x86'
-    if not machine_args.contains('-mno-avx512f')
-        if cc.has_argument('-mavx512f') and cc.has_argument('-mavx512vl') and cc.has_argument('-mavx512bw')
-            cflags += ['-DCC_AVX512_SUPPORT']
-            virtio_avx512_lib = static_library('virtio_avx512_lib',
-                          'virtio_rxtx_packed.c',
-                          dependencies: [static_rte_ethdev,
-                        static_rte_kvargs, static_rte_bus_pci],
-                          include_directories: includes,
-                          c_args: [cflags, '-mavx512f', '-mavx512bw', '-mavx512vl'])
-            objs += virtio_avx512_lib.extract_objects('virtio_rxtx_packed.c')
-            if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0'))
-                cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA'
-            elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0'))
-                cflags += '-DVIRTIO_CLANG_UNROLL_PRAGMA'
-            elif (toolchain == 'icc' and cc.version().version_compare('>=16.0.0'))
-                cflags += '-DVIRTIO_ICC_UNROLL_PRAGMA'
-            endif
+    if cc_has_avx512
+        cflags += ['-DCC_AVX512_SUPPORT']
+        virtio_avx512_lib = static_library('virtio_avx512_lib',
+                'virtio_rxtx_packed.c',
+                dependencies: [static_rte_ethdev,
+                    static_rte_kvargs, static_rte_bus_pci],
+                include_directories: includes,
+                c_args: cflags + cc_avx512_flags)
+        objs += virtio_avx512_lib.extract_objects('virtio_rxtx_packed.c')
+        if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0'))
+            cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA'
+        elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0'))
+            cflags += '-DVIRTIO_CLANG_UNROLL_PRAGMA'
+        elif (toolchain == 'icc' and cc.version().version_compare('>=16.0.0'))
+            cflags += '-DVIRTIO_ICC_UNROLL_PRAGMA'
         endif
     endif
     sources += files('virtio_rxtx_simple_sse.c')