[v9,07/14] build: isolate configuration for generic build

Message ID 1605100718-7991-8-git-send-email-juraj.linkes@pantheon.tech (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Arm build options rework |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Juraj Linkeš Nov. 11, 2020, 1:18 p.m. UTC
  Use generic configuration for the only build where it makes sense - the
generic build. For other builds, if we don't know either of implementer
ID or part number, the build is not supported.
Add part numbers to cross files where fallback to generic configuration
is assumed.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 config/arm/arm64_emag_linux_gcc               |  1 +
 ..._linux_gcc => arm64_thunderxt88_linux_gcc} |  1 +
 config/arm/meson.build                        | 45 +++++++++----------
 .../linux_gsg/cross_build_dpdk_for_arm64.rst  |  9 ++--
 4 files changed, 27 insertions(+), 29 deletions(-)
 rename config/arm/{arm64_thunderx_linux_gcc => arm64_thunderxt88_linux_gcc} (93%)
  

Comments

Honnappa Nagarahalli Nov. 13, 2020, 5:50 a.m. UTC | #1
<snip>

> 
> Use generic configuration for the only build where it makes sense - the
> generic build. For other builds, if we don't know either of implementer ID or
> part number, the build is not supported.
> Add part numbers to cross files where fallback to generic configuration is
> assumed.
> 
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

