[v8,4/5] config/arm: add support for fallback march

Message ID 20240314113829.2511-4-pbhagavatula@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v8,1/5] config/arm: avoid mcpu and march conflicts |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Pavan Nikhilesh Bhagavatula March 14, 2024, 11:38 a.m. UTC
  From: Pavan Nikhilesh <pbhagavatula@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 <pbhagavatula@marvell.com>
Reviewed-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 config/arm/meson.build | 6 ++++++
 1 file changed, 6 insertions(+)
  

Patch

diff --git a/config/arm/meson.build b/config/arm/meson.build
index 45f5db2c58..fd38031308 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"'],
@@ -844,6 +845,11 @@  if update_flags
                     break
                 endif
             endforeach
+            if (part_number_config.has_key('fallback_march') and
+                candidate_march != part_number_config['march'] and
+                cc.has_argument('-march=' + part_number_config['fallback_march']))
+                    candidate_march = part_number_config['fallback_march']
+            endif
         endif
 
         if candidate_march != part_number_config['march']