From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <christian.ehrhardt@canonical.com>
Received: from youngberry.canonical.com (youngberry.canonical.com
 [91.189.89.112]) by dpdk.org (Postfix) with ESMTP id 26FE21B113
 for <dev@dpdk.org>; Wed, 14 Nov 2018 14:18:40 +0100 (CET)
Received: from 2.general.paelzer.uk.vpn ([10.172.196.173]
 helo=Keschdeichel.fritz.box)
 by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.76) (envelope-from <christian.ehrhardt@canonical.com>)
 id 1gMv43-0001vq-Qf; Wed, 14 Nov 2018 13:18:39 +0000
From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
To: Luca Boccassi <bluca@debian.org>, dev <dev@dpdk.org>,
 Bruce Richardson <bruce.richardson@intel.com>
Cc: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Date: Wed, 14 Nov 2018 14:18:38 +0100
Message-Id: <20181114131838.17989-1-christian.ehrhardt@canonical.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <CAATJJ0L-JNce9i6B0+yXF7XR8nd3xc4ufd-8aJ6R-0b36EykOQ@mail.gmail.com>
References: <CAATJJ0L-JNce9i6B0+yXF7XR8nd3xc4ufd-8aJ6R-0b36EykOQ@mail.gmail.com>
Subject: [dpdk-dev] [PATCH] build: establish an invariant machine type
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 14 Nov 2018 13:18:40 -0000

Add the machine definition 'default' which is special compared
to 'native' (most optimized for current system) or any explicit
type (external entity has to decide on the type).

It defaults to the per arch agreed common minimal baseline
needed for DPDK to reasonable work.

That might not be the most optimized, but the most portable
version while still being able to support the CPU features
required for DPDK.

Going forward this can be bumped up by the DPDK project, but it
can never be an invariant like 'native'.

Distributions and other needing portable code are expected to
define the machine as 'baseline'.

Changes in v2:
- fixed the non 64 bit arm default type
- changed baseline to default to match the old build system

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
 config/meson.build | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/config/meson.build b/config/meson.build
index 1af305f46..db32499b3 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -7,6 +7,27 @@ if meson.is_cross_build()
 else
 	machine = get_option('machine')
 endif
+
+# machine type 'default' is special, it defaults to the per arch agreed common
+# minimal baseline needed for DPDK.
+# That might not be the most optimized, but the most portable version while
+# still being able to support the CPU features required for DPDK.
+# This can be bumped up by the DPDK project, but it can never be an
+# invariant like 'native'
+if machine == 'default'
+	if host_machine.cpu_family().startswith('x86')
+		# matches the old pre-meson build systems default
+		machine = 'corei7'
+	elif host_machine.cpu_family().startswith('arm')
+		machine = 'armv7-a'
+	elif host_machine.cpu_family().startswith('aarch')
+		# arm64 manages defaults in config/arm/meson.build
+		machine = 'default'
+	elif host_machine.cpu_family().startswith('ppc')
+		machine = 'power8'
+	endif
+endif
+
 dpdk_conf.set('RTE_MACHINE', machine)
 machine_args = []
 
-- 
2.17.1