[dpdk-dev] build: add support for vendor specific ARM cross builds

Message ID 20180119131508.7768-1-pbhagavatula@caviumnetworks.com (mailing list archive)
State Superseded, archived
Delegated to: Bruce Richardson
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Pavan Nikhilesh Jan. 19, 2018, 1:15 p.m. UTC
  Add various vendor specific cross build targets.
This can be verified by using linaro toolchain and running

	meson build --cross-file config/arm/arch64_armv8_<cpu>_cross

In future more cross build targets can be added.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
 config/arm/arch64_armv8_generic_cross  | 10 +++++++
 config/arm/arch64_armv8_thunderx_cross | 13 +++++++++
 config/arm/meson.build                 | 52 +++++++++++++++++++---------------
 3 files changed, 52 insertions(+), 23 deletions(-)
 create mode 100644 config/arm/arch64_armv8_generic_cross
 create mode 100644 config/arm/arch64_armv8_thunderx_cross
  

Comments

Bruce Richardson Jan. 19, 2018, 4:41 p.m. UTC | #1
On Fri, Jan 19, 2018 at 06:45:08PM +0530, Pavan Nikhilesh wrote:
> Add various vendor specific cross build targets.
> This can be verified by using linaro toolchain and running
> 
> 	meson build --cross-file config/arm/arch64_armv8_<cpu>_cross
> 

"arch64-armv8"? I thought we were standardizing on "arm64" as the naming
here, or alternatively I think it should be "aarch64", right?

In terms of file naming, do we want to have a file extension on these
files. I wondering if we want to change "_cross" to ".cross" for
instance. The basic example in the meson docs uses a .txt extension but
that looks weird to me. No strong opinion on my end, just looking for
any other ideas.

> In future more cross build targets can be added.

Yes, good idea. Is config/<arch> the best place to hold these, or should
we have a separate cross-build folder? I quite like having them in
config like you have done, but wondering if anyone disagrees?

> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> ---
>  config/arm/arch64_armv8_generic_cross  | 10 +++++++
>  config/arm/arch64_armv8_thunderx_cross | 13 +++++++++
>  config/arm/meson.build                 | 52 +++++++++++++++++++---------------
>  3 files changed, 52 insertions(+), 23 deletions(-)
>  create mode 100644 config/arm/arch64_armv8_generic_cross
>  create mode 100644 config/arm/arch64_armv8_thunderx_cross
> 

Adding Thomas on CC as he always has opinions on file locations and
naming.

/Bruce
  
Pavan Nikhilesh Jan. 19, 2018, 5:26 p.m. UTC | #2
On Fri, Jan 19, 2018 at 04:41:26PM +0000, Bruce Richardson wrote:
> On Fri, Jan 19, 2018 at 06:45:08PM +0530, Pavan Nikhilesh wrote:
> > Add various vendor specific cross build targets.
> > This can be verified by using linaro toolchain and running
> >
> > 	meson build --cross-file config/arm/arch64_armv8_<cpu>_cross
> >
>
> "arch64-armv8"? I thought we were standardizing on "arm64" as the naming
> here, or alternatively I think it should be "aarch64", right?
>

Currently, make uses "arm64-<platform>" as the naming convention.
I think either "arm64-<plat>" is better as we can easily represent
"arm-<plat>" (v7).

> In terms of file naming, do we want to have a file extension on these
> files. I wondering if we want to change "_cross" to ".cross" for
> instance. The basic example in the meson docs uses a .txt extension but
> that looks weird to me. No strong opinion on my end, just looking for
> any other ideas.
>
> > In future more cross build targets can be added.
>
> Yes, good idea. Is config/<arch> the best place to hold these, or should
> we have a separate cross-build folder? I quite like having them in
> config like you have done, but wondering if anyone disagrees?
>

I split this patch out from the other series specifically so that we could
discuss and agree upon common name/path etc. :-).

Thanks,
Pavan
> >
> > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> > ---
> >  config/arm/arch64_armv8_generic_cross  | 10 +++++++
> >  config/arm/arch64_armv8_thunderx_cross | 13 +++++++++
> >  config/arm/meson.build                 | 52 +++++++++++++++++++---------------
> >  3 files changed, 52 insertions(+), 23 deletions(-)
> >  create mode 100644 config/arm/arch64_armv8_generic_cross
> >  create mode 100644 config/arm/arch64_armv8_thunderx_cross
> >
>
> Adding Thomas on CC as he always has opinions on file locations and
> naming.
>
> /Bruce
  
