* [dpdk-dev] [PATCH] build: set RTE_ARCH_64 based on pointer size
@ 2018-09-26 9:15 Bruce Richardson
2018-09-26 9:45 ` Bruce Richardson
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Bruce Richardson @ 2018-09-26 9:15 UTC (permalink / raw)
To: dev; +Cc: bluca, Bruce Richardson
Rather than relying on the target machine architecture, use the
size of a pointer from the compiler to determine if we are 64-bits
or not. This allows correct behaviour when you pass -m32 as a compile
option. It also allows us to use this value repeatedly throughout the
repo rather than continually testing for the sizeof(void*).
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
config/arm/meson.build | 3 +--
config/meson.build | 5 ++++-
config/ppc_64/meson.build | 4 +++-
config/x86/meson.build | 3 +--
drivers/net/sfc/meson.build | 2 +-
lib/librte_bpf/meson.build | 2 +-
lib/librte_kni/meson.build | 2 +-
7 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/config/arm/meson.build b/config/arm/meson.build
index 94cca490e..5a1b79a15 100644
--- a/config/arm/meson.build
+++ b/config/arm/meson.build
@@ -85,14 +85,13 @@ impl_dpaa2 = ['NXP DPAA2', flags_dpaa2, machine_args_generic]
dpdk_conf.set('RTE_FORCE_INTRINSICS', 1)
-if cc.sizeof('void *') != 8
+if not dpdk_conf.get('RTE_ARCH_64')
dpdk_conf.set('RTE_CACHE_LINE_SIZE', 64)
dpdk_conf.set('RTE_ARCH_ARM', 1)
dpdk_conf.set('RTE_ARCH_ARMv7', 1)
else
dpdk_conf.set('RTE_CACHE_LINE_SIZE', 128)
dpdk_conf.set('RTE_ARCH_ARM64', 1)
- dpdk_conf.set('RTE_ARCH_64', 1)
machine = []
cmd_generic = ['generic', '', '', 'default', '']
diff --git a/config/meson.build b/config/meson.build
index 6f9228c87..172ab0249 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -21,6 +21,8 @@ toolchain = cc.get_id()
dpdk_conf.set_quoted('RTE_TOOLCHAIN', toolchain)
dpdk_conf.set('RTE_TOOLCHAIN_' + toolchain.to_upper(), 1)
+dpdk_conf.set('RTE_ARCH_64', cc.sizeof('void *') == 8)
+
# use pthreads
add_project_link_arguments('-pthread', language: 'c')
dpdk_extra_ldflags += '-pthread'
@@ -65,7 +67,7 @@ warning_flags = [
'-Wcast-qual',
'-Wno-address-of-packed-member'
]
-if cc.sizeof('void *') == 4
+if not dpdk_conf.get('RTE_ARCH_64')
# for 32-bit, don't warn about casting a 32-bit pointer to 64-bit int - it's fine!!
warning_flags += '-Wno-pointer-to-int-cast'
endif
@@ -85,6 +87,7 @@ dpdk_conf.set('RTE_MAX_VFIO_GROUPS', 64)
dpdk_conf.set('RTE_DRIVER_MEMPOOL_BUCKET_SIZE_KB', 64)
dpdk_conf.set('RTE_LIBRTE_DPAA2_USE_PHYS_IOVA', true)
+
compile_time_cpuflags = []
if host_machine.cpu_family().startswith('x86')
arch_subdir = 'x86'
diff --git a/config/ppc_64/meson.build b/config/ppc_64/meson.build
index e207c438b..7ceae1d39 100644
--- a/config/ppc_64/meson.build
+++ b/config/ppc_64/meson.build
@@ -1,9 +1,11 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
+if not dpdk_conf.get('RTE_ARCH_64')
+ error('Only 64-bit compiles are supported for this platform type')
+endif
dpdk_conf.set('RTE_ARCH', 'ppc_64')
dpdk_conf.set('RTE_ARCH_PPC_64', 1)
-dpdk_conf.set('RTE_ARCH_64', 1)
# overrides specific to ppc64
dpdk_conf.set('RTE_MAX_LCORE', 256)
diff --git a/config/x86/meson.build b/config/x86/meson.build
index 33efb5e54..084328da2 100644
--- a/config/x86/meson.build
+++ b/config/x86/meson.build
@@ -19,10 +19,9 @@ foreach f:base_flags
endforeach
dpdk_conf.set('RTE_ARCH_X86', 1)
-if (host_machine.cpu_family() == 'x86_64')
+if dpdk_conf.get('RTE_ARCH_64')
dpdk_conf.set('RTE_ARCH_X86_64', 1)
dpdk_conf.set('RTE_ARCH', 'x86_64')
- dpdk_conf.set('RTE_ARCH_64', 1)
else
dpdk_conf.set('RTE_ARCH_I686', 1)
dpdk_conf.set('RTE_ARCH', 'i686')
diff --git a/drivers/net/sfc/meson.build b/drivers/net/sfc/meson.build
index 2d34e869d..e67560991 100644
--- a/drivers/net/sfc/meson.build
+++ b/drivers/net/sfc/meson.build
@@ -6,7 +6,7 @@
# This software was jointly developed between OKTET Labs (under contract
# for Solarflare) and Solarflare Communications, Inc.
-if arch_subdir != 'x86' or cc.sizeof('void *') == 4
+if arch_subdir != 'x86' or not dpdk_conf.get('RTE_ARCH_64')
build = false
endif
diff --git a/lib/librte_bpf/meson.build b/lib/librte_bpf/meson.build
index bc0cd78f9..4fbb29d7c 100644
--- a/lib/librte_bpf/meson.build
+++ b/lib/librte_bpf/meson.build
@@ -8,7 +8,7 @@ sources = files('bpf.c',
'bpf_pkt.c',
'bpf_validate.c')
-if arch_subdir == 'x86' and cc.sizeof('void *') == 8
+if arch_subdir == 'x86' and dpdk_conf.get('RTE_ARCH_64')
sources += files('bpf_jit_x86.c')
endif
diff --git a/lib/librte_kni/meson.build b/lib/librte_kni/meson.build
index a738a033a..055ae1227 100644
--- a/lib/librte_kni/meson.build
+++ b/lib/librte_kni/meson.build
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2017 Intel Corporation
-if host_machine.system() != 'linux' or cc.sizeof('void *') == 4
+if host_machine.system() != 'linux' or not dpdk_conf.get('RTE_ARCH_64')
build = false
endif
version = 2
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] build: set RTE_ARCH_64 based on pointer size
2018-09-26 9:15 [dpdk-dev] [PATCH] build: set RTE_ARCH_64 based on pointer size Bruce Richardson
@ 2018-09-26 9:45 ` Bruce Richardson
2018-09-26 10:18 ` Luca Boccassi
2019-02-19 15:07 ` Luca Boccassi
2 siblings, 0 replies; 5+ messages in thread
From: Bruce Richardson @ 2018-09-26 9:45 UTC (permalink / raw)
To: dev; +Cc: bluca
On Wed, Sep 26, 2018 at 10:15:36AM +0100, Bruce Richardson wrote:
> Rather than relying on the target machine architecture, use the
> size of a pointer from the compiler to determine if we are 64-bits
> or not. This allows correct behaviour when you pass -m32 as a compile
> option. It also allows us to use this value repeatedly throughout the
> repo rather than continually testing for the sizeof(void*).
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
Just by way of note, for those looking to test: On Fedora 28 I can
compile a 32-bit version of DPDK using:
PKG_CONFIG_LIBDIR='/usr/lib/pkgconfig' meson -Dc_args=-m32 -Dc_link_args=-m32 i686-build
ninja -C i686-build
The PKG_CONFIG_LIBDIR is necessary to ensure the 32-bit .pc files are
found. The c_args and c_link_args values are pretty self-explanatory. This
didn't work before this patch because we looked at host_system() for 32-bit
or 64-bit info, rather than asking the compiler about it.
/Bruce
PS: Sorry, Thomas, this doesn't seem to work on Arch, which seems to have a
more mixed lib setup than other distros, having /usr/lib32, /usr/lib64 as
well as a 3rd /usr/lib directory to confuse things. :-(
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] build: set RTE_ARCH_64 based on pointer size
2018-09-26 9:15 [dpdk-dev] [PATCH] build: set RTE_ARCH_64 based on pointer size Bruce Richardson
2018-09-26 9:45 ` Bruce Richardson
@ 2018-09-26 10:18 ` Luca Boccassi
2019-02-26 17:34 ` Thomas Monjalon
2019-02-19 15:07 ` Luca Boccassi
2 siblings, 1 reply; 5+ messages in thread
From: Luca Boccassi @ 2018-09-26 10:18 UTC (permalink / raw)
To: Bruce Richardson, dev
On Wed, 2018-09-26 at 10:15 +0100, Bruce Richardson wrote:
> Rather than relying on the target machine architecture, use the
> size of a pointer from the compiler to determine if we are 64-bits
> or not. This allows correct behaviour when you pass -m32 as a compile
> option. It also allows us to use this value repeatedly throughout the
> repo rather than continually testing for the sizeof(void*).
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> config/arm/meson.build | 3 +--
> config/meson.build | 5 ++++-
> config/ppc_64/meson.build | 4 +++-
> config/x86/meson.build | 3 +--
> drivers/net/sfc/meson.build | 2 +-
> lib/librte_bpf/meson.build | 2 +-
> lib/librte_kni/meson.build | 2 +-
> 7 files changed, 12 insertions(+), 9 deletions(-)
Tested-by: Luca Boccassi <bluca@debian.org>
Build-tested on ppc64 and arm64 native Debian sid hosts.
--
Kind regards,
Luca Boccassi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] build: set RTE_ARCH_64 based on pointer size
2018-09-26 9:15 [dpdk-dev] [PATCH] build: set RTE_ARCH_64 based on pointer size Bruce Richardson
2018-09-26 9:45 ` Bruce Richardson
2018-09-26 10:18 ` Luca Boccassi
@ 2019-02-19 15:07 ` Luca Boccassi
2 siblings, 0 replies; 5+ messages in thread
From: Luca Boccassi @ 2019-02-19 15:07 UTC (permalink / raw)
To: Bruce Richardson, dev
On Wed, 2018-09-26 at 10:15 +0100, Bruce Richardson wrote:
> Rather than relying on the target machine architecture, use the
> size of a pointer from the compiler to determine if we are 64-bits
> or not. This allows correct behaviour when you pass -m32 as a compile
> option. It also allows us to use this value repeatedly throughout the
> repo rather than continually testing for the sizeof(void*).
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> config/arm/meson.build | 3 +--
> config/meson.build | 5 ++++-
> config/ppc_64/meson.build | 4 +++-
> config/x86/meson.build | 3 +--
> drivers/net/sfc/meson.build | 2 +-
> lib/librte_bpf/meson.build | 2 +-
> lib/librte_kni/meson.build | 2 +-
> 7 files changed, 12 insertions(+), 9 deletions(-)
Acked-by: Luca Boccassi <bluca@debian.org>
--
Kind regards,
Luca Boccassi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] build: set RTE_ARCH_64 based on pointer size
2018-09-26 10:18 ` Luca Boccassi
@ 2019-02-26 17:34 ` Thomas Monjalon
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2019-02-26 17:34 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev, Luca Boccassi
26/09/2018 12:18, Luca Boccassi:
> On Wed, 2018-09-26 at 10:15 +0100, Bruce Richardson wrote:
> > Rather than relying on the target machine architecture, use the
> > size of a pointer from the compiler to determine if we are 64-bits
> > or not. This allows correct behaviour when you pass -m32 as a compile
> > option. It also allows us to use this value repeatedly throughout the
> > repo rather than continually testing for the sizeof(void*).
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > ---
> > config/arm/meson.build | 3 +--
> > config/meson.build | 5 ++++-
> > config/ppc_64/meson.build | 4 +++-
> > config/x86/meson.build | 3 +--
> > drivers/net/sfc/meson.build | 2 +-
> > lib/librte_bpf/meson.build | 2 +-
> > lib/librte_kni/meson.build | 2 +-
> > 7 files changed, 12 insertions(+), 9 deletions(-)
>
> Tested-by: Luca Boccassi <bluca@debian.org>
>
> Build-tested on ppc64 and arm64 native Debian sid hosts.
Rebased with new change in drivers/net/enic/meson.build,
and applied, thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-02-26 17:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-26 9:15 [dpdk-dev] [PATCH] build: set RTE_ARCH_64 based on pointer size Bruce Richardson
2018-09-26 9:45 ` Bruce Richardson
2018-09-26 10:18 ` Luca Boccassi
2019-02-26 17:34 ` Thomas Monjalon
2019-02-19 15:07 ` Luca Boccassi
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).