On Wed, Feb 21, 2024 at 9:20 PM <pbhagavat...@marvell.com> wrote:
>
> From: Pavan Nikhilesh <pbhagavat...@marvell.com>
>
> Some ARM CPUs have specific march requirements and
> are not compatible with the supported march list.
> Add fallback march in case the mcpu and the march
> advertised in the part_number_config are not supported
> by the compiler.
>
> Example
>         mcpu = neoverse-n2
>         march = armv9-a
>         fallback_march = armv8.5-a
>
>         mcpu, march not supported
>         machine_args = ['-march=armv8.5-a']
>
>         mcpu, march, fallback_march not supported
>         least march supported = armv8-a
>
>         machine_args = ['-march=armv8-a']
>
> Signed-off-by: Pavan Nikhilesh <pbhagavat...@marvell.com>
> ---
>  config/arm/meson.build | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/config/arm/meson.build b/config/arm/meson.build
> index e77b696d8e..f6521653c8 100644
> --- a/config/arm/meson.build
> +++ b/config/arm/meson.build
> @@ -94,6 +94,7 @@ part_number_config_arm = {
>      '0xd49': {
>          'march': 'armv9-a',
>          'march_features': ['sve2'],
> +        'fallback_march': 'armv8.5-a',
>          'mcpu': 'neoverse-n2',
>          'flags': [
>              ['RTE_MACHINE', '"neoverse-n2"'],
> @@ -716,6 +717,7 @@ if update_flags
>
>      # probe supported archs and their features
>      candidate_march = ''
> +    fallback_march = ''
>      if part_number_config.has_key('march') and candidate_mcpu == ''
>          if part_number_config.get('force_march', false)
>              if cc.has_argument('-march=' +  part_number_config['march'])
> @@ -736,10 +738,18 @@ if update_flags
>                      # highest supported march version found
>                      break
>                  endif
> +                if (part_number_config.has_key('fallback_march') and
> +                    supported_march == part_number_config['fallback_march'] 
> and
> +                    cc.has_argument('-march=' + supported_march))
> +                    fallback_march = supported_march
> +                endif

I'm trying to wrap my head around this. If I understand this
correctly, fallback_march is going to be set only if fallback_march >
part_number_config['march'] (fallback_march must be higher than the
one in part_number_config, otherwise the loop will end with break
before setting fallback_march).

The added fallback_march configuration above is the opposite
(fallback_march < part_number_config['march']) so I'm not sure what
we're trying to accomplish here. Is the intention to specify a
fallback_march that's lower than the one the original fallback
mechanism would find? If so, we'll need to remove the break (and
probably set check_compiler_support to false) so that the loop could
continue.

>              endforeach
>          endif
>
>          if candidate_march != part_number_config['march']
> +            if fallback_march != ''
> +                candidate_march = fallback_march
> +            endif
>              warning('Configuration march version is @0@, not supported.'
>                      .format(part_number_config['march']))
>              if candidate_march != ''
> --
> 2.25.1
>

Reply via email to