> ---
>  config/arm/arm64_emag_linux_gcc               |  1 +
>  ..._linux_gcc => arm64_thunderxt88_linux_gcc} |  1 +
>  config/arm/meson.build                        | 45 +++++++++----------
>  .../linux_gsg/cross_build_dpdk_for_arm64.rst  |  9 ++--
>  4 files changed, 27 insertions(+), 29 deletions(-)  rename
> config/arm/{arm64_thunderx_linux_gcc => arm64_thunderxt88_linux_gcc}
> (93%)
> 
> diff --git a/config/arm/arm64_emag_linux_gcc
> b/config/arm/arm64_emag_linux_gcc index 24f3d533e..c675954fc 100644
> --- a/config/arm/arm64_emag_linux_gcc
> +++ b/config/arm/arm64_emag_linux_gcc
> @@ -14,3 +14,4 @@ endian = 'little'
> 
>  [properties]
>  implementer_id = '0x50'
> +part_number = '0x0'
> diff --git a/config/arm/arm64_thunderx_linux_gcc
> b/config/arm/arm64_thunderxt88_linux_gcc
> similarity index 93%
> rename from config/arm/arm64_thunderx_linux_gcc
> rename to config/arm/arm64_thunderxt88_linux_gcc
> index 670764437..758966262 100644
> --- a/config/arm/arm64_thunderx_linux_gcc
> +++ b/config/arm/arm64_thunderxt88_linux_gcc
> @@ -14,3 +14,4 @@ endian = 'little'
> 
>  [properties]
>  implementer_id = '0x43'
> +part_number = '0xa1'
> diff --git a/config/arm/meson.build b/config/arm/meson.build index
> eb15848cb..fec06e70c 100644
> --- a/config/arm/meson.build
> +++ b/config/arm/meson.build
> @@ -48,8 +48,6 @@ implementer_generic = {  }
> 
>  part_number_config_arm = {
> -	'generic': {'machine_args':  ['-march=armv8-a+crc',
> -				      '-moutline-atomics']},
>  	'native': {'machine_args':  ['-march=native']},
>  	'0xd03': {'machine_args':  ['-mcpu=cortex-a53']},
>  	'0xd04': {'machine_args':  ['-mcpu=cortex-a35']}, @@ -98,8 +96,6 @@
> implementer_cavium = {
>  		['RTE_MAX_NUMA_NODES', 2]
>  	],
>  	'part_number_config': {
> -		'generic': {'machine_args': ['-march=armv8-a+crc+crypto',
> -					     '-mcpu=thunderx']},
>  		'native': {'machine_args': ['-march=native']},
>  		'0xa1': {
>  			'machine_args': ['-mcpu=thunderxt88'], @@ -149,8
> +145,8 @@ implementer_ampere = {
>  		['RTE_MAX_NUMA_NODES', 1]
>  	],
>  	'part_number_config': {
> -		'generic': {'machine_args':  ['-march=armv8-a+crc+crypto',
> -					      '-mtune=emag']},
> +		'0x0': {'machine_args':  ['-march=armv8-a+crc+crypto',
> +					  '-mtune=emag']},
>  		'native': {'machine_args':  ['-march=native']}
>  	}
>  }
> @@ -200,10 +196,9 @@ if dpdk_conf.get('RTE_ARCH_32')
>  	machine_args += '-mfpu=neon'
>  else
>  	# aarch64 build
> -	implementer_id = 'generic'
>  	if machine == 'generic' and not meson.is_cross_build()
>  		# generic build
> -		implementer_config = implementer['generic']
> +		implementer_id = 'generic'
>  		part_number = 'generic'
>  	elif not meson.is_cross_build()
>  		# native build
> @@ -216,21 +211,24 @@ else
>  			cmd_output = cmd.stdout().to_lower().strip().split('
> ')
>  			implementer_id = cmd_output[0]
>  			part_number = cmd_output[3]
> -		endif
> -		# Set to generic if variable is not found
> -		implementer_config = implementers.get(implementer_id,
> ['generic'])
> -		if implementer_config[0] == 'generic'
> -			implementer_config = implementer['generic']
> -			part_number = 'generic'
> +		else
> +			error('Error when getting Arm Implementer ID and
> part number.')
>  		endif
>  		if arm_force_native_march == true
>  			part_number = 'native'
>  		endif
>  	else
>  		# cross build
> -		implementer_id =
> meson.get_cross_property('implementer_id', 'generic')
> -		part_number = meson.get_cross_property('part_number',
> 'generic')
> -		implementer_config = implementers.get(implementer_id)
> +		implementer_id =
> meson.get_cross_property('implementer_id')
> +		part_number = meson.get_cross_property('part_number')
> +	endif
> +
> +	if implementers.has_key(implementer_id)
> +		implementer_config = implementers[implementer_id]
> +	else
> +		error('Unsupported Arm implementer: @0@.
> '.format(implementer_id) +
> +		      'Please add support for it or use the generic ' +
> +		      '(-Dmachine=generic) build.')
>  	endif
> 
>  	message('Arm implementer: ' + implementer_config['description'])
> @@ -240,15 +238,12 @@ else
>  	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))
> +		# unknown part number
> +		error('Unsupported part number @0@ of implementer
> @1@. '
> +		      .format(part_number, implementer_id) +
> +		      'Please add support for it or use the generic ' +
> +		      '(-Dmachine=generic) build.')
>  	endif
> 
>  	# use default flags with implementer flags diff --git
> a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
> b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
> index 972598835..6a883b030 100644
> --- a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
> +++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
> @@ -114,8 +114,10 @@ you may use various combinations of
> implementer/part number::
>        '0x56':    Marvell ARMADA
>        'dpaa':    NXP DPAA
> 
> -   Supported part_numbers for generic, 0x41, 0x56, dpaa:
> -      'generic': valid for all armv8-a architectures (default value)
> +   Supported part_numbers for generic:
> +      'generic': valid for all armv8-a architectures (unoptimized
> + portable build)
> +
> +   Supported part_numbers for 0x41, 0x56, dpaa:
>        '0xd03':   cortex-a53
>        '0xd04':   cortex-a35
>        '0xd09':   cortex-a73
> @@ -124,7 +126,6 @@ you may use various combinations of
> implementer/part number::
>        '0xd0c':   neoverse-n1
> 
>     Supported part_numbers for 0x43:
> -      'generic': valid for all Cavium builds
>        '0xa1':    thunderxt88
>        '0xa2':    thunderxt81
>        '0xa3':    thunderxt83
> @@ -132,4 +133,4 @@ you may use various combinations of
> implementer/part number::
>        '0xb2':    octeontx2
> 
>     Supported part_numbers for 0x50:
> -      'generic': valid for all Ampere builds
> +      '0x0':     emag
> --
> 2.20.1
  
Thomas Monjalon Nov. 13, 2020, 1:11 p.m. UTC | #2
11/11/2020 14:18, Juraj Linkeš:
> Use generic configuration for the only build where it makes sense - the
> generic build. For other builds, if we don't know either of implementer
> ID or part number, the build is not supported.
> Add part numbers to cross files where fallback to generic configuration
> is assumed.
> 
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>

It fails for config/arm/arm64_dpaa_linux_gcc:
config/arm/meson.build:223:2: ERROR: Unknown cross property: part_number.

Are you testing all platforms in config/arm/?
  
Juraj Linkeš Nov. 13, 2020, 2:03 p.m. UTC | #3
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Friday, November 13, 2020 2:11 PM
> To: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Cc: 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; ajit.khaparde@broadcom.com;
> ferruh.yigit@intel.com; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v9 07/14] build: isolate configuration for generic
> build
> 
> 11/11/2020 14:18, Juraj Linkeš:
> > Use generic configuration for the only build where it makes sense -
> > the generic build. For other builds, if we don't know either of
> > implementer ID or part number, the build is not supported.
> > Add part numbers to cross files where fallback to generic
> > configuration is assumed.
> >
> > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> 
> It fails for config/arm/arm64_dpaa_linux_gcc:
> config/arm/meson.build:223:2: ERROR: Unknown cross property: part_number.
> 
> Are you testing all platforms in config/arm/?
> 

I've tested this, but I forgot to fix it when I learned what the proper part_number should be. It works with all the patches in the series, but I can add it here as well if you want me to.

> 
>
  
Thomas Monjalon Nov. 13, 2020, 2:18 p.m. UTC | #4
13/11/2020 15:03, Juraj Linkeš:
> From: Thomas Monjalon <thomas@monjalon.net>
> > 11/11/2020 14:18, Juraj Linkeš:
> > > Use generic configuration for the only build where it makes sense -
> > > the generic build. For other builds, if we don't know either of
> > > implementer ID or part number, the build is not supported.
> > > Add part numbers to cross files where fallback to generic
> > > configuration is assumed.
> > >
> > > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > 
> > It fails for config/arm/arm64_dpaa_linux_gcc:
> > config/arm/meson.build:223:2: ERROR: Unknown cross property: part_number.
> > 
> > Are you testing all platforms in config/arm/?
> > 
> 
> I've tested this, but I forgot to fix it when I learned what the proper part_number should be. It works with all the patches in the series, but I can add it here as well if you want me to.

All patches must compile please.
I'm afraid it will make this series deferred to later.
  
Juraj Linkeš Nov. 13, 2020, 2:22 p.m. UTC | #5
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Friday, November 13, 2020 3:18 PM
> To: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Cc: 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; ajit.khaparde@broadcom.com;
> ferruh.yigit@intel.com; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v9 07/14] build: isolate configuration for generic
> build
> 
> 13/11/2020 15:03, Juraj Linkeš:
> > From: Thomas Monjalon <thomas@monjalon.net>
> > > 11/11/2020 14:18, Juraj Linkeš:
> > > > Use generic configuration for the only build where it makes sense
> > > > - the generic build. For other builds, if we don't know either of
> > > > implementer ID or part number, the build is not supported.
> > > > Add part numbers to cross files where fallback to generic
> > > > configuration is assumed.
> > > >
> > > > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > >
> > > It fails for config/arm/arm64_dpaa_linux_gcc:
> > > config/arm/meson.build:223:2: ERROR: Unknown cross property:
> part_number.
> > >
> > > Are you testing all platforms in config/arm/?
> > >
> >
> > I've tested this, but I forgot to fix it when I learned what the proper
> part_number should be. It works with all the patches in the series, but I can add
> it here as well if you want me to.
> 
> All patches must compile please.
> I'm afraid it will make this series deferred to later.
> 
> 

