DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chengwen Feng <fengchengwen@huawei.com>
To: <thomas@monjalon.net>, <ferruh.yigit@intel.com>, <ruifeng.wang@arm.com>
Cc: <dev@dpdk.org>, <bruce.richardson@intel.com>,
	<vladimir.medvedkin@intel.com>, <viktorin@rehivetech.com>,
	<jerinj@marvell.com>, <Honnappa.Nagarahalli@arm.com>,
	<jerinjacobk@gmail.com>, <juraj.linkes@pantheon.tech>
Subject: [dpdk-dev] [PATCH 1/2] build: fix SVE compile error with gcc8.3
Date: Mon, 28 Jun 2021 10:57:50 +0800	[thread overview]
Message-ID: <1624849071-56826-2-git-send-email-fengchengwen@huawei.com> (raw)
In-Reply-To: <1624849071-56826-1-git-send-email-fengchengwen@huawei.com>

If the target machine has SVE feature (e.g. "-march=armv8.2-a+sve'),
and the compiler are gcc8.3, it will compile error:
	In file included from ../dpdk-next-net/lib/eal/common/
	eal_common_options.c:38:
	../dpdk-next-net/lib/eal/arm/include/rte_vect.h:13:10: fatal
	error: arm_sve.h: No such file or directory
	#include <arm_sve.h>
	       ^~~~~~~~~~~
	compilation terminated.

The root cause is that gcc8.3 supports SVE (the macro
__ARM_FEATURE_SVE was 1), but it doesn't support SVE ACLE [1].

The solution:
a) Detect compiler whether support SVE ACLE, if support then define
RTE_HAS_SVE_ACLE macro.
b) Use the RTE_HAS_SVE_ACLE macro to include SVE header file.

[1] ACLE:  Arm C Language Extensions, the SVE ACLE header file is
<arm_sve.h>, user should include it when writing ACLE SVE code.

Fixes: 67b68824a82d ("lpm/arm: support SVE")

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 config/arm/meson.build         | 6 ++++++
 lib/eal/arm/include/rte_vect.h | 2 +-
 lib/lpm/rte_lpm.h              | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/config/arm/meson.build b/config/arm/meson.build
index e83a56e..7342626 100644
--- a/config/arm/meson.build
+++ b/config/arm/meson.build
@@ -488,3 +488,9 @@ if cc.get_define('__ARM_FEATURE_CRYPTO', args: machine_args) != ''
     compile_time_cpuflags += ['RTE_CPUFLAG_AES', 'RTE_CPUFLAG_PMULL',
     'RTE_CPUFLAG_SHA1', 'RTE_CPUFLAG_SHA2']
 endif
+
+# Check whether SVE ACLE is supported and set the corresponding flag which will used with SVE ACLE code.
+if (cc.get_define('__ARM_FEATURE_SVE', args: machine_args) != '' and
+        cc.check_header('arm_sve.h'))
+    dpdk_conf.set('RTE_HAS_SVE_ACLE', 1)
+endif
diff --git a/lib/eal/arm/include/rte_vect.h b/lib/eal/arm/include/rte_vect.h
index 093e912..4b705ba 100644
--- a/lib/eal/arm/include/rte_vect.h
+++ b/lib/eal/arm/include/rte_vect.h
@@ -9,7 +9,7 @@
 #include "generic/rte_vect.h"
 #include "rte_debug.h"
 #include "arm_neon.h"
-#ifdef __ARM_FEATURE_SVE
+#ifdef RTE_HAS_SVE_ACLE
 #include <arm_sve.h>
 #endif
 
diff --git a/lib/lpm/rte_lpm.h b/lib/lpm/rte_lpm.h
index 28b5768..5eb14c1 100644
--- a/lib/lpm/rte_lpm.h
+++ b/lib/lpm/rte_lpm.h
@@ -402,7 +402,7 @@ rte_lpm_lookupx4(const struct rte_lpm *lpm, xmm_t ip, uint32_t hop[4],
 	uint32_t defv);
 
 #if defined(RTE_ARCH_ARM)
-#ifdef __ARM_FEATURE_SVE
+#ifdef RTE_HAS_SVE_ACLE
 #include "rte_lpm_sve.h"
 #else
 #include "rte_lpm_neon.h"
-- 
2.8.1


  reply	other threads:[~2021-06-28  3:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-28  2:57 [dpdk-dev] [PATCH 0/2] bugfix for SVE compile Chengwen Feng
2021-06-28  2:57 ` Chengwen Feng [this message]
2021-07-09 20:18   ` [dpdk-dev] [PATCH 1/2] build: fix SVE compile error with gcc8.3 Thomas Monjalon
2021-06-28  2:57 ` [dpdk-dev] [PATCH 2/2] net/hns3: fix SVE code " Chengwen Feng
2021-06-28  3:33   ` Ruifeng Wang
2021-06-28  3:56     ` fengchengwen
2021-06-28  5:33       ` Ruifeng Wang
2021-07-02 14:15 ` [dpdk-dev] [PATCH 0/2] bugfix for SVE compile fengchengwen
2021-07-09 20:26 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1624849071-56826-2-git-send-email-fengchengwen@huawei.com \
    --to=fengchengwen@huawei.com \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jerinj@marvell.com \
    --cc=jerinjacobk@gmail.com \
    --cc=juraj.linkes@pantheon.tech \
    --cc=ruifeng.wang@arm.com \
    --cc=thomas@monjalon.net \
    --cc=viktorin@rehivetech.com \
    --cc=vladimir.medvedkin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).