From: "Juraj Linkeš" <juraj.linkes@pantheon.tech>
To: bruce.richardson@intel.com
Cc: dev@dpdk.org, "Juraj Linkeš" <juraj.linkes@pantheon.tech>
Subject: [dpdk-dev] [PATCH] build: add arm 32bit cross compilation to Meson
Date: Thu, 9 Apr 2020 16:14:48 +0200 [thread overview]
Message-ID: <1586441688-29190-1-git-send-email-juraj.linkes@pantheon.tech> (raw)
* Add arm-linux-gnueabihf cross-file
* Add generic and default arm 32 bit flags to arm meson.build
* Add support for disabling drivers using flags defined in Meson
* Change checks from dpdk_conf.has() to dpdk.conf.get()
* When processing which drivers to build, check whether the
appropriate RTE flag isn't set to false
Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
app/test-pmd/meson.build | 4 +-
app/test/meson.build | 2 +-
config/arm/arm_armv7a_linux_gcc | 17 ++++
config/arm/meson.build | 157 +++++++++++++++++++++-------------
drivers/meson.build | 13 ++-
drivers/net/kni/meson.build | 2 +-
examples/ethtool/meson.build | 2 +-
examples/ioat/meson.build | 2 +-
examples/kni/meson.build | 2 +-
examples/vm_power_manager/meson.build | 4 +-
lib/librte_port/meson.build | 2 +-
lib/meson.build | 2 +-
12 files changed, 133 insertions(+), 76 deletions(-)
create mode 100644 config/arm/arm_armv7a_linux_gcc
diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build
index 6006c60f9..eac092d94 100644
--- a/app/test-pmd/meson.build
+++ b/app/test-pmd/meson.build
@@ -31,10 +31,10 @@ endif
if dpdk_conf.has('RTE_LIBRTE_BNXT_PMD')
deps += 'pmd_bnxt'
endif
-if dpdk_conf.has('RTE_LIBRTE_I40E_PMD')
+if dpdk_conf.has('RTE_LIBRTE_I40E_PMD') and dpdk_conf.get('RTE_LIBRTE_I40E_PMD')
deps += 'pmd_i40e'
endif
-if dpdk_conf.has('RTE_LIBRTE_IXGBE_PMD')
+if dpdk_conf.has('RTE_LIBRTE_IXGBE_PMD') and dpdk_conf.get('RTE_LIBRTE_IXGBE_PMD')
deps += 'pmd_ixgbe'
endif
if dpdk_conf.has('RTE_LIBRTE_SOFTNIC_PMD')
diff --git a/app/test/meson.build b/app/test/meson.build
index 351d29cb6..64d5d7bdb 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -348,7 +348,7 @@ endif
if dpdk_conf.has('RTE_LIBRTE_POWER')
test_deps += 'power'
endif
-if dpdk_conf.has('RTE_LIBRTE_KNI')
+if dpdk_conf.has('RTE_LIBRTE_KNI') and dpdk_conf.get('RTE_LIBRTE_KNI')
test_deps += 'kni'
endif
if dpdk_conf.has('RTE_LIBRTE_PDUMP')
diff --git a/config/arm/arm_armv7a_linux_gcc b/config/arm/arm_armv7a_linux_gcc
new file mode 100644
index 000000000..39566d2ea
--- /dev/null
+++ b/config/arm/arm_armv7a_linux_gcc
@@ -0,0 +1,17 @@
+[binaries]
+c = 'arm-linux-gnueabihf-gcc'
+cpp = 'arm-linux-gnueabihf-cpp'
+ar = 'arm-linux-gnueabihf-gcc-ar'
+strip = 'arm-linux-gnueabihf-strip'
+pkgconfig = 'arm-linux-gnueabihf-pkg-config'
+pcap-config = ''
+
+[host_machine]
+system = 'linux'
+cpu_family = 'arm'
+cpu = 'armv7-a'
+endian = 'little'
+
+[properties]
+implementor_id = 'generic_arm32'
+implementor_pn = 'default_arm32'
diff --git a/config/arm/meson.build b/config/arm/meson.build
index 6e75e6d97..d359f2e14 100644
--- a/config/arm/meson.build
+++ b/config/arm/meson.build
@@ -34,6 +34,11 @@ flags_generic = [
['RTE_MAX_LCORE', 256],
['RTE_USE_C11_MEM_MODEL', true],
['RTE_CACHE_LINE_SIZE', 128]]
+flags_generic_arm32 = [
+ ['RTE_MACHINE', '"armv7a"'],
+ ['RTE_MAX_LCORE', 128],
+ ['RTE_USE_C11_MEM_MODEL', false],
+ ['RTE_CACHE_LINE_SIZE', 64]]
flags_arm = [
['RTE_MACHINE', '"armv8a"'],
['RTE_MAX_LCORE', 16],
@@ -63,6 +68,32 @@ flags_armada = [
['RTE_MAX_LCORE', 16]]
flags_default_extra = []
+flags_default_arm32_extra = [
+ ['RTE_ARCH_ARM_NEON_MEMCPY', false],
+ ['RTE_FORCE_INTRINSICS', true],
+ ['RTE_ARCH_STRICT_ALIGN', true],
+ ['RTE_EAL_NUMA_AWARE_HUGEPAGES', false],
+ ['RTE_LIBRTE_VHOST_NUMA', false],
+ ['RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT', false],
+ ['RTE_LIBRTE_KNI', false],
+ ['RTE_LIBRTE_ARK_PMD', false],
+ ['RTE_LIBRTE_EM_PMD', false],
+ ['RTE_LIBRTE_IGB_PMD', false],
+ ['RTE_LIBRTE_CXGBE_PMD', false],
+ ['RTE_LIBRTE_E1000_PMD', false],
+ ['RTE_LIBRTE_ENIC_PMD', false],
+ ['RTE_LIBRTE_FM10K_PMD', false],
+ ['RTE_LIBRTE_I40E_PMD', false],
+ ['RTE_LIBRTE_IXGBE_PMD', false],
+ ['RTE_LIBRTE_VMXNET3_PMD', false],
+ ['RTE_LIBRTE_QEDE_PMD', false],
+ ['RTE_LIBRTE_SFC_EFX_PMD', false],
+ ['RTE_LIBRTE_AVP_PMD', false],
+ ['RTE_LIBRTE_NFP_PMD', false],
+ ['RTE_LIBRTE_HINIC_PMD', false],
+ ['RTE_LIBRTE_HNS3_PMD', false],
+ ['RTE_LIBRTE_PMD_IOAT_RAWDEV', false],
+ ['RTE_LIBRTE_IONIC_PMD', false]]
flags_n1sdp_extra = [
['RTE_MACHINE', '"n1sdp"'],
['RTE_MAX_NUMA_NODES', 1],
@@ -99,6 +130,9 @@ machine_args_generic = [
['0xd0b', ['-mcpu=cortex-a76']],
['0xd0c', ['-march=armv8.2-a+crc+crypto', '-mcpu=neoverse-n1'], flags_n1sdp_extra]]
+machine_args_generic_arm32 = [
+ ['default_arm32', ['-march=armv7-a', '-mtune=cortex-a9', '-mfpu=neon'], flags_default_arm32_extra]]
+
machine_args_cavium = [
['default', ['-march=armv8-a+crc+crypto','-mcpu=thunderx']],
['native', ['-march=native']],
@@ -114,6 +148,7 @@ machine_args_emag = [
## Arm implementer ID (ARM DDI 0487C.a, Section G7.2.106, Page G7-5321)
impl_generic = ['Generic armv8', flags_generic, machine_args_generic]
+impl_generic_arm32 = ['Generic armv7', flags_generic_arm32, machine_args_generic_arm32]
impl_0x41 = ['Arm', flags_arm, machine_args_generic]
impl_0x42 = ['Broadcom', flags_generic, machine_args_generic]
impl_0x43 = ['Cavium', flags_cavium, machine_args_cavium]
@@ -136,74 +171,74 @@ if not dpdk_conf.get('RTE_ARCH_64')
dpdk_conf.set('RTE_ARCH_ARMv7', 1)
# the minimum architecture supported, armv7-a, needs the following,
# mk/machine/armv7a/rte.vars.mk sets it too
- machine_args += '-mfpu=neon'
else
dpdk_conf.set('RTE_CACHE_LINE_SIZE', 128)
dpdk_conf.set('RTE_ARCH_ARM64', 1)
+endif
- machine = []
- cmd_generic = ['generic', '', '', 'default', '']
- cmd_output = cmd_generic # Set generic by default
- machine_args = [] # Clear previous machine args
- if arm_force_default_march and not meson.is_cross_build()
+machine = []
+machine_args = [] # Clear previous machine args
+cmd_generic = ['generic', '', '', 'default', '']
+cmd_output = cmd_generic # Set generic by default
+if arm_force_default_march and not meson.is_cross_build()
+ machine = impl_generic
+ impl_pn = 'default'
+elif not meson.is_cross_build()
+ # The script returns ['Implementer', 'Variant', 'Architecture',
+ # 'Primary Part number', 'Revision']
+ detect_vendor = find_program(join_paths(
+ meson.current_source_dir(), 'armv8_machine.py'))
+ cmd = run_command(detect_vendor.path())
+ if cmd.returncode() == 0
+ cmd_output = cmd.stdout().to_lower().strip().split(' ')
+ endif
+ # Set to generic if variable is not found
+ machine = get_variable('impl_' + cmd_output[0], ['generic'])
+ if machine[0] == 'generic'
machine = impl_generic
- impl_pn = 'default'
- elif not meson.is_cross_build()
- # The script returns ['Implementer', 'Variant', 'Architecture',
- # 'Primary Part number', 'Revision']
- detect_vendor = find_program(join_paths(
- meson.current_source_dir(), 'armv8_machine.py'))
- cmd = run_command(detect_vendor.path())
- if cmd.returncode() == 0
- cmd_output = cmd.stdout().to_lower().strip().split(' ')
- endif
- # Set to generic if variable is not found
- machine = get_variable('impl_' + cmd_output[0], ['generic'])
- if machine[0] == 'generic'
- machine = impl_generic
- cmd_output = cmd_generic
- endif
- impl_pn = cmd_output[3]
- if arm_force_native_march == true
- impl_pn = 'native'
- endif
- else
- impl_id = meson.get_cross_property('implementor_id', 'generic')
- impl_pn = meson.get_cross_property('implementor_pn', 'default')
- machine = get_variable('impl_' + impl_id)
+ cmd_output = cmd_generic
endif
-
- # Apply Common Defaults. These settings may be overwritten by machine
- # settings later.
- foreach flag: flags_common_default
- if flag.length() > 0
- dpdk_conf.set(flag[0], flag[1])
- endif
- endforeach
-
- message('Implementer : ' + machine[0])
- foreach flag: machine[1]
- if flag.length() > 0
- dpdk_conf.set(flag[0], flag[1])
- endif
- endforeach
-
- foreach marg: machine[2]
- if marg[0] == impl_pn
- foreach flag: marg[1]
- if cc.has_argument(flag)
- machine_args += flag
- endif
- endforeach
- # Apply any extra machine specific flags.
- foreach flag: marg.get(2, flags_default_extra)
- if flag.length() > 0
- dpdk_conf.set(flag[0], flag[1])
- endif
- endforeach
- endif
- endforeach
+ impl_pn = cmd_output[3]
+ if arm_force_native_march == true
+ impl_pn = 'native'
+ endif
+else
+ impl_id = meson.get_cross_property('implementor_id', 'generic')
+ impl_pn = meson.get_cross_property('implementor_pn', 'default')
+ machine = get_variable('impl_' + impl_id)
endif
+
+# Apply Common Defaults. These settings may be overwritten by machine
+# settings later.
+foreach flag: flags_common_default
+ if flag.length() > 0
+ dpdk_conf.set(flag[0], flag[1])
+ endif
+endforeach
+
+message('Implementer : ' + machine[0])
+foreach flag: machine[1]
+ if flag.length() > 0
+ dpdk_conf.set(flag[0], flag[1])
+ endif
+endforeach
+
+foreach marg: machine[2]
+ if marg[0] == impl_pn
+ foreach flag: marg[1]
+ if cc.has_argument(flag)
+ machine_args += flag
+ endif
+ endforeach
+ # Apply any extra machine specific flags.
+ foreach flag: marg.get(2, flags_default_extra)
+ if flag.length() > 0
+ dpdk_conf.set(flag[0], flag[1])
+ message('Setting flag: @0@: @1@'.format(flag[0], flag[1]))
+ endif
+ endforeach
+ endif
+endforeach
message(machine_args)
if (cc.get_define('__ARM_NEON', args: machine_args) != '' or
diff --git a/drivers/meson.build b/drivers/meson.build
index 5502bf992..5763752fc 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -71,6 +71,14 @@ foreach class:dpdk_driver_classes
reason = 'Explicitly disabled via build config'
endif
endforeach
+ if fmt_name == ''
+ fmt_name = name
+ endif
+ conf_flag = config_flag_fmt.format(fmt_name.to_upper())
+ if dpdk_conf.has(conf_flag) and not dpdk_conf.get(conf_flag)
+ build = false
+ reason = 'Explicitly disabled via build config'
+ endif
if build
# get dependency objs from strings
shared_deps = ext_deps
@@ -100,10 +108,7 @@ foreach class:dpdk_driver_classes
else
class_drivers += name
- if fmt_name == ''
- fmt_name = name
- endif
- dpdk_conf.set(config_flag_fmt.format(fmt_name.to_upper()),1)
+ dpdk_conf.set(conf_flag, true)
lib_name = driver_name_fmt.format(fmt_name)
if allow_experimental_apis
diff --git a/drivers/net/kni/meson.build b/drivers/net/kni/meson.build
index 0539b4768..79a16ae5b 100644
--- a/drivers/net/kni/meson.build
+++ b/drivers/net/kni/meson.build
@@ -2,7 +2,7 @@
# Copyright(c) 2018 Intel Corporation
# this driver can be built if-and-only-if KNI library is buildable
-build = dpdk_conf.has('RTE_LIBRTE_KNI')
+build = dpdk_conf.has('RTE_LIBRTE_KNI') and dpdk_conf.get('RTE_LIBRTE_KNI')
reason = 'missing dependency, DPDK KNI library'
sources = files('rte_eth_kni.c')
deps += 'kni'
diff --git a/examples/ethtool/meson.build b/examples/ethtool/meson.build
index bc7a35514..814b8ada1 100644
--- a/examples/ethtool/meson.build
+++ b/examples/ethtool/meson.build
@@ -13,7 +13,7 @@ sources = files('lib/rte_ethtool.c',
includes = include_directories('lib', 'ethtool-app')
deps += 'bus_pci'
-if dpdk_conf.has('RTE_LIBRTE_IXGBE_PMD')
+if dpdk_conf.has('RTE_LIBRTE_IXGBE_PMD') and dpdk_conf.get('RTE_LIBRTE_IXGBE_PMD')
deps += 'pmd_ixgbe'
endif
diff --git a/examples/ioat/meson.build b/examples/ioat/meson.build
index ed8328963..029126353 100644
--- a/examples/ioat/meson.build
+++ b/examples/ioat/meson.build
@@ -6,7 +6,7 @@
# To build this example as a standalone application with an already-installed
# DPDK instance, use 'make'
-build = dpdk_conf.has('RTE_LIBRTE_PMD_IOAT_RAWDEV')
+build = dpdk_conf.has('RTE_LIBRTE_PMD_IOAT_RAWDEV') and dpdk_conf.get('RTE_LIBRTE_PMD_IOAT_RAWDEV')
deps += ['rawdev_ioat']
diff --git a/examples/kni/meson.build b/examples/kni/meson.build
index fd6ae4442..d9514b155 100644
--- a/examples/kni/meson.build
+++ b/examples/kni/meson.build
@@ -7,7 +7,7 @@
# DPDK instance, use 'make'
# this app can be built if-and-only-if KNI library is buildable
-build = dpdk_conf.has('RTE_LIBRTE_KNI')
+build = dpdk_conf.has('RTE_LIBRTE_KNI') and dpdk_conf.get('RTE_LIBRTE_KNI')
deps += ['kni', 'bus_pci']
sources = files(
'main.c'
diff --git a/examples/vm_power_manager/meson.build b/examples/vm_power_manager/meson.build
index 20a4a05b3..9d591813c 100644
--- a/examples/vm_power_manager/meson.build
+++ b/examples/vm_power_manager/meson.build
@@ -17,11 +17,11 @@ if dpdk_conf.has('RTE_LIBRTE_BNXT_PMD')
deps += ['pmd_bnxt']
endif
-if dpdk_conf.has('RTE_LIBRTE_I40E_PMD')
+if dpdk_conf.has('RTE_LIBRTE_I40E_PMD') and dpdk_conf.get('RTE_LIBRTE_I40E_PMD')
deps += ['pmd_i40e']
endif
-if dpdk_conf.has('RTE_LIBRTE_IXGBE_PMD')
+if dpdk_conf.has('RTE_LIBRTE_IXGBE_PMD') and dpdk_conf.get('RTE_LIBRTE_IXGBE_PMD')
deps += ['pmd_ixgbe']
endif
diff --git a/lib/librte_port/meson.build b/lib/librte_port/meson.build
index 0d5ede44a..5f3d190fa 100644
--- a/lib/librte_port/meson.build
+++ b/lib/librte_port/meson.build
@@ -28,7 +28,7 @@ if dpdk_conf.has('RTE_PORT_PCAP')
ext_deps += pcap_dep # dependency provided in config/meson.build
endif
-if dpdk_conf.has('RTE_LIBRTE_KNI')
+if dpdk_conf.has('RTE_LIBRTE_KNI') and dpdk_conf.get('RTE_LIBRTE_KNI')
sources += files('rte_port_kni.c')
headers += files('rte_port_kni.h')
deps += 'kni'
diff --git a/lib/meson.build b/lib/meson.build
index 9c3cc55d5..59ccfed9d 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -86,7 +86,7 @@ foreach l:libraries
set_variable(name.underscorify() + '_disable_reason', reason)
else
enabled_libs += name
- dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1)
+ dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), true)
install_headers(headers)
libname = 'rte_' + name
--
2.11.0
NOTES: tested here: https://travis-ci.com/github/jlinkes/dpdk/builds/159597484
There are two issues I would like to get feedback for:
1. the aarch64 -> arm cross compilation fails when compiling l3fwd example [0].
I think this failure needs to be fixed by arm devs, but I would like to have
this confirmed.
2. the patch breaks ABI checks on aarch64 [1]. The reason is that the
RTE_LIBRTE_FM10K_PMD and RTE_LIBRTE_AVP_PMD flags in config/arm/meson.build
get properly applied, the libs don't get built and then check the fails when
it doesn't find them. I don't know whether the application of these flags is
desirable (and we would need to fix the ABI check) or whether we should
remove the flags.
[0] https://travis-ci.com/github/jlinkes/dpdk/jobs/317622662#L2672
[1] https://travis-ci.com/github/jlinkes/dpdk/jobs/317622661#L4488
next reply other threads:[~2020-04-09 14:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-09 14:14 Juraj Linkeš [this message]
2020-04-10 9:46 ` Bruce Richardson
2020-04-14 6:48 ` Juraj Linkeš
2020-04-13 6:23 ` Ruifeng Wang
2020-04-14 7:05 ` Juraj Linkeš
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=1586441688-29190-1-git-send-email-juraj.linkes@pantheon.tech \
--to=juraj.linkes@pantheon.tech \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
/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).