I can send a fixed version right away.
  
Thomas Monjalon Nov. 13, 2020, 2:35 p.m. UTC | #6
13/11/2020 15:22, Juraj Linkeš:
> From: Thomas Monjalon <thomas@monjalon.net>
> > 13/11/2020 15:03, Juraj Linkeš:
> > > From: Thomas Monjalon <thomas@monjalon.net>
> > > > 11/11/2020 14:18, Juraj Linkeš:
> > > > > Use generic configuration for the only build where it makes sense
> > > > > - the generic build. For other builds, if we don't know either of
> > > > > implementer ID or part number, the build is not supported.
> > > > > Add part numbers to cross files where fallback to generic
> > > > > configuration is assumed.
> > > > >
> > > > > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > > >
> > > > It fails for config/arm/arm64_dpaa_linux_gcc:
> > > > config/arm/meson.build:223:2: ERROR: Unknown cross property:
> > part_number.
> > > >
> > > > Are you testing all platforms in config/arm/?
> > > >
> > >
> > > I've tested this, but I forgot to fix it when I learned what the proper
> > part_number should be. It works with all the patches in the series, but I can add
> > it here as well if you want me to.
> > 
> > All patches must compile please.
> > I'm afraid it will make this series deferred to later.
> 
> I can send a fixed version right away.

