- # aarch64 build
- use_native_machine_args = false
- if not meson.is_cross_build()
- if machine == 'default'
- # default build
- implementer_id = 'generic'
- part_number = 'generic'
- else
- # native build
- # The script returns ['Implementer', 'Variant', 'Architecture',
- # 'Primary Part number', 'Revision']
- detect_vendor = find_program(join_paths(
- meson.current_source_dir(), 'armv8_machine.py'))
- cmd = run_command(detect_vendor.path())
- if cmd.returncode() == 0
- cmd_output = cmd.stdout().to_lower().strip().split(' ')
- implementer_id = cmd_output[0]
- part_number = cmd_output[3]
- else
- error('Error when getting Arm Implementer ID and part number.')
- endif
- use_native_machine_args = true
- endif
- else
- # cross build
- implementer_id = meson.get_cross_property('implementer_id')
- part_number = meson.get_cross_property('part_number')
- endif
-
- if implementers.has_key(implementer_id)
- implementer_config = implementers[implementer_id]
- else
- error('Unsupported Arm implementer: @0@. '.format(implementer_id) +
- 'Please add support for it or use the generic ' +
- '(-Dmachine=generic) build.')
- endif
-
- message('Arm implementer: ' + implementer_config['description'])
- message('Arm part number: ' + part_number)
-
- part_number_config = implementer_config['part_number_config']
- if part_number_config.has_key(part_number)
- # use the specified part_number machine args if found
- part_number_config = part_number_config[part_number]
- else
- # unknown part number
- 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.')
- endif
-
- # use default flags with implementer flags
- dpdk_flags = flags_common + implementer_config['flags'] + part_number_config.get('flags', [])
-
- # apply supported machine args
- machine_args = [] # Clear previous machine args
- if use_native_machine_args
- candidate_machine_args = native_machine_args
- else
- candidate_machine_args = part_number_config['machine_args']
- endif
- foreach flag: candidate_machine_args
- if cc.has_argument(flag)
- machine_args += flag
- endif
- endforeach
-
- # apply flags
- foreach flag: dpdk_flags
- if flag.length() > 0
- dpdk_conf.set(flag[0], flag[1])
- endif
- endforeach
+ # armv8 build
+ update_flags = true
+ soc_config = {}
+ if not meson.is_cross_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
+ else
+ soc = platform
+ endif
+ if soc == 'native'
+ # native build
+ # The script returns ['Implementer', 'Variant', 'Architecture',
+ # 'Primary Part number', 'Revision']
+ detect_vendor = find_program(join_paths(meson.current_source_dir(),
+ 'armv8_machine.py'))
+ cmd = run_command(detect_vendor.path())
+ if cmd.returncode() == 0
+ cmd_output = cmd.stdout().to_lower().strip().split(' ')
+ implementer_id = cmd_output[0]
+ part_number = cmd_output[3]
+ 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
+ soc = meson.get_cross_property('platform', '')
+ if soc == ''
+ error('Arm SoC must be specified in the cross file.')
+ endif
+ soc_config = socs.get(soc, {'not_supported': true})
+ endif
+endif
+
+if update_flags
+ if soc_config.has_key('not_supported')
+ error('SoC @0@ not supported.'.format(soc))
+ elif soc_config != {}
+ implementer_id = soc_config['implementer']
+ implementer_config = implementers[implementer_id]
+ part_number = soc_config['part_number']
+ soc_flags = soc_config.get('flags', [])
+ if not soc_config.get('numa', true)
+ has_libnuma = 0
+ endif
+
+ disable_drivers += ',' + soc_config.get('disable_drivers', '')
+ enable_drivers += ',' + soc_config.get('enable_drivers', '')
+ endif
+
+ if implementers.has_key(implementer_id)
+ implementer_config = implementers[implementer_id]
+ else
+ error('Unsupported Arm implementer: @0@. '.format(implementer_id) +
+ 'Please add support for it or use the generic ' +
+ '(-Dplatform=generic) build.')
+ endif
+
+ message('Arm implementer: ' + implementer_config['description'])
+ message('Arm part number: ' + part_number)
+
+ part_number_config = implementer_config['part_number_config']
+ if part_number_config.has_key(part_number)
+ # use the specified part_number machine args if found
+ part_number_config = part_number_config[part_number]
+ else
+ # unknown part number
+ error('Unsupported part number @0@ of implementer @1@. '
+ .format(part_number, implementer_id) +
+ 'Please add support for it or use the generic ' +
+ '(-Dplatform=generic) build.')
+ endif
+
+ # add/overwrite flags in the proper order
+ dpdk_flags = flags_common + implementer_config['flags'] + part_number_config.get('flags', []) + soc_flags
+
+ machine_args = [] # Clear previous machine args
+
+ # probe supported archs and their features
+ candidate_march = ''
+ if part_number_config.has_key('march')
+ supported_marchs = ['armv8.6-a', 'armv8.5-a', 'armv8.4-a', 'armv8.3-a',
+ 'armv8.2-a', 'armv8.1-a', 'armv8-a']
+ check_compiler_support = false
+ foreach supported_march: supported_marchs
+ if supported_march == part_number_config['march']
+ # start checking from this version downwards
+ check_compiler_support = true
+ endif
+ if (check_compiler_support and
+ cc.has_argument('-march=' + supported_march))
+ candidate_march = supported_march
+ # highest supported march version found
+ break
+ endif
+ endforeach
+ if candidate_march == ''
+ error('No suitable armv8 march version found.')
+ endif
+ if candidate_march != part_number_config['march']
+ warning('Configuration march version is ' +
+ '@0@, but the compiler supports only @1@.'
+ .format(part_number_config['march'], candidate_march))
+ endif
+ candidate_march = '-march=' + candidate_march
+
+ march_features = []
+ if part_number_config.has_key('march_features')
+ march_features += part_number_config['march_features']
+ endif
+ if soc_config.has_key('extra_march_features')
+ march_features += soc_config['extra_march_features']
+ endif
+ foreach feature: march_features
+ if cc.has_argument('+'.join([candidate_march, feature]))
+ candidate_march = '+'.join([candidate_march, feature])
+ else
+ warning('The compiler does not support feature @0@'
+ .format(feature))
+ endif
+ endforeach
+ machine_args += candidate_march
+ endif
+
+ # apply supported compiler options
+ if part_number_config.has_key('compiler_options')
+ foreach flag: part_number_config['compiler_options']
+ if cc.has_argument(flag)
+ machine_args += flag
+ else
+ warning('Configuration compiler option ' +
+ '@0@ isn\'t supported.'.format(flag))
+ endif
+ endforeach
+ endif
+
+ # apply flags
+ foreach flag: dpdk_flags
+ if flag.length() > 0
+ dpdk_conf.set(flag[0], flag[1])
+ endif
+ endforeach