1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017 Intel Corporation.
3 # Copyright(c) 2017 Cavium, Inc
5 arm_force_native_march = false
7 # common flags to all aarch64 builds, with lowest priority
9 # Accelerate rte_memcpy. Be sure to run unit test (memcpy_perf_autotest)
10 # to determine the best threshold in code. Refer to notes in source file
11 # (lib/librte_eal/arm/include/rte_memcpy_64.h) for more info.
12 ['RTE_ARCH_ARM64_MEMCPY', false],
13 # ['RTE_ARM64_MEMCPY_ALIGNED_THRESHOLD', 2048],
14 # ['RTE_ARM64_MEMCPY_UNALIGNED_THRESHOLD', 512],
15 # Leave below RTE_ARM64_MEMCPY_xxx options commented out,
16 # unless there are strong reasons.
17 # ['RTE_ARM64_MEMCPY_SKIP_GCC_VER_CHECK', false],
18 # ['RTE_ARM64_MEMCPY_ALIGN_MASK', 0xF],
19 # ['RTE_ARM64_MEMCPY_STRICT_ALIGN', false],
21 ['RTE_NET_FM10K', false],
22 ['RTE_NET_AVP', false],
24 ['RTE_SCHED_VECTOR', false],
25 ['RTE_ARM_USE_WFE', false],
26 ['RTE_ARCH_ARM64', true],
27 ['RTE_CACHE_LINE_SIZE', 128]
30 ## Part numbers are specific to Arm implementers
31 # implementer specific aarch64 flags have middle priority
32 # (will overwrite common flags)
33 # part number specific aarch64 flags have the highest priority
34 # (will overwrite both common and implementer specific flags)
35 implementer_generic = {
36 'description': 'Generic armv8',
38 ['RTE_MACHINE', '"armv8a"'],
39 ['RTE_USE_C11_MEM_MODEL', true],
40 ['RTE_MAX_LCORE', 256]
42 'part_number_config': {
43 'generic': {'machine_args': ['-march=armv8-a+crc',
48 part_number_config_arm = {
49 'generic': {'machine_args': ['-march=armv8-a+crc',
50 '-moutline-atomics']},
51 'native': {'machine_args': ['-march=native']},
52 '0xd03': {'machine_args': ['-mcpu=cortex-a53']},
53 '0xd04': {'machine_args': ['-mcpu=cortex-a35']},
54 '0xd07': {'machine_args': ['-mcpu=cortex-a57']},
55 '0xd08': {'machine_args': ['-mcpu=cortex-a72']},
56 '0xd09': {'machine_args': ['-mcpu=cortex-a73']},
57 '0xd0a': {'machine_args': ['-mcpu=cortex-a75']},
58 '0xd0b': {'machine_args': ['-mcpu=cortex-a76']},
60 'machine_args': ['-march=armv8.2-a+crypto',
63 ['RTE_MACHINE', '"neoverse-n1"'],
64 ['RTE_ARM_FEATURE_ATOMICS', true],
65 ['RTE_EAL_NUMA_AWARE_HUGEPAGES', false],
66 ['RTE_LIBRTE_VHOST_NUMA', false],
67 ['RTE_MAX_MEM_MB', 1048576],
68 ['RTE_MAX_LCORE', 80],
69 ['RTE_MAX_NUMA_NODES', 1]
73 'machine_args': ['-march=armv8.5-a+crypto+sve2'],
75 ['RTE_MACHINE', '"neoverse-n2"'],
76 ['RTE_ARM_FEATURE_ATOMICS', true],
77 ['RTE_EAL_NUMA_AWARE_HUGEPAGES', false],
78 ['RTE_LIBRTE_VHOST_NUMA', false],
86 ['RTE_MACHINE', '"armv8a"'],
87 ['RTE_USE_C11_MEM_MODEL', true],
88 ['RTE_CACHE_LINE_SIZE', 64],
91 'part_number_config': part_number_config_arm
94 flags_part_number_thunderx = [
95 ['RTE_MACHINE', '"thunderx"'],
96 ['RTE_USE_C11_MEM_MODEL', false]
98 implementer_cavium = {
99 'description': 'Cavium',
101 ['RTE_MAX_VFIO_GROUPS', 128],
102 ['RTE_MAX_LCORE', 96],
103 ['RTE_MAX_NUMA_NODES', 2]
105 'part_number_config': {
106 'generic': {'machine_args': ['-march=armv8-a+crc+crypto',
108 'native': {'machine_args': ['-march=native']},
110 'machine_args': ['-mcpu=thunderxt88'],
111 'flags': flags_part_number_thunderx
114 'machine_args': ['-mcpu=thunderxt81'],
115 'flags': flags_part_number_thunderx
118 'machine_args': ['-mcpu=thunderxt83'],
119 'flags': flags_part_number_thunderx
122 'machine_args': ['-march=armv8.1-a+crc+crypto',
123 '-mcpu=thunderx2t99'],
125 ['RTE_MACHINE', '"thunderx2"'],
126 ['RTE_ARM_FEATURE_ATOMICS', true],
127 ['RTE_USE_C11_MEM_MODEL', true],
128 ['RTE_CACHE_LINE_SIZE', 64],
129 ['RTE_MAX_LCORE', 256],
130 ['RTE_MAX_NUMA_NODES', 2]
134 'machine_args': ['-march=armv8.2-a+crc+crypto+lse',
137 ['RTE_MACHINE', '"octeontx2"'],
138 ['RTE_ARM_FEATURE_ATOMICS', true],
139 ['RTE_USE_C11_MEM_MODEL', true],
140 ['RTE_EAL_IGB_UIO', false],
141 ['RTE_MAX_LCORE', 36],
142 ['RTE_MAX_NUMA_NODES', 1]
148 implementer_ampere = {
149 'description': 'Ampere Computing',
151 ['RTE_MACHINE', '"emag"'],
152 ['RTE_CACHE_LINE_SIZE', 64],
153 ['RTE_MAX_LCORE', 32],
154 ['RTE_MAX_NUMA_NODES', 1]
156 'part_number_config': {
157 'generic': {'machine_args': ['-march=armv8-a+crc+crypto',
159 'native': {'machine_args': ['-march=native']}
163 implementer_marvell = {
164 'description': 'Marvell ARMADA',
166 ['RTE_MACHINE', '"armv8a"'],
167 ['RTE_CACHE_LINE_SIZE', 64],
168 ['RTE_MAX_LCORE', 16],
169 ['RTE_MAX_NUMA_NODES', 1]
171 'part_number_config': part_number_config_arm
175 'description': 'NXP DPAA',
177 ['RTE_MACHINE', '"dpaa"'],
178 ['RTE_LIBRTE_DPAA2_USE_PHYS_IOVA', false],
179 ['RTE_USE_C11_MEM_MODEL', true],
180 ['RTE_CACHE_LINE_SIZE', 64],
181 ['RTE_MAX_LCORE', 16],
182 ['RTE_MAX_NUMA_NODES', 1]
184 'part_number_config': part_number_config_arm
187 ## Arm implementers (ID from MIDR in Arm Architecture Reference Manual)
189 'generic': implementer_generic,
190 '0x41': implementer_arm,
191 '0x43': implementer_cavium,
192 '0x50': implementer_ampere,
193 '0x56': implementer_marvell,
194 'dpaa': implementer_dpaa
197 dpdk_conf.set('RTE_ARCH_ARM', 1)
198 dpdk_conf.set('RTE_FORCE_INTRINSICS', 1)
200 if dpdk_conf.get('RTE_ARCH_32')
202 dpdk_conf.set('RTE_CACHE_LINE_SIZE', 64)
203 dpdk_conf.set('RTE_ARCH_ARMv7', 1)
204 # the minimum architecture supported, armv7-a, needs the following,
205 machine_args += '-mfpu=neon'
208 implementer_id = 'generic'
209 if machine == 'default' and not meson.is_cross_build()
211 implementer_config = implementer['generic']
212 part_number = 'generic'
213 elif not meson.is_cross_build()
215 # The script returns ['Implementer', 'Variant', 'Architecture',
216 # 'Primary Part number', 'Revision']
217 detect_vendor = find_program(join_paths(
218 meson.current_source_dir(), 'armv8_machine.py'))
219 cmd = run_command(detect_vendor.path())
220 if cmd.returncode() == 0
221 cmd_output = cmd.stdout().to_lower().strip().split(' ')
222 implementer_id = cmd_output[0]
223 part_number = cmd_output[3]
225 # Set to generic if variable is not found
226 implementer_config = implementers.get(implementer_id, ['generic'])
227 if implementer_config[0] == 'generic'
228 implementer_config = implementer['generic']
229 part_number = 'generic'
231 if arm_force_native_march == true
232 part_number = 'native'
236 implementer_id = meson.get_cross_property('implementer_id', 'generic')
237 part_number = meson.get_cross_property('part_number', 'generic')
238 implementer_config = implementers.get(implementer_id)
241 message('Arm implementer: ' + implementer_config['description'])
242 message('Arm part number: ' + part_number)
244 part_number_config = implementer_config['part_number_config']
245 if part_number_config.has_key(part_number)
246 # use the specified part_number machine args if found
247 part_number_config = part_number_config[part_number]
248 elif not meson.is_cross_build()
249 # default to generic machine args if part_number is not found
250 # and not forcing native machine args
251 # but don't default in cross-builds; if part_number is specified
252 # incorrectly in a cross-file, it needs to be fixed there
253 part_number_config = part_number_config['generic']
255 # doing cross build and part number is not in part_number_config
256 error('Cross build part number 0@0 not found.'.format(part_number))
259 # use default flags with implementer flags
260 dpdk_flags = flags_common + implementer_config['flags'] + part_number_config.get('flags', [])
262 # apply supported machine args
263 machine_args = [] # Clear previous machine args
264 foreach flag: part_number_config['machine_args']
265 if cc.has_argument(flag)
271 foreach flag: dpdk_flags
273 dpdk_conf.set(flag[0], flag[1])
277 message('Using machine args: @0@'.format(machine_args))
279 if (cc.get_define('__ARM_NEON', args: machine_args) != '' or
280 cc.get_define('__aarch64__', args: machine_args) != '')
281 compile_time_cpuflags += ['RTE_CPUFLAG_NEON']
284 if cc.get_define('__ARM_FEATURE_CRC32', args: machine_args) != ''
285 compile_time_cpuflags += ['RTE_CPUFLAG_CRC32']
288 if cc.get_define('__ARM_FEATURE_CRYPTO', args: machine_args) != ''
289 compile_time_cpuflags += ['RTE_CPUFLAG_AES', 'RTE_CPUFLAG_PMULL',
290 'RTE_CPUFLAG_SHA1', 'RTE_CPUFLAG_SHA2']