From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A82CFA0C47; Tue, 6 Jul 2021 10:21:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8A7F340688; Tue, 6 Jul 2021 10:21:57 +0200 (CEST) Received: from lb.pantheon.sk (lb.pantheon.sk [46.229.239.20]) by mails.dpdk.org (Postfix) with ESMTP id F1D3F4067E for ; Tue, 6 Jul 2021 10:21:55 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lb.pantheon.sk (Postfix) with ESMTP id D80FAD57B6; Tue, 6 Jul 2021 10:21:54 +0200 (CEST) X-Virus-Scanned: amavisd-new at siecit.sk Received: from lb.pantheon.sk ([127.0.0.1]) by localhost (lb.pantheon.sk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7FYeW4Zp9_sJ; Tue, 6 Jul 2021 10:21:53 +0200 (CEST) Received: from service-node1.lab.pantheon.local (unknown [46.229.239.141]) by lb.pantheon.sk (Postfix) with ESMTP id 1F488D57B0; Tue, 6 Jul 2021 10:21:53 +0200 (CEST) From: =?UTF-8?q?Juraj=20Linke=C5=A1?= To: thomas@monjalon.net, david.marchand@redhat.com, bruce.richardson@intel.com, Honnappa.Nagarahalli@arm.com, Ruifeng.Wang@arm.com, fengchengwen@huawei.com, ferruh.yigit@intel.com, jerinjacobk@gmail.com Cc: dev@dpdk.org, =?UTF-8?q?Juraj=20Linke=C5=A1?= Date: Tue, 6 Jul 2021 10:21:52 +0200 Message-Id: <1625559712-23403-1-git-send-email-juraj.linkes@pantheon.tech> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1624959593-6240-1-git-send-email-juraj.linkes@pantheon.tech> References: <1624959593-6240-1-git-send-email-juraj.linkes@pantheon.tech> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2] config/arm: split march cfg into arch and features X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Older compilers may not support all arch versions and all features that the target SoC supports, in which case it's better figure out the highest arch version and features that the compiler supports. Implement a way to achieve this: 1. Find the highest arch version that the compiler supports, keeping in mind the SoC arch version we're building. For example, if the SoC arch version is arm8.2-a, but the compiler only supports arm8.1-a, use arm8.1-a. On the other hand, if the compiler supports arm8.3-a (or higher), use armv8.2-a. 2. With the architecture version locked, iterate over SoC features and use all that are supported. In all cases, emit a warning if there's something unsupported by the compiler. Signed-off-by: Juraj Linkeš --- config/arm/meson.build | 122 +++++++++++++++++++++++++++++++++-------- 1 file changed, 98 insertions(+), 24 deletions(-) diff --git a/config/arm/meson.build b/config/arm/meson.build index 9b147c0b93..8272b4e2bc 100644 --- a/config/arm/meson.build +++ b/config/arm/meson.build @@ -37,20 +37,26 @@ implementer_generic = { ['RTE_MAX_NUMA_NODES', 4] ], 'part_number_config': { - 'generic': {'machine_args': ['-march=armv8-a+crc', '-moutline-atomics']} + 'generic': { + 'march': 'armv8-a', + 'march_features': ['crc'], + 'compiler_options': ['-moutline-atomics'] + } } } part_number_config_arm = { - '0xd03': {'machine_args': ['-mcpu=cortex-a53']}, - '0xd04': {'machine_args': ['-mcpu=cortex-a35']}, - '0xd07': {'machine_args': ['-mcpu=cortex-a57']}, - '0xd08': {'machine_args': ['-mcpu=cortex-a72']}, - '0xd09': {'machine_args': ['-mcpu=cortex-a73']}, - '0xd0a': {'machine_args': ['-mcpu=cortex-a75']}, - '0xd0b': {'machine_args': ['-mcpu=cortex-a76']}, + '0xd03': {'compiler_options': ['-mcpu=cortex-a53']}, + '0xd04': {'compiler_options': ['-mcpu=cortex-a35']}, + '0xd07': {'compiler_options': ['-mcpu=cortex-a57']}, + '0xd08': {'compiler_options': ['-mcpu=cortex-a72']}, + '0xd09': {'compiler_options': ['-mcpu=cortex-a73']}, + '0xd0a': {'compiler_options': ['-mcpu=cortex-a75']}, + '0xd0b': {'compiler_options': ['-mcpu=cortex-a76']}, '0xd0c': { - 'machine_args': ['-march=armv8.2-a+crypto', '-mcpu=neoverse-n1'], + 'march': 'armv8.2-a', + 'march_features': ['crypto'], + 'compiler_options': ['-mcpu=neoverse-n1'], 'flags': [ ['RTE_MACHINE', '"neoverse-n1"'], ['RTE_ARM_FEATURE_ATOMICS', true], @@ -60,7 +66,8 @@ part_number_config_arm = { ] }, '0xd49': { - 'machine_args': ['-march=armv8.5-a+crypto+sve2'], + 'march': 'armv8.5-a', + 'march_features': ['crypto', 'sve2'], 'flags': [ ['RTE_MACHINE', '"neoverse-n2"'], ['RTE_ARM_FEATURE_ATOMICS', true], @@ -94,19 +101,21 @@ implementer_cavium = { ], 'part_number_config': { '0xa1': { - 'machine_args': ['-mcpu=thunderxt88'], + 'compiler_options': ['-mcpu=thunderxt88'], 'flags': flags_part_number_thunderx }, '0xa2': { - 'machine_args': ['-mcpu=thunderxt81'], + 'compiler_options': ['-mcpu=thunderxt81'], 'flags': flags_part_number_thunderx }, '0xa3': { - 'machine_args': ['-mcpu=thunderxt83'], + 'compiler_options': ['-mcpu=thunderxt83'], 'flags': flags_part_number_thunderx }, '0xaf': { - 'machine_args': ['-march=armv8.1-a+crc+crypto', '-mcpu=thunderx2t99'], + 'march': 'armv8.1-a', + 'march_features': ['crc', 'crypto'], + 'compiler_options': ['-mcpu=thunderx2t99'], 'flags': [ ['RTE_MACHINE', '"thunderx2"'], ['RTE_ARM_FEATURE_ATOMICS', true], @@ -116,7 +125,9 @@ implementer_cavium = { ] }, '0xb2': { - 'machine_args': ['-march=armv8.2-a+crc+crypto+lse', '-mcpu=octeontx2'], + 'march': 'armv8.2-a', + 'march_features': ['crc', 'crypto', 'lse'], + 'compiler_options': ['-mcpu=octeontx2'], 'flags': [ ['RTE_MACHINE', '"octeontx2"'], ['RTE_ARM_FEATURE_ATOMICS', true], @@ -137,7 +148,11 @@ implementer_ampere = { ['RTE_MAX_NUMA_NODES', 1] ], 'part_number_config': { - '0x0': {'machine_args': ['-march=armv8-a+crc+crypto', '-mtune=emag']} + '0x0': { + 'march': 'armv8-a', + 'march_features': ['crc', 'crypto'], + 'compiler_options': ['-mtune=emag'] + } } } @@ -149,7 +164,9 @@ implementer_hisilicon = { ], 'part_number_config': { '0xd01': { - 'machine_args': ['-march=armv8.2-a+crypto', '-mtune=tsv110'], + 'march': 'armv8.2-a', + 'march_features': ['crypto'], + 'compiler_options': ['-mtune=tsv110'], 'flags': [ ['RTE_MACHINE', '"Kunpeng 920"'], ['RTE_ARM_FEATURE_ATOMICS', true], @@ -158,7 +175,8 @@ implementer_hisilicon = { ] }, '0xd02': { - 'machine_args': ['-march=armv8.2-a+crypto+sve'], + 'march': 'armv8.2-a', + 'march_features': ['crypto', 'sve'], 'flags': [ ['RTE_MACHINE', '"Kunpeng 930"'], ['RTE_ARM_FEATURE_ATOMICS', true], @@ -179,7 +197,10 @@ implementer_qualcomm = { ['RTE_MAX_NUMA_NODES', 1] ], 'part_number_config': { - '0xc00': {'machine_args': ['-march=armv8-a+crc']} + '0xc00': { + 'march': 'armv8-a', + 'march_features': ['crc'] + } } } @@ -458,13 +479,66 @@ else # add/overwrite flags in the proper order dpdk_flags = flags_common + implementer_config['flags'] + part_number_config.get('flags', []) + soc_flags - # apply supported machine args machine_args = [] # Clear previous machine args - foreach flag: part_number_config['machine_args'] - if cc.has_argument(flag) - machine_args += flag + + # probe supported marchs 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.') + else + 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 endif - endforeach + if part_number_config.has_key('march_features') + feature_unsupported = false + foreach feature: part_number_config['march_features'] + if cc.has_argument('+'.join([candidate_march, feature])) + candidate_march = '+'.join([candidate_march, feature]) + else + feature_unsupported = true + endif + endforeach + if feature_unsupported + warning('Configuration march features are ' + + '@0@, but the compiler supports only @1@.' + .format(part_number_config['march_features'], + candidate_march)) + endif + endif + 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 -- 2.20.1