From patchwork Wed Jul 21 21:13:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Tran X-Patchwork-Id: 96180 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 95CCAA0C47; Wed, 21 Jul 2021 23:14:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2BAB54014E; Wed, 21 Jul 2021 23:14:05 +0200 (CEST) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by mails.dpdk.org (Postfix) with ESMTP id EE07D4014D for ; Wed, 21 Jul 2021 23:14:03 +0200 (CEST) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16LL3RHn177306 for ; Wed, 21 Jul 2021 17:14:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=hO2w9UvTVF6h0gI8Zw5yADhTtXUzHUvOK174Tr8NmaI=; b=T4CxWLyYO8n4lzZpdIENwWb3VQymCCj5qdlD7SiM+cPdj8aHeyn3FC1ep8lazA3ZGJHb Fmw6k16lF/SQmpBR6+ZkGTMXhjLFDT5owCesyYQMEEuXflG7jtaBE35pfqrEfRZJj84k vGtxJ2DkpzukOnflstxxNYgxo2yJyR2bTIAepmX1se1xmuo96jDeaDKwX2MPa0rLOz/2 nXYlEmRBQWvys96tua3UZj0DoBdBQFnownwG1eI2P41fluWHjBWb0+dD+HbmU/YEAXZp 7Pb3Ey+YAyMdvwLjJDw3Jy+0Wax5qTH7rmkZFoIzo/mf7RNrwGJkYgtnUJQE9BzNjlto Qg== Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com with ESMTP id 39xtefsd62-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 21 Jul 2021 17:14:01 -0400 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 16LL28Yh007935 for ; Wed, 21 Jul 2021 21:14:00 GMT Received: from b03cxnp07027.gho.boulder.ibm.com (b03cxnp07027.gho.boulder.ibm.com [9.17.130.14]) by ppma05wdc.us.ibm.com with ESMTP id 39upucj36t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 21 Jul 2021 21:14:00 +0000 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp07027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 16LLDxZt20316614 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Jul 2021 21:13:59 GMT Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A0ED1136069; Wed, 21 Jul 2021 21:13:59 +0000 (GMT) Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 328FC136055; Wed, 21 Jul 2021 21:13:59 +0000 (GMT) Received: from localhost.localdomain (unknown [9.77.134.169]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 21 Jul 2021 21:13:59 +0000 (GMT) From: Thinh Tran To: dev@dpdk.org Cc: Thinh Tran Date: Wed, 21 Jul 2021 16:13:08 -0500 Message-Id: <20210721211308.16644-1-thinhtr@linux.vnet.ibm.com> X-Mailer: git-send-email 2.21.0.windows.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 3qUoRTzGAAYOZLoH8S6_EVkgKt3r0Gca X-Proofpoint-ORIG-GUID: 3qUoRTzGAAYOZLoH8S6_EVkgKt3r0Gca X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-21_10:2021-07-21, 2021-07-21 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 mlxscore=0 lowpriorityscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 priorityscore=1501 spamscore=0 malwarescore=0 suspectscore=0 impostorscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107210125 Subject: [dpdk-dev] [PATCH] build: enable to build on power10 or newer for ppc 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" A older version of complier would fail to generate code for new Power CPUs when it uses "-mcpu=native" argument. This patch will test if the compiler supports the current Power CPU type then proceeds with "-mcpu=native" argument, else it tries with older type. Limit to two older CPU type levels. Signed-off-by: Thinh Tran --- config/ppc/check_cpu_platform.sh | 2 ++ config/ppc/meson.build | 40 +++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 config/ppc/check_cpu_platform.sh diff --git a/config/ppc/check_cpu_platform.sh b/config/ppc/check_cpu_platform.sh new file mode 100644 index 0000000000..cdea24561b --- /dev/null +++ b/config/ppc/check_cpu_platform.sh @@ -0,0 +1,2 @@ +#! /bin/sh +LD_SHOW_AUXV=1 /bin/true | awk '/AT_PLATFORM/ {print $2}'|sed 's/\power//' diff --git a/config/ppc/meson.build b/config/ppc/meson.build index adf49e1f42..05aa860cfd 100644 --- a/config/ppc/meson.build +++ b/config/ppc/meson.build @@ -7,16 +7,40 @@ endif dpdk_conf.set('RTE_ARCH', 'ppc_64') dpdk_conf.set('RTE_ARCH_PPC_64', 1) -# RHEL 7.x uses gcc 4.8.X which doesn't generate code for Power 9 CPUs, -# though it will detect a Power 9 CPU when the "-mcpu=native" argument -# is used, resulting in a build failure. -power9_supported = cc.has_argument('-mcpu=power9') -if not power9_supported - cpu_instruction_set = 'power8' - machine_args = ['-mcpu=power8', '-mtune=power8'] - dpdk_conf.set('RTE_MACHINE','power8') +# Checking compiler for supporting Power CPU platform +# For newer Power(N) System that current gcc may not supoort it yet, +# it falls back and try N-1 and N-2 +check_cpu = find_program(join_paths(meson.current_source_dir(), + 'check_cpu_platform.sh')) + +target_cpu = run_command(check_cpu.path()).stdout().strip() + +cpu_int = target_cpu.to_int() +cpu_flag = '-mcpu=power@0@' +tune_flag = '-mtune=power@0@' +machine_type = 'power@0@' +debug = 'configure the compiler to build DPDK for POWER@0@ platform' + +if cc.has_argument(cpu_flag.format(cpu_int)) + + # target system cpu is supported by the compiler, use '-mcpu=native' + message(debug.format(target_cpu+'_native')) + machine_args = ['-mcpu=native'] + dpdk_conf.set('RTE_MACHINE',machine_type.format(cpu_int)) +elif cc.has_argument(cpu_flag.format(cpu_int-1)) + message(debug.format(cpu_int-1)) + machine_args = [cpu_flag.format(cpu_int-1),tune_flag.format(cpu_int-1)] + dpdk_conf.set('RTE_MACHINE',machine_type.format(cpu_int-1)) +elif cc.has_argument(cpu_flag.format(cpu_int-2)) + message(debug.format(cpu_int-2)) + machine_args = [cpu_flag.format(cpu_int-2),tune_flag.format(cpu_int-2)] + dpdk_conf.set('RTE_MACHINE',machine_type.format(cpu_int-2)) +else + error('The compiler does not support POWER@0@ platform' .format(cpu_int)) endif + + # Certain POWER9 systems can scale as high as 1536 LCORES, but setting such a # high value can waste memory, cause timeouts in time limited autotests, and is # unlikely to be used in many production situations. Similarly, keeping the