From patchwork Wed Mar 2 19:29:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 63414 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2559965lbc; Wed, 2 Mar 2016 11:33:46 -0800 (PST) X-Received: by 10.140.100.244 with SMTP id s107mr34649242qge.19.1456947226454; Wed, 02 Mar 2016 11:33:46 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id m69si10617673qge.48.2016.03.02.11.33.46; Wed, 02 Mar 2016 11:33:46 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 0964D62FF3; Wed, 2 Mar 2016 19:33:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 2B91B650F3; Wed, 2 Mar 2016 19:31:01 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 0229562FC2; Wed, 2 Mar 2016 19:30:50 +0000 (UTC) Received: from mail-qg0-f51.google.com (mail-qg0-f51.google.com [209.85.192.51]) by lists.linaro.org (Postfix) with ESMTPS id 1285762FC4 for ; Wed, 2 Mar 2016 19:30:20 +0000 (UTC) Received: by mail-qg0-f51.google.com with SMTP id u110so48573669qge.3 for ; Wed, 02 Mar 2016 11:30:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yurl2tQziGkL4h+F/fj17NRcz36otHhYjEVm45Omxec=; b=EPi8YXkTGx5H+5/4W6e8yLMZhFks8VZmOy9Ezq2dbu/4x/oQaMU1Qx3YKs9rRCJFlW eGw6MIgVy06KvdvyPSMkWuE3/OEiK4joOlQnyjNSsfKvqLlZ0G8lz3BarMApgWhGX1QQ D3RvDDEwGZ09KDHScdYsfJBOrAzTQVfF17fkIMrEbrbBcbLJs6fmAgE6rO3aQWZxSdGD iLTYmZ0ck61lJVzIYfep03g9SYFbOVp9p076M1uWuPhKVSrFfomG9hHdpzQzKGxD9P+r V+a//Q+Qidp6U8F0pikg3Ycb2xBkIN2wUwG2/adcP4t0sdXYr4bsFxGjZKr3CKb3y6Ps 706g== X-Gm-Message-State: AD7BkJLqX44OTMLhCkWbx2VVPjQJu+MHLXuWJED87CQfCf185egv4BUahUp04TVoTXC4c6iAzFg= X-Received: by 10.140.20.104 with SMTP id 95mr8773247qgi.40.1456947019770; Wed, 02 Mar 2016 11:30:19 -0800 (PST) Received: from localhost.localdomain (c-98-221-136-245.hsd1.nj.comcast.net. [98.221.136.245]) by smtp.gmail.com with ESMTPSA id a129sm15527538qkb.45.2016.03.02.11.30.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Mar 2016 11:30:19 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Wed, 2 Mar 2016 14:29:49 -0500 Message-Id: <1456946992-19251-6-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456946992-19251-1-git-send-email-mike.holmes@linaro.org> References: <1456946992-19251-1-git-send-email-mike.holmes@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v5 5/8] linux-generic: move CPU info dummy data to generic default file X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Hongbo Zhang The dummy data of cpu_hz_max and model_str are used when platform is unknown or data cannot be acquired, but these variables should be set in function odp_cpuinfo_parser() instead of the systemcpu() which should cover only the cpu_count, huge_page_size and cache_line_size. Signed-off-by: Hongbo Zhang Reviewed-and-tested-by: Bill Fischofer --- platform/linux-generic/arch/linux/odp_sysinfo_parse.c | 13 +++++++++++-- platform/linux-generic/odp_system_info.c | 9 +-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c index 8ff6f48..4a22a61 100644 --- a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c @@ -5,11 +5,20 @@ */ #include +#include #include -int odp_cpuinfo_parser(FILE *file ODP_UNUSED, - odp_system_info_t *sysinfo ODP_UNUSED) +int odp_cpuinfo_parser(FILE *file ODP_UNUSED, odp_system_info_t *sysinfo) { + int i; + + ODP_DBG("Warning: use dummy values for freq and model string\n"); + ODP_DBG("Refer to https://bugs.linaro.org/show_bug.cgi?id=1870\n"); + for (i = 0; i < MAX_CPU_NUMBER; i++) { + sysinfo->cpu_hz_max[i] = 1400000000; + strcpy(sysinfo->model_str[i], "UNKNOWN"); + } + return 0; } diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index 42aef8a..bedbbc8 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -151,7 +151,7 @@ static int systemcpu(odp_system_info_t *sysinfo) static int systemcpu(odp_system_info_t *sysinfo) { - int ret, i; + int ret; ret = sysconf_cpu_count(); if (ret == 0) { @@ -166,13 +166,6 @@ static int systemcpu(odp_system_info_t *sysinfo) /* Dummy values */ sysinfo->cache_line_size = 64; - ODP_DBG("Warning: use dummy values for freq and model string\n"); - ODP_DBG("Refer to https://bugs.linaro.org/show_bug.cgi?id=1870\n"); - for (i = 0; i < MAX_CPU_NUMBER; i++) { - sysinfo->cpu_hz_max[i] = 1400000000; - strcpy(sysinfo->model_str[i], "UNKNOWN"); - } - return 0; }