OK but be aware that we need to wait for the CI
and I won't have time to test again compilation today,
so no guarantee about when it can be merged.
  

Patch

diff --git a/config/arm/arm64_emag_linux_gcc b/config/arm/arm64_emag_linux_gcc
index 24f3d533e..c675954fc 100644
--- a/config/arm/arm64_emag_linux_gcc
+++ b/config/arm/arm64_emag_linux_gcc
@@ -14,3 +14,4 @@  endian = 'little'
 
 [properties]
 implementer_id = '0x50'
+part_number = '0x0'
diff --git a/config/arm/arm64_thunderx_linux_gcc b/config/arm/arm64_thunderxt88_linux_gcc
similarity index 93%
rename from config/arm/arm64_thunderx_linux_gcc
rename to config/arm/arm64_thunderxt88_linux_gcc
index 670764437..758966262 100644
--- a/config/arm/arm64_thunderx_linux_gcc
+++ b/config/arm/arm64_thunderxt88_linux_gcc
@@ -14,3 +14,4 @@  endian = 'little'
 
 [properties]
 implementer_id = '0x43'
+part_number = '0xa1'
diff --git a/config/arm/meson.build b/config/arm/meson.build
index eb15848cb..fec06e70c 100644
--- a/config/arm/meson.build
+++ b/config/arm/meson.build
@@ -48,8 +48,6 @@  implementer_generic = {
 }
 
 part_number_config_arm = {
-	'generic': {'machine_args':  ['-march=armv8-a+crc',
-				      '-moutline-atomics']},
 	'native': {'machine_args':  ['-march=native']},
 	'0xd03': {'machine_args':  ['-mcpu=cortex-a53']},
 	'0xd04': {'machine_args':  ['-mcpu=cortex-a35']},
@@ -98,8 +96,6 @@  implementer_cavium = {
 		['RTE_MAX_NUMA_NODES', 2]
 	],
 	'part_number_config': {
-		'generic': {'machine_args': ['-march=armv8-a+crc+crypto',
-					     '-mcpu=thunderx']},
 		'native': {'machine_args': ['-march=native']},
 		'0xa1': {
 			'machine_args': ['-mcpu=thunderxt88'],
@@ -149,8 +145,8 @@  implementer_ampere = {
 		['RTE_MAX_NUMA_NODES', 1]
 	],
 	'part_number_config': {
-		'generic': {'machine_args':  ['-march=armv8-a+crc+crypto',
-					      '-mtune=emag']},
+		'0x0': {'machine_args':  ['-march=armv8-a+crc+crypto',
+					  '-mtune=emag']},
 		'native': {'machine_args':  ['-march=native']}
 	}
 }
@@ -200,10 +196,9 @@  if dpdk_conf.get('RTE_ARCH_32')
 	machine_args += '-mfpu=neon'
 else
 	# aarch64 build
-	implementer_id = 'generic'
 	if machine == 'generic' and not meson.is_cross_build()
 		# generic build
-		implementer_config = implementer['generic']
+		implementer_id = 'generic'
 		part_number = 'generic'
 	elif not meson.is_cross_build()
 		# native build
@@ -216,21 +211,24 @@  else
 			cmd_output = cmd.stdout().to_lower().strip().split(' ')
 			implementer_id = cmd_output[0]
 			part_number = cmd_output[3]
-		endif
-		# Set to generic if variable is not found
-		implementer_config = implementers.get(implementer_id, ['generic'])
-		if implementer_config[0] == 'generic'
-			implementer_config = implementer['generic']
-			part_number = 'generic'
+		else
+			error('Error when getting Arm Implementer ID and part number.')
 		endif
 		if arm_force_native_march == true
 			part_number = 'native'
 		endif
 	else
 		# cross build
-		implementer_id = meson.get_cross_property('implementer_id', 'generic')
-		part_number = meson.get_cross_property('part_number', 'generic')
-		implementer_config = implementers.get(implementer_id)
+		implementer_id = meson.get_cross_property('implementer_id')
+		part_number = meson.get_cross_property('part_number')
+	endif
+
+	if implementers.has_key(implementer_id)
+		implementer_config = implementers[implementer_id]
+	else
+		error('Unsupported Arm implementer: @0@. '.format(implementer_id) +
+		      'Please add support for it or use the generic ' +
+		      '(-Dmachine=generic) build.')
 	endif
 
 	message('Arm implementer: ' + implementer_config['description'])
@@ -240,15 +238,12 @@  else
 	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))
