From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id B6FAAA09FF;
	Tue,  5 Jan 2021 23:17:53 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id CD4FD16083F;
	Tue,  5 Jan 2021 23:17:52 +0100 (CET)
Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com
 [148.163.158.5])
 by mails.dpdk.org (Postfix) with ESMTP id D832D160839
 for <dev@dpdk.org>; Tue,  5 Jan 2021 23:17:51 +0100 (CET)
Received: from pps.filterd (m0098413.ppops.net [127.0.0.1])
 by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id
 105MEYKC177691; Tue, 5 Jan 2021 17:17:47 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com;
 h=subject : to : cc :
 references : from : message-id : date : mime-version : in-reply-to :
 content-type : content-transfer-encoding; s=pp1;
 bh=ZFsTaSLhceedNDrPG6fiC2Db3Tv2skrswd8170+Uo78=;
 b=iecpfBUpllx2Z8CzkIrMtZpiMT6BjIeyNkC3fky4FYLB9MixgDQCiAfj8QpcqcG1RObn
 qtd80nPEW+AgFZoVIyei6zE7jvQtZA3LlrfxFLyF9iiZ+MoUxfgaQE3V8RNaUs/tQo0H
 Kp1lPd5GuxXLrD4iHhqkU+g+YDucVlN8FPjtAI3oC3okvcDYdJeyH+mYH/EpZYUNOyax
 p8hg8ITW3N6ggOWZ7VBA4Py+3Tj+caBdMANG8INFz4pj6Ev5T6Yfej9fLNunrE+6fjXw
 Zq4NGrn5VbzxnNKxNAZQxo0GRsj2BVRwFoq5k1w62x/puU4uD9m+MOODhC/efopYdB4K TA== 
Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com
 [169.47.144.26])
 by mx0b-001b2d01.pphosted.com with ESMTP id 35w0r20199-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
 Tue, 05 Jan 2021 17:17:47 -0500
Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1])
 by ppma04wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 105MGxGe004444;
 Tue, 5 Jan 2021 22:17:46 GMT
Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com
 [9.57.198.25]) by ppma04wdc.us.ibm.com with ESMTP id 35tgf9rstd-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
 Tue, 05 Jan 2021 22:17:46 +0000
Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com
 [9.57.199.108])
 by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id
 105MHkMN30278092
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Tue, 5 Jan 2021 22:17:46 GMT
Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1])
 by IMSVA (Postfix) with ESMTP id 173B0B2065;
 Tue,  5 Jan 2021 22:17:46 +0000 (GMT)
Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1])
 by IMSVA (Postfix) with ESMTP id 8034FB205F;
 Tue,  5 Jan 2021 22:17:45 +0000 (GMT)
Received: from Davids-MBP.randomparity.org (unknown [9.163.86.38])
 by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP;
 Tue,  5 Jan 2021 22:17:45 +0000 (GMT)
To: =?UTF-8?Q?Juraj_Linke=c5=a1?= <juraj.linkes@pantheon.tech>,
 "thomas@monjalon.net" <thomas@monjalon.net>,
 "bruce.richardson@intel.com" <bruce.richardson@intel.com>,
 "Honnappa.Nagarahalli@arm.com" <Honnappa.Nagarahalli@arm.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
References: <1606405649-4308-1-git-send-email-juraj.linkes@pantheon.tech>
 <1609761130-4627-1-git-send-email-juraj.linkes@pantheon.tech>
 <2c52c961e32643f385c9ce76d9d78236@pantheon.tech>
From: David Christensen <drc@linux.vnet.ibm.com>
Message-ID: <1be8e489-db41-c0d6-8518-d2844c8145c4@linux.vnet.ibm.com>
Date: Tue, 5 Jan 2021 14:17:44 -0800
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0)
 Gecko/20100101 Thunderbird/78.6.0
MIME-Version: 1.0
In-Reply-To: <2c52c961e32643f385c9ce76d9d78236@pantheon.tech>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-TM-AS-GCONF: 00
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737
 definitions=2021-01-05_07:2021-01-05,
 2021-01-05 signatures=0
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
 priorityscore=1501 mlxscore=0
 lowpriorityscore=0 malwarescore=0 bulkscore=0 phishscore=0 mlxlogscore=999
 clxscore=1011 impostorscore=0 suspectscore=0 spamscore=0 adultscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000
 definitions=main-2101050125
Subject: Re: [dpdk-dev] [RFC PATCH v2] build: add platform meson option
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

