From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 73467A0093;
	Thu, 23 Jun 2022 15:50:07 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id D551E4280B;
	Thu, 23 Jun 2022 15:49:58 +0200 (CEST)
Received: from mga03.intel.com (mga03.intel.com [134.134.136.65])
 by mails.dpdk.org (Postfix) with ESMTP id 990DF40042
 for <dev@dpdk.org>; Thu, 23 Jun 2022 15:49:57 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
 t=1655992197; x=1687528197;
 h=from:to:cc:subject:date:message-id:in-reply-to:
 references:mime-version:content-transfer-encoding;
 bh=XFH0349hlIyrhRodaeg7AvGz/fy9Mf/vKfcJF2xfmb4=;
 b=ZmPBAKwphaZOpIXG9gOs9HRYK2ZMFYpIvS/mlpXnp9Os+5vmf+VdU7As
 n7j7GpqR/y7UkMf54v/zUlPB1BNhhy1L7TKLpwAJdHNhjj5auhZ9yRxnW
 P2s/W+Nwf7V7cPBSIVByinOL/KXcm3dGGA5v9U5qC9N46e3z4nuH/JNmb
 yGeODXMTwq6ah7FVEywIodzMV8gneJqb9xQ2y7+pOrtRJBT9RDFNy6ZM3
 0dKgTaq5DlEh2ZgMmIxyOLOQCptgMk6XUp/m/2lFHfgvZufk93X8Sagkz
 4xZXdh8B5h/2WPssgDf47Dst3DR7E9Yqbxr2w739TrSGwPGEU6WdQIRzB g==;
X-IronPort-AV: E=McAfee;i="6400,9594,10386"; a="281800711"
X-IronPort-AV: E=Sophos;i="5.92,216,1650956400"; d="scan'208";a="281800711"
Received: from fmsmga003.fm.intel.com ([10.253.24.29])
 by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 23 Jun 2022 06:49:57 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.92,216,1650956400"; d="scan'208";a="678065803"
Received: from silpixa00401385.ir.intel.com (HELO
 silpixa00401385.ger.corp.intel.com.) ([10.237.223.125])
 by FMSMGA003.fm.intel.com with ESMTP; 23 Jun 2022 06:49:56 -0700
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>
Subject: [PATCH 3/3] dma/idxd: fix non-AVX builds with older compilers
Date: Thu, 23 Jun 2022 14:49:33 +0100
Message-Id: <20220623134933.469240-4-bruce.richardson@intel.com>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20220623134933.469240-1-bruce.richardson@intel.com>
References: <20220623134933.469240-1-bruce.richardson@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

When building without AVX2 support using an older compiler e.g. gcc 4.8
on Centos/RHEL 7, we get build errors due to the use of AVX2 intrinsics.
This is because the compiler does not support
"__attribute__((target(AVX2)))" function attribute. Disable build of
this driver such edge cases.

Generic builds using recent compilers, and all builds with a minimum
baseline of AVX2 are unaffected by this change.

Fixes: aa802b10237c ("dma/idxd: fix AVX2 in non-datapath functions")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/dma/idxd/meson.build | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/dma/idxd/meson.build b/drivers/dma/idxd/meson.build
index dcc0a297d7..c5403b431c 100644
--- a/drivers/dma/idxd/meson.build
+++ b/drivers/dma/idxd/meson.build
@@ -4,6 +4,17 @@
 build = dpdk_conf.has('RTE_ARCH_X86')
 reason = 'only supported on x86'

+test_avx2_code = '''
+#include <x86intrin.h>
+__attribute__((target("avx2")))
+__m256i fn(void *x) { return _mm256_loadu_si256(x); }
+'''
+if build and not cc.compiles(test_avx2_code, args:machine_args)
+    build = false
+    reason = 'missing support for AVX2 function attribute'
+    subdir_done()
+endif
+
 deps += ['bus_pci']
 sources = files(
         'idxd_common.c',
--
2.34.1