From patchwork Fri Jan 29 11:30:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Zhang X-Patchwork-Id: 60788 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp1057409lbb; Fri, 29 Jan 2016 03:39:06 -0800 (PST) X-Received: by 10.50.3.39 with SMTP id 7mr8714133igz.56.1454067546332; Fri, 29 Jan 2016 03:39:06 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id b66si19024519ioe.8.2016.01.29.03.39.05; Fri, 29 Jan 2016 03:39:06 -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; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 92F6F61A52; Fri, 29 Jan 2016 11:39:05 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=g9r9UEBS; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,T_DKIM_INVALID,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 8E70561A06; Fri, 29 Jan 2016 11:38:38 +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 1297C61769; Fri, 29 Jan 2016 11:38:31 +0000 (UTC) Received: from mail-pf0-f181.google.com (mail-pf0-f181.google.com [209.85.192.181]) by lists.linaro.org (Postfix) with ESMTPS id D34E66171F for ; Fri, 29 Jan 2016 11:38:29 +0000 (UTC) Received: by mail-pf0-f181.google.com with SMTP id n128so40751137pfn.3 for ; Fri, 29 Jan 2016 03:38:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=p70te6wnYrmWbI6qlm1/TCMoWQoYy0776OmagKtSof0=; b=g9r9UEBSPZ9LZcVZdeg9kL0uRjpzyDhjIDtyoi76+CpevtKwHTrQuLYFO9QyjmBkni znNfyaeUmpjELNFUNa4BYSKji7IXCqwyW8o68nPfGyqpnwMytv9O9ZWmBFPOMZ8um8+a BhHNdaHulQf2d4d48aobfQZRi2vsDCLCVc4bo= 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=p70te6wnYrmWbI6qlm1/TCMoWQoYy0776OmagKtSof0=; b=FlC9oFMbPJvlV+igkIjLISe9cwf3BKWRiGoXOAn9TZ0LvwsytG1kf5fLxhYsJrVK/p zTVp1UIFV3fePSZtC2MBrfBtVaclbKhZdFHX1TvfUszBAiWMQfFwkd7zEduUn7IY9fXJ FRc9JHekHIBhlQLRYW0sls2I0S4095QyIMSfGdfZ/gagSiLR327IMb6Pd4ZOuYxc5QeS 1k0E9YqsjHWOiWZWbt3n6vOCvLrrMDemuCyt6mhiRF86HL/436aGqQzkhnoObFtFe31d NFaES7dKc7d3OUHsqG+8UMmpLh5VeH2u3+cm/RGjrzPtGqy1s/vUV1xHPrdaXHmKok+k OlLg== X-Gm-Message-State: AG10YOSWc6pdnjJB1Jqqk3Y/sJjhfSiqgDch4KPALb5xQcO8rzkqkJPtHvsJzNMBM5hdIng87lM= X-Received: by 10.98.14.81 with SMTP id w78mr12691708pfi.26.1454067509207; Fri, 29 Jan 2016 03:38:29 -0800 (PST) Received: from ubuntu1504.ap.freescale.net (gate-zmy3.freescale.com. [192.88.167.1]) by smtp.gmail.com with ESMTPSA id f21sm23063753pfd.6.2016.01.29.03.38.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Jan 2016 03:38:28 -0800 (PST) From: hongbo.zhang@linaro.org To: lng-odp@lists.linaro.org Date: Fri, 29 Jan 2016 19:30:44 +0800 Message-Id: <1454067047-381-2-git-send-email-hongbo.zhang@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1454067047-381-1-git-send-email-hongbo.zhang@linaro.org> References: <1454067047-381-1-git-send-email-hongbo.zhang@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH API-NEXT 1/4] 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 --- 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; }