Bruce Richardson Jan. 19, 2018, 5:35 p.m. UTC | #3
On Fri, Jan 19, 2018 at 10:56:08PM +0530, Pavan Nikhilesh wrote:
> On Fri, Jan 19, 2018 at 04:41:26PM +0000, Bruce Richardson wrote:
> > On Fri, Jan 19, 2018 at 06:45:08PM +0530, Pavan Nikhilesh wrote:
> > > Add various vendor specific cross build targets.
> > > This can be verified by using linaro toolchain and running
> > >
> > > 	meson build --cross-file config/arm/arch64_armv8_<cpu>_cross
> > >
> >
> > "arch64-armv8"? I thought we were standardizing on "arm64" as the naming
> > here, or alternatively I think it should be "aarch64", right?
> >
> 
> Currently, make uses "arm64-<platform>" as the naming convention.
> I think either "arm64-<plat>" is better as we can easily represent
> "arm-<plat>" (v7).
> 
Yes, keep it consistent with "make" names to avoid confusion.

> > In terms of file naming, do we want to have a file extension on these
> > files. I wondering if we want to change "_cross" to ".cross" for
> > instance. The basic example in the meson docs uses a .txt extension but
> > that looks weird to me. No strong opinion on my end, just looking for
> > any other ideas.
> >
> > > In future more cross build targets can be added.
> >
> > Yes, good idea. Is config/<arch> the best place to hold these, or should
> > we have a separate cross-build folder? I quite like having them in
> > config like you have done, but wondering if anyone disagrees?
> >
> 
> I split this patch out from the other series specifically so that we could
> discuss and agree upon common name/path etc. :-).

Good idea. If no discussion or objection I'll take your patch as-is
(with arm64 filenames) and we can always move/rename files later.

> 
> Thanks, Pavan
> > >
> > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> > > --- config/arm/arch64_armv8_generic_cross  | 10 +++++++
> > > config/arm/arch64_armv8_thunderx_cross | 13 +++++++++
> > > config/arm/meson.build                 | 52
> > > +++++++++++++++++++--------------- 3 files changed, 52
> > > insertions(+), 23 deletions(-) create mode 100644
> > > config/arm/arch64_armv8_generic_cross create mode 100644
> > > config/arm/arch64_armv8_thunderx_cross
> > >
> >
> > Adding Thomas on CC as he always has opinions on file locations and
> > naming.
> >
> > /Bruce
  
Jerin Jacob Jan. 22, 2018, 12:38 p.m. UTC | #4
-----Original Message-----
> Date: Fri, 19 Jan 2018 17:35:57 +0000
> From: Bruce Richardson <bruce.richardson@intel.com>
> To: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> CC: jerin.jacob@caviumnetworks.com, harry.van.haaren@intel.com,
>  thomas@monjalon.net, dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] build: add support for vendor specific ARM
>  cross builds
> User-Agent: Mutt/1.9.1 (2017-09-22)
> 
> On Fri, Jan 19, 2018 at 10:56:08PM +0530, Pavan Nikhilesh wrote:
> > On Fri, Jan 19, 2018 at 04:41:26PM +0000, Bruce Richardson wrote:
> > > On Fri, Jan 19, 2018 at 06:45:08PM +0530, Pavan Nikhilesh wrote:
> > > > Add various vendor specific cross build targets.
> > > > This can be verified by using linaro toolchain and running
> > > >
> > > > 	meson build --cross-file config/arm/arch64_armv8_<cpu>_cross
> > > >
> > >
> > > "arch64-armv8"? I thought we were standardizing on "arm64" as the naming
> > > here, or alternatively I think it should be "aarch64", right?
> > >
> > 
> > Currently, make uses "arm64-<platform>" as the naming convention.
> > I think either "arm64-<plat>" is better as we can easily represent
> > "arm-<plat>" (v7).
> > 
> Yes, keep it consistent with "make" names to avoid confusion.

+1 to keep it consistent with "make" names.

