From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 118E8A04DD; Wed, 28 Oct 2020 15:06:33 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 40CD9CB97; Wed, 28 Oct 2020 15:04:51 +0100 (CET) Received: from lb.pantheon.sk (lb.pantheon.sk [46.229.239.20]) by dpdk.org (Postfix) with ESMTP id A5EF2CB04 for ; Wed, 28 Oct 2020 15:04:19 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by lb.pantheon.sk (Postfix) with ESMTP id 2E827B6B54; Wed, 28 Oct 2020 15:04:17 +0100 (CET) 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 rUVTcpJh_Gi6; Wed, 28 Oct 2020 15:04:16 +0100 (CET) Received: from service-node1.lab.pantheon.local (unknown [46.229.239.141]) by lb.pantheon.sk (Postfix) with ESMTP id E985BB6B57; Wed, 28 Oct 2020 15:04:09 +0100 (CET) From: =?UTF-8?q?Juraj=20Linke=C5=A1?= To: bruce.richardson@intel.com, Ruifeng.Wang@arm.com, Honnappa.Nagarahalli@arm.com, Phil.Yang@arm.com, vcchunga@amazon.com, Dharmik.Thakkar@arm.com, jerinjacobk@gmail.com, hemant.agrawal@nxp.com Cc: dev@dpdk.org, =?UTF-8?q?Juraj=20Linke=C5=A1?= Date: Wed, 28 Oct 2020 15:04:00 +0100 Message-Id: <1603893845-5736-7-git-send-email-juraj.linkes@pantheon.tech> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1603893845-5736-1-git-send-email-juraj.linkes@pantheon.tech> References: <1603464488-25493-1-git-send-email-juraj.linkes@pantheon.tech> <1603893845-5736-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 v5 06/11] build: use dict in Arm part number config X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Use dictionary lookup instead of iterating over all elements in the list. Fallback to generic part number if the discovered part number is unknown. Signed-off-by: Juraj Linkeš --- config/arm/meson.build | 85 ++++++++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 37 deletions(-) diff --git a/config/arm/meson.build b/config/arm/meson.build index 133a0d7fd..2f89cb2a8 100644 --- a/config/arm/meson.build +++ b/config/arm/meson.build @@ -101,31 +101,31 @@ flags_octeontx2_extra = [ ] # arm config (implementer 0x41) is the default config -part_number_config_default = [ - ['generic', ['-march=armv8-a+crc', '-moutline-atomics']], - ['native', ['-march=native']], - ['0xd03', ['-mcpu=cortex-a53']], - ['0xd04', ['-mcpu=cortex-a35']], - ['0xd07', ['-mcpu=cortex-a57']], - ['0xd08', ['-mcpu=cortex-a72']], - ['0xd09', ['-mcpu=cortex-a73']], - ['0xd0a', ['-mcpu=cortex-a75']], - ['0xd0b', ['-mcpu=cortex-a76']], - ['0xd0c', ['-march=armv8.2-a+crc+crypto', '-mcpu=neoverse-n1'], flags_n1sdp_extra] -] -part_number_config_cavium = [ - ['generic', ['-march=armv8-a+crc+crypto','-mcpu=thunderx']], - ['native', ['-march=native']], - ['0xa1', ['-mcpu=thunderxt88'], flags_thunderx_extra], - ['0xa2', ['-mcpu=thunderxt81'], flags_thunderx_extra], - ['0xa3', ['-mcpu=thunderxt83'], flags_thunderx_extra], - ['0xaf', ['-march=armv8.1-a+crc+crypto','-mcpu=thunderx2t99'], flags_thunderx2_extra], - ['0xb2', ['-march=armv8.2-a+crc+crypto+lse','-mcpu=octeontx2'], flags_octeontx2_extra] -] -part_number_config_emag = [ - ['generic', ['-march=armv8-a+crc+crypto', '-mtune=emag']], - ['native', ['-march=native']] -] +part_number_config_default = { + 'generic': [['-march=armv8-a+crc', '-moutline-atomics']], + 'native': [['-march=native']], + '0xd03': [['-mcpu=cortex-a53']], + '0xd04': [['-mcpu=cortex-a35']], + '0xd07': [['-mcpu=cortex-a57']], + '0xd08': [['-mcpu=cortex-a72']], + '0xd09': [['-mcpu=cortex-a73']], + '0xd0a': [['-mcpu=cortex-a75']], + '0xd0b': [['-mcpu=cortex-a76']], + '0xd0c': [['-march=armv8.2-a+crc+crypto', '-mcpu=neoverse-n1'], flags_n1sdp_extra] +} +part_number_config_cavium = { + 'generic': [['-march=armv8-a+crc+crypto', '-mcpu=thunderx']], + 'native': [['-march=native']], + '0xa1': [['-mcpu=thunderxt88'], flags_thunderx_extra], + '0xa2': [['-mcpu=thunderxt81'], flags_thunderx_extra], + '0xa3': [['-mcpu=thunderxt83'], flags_thunderx_extra], + '0xaf': [['-march=armv8.1-a+crc+crypto','-mcpu=thunderx2t99'], flags_thunderx2_extra], + '0xb2': [['-march=armv8.2-a+crc+crypto+lse','-mcpu=octeontx2'], flags_octeontx2_extra], +} +part_number_config_emag = { + 'generic': [['-march=armv8-a+crc+crypto', '-mtune=emag']], + 'native': [['-march=native']] +} ## Arm implementer ID (ARM DDI 0487C.a, Section G7.2.106, Page G7-5321) implementer_generic = ['Generic armv8', flags_generic, part_number_config_default] @@ -189,22 +189,33 @@ else message('Arm implementer: ' + implementer_config[0]) message('Arm part number: ' + part_number) + part_number_config = implementer_config[2] + 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] + elif not meson.is_cross_build() + # default to generic machine args if part_number is not found + # and not forcing native machine args + # but don't default in cross-builds; if part_number is specified + # incorrectly in a cross-file, it needs to be fixed there + part_number_config = part_number_config['generic'] + else + # doing cross build and part number is not in part_number_config + error('Cross build part number 0@0 not found.'.format(part_number)) + endif + # use default flags with implementer flags dpdk_flags = flags_common_default + implementer_config[1] + if part_number_config.length() > 1 + # add extra flags from the part number + dpdk_flags += part_number_config[1] + endif + # apply supported machine args machine_args = [] # Clear previous machine args - foreach marg: implementer_config[2] - if marg[0] == part_number - # apply supported machine args - foreach flag: marg[1] - if cc.has_argument(flag) - machine_args += flag - endif - endforeach - if marg.length() > 2 - # add extra flags for the part - dpdk_flags += marg[2] - endif + foreach flag: part_number_config[0] + if cc.has_argument(flag) + machine_args += flag endif endforeach -- 2.20.1