From patchwork Tue Oct 12 18:54:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Tran X-Patchwork-Id: 101250 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 0D443A0C4C; Tue, 12 Oct 2021 20:54:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 985E4410DC; Tue, 12 Oct 2021 20:54:47 +0200 (CEST) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by mails.dpdk.org (Postfix) with ESMTP id B8B914003C for ; Tue, 12 Oct 2021 20:54:45 +0200 (CEST) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19CHbW81026805 for ; Tue, 12 Oct 2021 14:54:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=uMOqcd42EUYuA7PtdUfNqqZ0DiLqVh2wKdajQPE0j44=; b=KBqu8pmMC4fkih5EnmBiUPukfELVszUPBWRj4wO2o+oqJWGEcDaQR5ECWpmm6Hz4opz1 LAi+BN44xCLSI7pnrsIki0oFMxl/Mp5ZBLajSPt3MXrDKv4B0/jU3dQlWZUbv8pOz1TK CEfaKm+lPeTILyRuLSlmzUzF6OObkKdr8EAZYtb6KnMRLKCapLhADz0bydpnz0lzgxmq 27QI9ii+77Z4jjjIlcKK1k2Ep9aJQp7Y8CW7rNJ7I8tM7AjzbKWAVFIj07dtVd+5qh/U UGTwQYFIQ3aSkqN+5zjkh7SZaPqWm/cw+t1K6pXYHl2DTcOglKg+PARrTBkOttqE8KYf pQ== Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bn9993esf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 12 Oct 2021 14:54:44 -0400 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 19CIrSd4022751 for ; Tue, 12 Oct 2021 18:54:44 GMT Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by ppma02wdc.us.ibm.com with ESMTP id 3bk2qb9p9f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 12 Oct 2021 18:54:44 +0000 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19CIshl134996634 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Oct 2021 18:54:43 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 17B1DBE05D; Tue, 12 Oct 2021 18:54:43 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1EAEDBE056; Tue, 12 Oct 2021 18:54:42 +0000 (GMT) Received: from linux.vnet.ibm.com (unknown [9.114.219.126]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 12 Oct 2021 18:54:41 +0000 (GMT) From: Thinh Tran To: dev@dpdk.org Cc: Thinh Tran , David Christensen Date: Tue, 12 Oct 2021 18:54:32 +0000 Message-Id: <20211012185432.647898-1-thinhtr@linux.vnet.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210930000811.593298-1-thinhtr@linux.vnet.ibm.com> References: <20210930000811.593298-1-thinhtr@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: LgXTjMhleqfWfmtKb2QnH1HpR4RQcAdD X-Proofpoint-ORIG-GUID: LgXTjMhleqfWfmtKb2QnH1HpR4RQcAdD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-12_04,2021-10-12_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 clxscore=1015 bulkscore=0 lowpriorityscore=0 impostorscore=0 phishscore=0 suspectscore=0 malwarescore=0 priorityscore=1501 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110120099 Subject: [dpdk-dev] [PATCH v2] build/ppc: enable build support for Power10 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" For native build, enabling building the highest cpu_instruction_set supported by the build host, including the new POWER10. For cross compile, verifying that the compiler supports the cpu_instruction_set specified in the cross-file Signed-off-by: Thinh Tran Reviewed-by: David Christensen v2: * resubmit to trigger the rebuild on the current head of repo which should have the fix for the build issue reported in Bug 817 --- config/ppc/meson.build | 83 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/config/ppc/meson.build b/config/ppc/meson.build index aa1327a595..cba8222163 100644 --- a/config/ppc/meson.build +++ b/config/ppc/meson.build @@ -24,6 +24,89 @@ if (cc.get_id() == 'gcc' and cc.version().version_compare('>=10.0') and cc.version().version_compare('<12.0') and cc.has_argument('-Wno-psabi')) add_project_arguments('-Wno-psabi', language: 'c') endif +# If using a generic build, select the lowest common denominator +if platform == 'generic' + cpu_instruction_set = 'power8' +# If using a native build, select the highest cpu_instruction_set supported +# by the build host. (Native is the default platform type set in meson_options.txt.) +# When a cross compile is detected, verify that the compiler/assembler supports +# the requested cpu_instruction_set in the cross-file. +elif platform == 'native' + if meson.is_cross_build() + # cpu_instruction_set specified in cross-compile file as "cpu" + if host_machine.cpu() == 'power10' + test_p10 = ''' +#include +#include +int main() { + __vector unsigned __int128 t, a, b; +#ifdef _ARCH_PWR10 + __asm__("vcmpequq %0,%1,%2;" : "=v" (t) : "v" (a), "v" (b) : ); +#else +#error POWER10 not supported +#endif + printf("%d", (int)t[0]); + return 0; +} +''' + if not cc.compiles(test_p10, args : '-mcpu=power10', name: 'Detect P10') + error('POWER10 requested but not supported') + endif + endif + else + # Using a POWER native build host. Assume P8 support, move to later CPUs + # if supported by the build host and the compiler. Detect the CPU used by + # the build host + detect_cpu = ''' +#include +#include +#include +int main() { + char * platform = (char*) getauxval(AT_PLATFORM); + if (platform) { + if (!strncmp(platform,"power",5)) { + printf("%s", platform+5); return 0; + } + } + return 1; +}''' + result = cc.run(detect_cpu, name : 'Detect host CPU type') + if not result.compiled() + error('Failed to detect CPU type') + endif + cpu = result.stdout().to_int() + if cpu < 8 + error('Unsupported POWER CPU detected') + else + # Found supported CPU on build host, verify compiler support + mcpu_flag = '-mcpu=power@0@' + if cc.has_argument(mcpu_flag.format(cpu)) + # Compiler supports current detected CPU + elif cc.has_argument(mcpu_flag.format(cpu-1)) + cpu = cpu-1 + elif cc.has_argument(mcpu_flag.format(cpu-2)) + cpu = cpu-2 + else + error('Compiler does not support POWER@0@ platform'.format(cpu)) + endif + if cpu > 8 + cpu_instruction_set = 'power'+cpu.to_string() + else + error('Compiler does not support POWER@0@ platform'.format(cpu)) + endif + endif + endif #end if not cross-build +else + # User has explicitly chosen a platform for the build, use that + if cc.has_argument('-mcpu=' + platform) + cpu_instruction_set = platform + else + error('User selected platform ' + platform + ' not supported by compiler') + endif +endif +machine_args = ['-mcpu=' + cpu_instruction_set, '-mtune=' + cpu_instruction_set] +dpdk_conf.set('RTE_MACHINE', cpu_instruction_set) + # 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