> 
> > > In terms of file naming, do we want to have a file extension on these
> > > files. I wondering if we want to change "_cross" to ".cross" for
> > > instance. The basic example in the meson docs uses a .txt extension but
> > > that looks weird to me. No strong opinion on my end, just looking for
> > > any other ideas.
> > >
> > > > In future more cross build targets can be added.
> > >
> > > Yes, good idea. Is config/<arch> the best place to hold these, or should
> > > we have a separate cross-build folder? I quite like having them in
> > > config like you have done, but wondering if anyone disagrees?
> > >
> > 
> > I split this patch out from the other series specifically so that we could
> > discuss and agree upon common name/path etc. :-).
> 
> Good idea. If no discussion or objection I'll take your patch as-is
> (with arm64 filenames) and we can always move/rename files later.
> 
> > 
> > Thanks, Pavan
> > > >
> > > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> > > > --- config/arm/arch64_armv8_generic_cross  | 10 +++++++
> > > > config/arm/arch64_armv8_thunderx_cross | 13 +++++++++
> > > > config/arm/meson.build                 | 52
> > > > +++++++++++++++++++--------------- 3 files changed, 52
> > > > insertions(+), 23 deletions(-) create mode 100644
> > > > config/arm/arch64_armv8_generic_cross create mode 100644
> > > > config/arm/arch64_armv8_thunderx_cross
> > > >
> > >
> > > Adding Thomas on CC as he always has opinions on file locations and
> > > naming.
> > >
> > > /Bruce
  

Patch

diff --git a/config/arm/arch64_armv8_generic_cross b/config/arm/arch64_armv8_generic_cross
new file mode 100644
index 000000000..3b4d3c469
--- /dev/null
+++ b/config/arm/arch64_armv8_generic_cross
@@ -0,0 +1,10 @@ 
+[binaries]
+c = 'aarch64-linux-gnu-gcc'
+cpp = 'aarch64-linux-gnu-cpp'
+ar = 'aarch64-linux-gnu-gcc-ar'
+
+[host_machine]
+system = 'linux'
+cpu_family = 'aarch64'
+cpu = 'armv8-a'
+endian = 'little'
diff --git a/config/arm/arch64_armv8_thunderx_cross b/config/arm/arch64_armv8_thunderx_cross
new file mode 100644
index 000000000..7ff34af74
--- /dev/null
+++ b/config/arm/arch64_armv8_thunderx_cross
@@ -0,0 +1,13 @@ 
+[binaries]
+c = 'aarch64-linux-gnu-gcc'
+cpp = 'aarch64-linux-gnu-cpp'
+ar = 'aarch64-linux-gnu-gcc-ar'
+
+[host_machine]
+system = 'linux'
+cpu_family = 'aarch64'
+cpu = 'armv8-a'
+endian = 'little'
+
+[properties]
+implementor_id = '0x43'
diff --git a/config/arm/meson.build b/config/arm/meson.build
index 62af5e68a..79e453997 100644
--- a/config/arm/meson.build
+++ b/config/arm/meson.build
@@ -34,6 +34,8 @@  else
 	dpdk_conf.set('RTE_ARCH_ARM64', 1)
 	dpdk_conf.set('RTE_ARCH_64', 1)
 
+	machine = []
+	cmd_output = []
 	if not meson.is_cross_build()
 		# The script returns ['Implementor', 'Variant', 'Architecture',
 		# 'Primary Part number', 'Revision']
@@ -46,31 +48,35 @@  else
 			machine_args = [] # Clear previous machine args
 			cmd_output = cmd.stdout().strip().split(' ')
 			machine = get_variable('impl_' + cmd_output[0])
-			message('Implementor : ' + machine[0])
+		endif
+	else
+		impl_id = meson.get_cross_property('implementor_id', 'generic')
+		machine = get_variable('impl_' + impl_id, 'generic')
+	endif
 
-			foreach flag: machine[1]
-				dpdk_conf.set(flag[0], flag[1])
+	if machine != 'generic'
+		message('Implementor : ' + machine[0])
+		foreach flag: machine[1]
+			dpdk_conf.set(flag[0], flag[1])
+		endforeach
+		# Primary part number based mcpu flags are supported
+		# for gcc versions > 7
+		if cc.version().version_compare('<7.0') or cmd_output.length() == 0
+			foreach marg: machine[2]
+				if marg[0] == 'default'
+					foreach f: marg[1]
+						machine_args += f
+					endforeach
+				endif
+			endforeach
+		else
+			foreach marg: machine[2]
+				if marg[0] == cmd_output[3]
+					foreach f: marg[1]
+						machine_args += f
+					endforeach
+				endif
 			endforeach
-
-			# Primary part number based mcpu flags are supported
-			# for gcc versions > 7
-			if cc.version().version_compare('<7.0')
-				foreach marg: machine[2]
-					if marg[0] == 'default'
-						foreach f: marg[1]
-							machine_args += f
-						endforeach
-					endif
-				endforeach
-			else
-				foreach marg: machine[2]
-					if marg[0] == cmd_output[3]
-						foreach f: marg[1]
-							machine_args += f
-						endforeach
-					endif
-				endforeach
-			endif
 		endif
 	endif
 endif