>> The current meson option 'machine' should only specify the ISA, which is not
>> sufficient for Arm, where setting ISA implies other setting as well.
>> Add a new meson option, 'platform', which differentiates the type of the build
>> (native/generic) and sets machine accordingly, unless the user chooses to
>> override it.
>> The 'machine' option also doesn't describe very well what it sets, so introduce a
>> new option 'cpu_instruction_set', but keep 'machine' for backward
>> compatibility.
>> These two new variables, taken together, achieve what 'machine' was setting
>> per architecture - setting the ISA in x86 build and setting native/default 'build
>> type' in aarch64 build - is now properly being set for all architectures in a
>> uniform manner.
>>
>> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
>> ---
>>   config/arm/meson.build        |  4 +--
>>   config/meson.build            | 47 +++++++++++++++++++++++++----------
>>   devtools/test-meson-builds.sh |  9 ++++---
>>   meson_options.txt             |  8 ++++--
>>   4 files changed, 47 insertions(+), 21 deletions(-)
>>
>> diff --git a/config/arm/meson.build b/config/arm/meson.build index
>> 42b4e43c7..6b09a74a7 100644
>> --- a/config/arm/meson.build
>> +++ b/config/arm/meson.build
>> @@ -3,10 +3,10 @@
>>   # Copyright(c) 2017 Cavium, Inc
>>
>>   # for checking defines we need to use the correct compiler flags -march_opt = '-
>> march=@0@'.format(machine)
>> +march_opt = '-march=@0@'.format(cpu_instruction_set)
>>
>>   arm_force_native_march = false
>> -arm_force_default_march = (machine == 'default')
>> +arm_force_default_march = (platform == 'generic')
>>
>>   flags_common_default = [
>>   	# Accelarate rte_memcpy. Be sure to run unit test
>> (memcpy_perf_autotest) diff --git a/config/meson.build b/config/meson.build
>> index a3154e29c..647116513 100644
>> --- a/config/meson.build
>> +++ b/config/meson.build
>> @@ -63,42 +63,63 @@ if not is_windows
>>   			pmd_subdir_opt)
>>   endif
>>
>> -# set the machine type and cflags for it
>> +platform = get_option('platform')
>> +
>> +# set the cpu_instruction_set type and cflags for it
>>   if meson.is_cross_build()
>> -	machine = host_machine.cpu()
>> +	cpu_instruction_set = host_machine.cpu()
>>   else
>> -	machine = get_option('machine')
>> +	cpu_instruction_set = get_option('cpu_instruction_set')
>> +	if get_option('machine') != 'auto'
>> +		warning('The "machine" option is deprecated. ' +
>> +		        'Please use "cpu_instruction_set" instead.')
>> +		if cpu_instruction_set != 'auto'
>> +			error('Setting both "machine" and ' +
>> +			      '"cpu_instruction_set" is unsupported.')
>> +		endif
>> +		cpu_instruction_set = get_option('machine')
>> +	endif
>> +endif
>> +
>> +if platform == 'native'
>> +	if cpu_instruction_set == 'auto'
>> +		cpu_instruction_set = 'native'
>> +	endif
>> +elif platform == 'generic'
>> +	if cpu_instruction_set == 'auto'
>> +		cpu_instruction_set = 'default'
>> +	endif
>>   endif
>>
>> -# machine type 'default' is special, it defaults to the per arch agreed common
>> +if cpu_instruction_set == 'default'
>> +# cpu_instruction_set type 'default' is special, it defaults to the per
>> +arch agreed common
>>   # minimal baseline needed for DPDK.
>>   # That might not be the most optimized, but the most portable version while  #
>> still being able to support the CPU features required for DPDK.
>>   # This can be bumped up by the DPDK project, but it can never be an  # invariant
>> like 'native'
>> -if machine == 'default'
>>   	if host_machine.cpu_family().startswith('x86')
>>   		# matches the old pre-meson build systems default
>> -		machine = 'corei7'
>> +		cpu_instruction_set = 'corei7'
>>   	elif host_machine.cpu_family().startswith('arm')
>> -		machine = 'armv7-a'
>> +		cpu_instruction_set = 'armv7-a'
>>   	elif host_machine.cpu_family().startswith('aarch')
>>   		# arm64 manages defaults in config/arm/meson.build
>> -		machine = 'default'
>> +		cpu_instruction_set = 'default'
>>   	elif host_machine.cpu_family().startswith('ppc')
>> -		machine = 'power8'
>> +		cpu_instruction_set = 'power8'
>>   	endif
>>   endif

This change forces the build on a P9 system to use the P8 instruction 
set.  Prior to this change the "native" machine type was used which 
resulted in P9 instructions when built on a P9 system.  How do I force 
the build to use the power9 instruction set in this case?

Dave