From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <luca.boccassi@gmail.com>
Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com
 [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id 8D7BD5911
 for <dev@dpdk.org>; Fri,  7 Sep 2018 20:35:17 +0200 (CEST)
Received: by mail-wr1-f67.google.com with SMTP id j26-v6so15906643wre.2
 for <dev@dpdk.org>; Fri, 07 Sep 2018 11:35:17 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id;
 bh=TrT+FFvhwkcFMihKFXGuDi/2E+ZRnHPT3Y8UkhhvnDM=;
 b=C3AzU35/x95QqrOo6YoZa9qvDel0rujDGR3oDa4S0jlLzKqk05MLVmKI04JWPs/LAd
 axm8M/JeiG+nemqzgL4z8YQYPQKPgdC/IFYah15eNtvO5QkkMPVdG2MgghOS+p6OanQp
 k/qXNNcBn3O15Iw22GL0zGfa0ltoC1ABrdxm1PaO13IsTyL8DoBZ92Sp8ZN6Kyy/1CUD
 70H7XYpPxnYNotwFoxfTKhWMZBxUQi05up6QOW4SMlSAoeJ2xNqiN6pVYykQ9/I+pjue
 lrNkIL74DtHm3/sTfR3JwteNMKuwF/zAilXHIaN3kBf/Cgr48L5Cc6JevV9ASbg2s9Dg
 TaGA==
X-Gm-Message-State: APzg51DjZKuJtF8qE+OTCQ7nf+tIG3JdLmBQXcnPmuNCesTnr6UC4Bz+
 WYbhe3Bz61JL5u9qXLe75plRj3r4G88=
X-Google-Smtp-Source: ANB0VdaoPFa5FB4DAfCkNSUBOVMvdBczEy1RPwrY8B/FbJ5u+TNUieQxAR3BV0WzdocUHsG/cEeSCQ==
X-Received: by 2002:a05:6000:1252:: with SMTP id
 j18mr2301195wrx.157.1536345316755; 
 Fri, 07 Sep 2018 11:35:16 -0700 (PDT)
Received: from localhost ([2a01:4b00:f419:6f00:8361:8946:ba2b:d556])
 by smtp.gmail.com with ESMTPSA id z21-v6sm5541263wmi.29.2018.09.07.11.35.15
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 07 Sep 2018 11:35:15 -0700 (PDT)
From: Luca Boccassi <bluca@debian.org>
To: dev@dpdk.org
Cc: chaozhu@linux.vnet.ibm.com, christian.ehrhardt@canonical.com,
 bruce.richardson@intel.com, thomas@monjalon.net
Date: Fri,  7 Sep 2018 19:35:02 +0100
Message-Id: <20180907183502.26164-1-bluca@debian.org>
X-Mailer: git-send-email 2.18.0
Subject: [dpdk-dev] [PATCH] build: add PPC64 Meson build
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: Fri, 07 Sep 2018 18:35:17 -0000

This has been only build-tested for now, on a native ppc64el POWER8E
machine running Debian sid.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
The build box cannot be used to run DPDK as it doesn't have supported
NICs and root access. Would be great if someone could run-test it, but
at this point I think build support is enough to get started.

 config/meson.build                               |  8 ++++++++
 config/ppc_64/meson.build                        | 15 +++++++++++++++
 lib/librte_eal/common/arch/ppc_64/meson.build    |  5 +++++
 .../common/include/arch/ppc_64/meson.build       | 16 ++++++++++++++++
 4 files changed, 44 insertions(+)
 create mode 100644 config/ppc_64/meson.build
 create mode 100644 lib/librte_eal/common/arch/ppc_64/meson.build
 create mode 100644 lib/librte_eal/common/include/arch/ppc_64/meson.build

diff --git a/config/meson.build b/config/meson.build
index 4d755323f4..8e87b344c2 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -9,7 +9,13 @@ else
 endif
 dpdk_conf.set('RTE_MACHINE', machine)
 machine_args = []
+# ppc64 does not support -march=native
+if host_machine.cpu_family().startswith('ppc') and machine == 'native'
+machine_args += '-mcpu=' + machine
+machine_args += '-mtune=' + machine
+else
 machine_args += '-march=' + machine
+endif
 
 toolchain = cc.get_id()
 dpdk_conf.set_quoted('RTE_TOOLCHAIN', toolchain)
@@ -84,6 +90,8 @@ if host_machine.cpu_family().startswith('x86')
 	arch_subdir = 'x86'
 elif host_machine.cpu_family().startswith('arm') or host_machine.cpu_family().startswith('aarch')
 	arch_subdir = 'arm'
+elif host_machine.cpu_family().startswith('ppc')
+	arch_subdir = 'ppc_64'
 endif
 subdir(arch_subdir)
 dpdk_conf.set('RTE_COMPILE_TIME_CPUFLAGS', ','.join(compile_time_cpuflags))
diff --git a/config/ppc_64/meson.build b/config/ppc_64/meson.build
new file mode 100644
index 0000000000..d6faa7d64f
--- /dev/null
+++ b/config/ppc_64/meson.build
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
+
+# for checking defines we need to use the correct compiler flags
+march_opt = '-march=@0@'.format(machine)
+
+dpdk_conf.set('RTE_ARCH', 'ppc_64')
+dpdk_conf.set('RTE_ARCH_PPC_64', 1)
+dpdk_conf.set('RTE_ARCH_64', 1)
+
+# overrides specific to ppc64
+dpdk_conf.set('RTE_MAX_LCORE', 256)
+dpdk_conf.set('RTE_MAX_NUMA_NODES', 32)
+dpdk_conf.set('RTE_CACHE_LINE_SIZE', 128)
+dpdk_conf.set('RTE_MAX_LCORE', 256)
diff --git a/lib/librte_eal/common/arch/ppc_64/meson.build b/lib/librte_eal/common/arch/ppc_64/meson.build
new file mode 100644
index 0000000000..40b3dc533a
--- /dev/null
+++ b/lib/librte_eal/common/arch/ppc_64/meson.build
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
+
+eal_common_arch_sources = files('rte_cpuflags.c',
+	'rte_cycles.c', 'rte_hypervisor.c')
diff --git a/lib/librte_eal/common/include/arch/ppc_64/meson.build b/lib/librte_eal/common/include/arch/ppc_64/meson.build
new file mode 100644
index 0000000000..00f9611768
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/ppc_64/meson.build
@@ -0,0 +1,16 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
+
+install_headers(
+	'rte_atomic.h',
+	'rte_byteorder.h',
+	'rte_cpuflags.h',
+	'rte_cycles.h',
+	'rte_io.h',
+	'rte_memcpy.h',
+	'rte_pause.h',
+	'rte_prefetch.h',
+	'rte_rwlock.h',
+	'rte_spinlock.h',
+	'rte_vect.h',
+	subdir: get_option('include_subdir_arch'))
-- 
2.18.0