1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017 Intel Corporation.
3 # Copyright(c) 2017 Cavium, Inc
4 # Copyright(c) 2021 PANTHEON.tech s.r.o.
6 # common flags to all aarch64 builds, with lowest priority
8 # Accelerate rte_memcpy. Be sure to run unit test (memcpy_perf_autotest)
9 # to determine the best threshold in code. Refer to notes in source file
10 # (lib/eal/arm/include/rte_memcpy_64.h) for more info.
11 ['RTE_ARCH_ARM64_MEMCPY', false],
12 # ['RTE_ARM64_MEMCPY_ALIGNED_THRESHOLD', 2048],
13 # ['RTE_ARM64_MEMCPY_UNALIGNED_THRESHOLD', 512],
14 # Leave below RTE_ARM64_MEMCPY_xxx options commented out,
15 # unless there are strong reasons.
16 # ['RTE_ARM64_MEMCPY_SKIP_GCC_VER_CHECK', false],
17 # ['RTE_ARM64_MEMCPY_ALIGN_MASK', 0xF],
18 # ['RTE_ARM64_MEMCPY_STRICT_ALIGN', false],
20 ['RTE_SCHED_VECTOR', false],
21 ['RTE_ARM_USE_WFE', false],
22 ['RTE_ARCH_ARM64', true],
23 ['RTE_CACHE_LINE_SIZE', 128]
26 ## Part numbers are specific to Arm implementers
27 # implementer specific armv8 flags have middle priority
28 # (will overwrite common flags)
29 # part number specific armv8 flags have higher priority
30 # (will overwrite both common and implementer specific flags)
31 implementer_generic = {
32 'description': 'Generic armv8',
34 ['RTE_MACHINE', '"armv8a"'],
35 ['RTE_USE_C11_MEM_MODEL', true],
36 ['RTE_MAX_LCORE', 256],
37 ['RTE_MAX_NUMA_NODES', 4]
39 'part_number_config': {
42 'march_features': ['crc'],
43 'compiler_options': ['-moutline-atomics']
47 'compiler_options': ['-mfpu=neon'],
49 ['RTE_ARCH_ARM_NEON_MEMCPY', false],
50 ['RTE_ARCH_STRICT_ALIGN', true],
51 ['RTE_ARCH_ARMv8_AARCH32', true],
52 ['RTE_CACHE_LINE_SIZE', 64]
58 part_number_config_arm = {
59 '0xd03': {'compiler_options': ['-mcpu=cortex-a53']},
60 '0xd04': {'compiler_options': ['-mcpu=cortex-a35']},
61 '0xd07': {'compiler_options': ['-mcpu=cortex-a57']},
62 '0xd08': {'compiler_options': ['-mcpu=cortex-a72']},
63 '0xd09': {'compiler_options': ['-mcpu=cortex-a73']},
64 '0xd0a': {'compiler_options': ['-mcpu=cortex-a75']},
65 '0xd0b': {'compiler_options': ['-mcpu=cortex-a76']},
68 'march_features': ['crypto'],
69 'compiler_options': ['-mcpu=neoverse-n1'],
71 ['RTE_MACHINE', '"neoverse-n1"'],
72 ['RTE_ARM_FEATURE_ATOMICS', true],
73 ['RTE_MAX_MEM_MB', 1048576],
74 ['RTE_MAX_LCORE', 160],
75 ['RTE_MAX_NUMA_NODES', 2]
80 'march_features': ['sve2'],
82 ['RTE_MACHINE', '"neoverse-n2"'],
83 ['RTE_ARM_FEATURE_ATOMICS', true],
84 ['RTE_MAX_LCORE', 64],
85 ['RTE_MAX_NUMA_NODES', 1]
92 ['RTE_MACHINE', '"armv8a"'],
93 ['RTE_USE_C11_MEM_MODEL', true],
94 ['RTE_CACHE_LINE_SIZE', 64],
95 ['RTE_MAX_LCORE', 64],
96 ['RTE_MAX_NUMA_NODES', 4]
98 'part_number_config': part_number_config_arm
101 flags_part_number_thunderx = [
102 ['RTE_MACHINE', '"thunderx"'],
103 ['RTE_USE_C11_MEM_MODEL', false]
105 implementer_cavium = {
106 'description': 'Cavium',
108 ['RTE_MAX_VFIO_GROUPS', 128],
109 ['RTE_MAX_LCORE', 96],
110 ['RTE_MAX_NUMA_NODES', 2]
112 'part_number_config': {
114 'compiler_options': ['-mcpu=thunderxt88'],
115 'flags': flags_part_number_thunderx
118 'compiler_options': ['-mcpu=thunderxt81'],
119 'flags': flags_part_number_thunderx
122 'compiler_options': ['-mcpu=thunderxt83'],
123 'flags': flags_part_number_thunderx
126 'march': 'armv8.1-a',
127 'march_features': ['crc', 'crypto'],
128 'compiler_options': ['-mcpu=thunderx2t99'],
130 ['RTE_MACHINE', '"thunderx2"'],
131 ['RTE_ARM_FEATURE_ATOMICS', true],
132 ['RTE_USE_C11_MEM_MODEL', true],
133 ['RTE_CACHE_LINE_SIZE', 64],
134 ['RTE_MAX_LCORE', 256]
138 'march': 'armv8.2-a',
139 'march_features': ['crc', 'crypto', 'lse'],
140 'compiler_options': ['-mcpu=octeontx2'],
142 ['RTE_MACHINE', '"cn9k"'],
143 ['RTE_ARM_FEATURE_ATOMICS', true],
144 ['RTE_USE_C11_MEM_MODEL', true],
145 ['RTE_MAX_LCORE', 36],
146 ['RTE_MAX_NUMA_NODES', 1]
152 implementer_ampere = {
153 'description': 'Ampere Computing',
155 ['RTE_MACHINE', '"emag"'],
156 ['RTE_CACHE_LINE_SIZE', 64],
157 ['RTE_MAX_LCORE', 32],
158 ['RTE_MAX_NUMA_NODES', 1]
160 'part_number_config': {
163 'march_features': ['crc', 'crypto'],
164 'compiler_options': ['-mtune=emag']
169 implementer_hisilicon = {
170 'description': 'HiSilicon',
172 ['RTE_USE_C11_MEM_MODEL', true],
173 ['RTE_CACHE_LINE_SIZE', 128]
175 'part_number_config': {
177 'march': 'armv8.2-a',
178 'march_features': ['crypto'],
179 'compiler_options': ['-mtune=tsv110'],
181 ['RTE_MACHINE', '"Kunpeng 920"'],
182 ['RTE_ARM_FEATURE_ATOMICS', true],
183 ['RTE_MAX_LCORE', 256],
184 ['RTE_MAX_NUMA_NODES', 8]
188 'march': 'armv8.2-a',
189 'march_features': ['crypto', 'sve'],
191 ['RTE_MACHINE', '"Kunpeng 930"'],
192 ['RTE_ARM_FEATURE_ATOMICS', true],
193 ['RTE_MAX_LCORE', 1280],
194 ['RTE_MAX_NUMA_NODES', 16]
200 implementer_qualcomm = {
201 'description': 'Qualcomm',
203 ['RTE_MACHINE', '"armv8a"'],
204 ['RTE_USE_C11_MEM_MODEL', true],
205 ['RTE_CACHE_LINE_SIZE', 64],
206 ['RTE_MAX_LCORE', 64],
207 ['RTE_MAX_NUMA_NODES', 1]
209 'part_number_config': {
212 'march_features': ['crc']
216 'march_features': ['crc']
221 ## Arm implementers (ID from MIDR in Arm Architecture Reference Manual)
223 'generic': implementer_generic,
224 '0x41': implementer_arm,
225 '0x43': implementer_cavium,
226 '0x48': implementer_hisilicon,
227 '0x50': implementer_ampere,
228 '0x51': implementer_qualcomm
231 # SoC specific armv8 flags have the highest priority
232 # (will overwrite all other flags)
234 'description': 'Generic un-optimized build for armv8 aarch64 exec mode',
235 'implementer': 'generic',
236 'part_number': 'generic'
239 soc_generic_aarch32 = {
240 'description': 'Generic un-optimized build for armv8 aarch32 exec mode',
241 'implementer': 'generic',
242 'part_number': 'generic_aarch32'
246 'description': 'Marvell ARMADA',
247 'implementer': '0x41',
248 'part_number': '0xd08',
250 ['RTE_MAX_LCORE', 16],
251 ['RTE_MAX_NUMA_NODES', 1]
257 'description': 'NVIDIA BlueField',
258 'implementer': '0x41',
259 'part_number': '0xd08',
261 ['RTE_MAX_LCORE', 16],
262 ['RTE_MAX_NUMA_NODES', 1]
268 'description': 'Qualcomm Centriq 2400',
269 'implementer': '0x51',
270 'part_number': '0xc00',
275 'description' : 'Marvell OCTEON 10',
276 'implementer' : '0x41',
278 ['RTE_MAX_LCORE', 24],
279 ['RTE_MAX_NUMA_NODES', 1]
281 'part_number': '0xd49',
282 'extra_march_features': ['crypto'],
287 'description': 'NXP DPAA',
288 'implementer': '0x41',
289 'part_number': '0xd08',
291 ['RTE_MACHINE', '"dpaa"'],
292 ['RTE_LIBRTE_DPAA2_USE_PHYS_IOVA', false],
293 ['RTE_MAX_LCORE', 16],
294 ['RTE_MAX_NUMA_NODES', 1]
300 'description': 'Ampere eMAG',
301 'implementer': '0x50',
306 'description': 'AWS Graviton2',
307 'implementer': '0x41',
308 'part_number': '0xd0c',
313 'description': 'HiSilicon Kunpeng 920',
314 'implementer': '0x48',
315 'part_number': '0xd01',
320 'description': 'HiSilicon Kunpeng 930',
321 'implementer': '0x48',
322 'part_number': '0xd02',
327 'description': 'Arm Neoverse N1SDP',
328 'implementer': '0x41',
329 'part_number': '0xd0c',
337 'description': 'Arm Neoverse N2',
338 'implementer': '0x41',
339 'part_number': '0xd49',
344 'description': 'Marvell OCTEON 9',
345 'implementer': '0x43',
346 'part_number': '0xb2',
351 'description': 'Broadcom Stingray',
352 'implementer': '0x41',
354 ['RTE_MAX_LCORE', 16],
355 ['RTE_MAX_NUMA_NODES', 1]
357 'part_number': '0xd08',
362 'description': 'Marvell ThunderX2 T99',
363 'implementer': '0x43',
364 'part_number': '0xaf'
368 'description': 'Marvell ThunderX T88',
369 'implementer': '0x43',
370 'part_number': '0xa1'
375 generic: Generic un-optimized build for armv8 aarch64 execution mode.
376 generic_aarch32: Generic un-optimized build for armv8 aarch32 execution mode.
377 armada: Marvell ARMADA
378 bluefield: NVIDIA BlueField
379 centriq2400: Qualcomm Centriq 2400
380 cn9k: Marvell OCTEON 9
381 cn10k: Marvell OCTEON 10
384 graviton2: AWS Graviton2
385 kunpeng920: HiSilicon Kunpeng 920
386 kunpeng930: HiSilicon Kunpeng 930
387 n1sdp: Arm Neoverse N1SDP
389 stingray: Broadcom Stingray
390 thunderx2: Marvell ThunderX2 T99
391 thunderxt88: Marvell ThunderX T88
394 # The string above is included in the documentation, keep it in sync with the
397 'generic': soc_generic,
398 'generic_aarch32': soc_generic_aarch32,
399 'armada': soc_armada,
400 'bluefield': soc_bluefield,
401 'centriq2400': soc_centriq2400,
406 'graviton2': soc_graviton2,
407 'kunpeng920': soc_kunpeng920,
408 'kunpeng930': soc_kunpeng930,
411 'stingray': soc_stingray,
412 'thunderx2': soc_thunderx2,
413 'thunderxt88': soc_thunderxt88
416 dpdk_conf.set('RTE_ARCH_ARM', 1)
417 dpdk_conf.set('RTE_FORCE_INTRINSICS', 1)
421 if dpdk_conf.get('RTE_ARCH_32')
423 dpdk_conf.set('RTE_CACHE_LINE_SIZE', 64)
424 if meson.is_cross_build()
426 soc = meson.get_cross_property('platform', '')
428 error('Arm SoC must be specified in the cross file.')
430 soc_config = socs.get(soc, {'not_supported': true})
434 dpdk_conf.set('RTE_ARCH_ARMv7', true)
435 # the minimum architecture supported, armv7-a, needs the following,
436 machine_args += '-mfpu=neon'
442 if not meson.is_cross_build()
443 # for backwards compatibility:
444 # machine=native is the same behavior as soc=native
445 # machine=generic/default is the same as soc=generic
446 # cpu_instruction_set holds the proper value - native, generic or cpu
447 # the old behavior only distinguished between generic and native build
449 if cpu_instruction_set == 'generic'
459 # The script returns ['Implementer', 'Variant', 'Architecture',
460 # 'Primary Part number', 'Revision']
461 detect_vendor = find_program(join_paths(meson.current_source_dir(),
463 cmd = run_command(detect_vendor.path())
464 if cmd.returncode() == 0
465 cmd_output = cmd.stdout().to_lower().strip().split(' ')
466 implementer_id = cmd_output[0]
467 part_number = cmd_output[3]
469 error('Error when getting Arm Implementer ID and part number.')
473 soc_config = socs.get(soc, {'not_supported': true})
477 soc = meson.get_cross_property('platform', '')
479 error('Arm SoC must be specified in the cross file.')
481 soc_config = socs.get(soc, {'not_supported': true})
486 if soc_config.has_key('not_supported')
487 error('SoC @0@ not supported.'.format(soc))
488 elif soc_config != {}
489 implementer_id = soc_config['implementer']
490 implementer_config = implementers[implementer_id]
491 part_number = soc_config['part_number']
492 soc_flags = soc_config.get('flags', [])
493 if not soc_config.get('numa', true)
497 disable_drivers += ',' + soc_config.get('disable_drivers', '')
498 enable_drivers += ',' + soc_config.get('enable_drivers', '')
501 if implementers.has_key(implementer_id)
502 implementer_config = implementers[implementer_id]
504 error('Unsupported Arm implementer: @0@. '.format(implementer_id) +
505 'Please add support for it or use the generic ' +
506 '(-Dplatform=generic) build.')
509 message('Arm implementer: ' + implementer_config['description'])
510 message('Arm part number: ' + part_number)
512 part_number_config = implementer_config['part_number_config']
513 if part_number_config.has_key(part_number)
514 # use the specified part_number machine args if found
515 part_number_config = part_number_config[part_number]
517 # unknown part number
518 error('Unsupported part number @0@ of implementer @1@. '
519 .format(part_number, implementer_id) +
520 'Please add support for it or use the generic ' +
521 '(-Dplatform=generic) build.')
524 # add/overwrite flags in the proper order
525 dpdk_flags = flags_common + implementer_config['flags'] + part_number_config.get('flags', []) + soc_flags
527 machine_args = [] # Clear previous machine args
529 # probe supported archs and their features
531 if part_number_config.has_key('march')
532 supported_marchs = ['armv8.6-a', 'armv8.5-a', 'armv8.4-a', 'armv8.3-a',
533 'armv8.2-a', 'armv8.1-a', 'armv8-a']
534 check_compiler_support = false
535 foreach supported_march: supported_marchs
536 if supported_march == part_number_config['march']
537 # start checking from this version downwards
538 check_compiler_support = true
540 if (check_compiler_support and
541 cc.has_argument('-march=' + supported_march))
542 candidate_march = supported_march
543 # highest supported march version found
547 if candidate_march == ''
548 error('No suitable armv8 march version found.')
550 if candidate_march != part_number_config['march']
551 warning('Configuration march version is ' +
552 '@0@, but the compiler supports only @1@.'
553 .format(part_number_config['march'], candidate_march))
555 candidate_march = '-march=' + candidate_march
558 if part_number_config.has_key('march_features')
559 march_features += part_number_config['march_features']
561 if soc_config.has_key('extra_march_features')
562 march_features += soc_config['extra_march_features']
564 foreach feature: march_features
565 if cc.has_argument('+'.join([candidate_march, feature]))
566 candidate_march = '+'.join([candidate_march, feature])
568 warning('The compiler does not support feature @0@'
572 machine_args += candidate_march
575 # apply supported compiler options
576 if part_number_config.has_key('compiler_options')
577 foreach flag: part_number_config['compiler_options']
578 if cc.has_argument(flag)
581 warning('Configuration compiler option ' +
582 '@0@ isn\'t supported.'.format(flag))
588 foreach flag: dpdk_flags
590 dpdk_conf.set(flag[0], flag[1])
594 message('Using machine args: @0@'.format(machine_args))
596 if (cc.get_define('__ARM_NEON', args: machine_args) != '' or
597 cc.get_define('__aarch64__', args: machine_args) != '')
598 compile_time_cpuflags += ['RTE_CPUFLAG_NEON']
601 if cc.get_define('__ARM_FEATURE_SVE', args: machine_args) != ''
602 compile_time_cpuflags += ['RTE_CPUFLAG_SVE']
603 if (cc.check_header('arm_sve.h'))
604 dpdk_conf.set('RTE_HAS_SVE_ACLE', 1)
608 if cc.get_define('__ARM_FEATURE_CRC32', args: machine_args) != ''
609 compile_time_cpuflags += ['RTE_CPUFLAG_CRC32']
612 if cc.get_define('__ARM_FEATURE_CRYPTO', args: machine_args) != ''
613 compile_time_cpuflags += ['RTE_CPUFLAG_AES', 'RTE_CPUFLAG_PMULL',
614 'RTE_CPUFLAG_SHA1', 'RTE_CPUFLAG_SHA2']