config: enable/disable drivers in Arm builds

Add support for enabling or disabling drivers for Arm cross build. Do
not implement any enable/disable lists yet.

Enabling drivers is useful when building for an SoC where we only want
to build a few drivers. That way the list won't be too long.

Similarly, disabling drivers is useful when we want to disable only a
few drivers.

Both of these are advantageous mainly in aarch64 -> aarch64 (or arch ->
same arch) builds, where the build machine may have the required driver
dependencies, yet we don't want to build drivers for a specific SoC.

If enable_drivers is a non-empty list, build only those drivers,
otherwise build all drivers and add them to enable_drivers.  If
disable_drivers is non-empty list, build all drivers specified in
enable_drivers except those in disable_drivers.

There are two drivers, bus/pci and bus/vdev, which break the build if
not enabled. Address this by always enabling these if the user disables
them or doesn't specify in their allowlist.

Also remove the old Makefile arm configuration options which don't do
anything in Meson.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
This commit is contained in:
Juraj Linkeš 2021-04-14 15:41:34 +02:00 committed by Thomas Monjalon
parent a6f88f7eb9
commit 2e33309ebe
7 changed files with 48 additions and 13 deletions

View File

@ -14,6 +14,7 @@
os.getenv('MESON_SUBDIR', '.'))
for path in sys.argv[1].split(','):
for p in iglob(os.path.join(root, path)):
if os.path.isdir(p):
print(os.path.relpath(p))
if path:
for p in iglob(os.path.join(root, path)):
if os.path.isdir(p):
print(os.path.relpath(p))

View File

@ -17,9 +17,6 @@ flags_common = [
# ['RTE_ARM64_MEMCPY_ALIGN_MASK', 0xF],
# ['RTE_ARM64_MEMCPY_STRICT_ALIGN', false],
['RTE_NET_FM10K', false],
['RTE_NET_AVP', false],
['RTE_SCHED_VECTOR', false],
['RTE_ARM_USE_WFE', false],
['RTE_ARCH_ARM64', true],
@ -126,7 +123,6 @@ implementer_cavium = {
['RTE_MACHINE', '"octeontx2"'],
['RTE_ARM_FEATURE_ATOMICS', true],
['RTE_USE_C11_MEM_MODEL', true],
['RTE_EAL_IGB_UIO', false],
['RTE_MAX_LCORE', 36],
['RTE_MAX_NUMA_NODES', 1]
]

View File

@ -63,6 +63,10 @@ if not is_windows
pmd_subdir_opt)
endif
# init disable/enable driver lists that will be populated in different places
disable_drivers = ''
enable_drivers = ''
# set the machine type and cflags for it
if meson.is_cross_build()
machine = host_machine.cpu()

View File

@ -234,3 +234,11 @@ There are other options you may specify in a cross file to tailor the build::
numa = false # set to false to force building for a non-NUMA system
# if not set or set to true, the build system will build for a NUMA
# system only if libnuma is installed
disable_drivers = 'bus/dpaa,crypto/*' # add disabled drivers
# valid values are dir/subdirs in the drivers directory
# wildcards are allowed
enable_drivers = 'common/*,bus/*' # build only these drivers
# valid values are dir/subdirs in the drivers directory
# wildcards are allowed

View File

@ -14,13 +14,13 @@ qat_compress = true
qat_compress_path = 'compress/qat'
qat_compress_relpath = '../../' + qat_compress_path
if disabled_drivers.contains(qat_crypto_path)
if disable_drivers.contains(qat_crypto_path)
qat_crypto = false
dpdk_drvs_disabled += qat_crypto_path
set_variable(qat_crypto_path.underscorify() + '_disable_reason',
'Explicitly disabled via build config')
endif
if disabled_drivers.contains(qat_compress_path)
if disable_drivers.contains(qat_compress_path)
qat_compress = false
dpdk_drvs_disabled += qat_compress_path
set_variable(qat_compress_path.underscorify() + '_disable_reason',

View File

@ -20,8 +20,25 @@ subdirs = [
'baseband', # depends on common and bus.
]
disabled_drivers = run_command(list_dir_globs, get_option('disable_drivers'),
).stdout().split()
if meson.is_cross_build()
disable_drivers += ',' + meson.get_cross_property('disable_drivers', '')
enable_drivers += ',' + meson.get_cross_property('enable_drivers', '')
endif
# add cmdline disabled drivers and meson disabled drivers together
disable_drivers += ',' + get_option('disable_drivers')
disable_drivers = run_command(list_dir_globs, disable_drivers).stdout().split()
# add cmdline enabled drivers and meson enabled drivers together
enable_drivers = ',' + get_option('enable_drivers')
enable_drivers = run_command(list_dir_globs, enable_drivers).stdout().split()
if enable_drivers.length() == 0
enable_drivers = run_command(list_dir_globs, '*/*').stdout().split()
endif
# these drivers must always be enabled, otherwise the build breaks
always_enable = ['bus/pci', 'bus/vdev']
enable_drivers += always_enable
default_cflags = machine_args
default_cflags += ['-DALLOW_EXPERIMENTAL_API']
@ -75,9 +92,16 @@ foreach subpath:subdirs
ext_deps = []
pkgconfig_extra_libs = []
if disabled_drivers.contains(drv_path)
if not enable_drivers.contains(drv_path)
build = false
reason = 'explicitly disabled via build config'
reason = 'not in enabled drivers build config'
elif disable_drivers.contains(drv_path)
if always_enable.contains(drv_path)
message('Driver @0@ cannot be disabled, not disabling.'.format(drv_path))
else
build = false
reason = 'explicitly disabled via build config'
endif
else
# pull in driver directory which should update all the local variables
subdir(drv_path)

View File

@ -10,6 +10,8 @@ option('drivers_install_subdir', type: 'string', value: 'dpdk/pmds-<VERSION>',
description: 'Subdirectory of libdir where to install PMDs. Defaults to using a versioned subdirectory.')
option('enable_docs', type: 'boolean', value: false,
description: 'build documentation')
option('enable_drivers', type: 'string', value: '',
description: 'Comma-separated list of drivers to build. If unspecified, build all drivers.')
option('enable_driver_sdk', type: 'boolean', value: false,
description: 'Install headers to build drivers.')
option('enable_kmods', type: 'boolean', value: false,