1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017 Intel Corporation.
3 # Copyright(c) 2017 Cavium, Inc
5 # for checking defines we need to use the correct compiler flags
6 march_opt = '-march=@0@'.format(machine)
8 arm_force_native_march = false
9 arm_force_default_march = (machine == 'default')
11 flags_common_default = [
12 # Accelarate rte_memcpy. Be sure to run unit test (memcpy_perf_autotest)
13 # to determine the best threshold in code. Refer to notes in source file
14 # (lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h) for more info.
15 ['RTE_ARCH_ARM64_MEMCPY', false],
16 # ['RTE_ARM64_MEMCPY_ALIGNED_THRESHOLD', 2048],
17 # ['RTE_ARM64_MEMCPY_UNALIGNED_THRESHOLD', 512],
18 # Leave below RTE_ARM64_MEMCPY_xxx options commented out, unless there're
20 # ['RTE_ARM64_MEMCPY_SKIP_GCC_VER_CHECK', false],
21 # ['RTE_ARM64_MEMCPY_ALIGN_MASK', 0xF],
22 # ['RTE_ARM64_MEMCPY_STRICT_ALIGN', false],
24 ['RTE_LIBRTE_FM10K_PMD', false],
25 ['RTE_LIBRTE_SFC_EFX_PMD', false],
26 ['RTE_LIBRTE_AVP_PMD', false],
28 ['RTE_SCHED_VECTOR', false],
32 ['RTE_MACHINE', '"armv8a"'],
33 ['RTE_MAX_LCORE', 256],
34 ['RTE_USE_C11_MEM_MODEL', true],
35 ['RTE_CACHE_LINE_SIZE', 128]]
37 ['RTE_MACHINE', '"armv8a"'],
38 ['RTE_MAX_LCORE', 16],
39 ['RTE_USE_C11_MEM_MODEL', true],
40 ['RTE_CACHE_LINE_SIZE', 64]]
42 ['RTE_CACHE_LINE_SIZE', 128],
43 ['RTE_MAX_NUMA_NODES', 2],
44 ['RTE_MAX_LCORE', 96],
45 ['RTE_MAX_VFIO_GROUPS', 128]]
47 ['RTE_MACHINE', '"dpaa"'],
48 ['RTE_USE_C11_MEM_MODEL', true],
49 ['RTE_CACHE_LINE_SIZE', 64],
50 ['RTE_MAX_NUMA_NODES', 1],
51 ['RTE_MAX_LCORE', 16],
52 ['RTE_LIBRTE_DPAA2_USE_PHYS_IOVA', false]]
54 ['RTE_MACHINE', '"armv8a"'],
55 ['RTE_CACHE_LINE_SIZE', 64],
56 ['RTE_MAX_NUMA_NODES', 1],
57 ['RTE_MAX_LCORE', 16]]
59 flags_default_extra = []
60 flags_thunderx_extra = [
61 ['RTE_MACHINE', '"thunderx"'],
62 ['RTE_USE_C11_MEM_MODEL', false]]
63 flags_thunderx2_extra = [
64 ['RTE_MACHINE', '"thunderx2"'],
65 ['RTE_CACHE_LINE_SIZE', 64],
66 ['RTE_MAX_NUMA_NODES', 2],
67 ['RTE_MAX_LCORE', 256],
68 ['RTE_ARM_FEATURE_ATOMICS', true],
69 ['RTE_USE_C11_MEM_MODEL', true]]
70 flags_octeontx2_extra = [
71 ['RTE_MACHINE', '"octeontx2"'],
72 ['RTE_MAX_NUMA_NODES', 1],
73 ['RTE_MAX_LCORE', 24],
74 ['RTE_ARM_FEATURE_ATOMICS', true],
75 ['RTE_EAL_IGB_UIO', false],
76 ['RTE_USE_C11_MEM_MODEL', true]]
78 machine_args_generic = [
79 ['default', ['-march=armv8-a+crc']],
80 ['native', ['-march=native']],
81 ['0xd03', ['-mcpu=cortex-a53']],
82 ['0xd04', ['-mcpu=cortex-a35']],
83 ['0xd07', ['-mcpu=cortex-a57']],
84 ['0xd08', ['-mcpu=cortex-a72']],
85 ['0xd09', ['-mcpu=cortex-a73']],
86 ['0xd0a', ['-mcpu=cortex-a75']]]
88 machine_args_cavium = [
89 ['default', ['-march=armv8-a+crc+crypto','-mcpu=thunderx']],
90 ['native', ['-march=native']],
91 ['0xa1', ['-mcpu=thunderxt88'], flags_thunderx_extra],
92 ['0xa2', ['-mcpu=thunderxt81'], flags_thunderx_extra],
93 ['0xa3', ['-mcpu=thunderxt83'], flags_thunderx_extra],
94 ['0xaf', ['-march=armv8.1-a+crc+crypto','-mcpu=thunderx2t99'], flags_thunderx2_extra],
95 ['0xb2', ['-march=armv8.2-a+crc+crypto+lse','-mcpu=octeontx2'], flags_octeontx2_extra]]
97 ## Arm implementer ID (ARM DDI 0487C.a, Section G7.2.106, Page G7-5321)
98 impl_generic = ['Generic armv8', flags_generic, machine_args_generic]
99 impl_0x41 = ['Arm', flags_arm, machine_args_generic]
100 impl_0x42 = ['Broadcom', flags_generic, machine_args_generic]
101 impl_0x43 = ['Cavium', flags_cavium, machine_args_cavium]
102 impl_0x44 = ['DEC', flags_generic, machine_args_generic]
103 impl_0x49 = ['Infineon', flags_generic, machine_args_generic]
104 impl_0x4d = ['Motorola', flags_generic, machine_args_generic]
105 impl_0x4e = ['NVIDIA', flags_generic, machine_args_generic]
106 impl_0x50 = ['AppliedMicro', flags_generic, machine_args_generic]
107 impl_0x51 = ['Qualcomm', flags_generic, machine_args_generic]
108 impl_0x53 = ['Samsung', flags_generic, machine_args_generic]
109 impl_0x56 = ['Marvell ARMADA', flags_armada, machine_args_generic]
110 impl_0x69 = ['Intel', flags_generic, machine_args_generic]
111 impl_dpaa = ['NXP DPAA', flags_dpaa, machine_args_generic]
113 dpdk_conf.set('RTE_FORCE_INTRINSICS', 1)
115 if not dpdk_conf.get('RTE_ARCH_64')
116 dpdk_conf.set('RTE_CACHE_LINE_SIZE', 64)
117 dpdk_conf.set('RTE_ARCH_ARM', 1)
118 dpdk_conf.set('RTE_ARCH_ARMv7', 1)
119 # the minimum architecture supported, armv7-a, needs the following,
120 # mk/machine/armv7a/rte.vars.mk sets it too
121 machine_args += '-mfpu=neon'
123 dpdk_conf.set('RTE_CACHE_LINE_SIZE', 128)
124 dpdk_conf.set('RTE_ARCH_ARM64', 1)
127 cmd_generic = ['generic', '', '', 'default', '']
128 cmd_output = cmd_generic # Set generic by default
129 machine_args = [] # Clear previous machine args
130 if arm_force_default_march and not meson.is_cross_build()
131 machine = impl_generic
133 elif not meson.is_cross_build()
134 # The script returns ['Implementer', 'Variant', 'Architecture',
135 # 'Primary Part number', 'Revision']
136 detect_vendor = find_program(join_paths(
137 meson.current_source_dir(), 'armv8_machine.py'))
138 cmd = run_command(detect_vendor.path())
139 if cmd.returncode() == 0
140 cmd_output = cmd.stdout().to_lower().strip().split(' ')
142 # Set to generic if variable is not found
143 machine = get_variable('impl_' + cmd_output[0], ['generic'])
144 if machine[0] == 'generic'
145 machine = impl_generic
146 cmd_output = cmd_generic
148 impl_pn = cmd_output[3]
149 if arm_force_native_march == true
153 impl_id = meson.get_cross_property('implementor_id', 'generic')
154 impl_pn = meson.get_cross_property('implementor_pn', 'default')
155 machine = get_variable('impl_' + impl_id)
158 # Apply Common Defaults. These settings may be overwritten by machine
160 foreach flag: flags_common_default
162 dpdk_conf.set(flag[0], flag[1])
166 message('Implementer : ' + machine[0])
167 foreach flag: machine[1]
169 dpdk_conf.set(flag[0], flag[1])
173 foreach marg: machine[2]
174 if marg[0] == impl_pn
175 foreach flag: marg[1]
176 if cc.has_argument(flag)
180 # Apply any extra machine specific flags.
181 foreach flag: marg.get(2, flags_default_extra)
183 dpdk_conf.set(flag[0], flag[1])
189 message(machine_args)
191 if (cc.get_define('__ARM_NEON', args: machine_args) != '' or
192 cc.get_define('__aarch64__', args: machine_args) != '')
193 dpdk_conf.set('RTE_MACHINE_CPUFLAG_NEON', 1)
194 compile_time_cpuflags += ['RTE_CPUFLAG_NEON']
197 if cc.get_define('__ARM_FEATURE_CRC32', args: machine_args) != ''
198 dpdk_conf.set('RTE_MACHINE_CPUFLAG_CRC32', 1)
199 compile_time_cpuflags += ['RTE_CPUFLAG_CRC32']
202 if cc.get_define('__ARM_FEATURE_CRYPTO', args: machine_args) != ''
203 dpdk_conf.set('RTE_MACHINE_CPUFLAG_AES', 1)
204 dpdk_conf.set('RTE_MACHINE_CPUFLAG_PMULL', 1)
205 dpdk_conf.set('RTE_MACHINE_CPUFLAG_SHA1', 1)
206 dpdk_conf.set('RTE_MACHINE_CPUFLAG_SHA2', 1)
207 compile_time_cpuflags += ['RTE_CPUFLAG_AES', 'RTE_CPUFLAG_PMULL',
208 'RTE_CPUFLAG_SHA1', 'RTE_CPUFLAG_SHA2']