+		# unknown part number
+		error('Unsupported part number @0@ of implementer @1@. '
+		      .format(part_number, implementer_id) +
+		      'Please add support for it or use the generic ' +
+		      '(-Dmachine=generic) build.')
 	endif
 
 	# use default flags with implementer flags
diff --git a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
index 972598835..6a883b030 100644
--- a/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
+++ b/doc/guides/linux_gsg/cross_build_dpdk_for_arm64.rst
@@ -114,8 +114,10 @@  you may use various combinations of implementer/part number::
       '0x56':    Marvell ARMADA
       'dpaa':    NXP DPAA
 
-   Supported part_numbers for generic, 0x41, 0x56, dpaa:
-      'generic': valid for all armv8-a architectures (default value)
+   Supported part_numbers for generic:
+      'generic': valid for all armv8-a architectures (unoptimized portable build)
+
+   Supported part_numbers for 0x41, 0x56, dpaa:
       '0xd03':   cortex-a53
       '0xd04':   cortex-a35
       '0xd09':   cortex-a73
@@ -124,7 +126,6 @@  you may use various combinations of implementer/part number::
       '0xd0c':   neoverse-n1
 
    Supported part_numbers for 0x43:
-      'generic': valid for all Cavium builds
       '0xa1':    thunderxt88
       '0xa2':    thunderxt81
       '0xa3':    thunderxt83
@@ -132,4 +133,4 @@  you may use various combinations of implementer/part number::
       '0xb2':    octeontx2
 
    Supported part_numbers for 0x50:
-      'generic': valid for all Ampere builds
+      '0x0':     emag