[v5,2/4] build: add arm32 meson build flags

Message ID 1594024094-15515-3-git-send-email-juraj.linkes@pantheon.tech (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series aarch64 -> arm32 cross compilation support |

Checks

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

Commit Message

Juraj Linkeš July 6, 2020, 8:28 a.m. UTC
  Base the flags on config/defconfig_arm-armv7a-linuxapp-gcc.
Omit driver flags which can be built on arm32.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 config/arm/meson.build | 135 ++++++++++++++++++++++-------------------
 1 file changed, 74 insertions(+), 61 deletions(-)
  

Comments

Jerin Jacob July 6, 2020, 9:11 a.m. UTC | #1
On Mon, Jul 6, 2020 at 1:59 PM Juraj Linkeš <juraj.linkes@pantheon.tech> wrote:
>
> Base the flags on config/defconfig_arm-armv7a-linuxapp-gcc.
> Omit driver flags which can be built on arm32.
>
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>

Hi Juraj,

Not strictly specific to this patch. Just to understand, How armv7
support has been used?
- Is it for Running arm32 program on arm64 machines?
- Is it for Native DPDK support from arm32. If so, What kind of PMD
supports native arm32 DPDK?

Or some other use case?

I would like to understand the arm32 use case, so we can review it at
that angle.

> ---
>  config/arm/meson.build | 135 ++++++++++++++++++++++-------------------
>  1 file changed, 74 insertions(+), 61 deletions(-)
>
> diff --git a/config/arm/meson.build b/config/arm/meson.build
> index 8728051d5..b02fc95d9 100644
> --- a/config/arm/meson.build
> +++ b/config/arm/meson.build
> @@ -34,6 +34,11 @@ flags_generic = [
>         ['RTE_MAX_LCORE', 256],
>         ['RTE_USE_C11_MEM_MODEL', true],
>         ['RTE_CACHE_LINE_SIZE', 128]]
> +flags_generic_arm32 = [
> +       ['RTE_MACHINE', '"armv7a"'],
> +       ['RTE_MAX_LCORE', 128],
> +       ['RTE_USE_C11_MEM_MODEL', false],
> +       ['RTE_CACHE_LINE_SIZE', 64]]
>  flags_arm = [
>         ['RTE_MACHINE', '"armv8a"'],
>         ['RTE_MAX_LCORE', 16],
> @@ -63,6 +68,10 @@ flags_armada = [
>         ['RTE_MAX_LCORE', 16]]
>
>  flags_default_extra = []
> +flags_default_arm32_extra = [
> +        ['RTE_ARCH_ARM_NEON_MEMCPY', false],
> +        ['RTE_ARCH_STRICT_ALIGN', true],
> +        ['RTE_EAL_NUMA_AWARE_HUGEPAGES', false]]
>  flags_n1sdp_extra = [
>         ['RTE_MACHINE', '"n1sdp"'],
>         ['RTE_MAX_NUMA_NODES', 1],
> @@ -99,6 +108,9 @@ machine_args_generic = [
>         ['0xd0b', ['-mcpu=cortex-a76']],
>         ['0xd0c', ['-march=armv8.2-a+crc+crypto', '-mcpu=neoverse-n1'], flags_n1sdp_extra]]
>
> +machine_args_generic_arm32 = [
> +        ['default_arm32', ['-march=armv7-a', '-mtune=cortex-a9', '-mfpu=neon'], flags_default_arm32_extra]]
> +
>  machine_args_cavium = [
>         ['default', ['-march=armv8-a+crc+crypto','-mcpu=thunderx']],
>         ['native', ['-march=native']],
> @@ -114,6 +126,7 @@ machine_args_emag = [
>
>  ## Arm implementer ID (ARM DDI 0487C.a, Section G7.2.106, Page G7-5321)
>  impl_generic = ['Generic armv8', flags_generic, machine_args_generic]
> +impl_generic_arm32 = ['Generic armv7', flags_generic_arm32, machine_args_generic_arm32]
>  impl_0x41 = ['Arm', flags_arm, machine_args_generic]
>  impl_0x42 = ['Broadcom', flags_generic, machine_args_generic]
>  impl_0x43 = ['Cavium', flags_cavium, machine_args_cavium]
> @@ -136,74 +149,74 @@ if not dpdk_conf.get('RTE_ARCH_64')
>         dpdk_conf.set('RTE_ARCH_ARMv7', 1)
>         # the minimum architecture supported, armv7-a, needs the following,
>         # mk/machine/armv7a/rte.vars.mk sets it too
> -       machine_args += '-mfpu=neon'
>  else
>         dpdk_conf.set('RTE_CACHE_LINE_SIZE', 128)
>         dpdk_conf.set('RTE_ARCH_ARM64', 1)
> +endif
>
> -       machine = []
> -       cmd_generic = ['generic', '', '', 'default', '']
> -       cmd_output = cmd_generic # Set generic by default
> -       machine_args = [] # Clear previous machine args
> -       if arm_force_default_march and not meson.is_cross_build()
> +machine = []
> +machine_args = [] # Clear previous machine args
> +cmd_generic = ['generic', '', '', 'default', '']
> +cmd_output = cmd_generic # Set generic by default
> +if arm_force_default_march and not meson.is_cross_build()
> +       machine = impl_generic
> +       impl_pn = 'default'
> +elif not meson.is_cross_build()
> +       # The script returns ['Implementer', 'Variant', 'Architecture',
> +       # 'Primary Part number', 'Revision']
> +       detect_vendor = find_program(join_paths(
> +                       meson.current_source_dir(), 'armv8_machine.py'))
> +       cmd = run_command(detect_vendor.path())
> +       if cmd.returncode() == 0
> +               cmd_output = cmd.stdout().to_lower().strip().split(' ')
> +       endif
> +       # Set to generic if variable is not found
> +       machine = get_variable('impl_' + cmd_output[0], ['generic'])
> +       if machine[0] == 'generic'
>                 machine = impl_generic
> -               impl_pn = 'default'
> -       elif not meson.is_cross_build()
> -               # The script returns ['Implementer', 'Variant', 'Architecture',
> -               # 'Primary Part number', 'Revision']
> -               detect_vendor = find_program(join_paths(
> -                               meson.current_source_dir(), 'armv8_machine.py'))
> -               cmd = run_command(detect_vendor.path())
> -               if cmd.returncode() == 0
> -                       cmd_output = cmd.stdout().to_lower().strip().split(' ')
> -               endif
> -               # Set to generic if variable is not found
> -               machine = get_variable('impl_' + cmd_output[0], ['generic'])
> -               if machine[0] == 'generic'
> -                       machine = impl_generic
> -                       cmd_output = cmd_generic
> -               endif
> -               impl_pn = cmd_output[3]
> -               if arm_force_native_march == true
> -                       impl_pn = 'native'
> -               endif
> -       else
> -               impl_id = meson.get_cross_property('implementor_id', 'generic')
> -               impl_pn = meson.get_cross_property('implementor_pn', 'default')
> -               machine = get_variable('impl_' + impl_id)
> +               cmd_output = cmd_generic
>         endif
> -
> -       # Apply Common Defaults. These settings may be overwritten by machine
> -       # settings later.
> -       foreach flag: flags_common_default
> -               if flag.length() > 0
> -                       dpdk_conf.set(flag[0], flag[1])
> -               endif
> -       endforeach
> -
> -       message('Implementer : ' + machine[0])
> -       foreach flag: machine[1]
> -               if flag.length() > 0
> -                       dpdk_conf.set(flag[0], flag[1])
> -               endif
> -       endforeach
> -
> -       foreach marg: machine[2]
> -               if marg[0] == impl_pn
> -                       foreach flag: marg[1]
> -                               if cc.has_argument(flag)
> -                                       machine_args += flag
> -                               endif
> -                       endforeach
> -                       # Apply any extra machine specific flags.
> -                       foreach flag: marg.get(2, flags_default_extra)
> -                               if flag.length() > 0
> -                                       dpdk_conf.set(flag[0], flag[1])
> -                               endif
> -                       endforeach
> -               endif
> -       endforeach
> +       impl_pn = cmd_output[3]
> +       if arm_force_native_march == true
> +               impl_pn = 'native'
> +       endif
> +else
> +       impl_id = meson.get_cross_property('implementor_id', 'generic')
> +       impl_pn = meson.get_cross_property('implementor_pn', 'default')
> +       machine = get_variable('impl_' + impl_id)
>  endif
> +
> +# Apply Common Defaults. These settings may be overwritten by machine
> +# settings later.
> +foreach flag: flags_common_default
> +       if flag.length() > 0
> +               dpdk_conf.set(flag[0], flag[1])
> +       endif
> +endforeach
> +
> +message('Implementer : ' + machine[0])
> +foreach flag: machine[1]
> +       if flag.length() > 0
> +               dpdk_conf.set(flag[0], flag[1])
> +       endif
> +endforeach
> +
> +foreach marg: machine[2]
> +       if marg[0] == impl_pn
> +               foreach flag: marg[1]
> +                       if cc.has_argument(flag)
> +                               machine_args += flag
> +                       endif
> +               endforeach
> +               # Apply any extra machine specific flags.
> +               foreach flag: marg.get(2, flags_default_extra)
> +                       if flag.length() > 0
> +                               dpdk_conf.set(flag[0], flag[1])
> +                                message('Setting flag: @0@: @1@'.format(flag[0], flag[1]))
> +                       endif
> +               endforeach
> +       endif
> +endforeach
>  message(machine_args)
>
>  if (cc.get_define('__ARM_NEON', args: machine_args) != '' or
> --
> 2.20.1
>
  
Honnappa Nagarahalli July 7, 2020, 8:44 p.m. UTC | #2
<snip>

> Subject: Re: [dpdk-dev] [PATCH v5 2/4] build: add arm32 meson build flags
> 
> On Mon, Jul 6, 2020 at 1:59 PM Juraj Linkeš <juraj.linkes@pantheon.tech>
> wrote:
> >
> > Base the flags on config/defconfig_arm-armv7a-linuxapp-gcc.
> > Omit driver flags which can be built on arm32.
> >
> > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> 
> Hi Juraj,
> 
> Not strictly specific to this patch. Just to understand, How armv7 support has
> been used?
I do not know how armv7 support is being used. I have not heard of anything so far.

In this patch arm32 is actually referring to aarch32.

> - Is it for Running arm32 program on arm64 machines?
I am not sure if anyone would run armv7 binaries on arm64 machines. I would think they will at least go through a re-compilation (to aarch32) and test phase.

> - Is it for Native DPDK support from arm32. If so, What kind of PMD supports
> native arm32 DPDK?
Yes, this is for DPDK on aarch32 support. We do not have any plans to enable any PMD for aarch32. The current goal is to make sure that the code compiles for aarch32. Internally, we have validated few test cases for the libraries.

> 
> Or some other use case?
> 
> I would like to understand the arm32 use case, so we can review it at that
> angle.

I believe armv7a compilation is not supported in meson. Do you have any thoughts? Do you plan to maintain the support for armv7a?

> 
> > ---
> >  config/arm/meson.build | 135
> > ++++++++++++++++++++++-------------------
> >  1 file changed, 74 insertions(+), 61 deletions(-)
> >
> > diff --git a/config/arm/meson.build b/config/arm/meson.build index
> > 8728051d5..b02fc95d9 100644
> > --- a/config/arm/meson.build
> > +++ b/config/arm/meson.build
> > @@ -34,6 +34,11 @@ flags_generic = [
> >         ['RTE_MAX_LCORE', 256],
> >         ['RTE_USE_C11_MEM_MODEL', true],
> >         ['RTE_CACHE_LINE_SIZE', 128]]
> > +flags_generic_arm32 = [
> > +       ['RTE_MACHINE', '"armv7a"'],
> > +       ['RTE_MAX_LCORE', 128],
> > +       ['RTE_USE_C11_MEM_MODEL', false],
> > +       ['RTE_CACHE_LINE_SIZE', 64]]
> >  flags_arm = [
> >         ['RTE_MACHINE', '"armv8a"'],
> >         ['RTE_MAX_LCORE', 16],
> > @@ -63,6 +68,10 @@ flags_armada = [
> >         ['RTE_MAX_LCORE', 16]]
> >
> >  flags_default_extra = []
> > +flags_default_arm32_extra = [
> > +        ['RTE_ARCH_ARM_NEON_MEMCPY', false],
> > +        ['RTE_ARCH_STRICT_ALIGN', true],
> > +        ['RTE_EAL_NUMA_AWARE_HUGEPAGES', false]]
> >  flags_n1sdp_extra = [
> >         ['RTE_MACHINE', '"n1sdp"'],
> >         ['RTE_MAX_NUMA_NODES', 1],
> > @@ -99,6 +108,9 @@ machine_args_generic = [
> >         ['0xd0b', ['-mcpu=cortex-a76']],
> >         ['0xd0c', ['-march=armv8.2-a+crc+crypto',
> > '-mcpu=neoverse-n1'], flags_n1sdp_extra]]
> >
> > +machine_args_generic_arm32 = [
> > +        ['default_arm32', ['-march=armv7-a', '-mtune=cortex-a9',
> > +'-mfpu=neon'], flags_default_arm32_extra]]
> > +
> >  machine_args_cavium = [
> >         ['default', ['-march=armv8-a+crc+crypto','-mcpu=thunderx']],
> >         ['native', ['-march=native']], @@ -114,6 +126,7 @@
> > machine_args_emag = [
> >
> >  ## Arm implementer ID (ARM DDI 0487C.a, Section G7.2.106, Page
> > G7-5321)  impl_generic = ['Generic armv8', flags_generic,
> > machine_args_generic]
> > +impl_generic_arm32 = ['Generic armv7', flags_generic_arm32,
> > +machine_args_generic_arm32]
> >  impl_0x41 = ['Arm', flags_arm, machine_args_generic]
> >  impl_0x42 = ['Broadcom', flags_generic, machine_args_generic]
> >  impl_0x43 = ['Cavium', flags_cavium, machine_args_cavium] @@ -136,74
> > +149,74 @@ if not dpdk_conf.get('RTE_ARCH_64')
> >         dpdk_conf.set('RTE_ARCH_ARMv7', 1)
> >         # the minimum architecture supported, armv7-a, needs the following,
> >         # mk/machine/armv7a/rte.vars.mk sets it too
> > -       machine_args += '-mfpu=neon'
> >  else
> >         dpdk_conf.set('RTE_CACHE_LINE_SIZE', 128)
> >         dpdk_conf.set('RTE_ARCH_ARM64', 1)
> > +endif
> >
> > -       machine = []
> > -       cmd_generic = ['generic', '', '', 'default', '']
> > -       cmd_output = cmd_generic # Set generic by default
> > -       machine_args = [] # Clear previous machine args
> > -       if arm_force_default_march and not meson.is_cross_build()
> > +machine = []
> > +machine_args = [] # Clear previous machine args cmd_generic =
> > +['generic', '', '', 'default', ''] cmd_output = cmd_generic # Set
> > +generic by default if arm_force_default_march and not
> > +meson.is_cross_build()
> > +       machine = impl_generic
> > +       impl_pn = 'default'
> > +elif not meson.is_cross_build()
> > +       # The script returns ['Implementer', 'Variant', 'Architecture',
> > +       # 'Primary Part number', 'Revision']
> > +       detect_vendor = find_program(join_paths(
> > +                       meson.current_source_dir(), 'armv8_machine.py'))
> > +       cmd = run_command(detect_vendor.path())
> > +       if cmd.returncode() == 0
> > +               cmd_output = cmd.stdout().to_lower().strip().split(' ')
> > +       endif
> > +       # Set to generic if variable is not found
> > +       machine = get_variable('impl_' + cmd_output[0], ['generic'])
> > +       if machine[0] == 'generic'
> >                 machine = impl_generic
> > -               impl_pn = 'default'
> > -       elif not meson.is_cross_build()
> > -               # The script returns ['Implementer', 'Variant', 'Architecture',
> > -               # 'Primary Part number', 'Revision']
> > -               detect_vendor = find_program(join_paths(
> > -                               meson.current_source_dir(), 'armv8_machine.py'))
> > -               cmd = run_command(detect_vendor.path())
> > -               if cmd.returncode() == 0
> > -                       cmd_output = cmd.stdout().to_lower().strip().split(' ')
> > -               endif
> > -               # Set to generic if variable is not found
> > -               machine = get_variable('impl_' + cmd_output[0], ['generic'])
> > -               if machine[0] == 'generic'
> > -                       machine = impl_generic
> > -                       cmd_output = cmd_generic
> > -               endif
> > -               impl_pn = cmd_output[3]
> > -               if arm_force_native_march == true
> > -                       impl_pn = 'native'
> > -               endif
> > -       else
> > -               impl_id = meson.get_cross_property('implementor_id', 'generic')
> > -               impl_pn = meson.get_cross_property('implementor_pn', 'default')
> > -               machine = get_variable('impl_' + impl_id)
> > +               cmd_output = cmd_generic
> >         endif
> > -
> > -       # Apply Common Defaults. These settings may be overwritten by
> machine
> > -       # settings later.
> > -       foreach flag: flags_common_default
> > -               if flag.length() > 0
> > -                       dpdk_conf.set(flag[0], flag[1])
> > -               endif
> > -       endforeach
> > -
> > -       message('Implementer : ' + machine[0])
> > -       foreach flag: machine[1]
> > -               if flag.length() > 0
> > -                       dpdk_conf.set(flag[0], flag[1])
> > -               endif
> > -       endforeach
> > -
> > -       foreach marg: machine[2]
> > -               if marg[0] == impl_pn
> > -                       foreach flag: marg[1]
> > -                               if cc.has_argument(flag)
> > -                                       machine_args += flag
> > -                               endif
> > -                       endforeach
> > -                       # Apply any extra machine specific flags.
> > -                       foreach flag: marg.get(2, flags_default_extra)
> > -                               if flag.length() > 0
> > -                                       dpdk_conf.set(flag[0], flag[1])
> > -                               endif
> > -                       endforeach
> > -               endif
> > -       endforeach
> > +       impl_pn = cmd_output[3]
> > +       if arm_force_native_march == true
> > +               impl_pn = 'native'
> > +       endif
> > +else
> > +       impl_id = meson.get_cross_property('implementor_id', 'generic')
> > +       impl_pn = meson.get_cross_property('implementor_pn', 'default')
> > +       machine = get_variable('impl_' + impl_id)
> >  endif
> > +
> > +# Apply Common Defaults. These settings may be overwritten by machine
> > +# settings later.
> > +foreach flag: flags_common_default
> > +       if flag.length() > 0
> > +               dpdk_conf.set(flag[0], flag[1])
> > +       endif
> > +endforeach
> > +
> > +message('Implementer : ' + machine[0]) foreach flag: machine[1]
> > +       if flag.length() > 0
> > +               dpdk_conf.set(flag[0], flag[1])
> > +       endif
> > +endforeach
> > +
> > +foreach marg: machine[2]
> > +       if marg[0] == impl_pn
> > +               foreach flag: marg[1]
> > +                       if cc.has_argument(flag)
> > +                               machine_args += flag
> > +                       endif
> > +               endforeach
> > +               # Apply any extra machine specific flags.
> > +               foreach flag: marg.get(2, flags_default_extra)
> > +                       if flag.length() > 0
> > +                               dpdk_conf.set(flag[0], flag[1])
> > +                                message('Setting flag: @0@: @1@'.format(flag[0],
> flag[1]))
> > +                       endif
> > +               endforeach
> > +       endif
> > +endforeach
> >  message(machine_args)
> >
> >  if (cc.get_define('__ARM_NEON', args: machine_args) != '' or
> > --
> > 2.20.1
> >
  
Jerin Jacob July 8, 2020, 8:33 a.m. UTC | #3
On Wed, Jul 8, 2020 at 2:14 AM Honnappa Nagarahalli
<Honnappa.Nagarahalli@arm.com> wrote:
>
> <snip>
>
> > Subject: Re: [dpdk-dev] [PATCH v5 2/4] build: add arm32 meson build flags
> >
> > On Mon, Jul 6, 2020 at 1:59 PM Juraj Linkeš <juraj.linkes@pantheon.tech>
> > wrote:
> > >
> > > Base the flags on config/defconfig_arm-armv7a-linuxapp-gcc.
> > > Omit driver flags which can be built on arm32.
> > >
> > > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> >
> > Hi Juraj,
> >
> > Not strictly specific to this patch. Just to understand, How armv7 support has
> > been used?
> I do not know how armv7 support is being used. I have not heard of anything so far.
>
> In this patch arm32 is actually referring to aarch32.
>
> > - Is it for Running arm32 program on arm64 machines?
> I am not sure if anyone would run armv7 binaries on arm64 machines. I would think they will at least go through a re-compilation (to aarch32) and test phase.
>
> > - Is it for Native DPDK support from arm32. If so, What kind of PMD supports
> > native arm32 DPDK?
> Yes, this is for DPDK on aarch32 support. We do not have any plans to enable any PMD for aarch32. The current goal is to make sure that the code compiles for aarch32. Internally, we have validated few test cases for the libraries.

One thing is lack of PMD support and other is lack  PCI HW support for
armv7 machines in general.


>
> >
> > Or some other use case?
> >
> > I would like to understand the arm32 use case, so we can review it at that
> > angle.
>
> I believe armv7a compilation is not supported in meson. Do you have any thoughts? Do you plan to maintain the support for armv7a?

Armv7 is maintained by:
ARM v7
M: Jan Viktorin <viktorin@rehivetech.com>
M: Ruifeng Wang <ruifeng.wang@arm.com>
F: lib/librte_eal/arm/

My only concern is if there is no REAL use case for armv7 in DPDK, May
it is not worth to add a lot of code and make it complicated for
arm64.
At a minimum, If we are planning to add armv7 support then please
split config/arm/meson.build file as two for arm64 and armv7.
  
Honnappa Nagarahalli July 8, 2020, 8:55 p.m. UTC | #4
> > <snip>
> >
> > > Subject: Re: [dpdk-dev] [PATCH v5 2/4] build: add arm32 meson build
> > > flags
> > >
> > > On Mon, Jul 6, 2020 at 1:59 PM Juraj Linkeš
> > > <juraj.linkes@pantheon.tech>
> > > wrote:
> > > >
> > > > Base the flags on config/defconfig_arm-armv7a-linuxapp-gcc.
> > > > Omit driver flags which can be built on arm32.
> > > >
> > > > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > >
> > > Hi Juraj,
> > >
> > > Not strictly specific to this patch. Just to understand, How armv7
> > > support has been used?
> > I do not know how armv7 support is being used. I have not heard of
> anything so far.
> >
> > In this patch arm32 is actually referring to aarch32.
> >
> > > - Is it for Running arm32 program on arm64 machines?
> > I am not sure if anyone would run armv7 binaries on arm64 machines. I
> would think they will at least go through a re-compilation (to aarch32) and
> test phase.
> >
> > > - Is it for Native DPDK support from arm32. If so, What kind of PMD
> > > supports native arm32 DPDK?
> > Yes, this is for DPDK on aarch32 support. We do not have any plans to
> enable any PMD for aarch32. The current goal is to make sure that the code
> compiles for aarch32. Internally, we have validated few test cases for the
> libraries.
> 
> One thing is lack of PMD support and other is lack  PCI HW support for
> armv7 machines in general.
> 
> 
> >
> > >
> > > Or some other use case?
> > >
> > > I would like to understand the arm32 use case, so we can review it
> > > at that angle.
> >
> > I believe armv7a compilation is not supported in meson. Do you have any
> thoughts? Do you plan to maintain the support for armv7a?
> 
> Armv7 is maintained by:
> ARM v7
> M: Jan Viktorin <viktorin@rehivetech.com>
> M: Ruifeng Wang <ruifeng.wang@arm.com>
> F: lib/librte_eal/arm/
> 
> My only concern is if there is no REAL use case for armv7 in DPDK, May it is
> not worth to add a lot of code and make it complicated for arm64.
> At a minimum, If we are planning to add armv7 support then please split
> config/arm/meson.build file as two for arm64 and armv7.
If no one objects, may be we should skip armv7.
But, we need to do aarch32 for compilation/unit tests for libraries as platforms (N1 based) exist with aarch32+PCI. We can skip the PMD support right now. Is that ok?
  
Jerin Jacob July 9, 2020, 4:49 a.m. UTC | #5
On Thu, Jul 9, 2020 at 2:25 AM Honnappa Nagarahalli
<Honnappa.Nagarahalli@arm.com> wrote:
>
> > > <snip>
> > >
> > > > Subject: Re: [dpdk-dev] [PATCH v5 2/4] build: add arm32 meson build
> > > > flags
> > > >
> > > > On Mon, Jul 6, 2020 at 1:59 PM Juraj Linkeš
> > > > <juraj.linkes@pantheon.tech>
> > > > wrote:
> > > > >
> > > > > Base the flags on config/defconfig_arm-armv7a-linuxapp-gcc.
> > > > > Omit driver flags which can be built on arm32.
> > > > >
> > > > > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > > >
> > > > Hi Juraj,
> > > >
> > > > Not strictly specific to this patch. Just to understand, How armv7
> > > > support has been used?
> > > I do not know how armv7 support is being used. I have not heard of
> > anything so far.
> > >
> > > In this patch arm32 is actually referring to aarch32.
> > >
> > > > - Is it for Running arm32 program on arm64 machines?
> > > I am not sure if anyone would run armv7 binaries on arm64 machines. I
> > would think they will at least go through a re-compilation (to aarch32) and
> > test phase.
> > >
> > > > - Is it for Native DPDK support from arm32. If so, What kind of PMD
> > > > supports native arm32 DPDK?
> > > Yes, this is for DPDK on aarch32 support. We do not have any plans to
> > enable any PMD for aarch32. The current goal is to make sure that the code
> > compiles for aarch32. Internally, we have validated few test cases for the
> > libraries.
> >
> > One thing is lack of PMD support and other is lack  PCI HW support for
> > armv7 machines in general.
> >
> >
> > >
> > > >
> > > > Or some other use case?
> > > >
> > > > I would like to understand the arm32 use case, so we can review it
> > > > at that angle.
> > >
> > > I believe armv7a compilation is not supported in meson. Do you have any
> > thoughts? Do you plan to maintain the support for armv7a?
> >
> > Armv7 is maintained by:
> > ARM v7
> > M: Jan Viktorin <viktorin@rehivetech.com>
> > M: Ruifeng Wang <ruifeng.wang@arm.com>
> > F: lib/librte_eal/arm/
> >
> > My only concern is if there is no REAL use case for armv7 in DPDK, May it is
> > not worth to add a lot of code and make it complicated for arm64.
> > At a minimum, If we are planning to add armv7 support then please split
> > config/arm/meson.build file as two for arm64 and armv7.
> If no one objects, may be we should skip armv7.
> But, we need to do aarch32 for compilation/unit tests for libraries as platforms (N1 based) exist with aarch32+PCI. We can skip the PMD support right now. Is that ok?

aarch32 is fine as they may be some legacy 32bit application that can
run on N1. If no one objects, we should remove armv7 and it's not been
actively maintained as well.
  

Patch

diff --git a/config/arm/meson.build b/config/arm/meson.build
index 8728051d5..b02fc95d9 100644
--- a/config/arm/meson.build
+++ b/config/arm/meson.build
@@ -34,6 +34,11 @@  flags_generic = [
 	['RTE_MAX_LCORE', 256],
 	['RTE_USE_C11_MEM_MODEL', true],
 	['RTE_CACHE_LINE_SIZE', 128]]
+flags_generic_arm32 = [
+	['RTE_MACHINE', '"armv7a"'],
+	['RTE_MAX_LCORE', 128],
+	['RTE_USE_C11_MEM_MODEL', false],
+	['RTE_CACHE_LINE_SIZE', 64]]
 flags_arm = [
 	['RTE_MACHINE', '"armv8a"'],
 	['RTE_MAX_LCORE', 16],
@@ -63,6 +68,10 @@  flags_armada = [
 	['RTE_MAX_LCORE', 16]]
 
 flags_default_extra = []
+flags_default_arm32_extra = [
+        ['RTE_ARCH_ARM_NEON_MEMCPY', false],
+        ['RTE_ARCH_STRICT_ALIGN', true],
+        ['RTE_EAL_NUMA_AWARE_HUGEPAGES', false]]
 flags_n1sdp_extra = [
 	['RTE_MACHINE', '"n1sdp"'],
 	['RTE_MAX_NUMA_NODES', 1],
@@ -99,6 +108,9 @@  machine_args_generic = [
 	['0xd0b', ['-mcpu=cortex-a76']],
 	['0xd0c', ['-march=armv8.2-a+crc+crypto', '-mcpu=neoverse-n1'], flags_n1sdp_extra]]
 
+machine_args_generic_arm32 = [
+        ['default_arm32', ['-march=armv7-a', '-mtune=cortex-a9', '-mfpu=neon'], flags_default_arm32_extra]]
+
 machine_args_cavium = [
 	['default', ['-march=armv8-a+crc+crypto','-mcpu=thunderx']],
 	['native', ['-march=native']],
@@ -114,6 +126,7 @@  machine_args_emag = [
 
 ## Arm implementer ID (ARM DDI 0487C.a, Section G7.2.106, Page G7-5321)
 impl_generic = ['Generic armv8', flags_generic, machine_args_generic]
+impl_generic_arm32 = ['Generic armv7', flags_generic_arm32, machine_args_generic_arm32]
 impl_0x41 = ['Arm', flags_arm, machine_args_generic]
 impl_0x42 = ['Broadcom', flags_generic, machine_args_generic]
 impl_0x43 = ['Cavium', flags_cavium, machine_args_cavium]
@@ -136,74 +149,74 @@  if not dpdk_conf.get('RTE_ARCH_64')
 	dpdk_conf.set('RTE_ARCH_ARMv7', 1)
 	# the minimum architecture supported, armv7-a, needs the following,
 	# mk/machine/armv7a/rte.vars.mk sets it too
-	machine_args += '-mfpu=neon'
 else
 	dpdk_conf.set('RTE_CACHE_LINE_SIZE', 128)
 	dpdk_conf.set('RTE_ARCH_ARM64', 1)
+endif
 
-	machine = []
-	cmd_generic = ['generic', '', '', 'default', '']
-	cmd_output = cmd_generic # Set generic by default
-	machine_args = [] # Clear previous machine args
-	if arm_force_default_march and not meson.is_cross_build()
+machine = []
+machine_args = [] # Clear previous machine args
+cmd_generic = ['generic', '', '', 'default', '']
+cmd_output = cmd_generic # Set generic by default
+if arm_force_default_march and not meson.is_cross_build()
+	machine = impl_generic
+	impl_pn = 'default'
+elif not meson.is_cross_build()
+	# The script returns ['Implementer', 'Variant', 'Architecture',
+	# 'Primary Part number', 'Revision']
+	detect_vendor = find_program(join_paths(
+			meson.current_source_dir(), 'armv8_machine.py'))
+	cmd = run_command(detect_vendor.path())
+	if cmd.returncode() == 0
+		cmd_output = cmd.stdout().to_lower().strip().split(' ')
+	endif
+	# Set to generic if variable is not found
+	machine = get_variable('impl_' + cmd_output[0], ['generic'])
+	if machine[0] == 'generic'
 		machine = impl_generic
-		impl_pn = 'default'
-	elif not meson.is_cross_build()
-		# The script returns ['Implementer', 'Variant', 'Architecture',
-		# 'Primary Part number', 'Revision']
-		detect_vendor = find_program(join_paths(
-				meson.current_source_dir(), 'armv8_machine.py'))
-		cmd = run_command(detect_vendor.path())
-		if cmd.returncode() == 0
-			cmd_output = cmd.stdout().to_lower().strip().split(' ')
-		endif
-		# Set to generic if variable is not found
-		machine = get_variable('impl_' + cmd_output[0], ['generic'])
-		if machine[0] == 'generic'
-			machine = impl_generic
-			cmd_output = cmd_generic
-		endif
-		impl_pn = cmd_output[3]
-		if arm_force_native_march == true
-			impl_pn = 'native'
-		endif
-	else
-		impl_id = meson.get_cross_property('implementor_id', 'generic')
-		impl_pn = meson.get_cross_property('implementor_pn', 'default')
-		machine = get_variable('impl_' + impl_id)
+		cmd_output = cmd_generic
 	endif
-
-	# Apply Common Defaults. These settings may be overwritten by machine
-	# settings later.
-	foreach flag: flags_common_default
-		if flag.length() > 0
-			dpdk_conf.set(flag[0], flag[1])
-		endif
-	endforeach
-
-	message('Implementer : ' + machine[0])
-	foreach flag: machine[1]
-		if flag.length() > 0
-			dpdk_conf.set(flag[0], flag[1])
-		endif
-	endforeach
-
-	foreach marg: machine[2]
-		if marg[0] == impl_pn
-			foreach flag: marg[1]
-				if cc.has_argument(flag)
-					machine_args += flag
-				endif
-			endforeach
-			# Apply any extra machine specific flags.
-			foreach flag: marg.get(2, flags_default_extra)
-				if flag.length() > 0
-					dpdk_conf.set(flag[0], flag[1])
-				endif
-			endforeach
-		endif
-	endforeach
+	impl_pn = cmd_output[3]
+	if arm_force_native_march == true
+		impl_pn = 'native'
+	endif
+else
+	impl_id = meson.get_cross_property('implementor_id', 'generic')
+	impl_pn = meson.get_cross_property('implementor_pn', 'default')
+	machine = get_variable('impl_' + impl_id)
 endif
+
+# Apply Common Defaults. These settings may be overwritten by machine
+# settings later.
+foreach flag: flags_common_default
+	if flag.length() > 0
+		dpdk_conf.set(flag[0], flag[1])
+	endif
+endforeach
+
+message('Implementer : ' + machine[0])
+foreach flag: machine[1]
+	if flag.length() > 0
+		dpdk_conf.set(flag[0], flag[1])
+	endif
+endforeach
+
+foreach marg: machine[2]
+	if marg[0] == impl_pn
+		foreach flag: marg[1]
+			if cc.has_argument(flag)
+				machine_args += flag
+			endif
+		endforeach
+		# Apply any extra machine specific flags.
+		foreach flag: marg.get(2, flags_default_extra)
+			if flag.length() > 0
+				dpdk_conf.set(flag[0], flag[1])
+                                message('Setting flag: @0@: @1@'.format(flag[0], flag[1]))
+			endif
+		endforeach
+	endif
+endforeach
 message(machine_args)
 
 if (cc.get_define('__ARM_NEON', args: machine_args) != '' or