build: use platform for generic and native builds
The current meson option 'machine' should only specify the ISA, which is not sufficient for Arm, where setting ISA implies other settings as well (and is used in Arm configuration as such). Use the existing 'platform' meson option to differentiate the type of the build (native/generic) and set ISA accordingly, unless the user chooses to override it with a new option, 'cpu_instruction_set'. The 'machine' option set the ISA in x86 builds and set native/default 'build type' in aarch64 builds. These two new variables, 'platform' and 'cpu_instruction_set', now properly set both ISA and build type for all architectures in a uniform manner. The 'machine' option also doesn't describe very well what it sets. The new option, 'cpu_instruction_set', is much more descriptive. Keep 'machine' for backwards compatibility. Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
This commit is contained in:
parent
5898abedeb
commit
bf66003b51
@ -380,19 +380,23 @@ if dpdk_conf.get('RTE_ARCH_32')
|
||||
machine_args += '-mfpu=neon'
|
||||
else
|
||||
# aarch64 build
|
||||
soc = get_option('platform')
|
||||
soc_config = {}
|
||||
if not meson.is_cross_build()
|
||||
if machine == 'generic'
|
||||
# generic build
|
||||
if soc != ''
|
||||
error('Building for a particular platform is unsupported with generic build.')
|
||||
# for backwards compatibility:
|
||||
# machine=native is the same behavior as soc=native
|
||||
# machine=generic/default is the same as soc=generic
|
||||
# cpu_instruction_set holds the proper value - native, generic or cpu
|
||||
# the old behavior only distinguished between generic and native build
|
||||
if machine != 'auto'
|
||||
if cpu_instruction_set == 'generic'
|
||||
soc = 'generic'
|
||||
else
|
||||
soc = 'native'
|
||||
endif
|
||||
implementer_id = 'generic'
|
||||
part_number = 'generic'
|
||||
elif soc != ''
|
||||
soc_config = socs.get(soc, {'not_supported': true})
|
||||
else
|
||||
soc = platform
|
||||
endif
|
||||
if soc == 'native'
|
||||
# native build
|
||||
# The script returns ['Implementer', 'Variant', 'Architecture',
|
||||
# 'Primary Part number', 'Revision']
|
||||
@ -406,6 +410,9 @@ else
|
||||
else
|
||||
error('Error when getting Arm Implementer ID and part number.')
|
||||
endif
|
||||
else
|
||||
# SoC build
|
||||
soc_config = socs.get(soc, {'not_supported': true})
|
||||
endif
|
||||
else
|
||||
# cross build
|
||||
@ -437,7 +444,7 @@ else
|
||||
else
|
||||
error('Unsupported Arm implementer: @0@. '.format(implementer_id) +
|
||||
'Please add support for it or use the generic ' +
|
||||
'(-Dmachine=generic) build.')
|
||||
'(-Dplatform=generic) build.')
|
||||
endif
|
||||
|
||||
message('Arm implementer: ' + implementer_config['description'])
|
||||
@ -452,7 +459,7 @@ else
|
||||
error('Unsupported part number @0@ of implementer @1@. '
|
||||
.format(part_number, implementer_id) +
|
||||
'Please add support for it or use the generic ' +
|
||||
'(-Dmachine=generic) build.')
|
||||
'(-Dplatform=generic) build.')
|
||||
endif
|
||||
|
||||
# add/overwrite flags in the proper order
|
||||
|
@ -65,43 +65,68 @@ endif
|
||||
disable_drivers = ''
|
||||
enable_drivers = ''
|
||||
|
||||
# set the machine type and cflags for it
|
||||
platform = get_option('platform')
|
||||
|
||||
# set the cpu_instruction_set and cflags for it
|
||||
if meson.is_cross_build()
|
||||
machine = host_machine.cpu()
|
||||
cpu_instruction_set = host_machine.cpu()
|
||||
else
|
||||
cpu_instruction_set = get_option('cpu_instruction_set')
|
||||
machine = get_option('machine')
|
||||
if machine != 'auto'
|
||||
warning('The "machine" option is deprecated. ' +
|
||||
'Please use "cpu_instruction_set" instead.')
|
||||
if cpu_instruction_set != 'auto'
|
||||
error('Setting both "machine" and ' +
|
||||
'"cpu_instruction_set" is unsupported.')
|
||||
endif
|
||||
cpu_instruction_set = machine
|
||||
if cpu_instruction_set == 'default'
|
||||
cpu_instruction_set = 'generic'
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# machine type 'generic' is special, it selects the per arch agreed common
|
||||
# minimal baseline needed for DPDK. Machine type 'default' is also supported
|
||||
# with the same meaning for backwards compatibility.
|
||||
if platform == 'native'
|
||||
if cpu_instruction_set == 'auto'
|
||||
cpu_instruction_set = 'native'
|
||||
endif
|
||||
elif platform == 'generic'
|
||||
if cpu_instruction_set == 'auto'
|
||||
cpu_instruction_set = 'generic'
|
||||
endif
|
||||
endif
|
||||
|
||||
# cpu_instruction_set 'generic' is special, it selects the per arch agreed
|
||||
# common minimal baseline needed for DPDK. cpu_instruction_set 'default' is
|
||||
# also supported with the same meaning for backwards compatibility.
|
||||
# That might not be the most optimized, but the most portable version while
|
||||
# still being able to support the CPU features required for DPDK.
|
||||
# This can be bumped up by the DPDK project, but it can never be an
|
||||
# invariant like 'native'
|
||||
if machine == 'default' or machine == 'generic'
|
||||
if cpu_instruction_set == 'generic'
|
||||
if host_machine.cpu_family().startswith('x86')
|
||||
# matches the old pre-meson build systems generic machine
|
||||
machine = 'corei7'
|
||||
# matches the old pre-meson build systems generic cpu_instruction_set
|
||||
cpu_instruction_set = 'corei7'
|
||||
elif host_machine.cpu_family().startswith('arm')
|
||||
machine = 'armv7-a'
|
||||
cpu_instruction_set = 'armv7-a'
|
||||
elif host_machine.cpu_family().startswith('aarch')
|
||||
# arm64 manages generic config in config/arm/meson.build
|
||||
machine = 'generic'
|
||||
cpu_instruction_set = 'generic'
|
||||
elif host_machine.cpu_family().startswith('ppc')
|
||||
machine = 'power8'
|
||||
cpu_instruction_set = 'power8'
|
||||
endif
|
||||
endif
|
||||
|
||||
dpdk_conf.set('RTE_MACHINE', machine)
|
||||
dpdk_conf.set('RTE_MACHINE', cpu_instruction_set)
|
||||
machine_args = []
|
||||
|
||||
# ppc64 does not support -march= at all, use -mcpu and -mtune for that
|
||||
if host_machine.cpu_family().startswith('ppc')
|
||||
machine_args += '-mcpu=' + machine
|
||||
machine_args += '-mtune=' + machine
|
||||
machine_args += '-mcpu=' + cpu_instruction_set
|
||||
machine_args += '-mtune=' + cpu_instruction_set
|
||||
else
|
||||
machine_args += '-march=' + machine
|
||||
machine_args += '-march=' + cpu_instruction_set
|
||||
endif
|
||||
|
||||
toolchain = cc.get_id()
|
||||
|
@ -12,7 +12,7 @@ dpdk_conf.set('RTE_ARCH_PPC_64', 1)
|
||||
# is used, resulting in a build failure.
|
||||
power9_supported = cc.has_argument('-mcpu=power9')
|
||||
if not power9_supported
|
||||
machine = 'power8'
|
||||
cpu_instruction_set = 'power8'
|
||||
machine_args = ['-mcpu=power8', '-mtune=power8']
|
||||
dpdk_conf.set('RTE_MACHINE','power8')
|
||||
endif
|
||||
|
@ -223,12 +223,12 @@ done
|
||||
# test compilation with minimal x86 instruction set
|
||||
# Set the install path for libraries to "lib" explicitly to prevent problems
|
||||
# with pkg-config prefixes if installed in "lib/x86_64-linux-gnu" later.
|
||||
generic_machine='nehalem'
|
||||
if ! check_cc_flags "-march=$generic_machine" ; then
|
||||
generic_machine='corei7'
|
||||
generic_isa='nehalem'
|
||||
if ! check_cc_flags "-march=$generic_isa" ; then
|
||||
generic_isa='corei7'
|
||||
fi
|
||||
build build-x86-generic cc skipABI -Dcheck_includes=true \
|
||||
-Dlibdir=lib -Dmachine=$generic_machine $use_shared
|
||||
-Dlibdir=lib -Dcpu_instruction_set=$generic_isa $use_shared
|
||||
|
||||
# 32-bit with default compiler
|
||||
if check_cc_flags '-m32' ; then
|
||||
|
@ -89,7 +89,36 @@ to a regular "debug" build, you can either:
|
||||
* run ``meson configure -Dbuildtype=debug`` inside the build folder after the initial meson run.
|
||||
|
||||
Other options are specific to the DPDK project but can be adjusted similarly.
|
||||
To set the "max_lcores" value to 256, for example, you can either:
|
||||
The "platform" option specifies a set a configuration parameters that will be used.
|
||||
The valid values are:
|
||||
|
||||
* ``-Dplatform=native`` will tailor the configuration to the build machine.
|
||||
|
||||
* ``-Dplatform=generic`` will use configuration that works on all machines
|
||||
of the same architecture as the build machine.
|
||||
|
||||
* ``-Dplatform=<SoC>`` will use configuration optimized for a particular SoC.
|
||||
Consult the "socs" dictionary in ``config/arm/meson.build`` to see which
|
||||
SoCs are supported.
|
||||
|
||||
The instruction set will be set automatically by default according to these rules:
|
||||
|
||||
* ``-Dplatform=native`` sets ``cpu_instruction_set`` to ``native``,
|
||||
which configures ``-march`` (x86_64), ``-mcpu`` (ppc), ``-mtune`` (ppc) to ``native``.
|
||||
|
||||
* ``-Dplatform=generic`` sets ``cpu_instruction_set`` to ``generic``,
|
||||
which configures ``-march`` (x86_64), ``-mcpu`` (ppc), ``-mtune`` (ppc) to
|
||||
a common minimal baseline needed for DPDK.
|
||||
|
||||
To override what instruction set will be used, set the ``cpu_instruction_set``
|
||||
parameter to the instruction set of your choice (such as ``corei7``, ``power8``, etc.).
|
||||
|
||||
``cpu_instruction_set`` is not used in Arm builds, as setting the instruction set
|
||||
without other parameters leads to inferior builds. The way to tailor Arm builds
|
||||
is to build for a SoC using ``-Dplatform=<SoC>`` mentioned above.
|
||||
|
||||
The values determined by the ``platform`` parameter may be overwritten.
|
||||
For example, to set the ``max_lcores`` value to 256, you can either:
|
||||
|
||||
* pass ``-Dmax_lcores=256`` to meson when configuring the build folder initially
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
option('check_includes', type: 'boolean', value: false, description:
|
||||
'build "chkincs" to verify each header file can compile alone')
|
||||
option('cpu_instruction_set', type: 'string', value: 'auto',
|
||||
description: 'Set the target machine ISA (instruction set architecture). Will be set according to the platform option by default.')
|
||||
option('developer_mode', type: 'feature', description:
|
||||
'turn on additional build checks relevant for DPDK developers')
|
||||
option('disable_drivers', type: 'string', value: '', description:
|
||||
@ -28,16 +30,16 @@ option('include_subdir_arch', type: 'string', value: '', description:
|
||||
'subdirectory where to install arch-dependent headers')
|
||||
option('kernel_dir', type: 'string', value: '', description:
|
||||
'Path to the kernel for building kernel modules. Headers must be in $kernel_dir or $kernel_dir/build. Modules will be installed in /lib/modules.')
|
||||
option('machine', type: 'string', value: 'native', description:
|
||||
'set the target machine type or "generic", a build usable on all machines of the build machine architecture or "native", which lets the compiler pick the architecture of the build machine.')
|
||||
option('machine', type: 'string', value: 'auto', description:
|
||||
'Alias of cpu_instruction_set.')
|
||||
option('max_ethports', type: 'integer', value: 32, description:
|
||||
'maximum number of Ethernet devices')
|
||||
option('max_lcores', type: 'integer', value: 128, description:
|
||||
'maximum number of cores/threads supported by EAL')
|
||||
option('max_numa_nodes', type: 'integer', value: 32, description:
|
||||
'maximum number of NUMA nodes supported by EAL')
|
||||
option('platform', type: 'string', value: '', description:
|
||||
'use configuration for a particular platform (such as a SoC).')
|
||||
option('platform', type: 'string', value: 'native', description:
|
||||
'Platform to build, either "native", "generic" or a SoC. Please refer to the Linux build guide for more information.')
|
||||
option('enable_trace_fp', type: 'boolean', value: false, description:
|
||||
'enable fast path trace points.')
|
||||
option('tests', type: 'boolean', value: true, description:
|
||||
|
Loading…
Reference in New Issue
Block a user