From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0056.outbound.protection.outlook.com [104.47.34.56]) by dpdk.org (Postfix) with ESMTP id AFE18160 for ; Sat, 30 Dec 2017 17:38:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=L8JuT4f64zQxyws5R8kQk27yEMx4WDPDFJhh/2XPEqE=; b=nGwPppqAWBA7nS3Rh9JllvzsbENsMoaxRLcsoavrr15mktLdox6mUR7RNitzr9tQtm/BuZ+WPxWPiG917e5fvImQC9gMssIyMGGn51hBV/gj0fxReiwf8ThXjHpiRiACBIpoWIe1TBTjl4pvXEcNG280BfhttBHeJxrfgqRwLUw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from localhost.localdomain (111.93.218.67) by CY4PR07MB3462.namprd07.prod.outlook.com (10.171.252.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Sat, 30 Dec 2017 16:38:18 +0000 From: Pavan Nikhilesh To: bruce.richardson@intel.com, bluca@debian.org, harry.van.haaren@intel.com, jerin.jacob@caviumnetworks.com Cc: dev@dpdk.org, Pavan Nikhilesh Date: Sat, 30 Dec 2017 22:07:54 +0530 Message-Id: <20171230163754.20356-1-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BN6PR1301CA0035.namprd13.prod.outlook.com (10.174.84.176) To CY4PR07MB3462.namprd07.prod.outlook.com (10.171.252.143) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ee4e16e2-dbc4-4850-83db-08d54fa3bd24 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:CY4PR07MB3462; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3462; 3:5kLDfc2A2zBl1Jh9/4/zcrL5NeMOgzdpQowyYP7RyqUrNO3/+5tIVXQPvFHF9ZZTXYGM4MYE9PSZrmxaVBeRgEdFxr1UIAWHxIyZoS/fpbopJTgdZVNBFpl+Jg4F/cBBAmcphFv3p0IklW/b62Bm+kulSIMKCh92mQcYNKvgsopYOBm1RuoRp4ri8zXTKZINEhpTq9CM682JMV305xIqt1USnfULmFdJzdUGBLLUqbKLzBmInj/dV2nAfUnHi2kJ; 25:kgpOukBycnzysp480P3jucBJoynqHOGrFzkpPFbh6o02u31QyldBEkoWxwPID69EVDJh+ovc0hw9Ioyh8LuVRnzqQR7YrYRpXoLNtR3Q7cKjIvLOkGjEutYBlbnAxzuTotKdIz+G3Xe5xJbIlClgyP1XBeKIQPad8ULmubIVI198YiEqo9LygPJsBr8aHCQZgspnqOFohAOT1uWSDqnNRd1v0EKJBhp59tLq/zXR/nGgTFnZ+OayixhZv31jNUlileX4U5KBfYcdZP1Qh+eSTfYSi9Tn7qYwdgCal/tvmvi65QhKSYLIh0yCSYugWfHj+fZRzE7YWA6ecHKdzf9wiw==; 31:097s8/wimFwa1vmDkrSGC1Cgyo1lMG7rPVem/gcEUOWjV/JeDyClax0TRlDonA2AfB1nLGDCht+BgxJMwLKUvZN3M1hlek9sAFnVhLdzwig4E/6N24Oye4/VyNFTgQIBZCwclWZ1x054mqjTrYs7R7awStdz21ypKqCoCkIJDQUUsDaVSVrsTi4+LPzZr+kEw/FVBgZ7pFJ+7GnTTwcwH8nRP/Udy4MlqK/IqfqG9Vk= X-MS-TrafficTypeDiagnostic: CY4PR07MB3462: X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3462; 20:TxHZ2E6Up2ua3kg1uAmFR8eZJzx/pJRkfXD65eOSQLa/lJpDNOIz3S14NhG9OtYLpqfsJQghajlbc5wo6I/6ygtmHGjI21ARvYSY7Ax1jmWXkaQhTabZj7IgNFTtZ0Vcd5PkufbUl0r/9ECPtg8W1ba5d90e2nuS2ubn8HCKA4XPU/CggtBZt5Ma9VfNsPjrGGNpESDhEnOY2XtGBvjA91htGQ61S5oGvUXm1oJ7PMzgOsXjmdRJFp1vL5U7EqbmY4CaDWaaC+NBOD1CnsknoJ2V5FJ5Fxjm7xpYBW7vESISVLcpVS4vDuBe2vILmvRTleJqjtmNVjf1LIZt1LZNGfEbw5uAXGERpPjSr5lWEt/M/7RksKQrLh8hFbWUT3jLo/4D5ux7DgjFCfcOC8U4iKTTANAB5wueXIvEgo1bUQqFp2fc/sfYLL3I+QWrY5nqm1f1SQGmysnQPOa/lP3dsaAxLLthRQBJENs5eltCRBy4Qexz9e152Ki0gh8pPipLRoPDc/7aBOunUQ0jGdjL1eARQr86Djs1qVn8FZQNybpnzo1OUD6pbcNp9ZE5l4paDZJdvVAbUE1jfLWgAEKOspEHM3E6Fg29mxVn9ZbrV9I=; 4:QZvvxhxA/ItROWAYBIK3FGoK+kQlpwivqfHSMNIgTEeqVyFDeHDCZ5aFBdX9VlFfSY0MlB+EqYHZe8qJqpgz0yj0zbwT1Xt44yD5ZExGG5e569MkhFTMnB8Bq2iu4ogie93ct3bGIVh0EMPv3iC2sSENKHA+lO/s9M5Gqqp8LxTdfFuXxHdBeq90noTcos35rZbtYBSAok+MHERMnI3r+zi4Ay4dG/fvpJ9PpCdtyngvJigLVxbW//bMuL/fcTxzJ9BIBJsdfP3MeJHtyvMOJuDoPoKO2w72Gfrl5iCyUFx5UoABGgLNCW2bE/miMvQT X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(93006095)(3002001)(10201501046)(3231023)(944501075)(6041268)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011); SRVR:CY4PR07MB3462; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY4PR07MB3462; X-Forefront-PRVS: 05373A0663 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(39380400002)(396003)(376002)(346002)(366004)(39850400004)(189003)(199004)(81156014)(8676002)(52116002)(50226002)(16526018)(25786009)(42882006)(7736002)(66066001)(53936002)(50466002)(81166006)(6506007)(47776003)(8936002)(59450400001)(386003)(1076002)(16586007)(6116002)(3846002)(51416003)(305945005)(106356001)(107886003)(36756003)(53376002)(6666003)(68736007)(4326008)(48376002)(316002)(97736004)(2906002)(105586002)(6486002)(966005)(478600001)(6306002)(72206003)(5009440100003)(6636002)(6512007)(5660300001)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3462; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR07MB3462; 23:dJm0WPp1NuCHEcJ815entsug9knsYKyzUZvkFoL6k?= =?us-ascii?Q?TWaeMq3JG7LGUejNanv6ukvDe0NdfxA+OMybwM1ITCMn2vi6oXcQyOaglKsN?= =?us-ascii?Q?I1KZFgvpdzicq/xcwOsvKU9C9O/s8IjItMmh1MrU16xlXV4ynW15B58Y4GVa?= =?us-ascii?Q?Pjud5lhlzK7n4f1RuMZugg9P9spWoUy3jPWZw8sl63rw+gVQVTPla/qjiUPX?= =?us-ascii?Q?wmX+rb1p+rxmIG3SKLXSeqM1PdrVf811ITNnTMlDAMKolSCbAjNkfCaBBOdM?= =?us-ascii?Q?nTShKk+Lhvr4HU/zs2MRaLpmTzE56n1CDucwf+/KmpW2TnwpjoQhDZlcFnx7?= =?us-ascii?Q?DZd3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etworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Dec 2017 16:38:18.8093 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ee4e16e2-dbc4-4850-83db-08d54fa3bd24 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3462 Subject: [dpdk-dev] [PATCH] build: add support for detecting march on ARM X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Dec 2017 16:38:25 -0000 Added support for detecting march and mcpu by reading midr_el1 register. The implementer, primary part number values read can be used to figure out the underlying arm cpu. Signed-off-by: Pavan Nikhilesh --- The current method used for reading MIDR_EL1 form userspace might not be reliable and can be easily modified by updating config/arm/machine.py. More info on midr_el1 can be found at http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0500g/BABFEABI.html This patch depends on http://dpdk.org/dev/patchwork/patch/32410/ config/arm/machine.py | 18 ++++++++++++++++++ config/arm/meson.build | 20 ++++++++++++++++++++ config/meson.build | 3 ++- drivers/meson.build | 2 +- examples/meson.build | 2 +- lib/meson.build | 2 +- meson.build | 2 +- 7 files changed, 44 insertions(+), 5 deletions(-) create mode 100755 config/arm/machine.py diff --git a/config/arm/machine.py b/config/arm/machine.py new file mode 100755 index 000000000..3c6e7b6a7 --- /dev/null +++ b/config/arm/machine.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +import pprint +pp = pprint + +ident = [] +fname = '/sys/devices/system/cpu/cpu0/regs/identification/midr_el1' +with open(fname) as f: + content = f.read() + +midr_el1 = (int(content.rstrip('\n'), 16)) + +ident.append(hex((midr_el1 >> 24) & 0xFF)) # Implementer +ident.append(hex((midr_el1 >> 20) & 0xF)) # Variant +ident.append(hex((midr_el1 >> 16) & 0XF)) # Architecture +ident.append(hex((midr_el1 >> 4) & 0xFFF)) # Primary Part number +ident.append(hex(midr_el1 & 0xF)) # Revision + +print(' '.join(ident)) diff --git a/config/arm/meson.build b/config/arm/meson.build index 250958415..f6ae69c21 100644 --- a/config/arm/meson.build +++ b/config/arm/meson.build @@ -41,3 +41,23 @@ else endif dpdk_conf.set('RTE_CACHE_LINE_SIZE', 128) dpdk_conf.set('RTE_FORCE_INTRINSICS', 1) + +detect_vendor = find_program(join_paths(meson.current_source_dir(), + 'machine.py')) +cmd = run_command(detect_vendor.path()) +if cmd.returncode() != 0 + message('Unable to read midr_el1') +else + cmd_output = cmd.stdout().strip().split(' ') + message('midr_el1 output: \n' + 'Implementor ' + cmd_output[0] + + ' Variant ' + cmd_output[1] + ' Architecture ' + + cmd_output[2] + ' Primary Part number ' + cmd_output[3] + + ' Revision ' + cmd_output[4]) + if cmd_output[0] == '0x43' + message('Implementor : Cavium') + dpdk_conf.set('RTE_MACHINE', 'thunderx') + machine_arg = [] + machine_arg += '-march=' + 'armv8-a+crc+crypto' + machine_arg += '-mcpu=' + 'thunderx' + endif +endif diff --git a/config/meson.build b/config/meson.build index 86e978fb1..fe8104676 100644 --- a/config/meson.build +++ b/config/meson.build @@ -8,7 +8,8 @@ else machine = get_option('machine') endif dpdk_conf.set('RTE_MACHINE', machine) -machine_arg = '-march=' + machine +machine_arg = [] +machine_arg += '-march=' + machine # use pthreads add_project_link_arguments('-pthread', language: 'c') diff --git a/drivers/meson.build b/drivers/meson.build index 9b5039847..f5009aa2e 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -22,7 +22,7 @@ foreach class:driver_classes version = 1 sources = [] objs = [] - cflags = [machine_arg] + cflags = machine_arg includes = [include_directories(drv_path)] # set up internal deps. Drivers can append/override as necessary deps = std_deps diff --git a/examples/meson.build b/examples/meson.build index 0abed7169..88df650cf 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -9,7 +9,7 @@ endif foreach example: get_option('examples').split(',') name = example sources = [] - cflags = [machine_arg] + cflags = machine_arg ext_deps = [] includes = [include_directories(example)] deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline'] diff --git a/lib/meson.build b/lib/meson.build index 0c94d74b9..3c98efa70 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -31,7 +31,7 @@ foreach l:libraries sources = [] headers = [] includes = [] - cflags = [machine_arg] + cflags = machine_arg objs = [] # other object files to link against, used e.g. for # instruction-set optimized versions of code diff --git a/meson.build b/meson.build index 3dce8579e..493bcc313 100644 --- a/meson.build +++ b/meson.build @@ -66,5 +66,5 @@ pkg.generate(name: meson.project_name(), ['-Wl,-Bdynamic'] + dpdk_extra_ldflags, description: 'The Data Plane Development Kit (DPDK)', subdirs: [get_option('include_subdir_arch'), '.'], - extra_cflags: ['-include "rte_config.h"', machine_arg] + extra_cflags: ['-include "rte_config.h"'] + machine_arg ) -- 2.15.1