From patchwork Tue Oct 13 11:13:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hongbo.zhang@freescale.com X-Patchwork-Id: 54838 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by patches.linaro.org (Postfix) with ESMTPS id 612F120490 for ; Tue, 13 Oct 2015 11:38:11 +0000 (UTC) Received: by wicgb1 with SMTP id gb1sf8894416wic.3 for ; Tue, 13 Oct 2015 04:38:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:in-reply-to:references:mime-version:spamdiagnosticoutput :spamdiagnosticmetadata:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :content-type:content-transfer-encoding:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=JZe8Z5BmeTsV+jbKyV9qJHMZQqsrSvg3/YHfsKXRy78=; b=CDQ/8m8BgSaMMVdP7KEiSDOahX0JxH+Ck+LIT7Lti9nhjLJ+azZMN7taDU976STMyT 2jpvMzuFtzKE1oI5CiQ9fQOdkTikrsPvtkR9Sqfv8ErWYrgezM1+TsypY3tBhdGFLoNZ 7Rp5v1fzYBI447WPbAq6CgwJ0WxC8sV3w4iRQ5WGxcAVZtYSTUWohZw7v5LKc7eGA1VG 6Vc4ddia8YwYc4u/bq0AcM1FSe0kJHnAFJ4+iCRtlDCrS7ZNpg3Sl/Y6xo/oeW4lYE0u fxmPKWm57OpZVilZ4+kggzUjsiyy8HBMXQvoNj5JchGvTKtB6XQLD/l1VLuZO1kwi2wQ GtDQ== X-Gm-Message-State: ALoCoQmNMVocGXp6W007IjEnSAAGITzRv1z4CI6TY3y/8uORkU8Yhki7Jpz43i7lmbWowUgZGL8s X-Received: by 10.194.192.71 with SMTP id he7mr3279565wjc.2.1444736290615; Tue, 13 Oct 2015 04:38:10 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.151.79 with SMTP id z76ls582383lfd.104.gmail; Tue, 13 Oct 2015 04:38:10 -0700 (PDT) X-Received: by 10.25.89.141 with SMTP id n135mr3005534lfb.87.1444736290474; Tue, 13 Oct 2015 04:38:10 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id j191si1906621lfb.24.2015.10.13.04.38.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Oct 2015 04:38:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbwr8 with SMTP id r8so16241333lbw.2 for ; Tue, 13 Oct 2015 04:38:10 -0700 (PDT) X-Received: by 10.112.17.34 with SMTP id l2mr14569710lbd.117.1444736290344; Tue, 13 Oct 2015 04:38:10 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2076302lbq; Tue, 13 Oct 2015 04:38:09 -0700 (PDT) X-Received: by 10.140.151.140 with SMTP id 134mr41234130qhx.49.1444736289490; Tue, 13 Oct 2015 04:38:09 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 106si2373389qgd.97.2015.10.13.04.38.09; Tue, 13 Oct 2015 04:38:09 -0700 (PDT) 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; Received: by lists.linaro.org (Postfix, from userid 109) id 0D6A561A22; Tue, 13 Oct 2015 11:38:09 +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=-1.9 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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 8841E61A30; Tue, 13 Oct 2015 11:33:09 +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 3DF0261A22; Tue, 13 Oct 2015 11:33:05 +0000 (UTC) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0140.outbound.protection.outlook.com [157.56.111.140]) by lists.linaro.org (Postfix) with ESMTPS id 165EC61A24 for ; Tue, 13 Oct 2015 11:31:49 +0000 (UTC) Received: from CH1PR03CA011.namprd03.prod.outlook.com (10.255.156.156) by CY1PR0301MB1274.namprd03.prod.outlook.com (10.161.214.22) with Microsoft SMTP Server (TLS) id 15.1.293.16; Tue, 13 Oct 2015 11:31:47 +0000 Received: from BN1BFFO11FD026.protection.gbl (10.255.156.132) by CH1PR03CA011.outlook.office365.com (10.255.156.156) with Microsoft SMTP Server (TLS) id 15.1.300.14 via Frontend Transport; Tue, 13 Oct 2015 11:31:47 +0000 Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD026.mail.protection.outlook.com (10.58.144.89) with Microsoft SMTP Server (TLS) id 15.1.293.9 via Frontend Transport; Tue, 13 Oct 2015 11:31:47 +0000 Received: from hongbo.ap.freescale.net (hongbo.ap.freescale.net [10.193.20.96]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id t9DBVOFp009638; Tue, 13 Oct 2015 04:31:44 -0700 From: To: Date: Tue, 13 Oct 2015 19:13:11 +0800 Message-ID: <1444734798-29063-8-git-send-email-hongbo.zhang@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444734798-29063-1-git-send-email-hongbo.zhang@freescale.com> References: <1444734798-29063-1-git-send-email-hongbo.zhang@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD026; 1:sOH/n+TFqijWbS1PR56rNx4/8xdfzIePRsiyk+ron/gSeQc+b41REygavhGIr941WIAnhwAuxwFlIIxX07hSyVOsOEE4fAErQ+L8mJ6KIaXuGeUvqbZ0hgYpQonofhTj5CUZcS3xQhFDXiSuWzbHXW9qsgmxwCNVzmtHYTZ7NjAhmGRK9zmz5uWKB+N257I5rP5b2+u2VVRDZpiva7H6s8vKGa3+dXKkQQB5FRV1n/nxMIuoJk/HqriwIhnBk8KDSvNFqB9R1+ARjqn1SQYdpDXvcQIN569gEQVdwR9Zb2NDXrNBqLoRzcLYAiahNkknwRVUc6EQbAx9XtLwR+Qa4z6eGAL0todvFJuj4TUXcGjh80ukLW8WYygBQoD3qCDr4JHyQYEK1HMmgRoGbWH0LQ== X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(77096005)(33646002)(19580395003)(19580405001)(85426001)(5007970100001)(87936001)(50226001)(48376002)(50986999)(189998001)(81156007)(2351001)(106466001)(5001960100002)(97736004)(105606002)(64706001)(36756003)(110136002)(5003940100001)(11100500001)(47776003)(2950100001)(86362001)(86152002)(104016004)(6806005)(50466002)(92566002)(76176999)(5008740100001)(229853001)(46102003)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0301MB1274; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diag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k4jZMH68FwxOiXiSvQQX1cQ/v5yS9NTALah45DV8dQlx387jsz0P9/5pteuGOZ9H2HA866zFbd+CMdBAb7N4W7sAKenVGnVWezBk+rvcd5nQ=; 4:Bj4puBENSQqmPIFKI+piLLcWgsjq8W0maOE4SDxoXxfJ0Y2PV4G6CdSatIQJSQ8sozB02r53+JiyOs1WInj7R3guWguwVF92s1FVv/8pToL/naevGxixMBjQEufRILY5vGXCcrL+xWWUmn4lq4l1j8bQwEtdszgqFlKWS417iydwg4UumihcqKLrZXH/x7OMhvJv2UOYwqq4HDMnxu3d+IjXUatGH0gKAJLm15CKN7nD5Nl/0N8HBrVa2sCeU8Dg/Vf5dH6hMMIZyJUA/RceNw2JFsyKnFnV4mfJ8yzUs9EqqxwzF1f43zIXcn8hy6IKdwSX3vMEIAUSkgdxudDhLLe0bpdBNkghYDFsD32d2Fk= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001); SRVR:CY1PR0301MB1274; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0301MB1274; X-Forefront-PRVS: 07283408BE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB1274; 23:gNf4DL97Tha/BS/e4bAPinwkemeLfTHSWsJFN2p?= =?us-ascii?Q?ycOdX7ZV3ZeisSSb5XcEddhEw7iut0m8/Rd+5VSl0SdAR80NOvTT+NexqD0O?= =?us-ascii?Q?B9sRJDPPFX9UR0fBoCVde067m8fp4rRh1mtX3xQMuOquokKhQPtMFDsm+iVQ?= =?us-ascii?Q?SPv2zkI3DH05Y489iYnMW/nJr72wSE78oJs9zYizKugFeOIPGDn3KgiQVM1T?= =?us-ascii?Q?tcqB5z7C2TPTMdoxs0ZpS9R54jZFkvDchph6euFbPU7hsCGPeMy3k42Ic+Wz?= =?us-ascii?Q?jN0jtcjVy80mx3LpKD7++9L2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l5m6WthHE3kM/FkZ0Lyn9/C6nZoBpAv0YgaPK8sAVddIzwveHgdeByf8W8GPyMsUy69U7+TrxcQkv6a0mBYLoP1hCuLy/N1qsKRi1eVzl9aKgWzlaI9RtTMYlBKjfq5sujyEqC6oagA/rg1HBhdA==; 24:GHEPYpkBmWJZwEQa4ABwg9KFsiubnABf/jwx+sWfkSvlcbr02CEv0P+pzQbSFSzQL08RTmtF7H5Crv8C2TwApnjK30ubULL9Is7imLErvV4=; 20:2VcFGHof+pYWOWpuMr0VXmotuOgrV96GRz5QnfZHkV/Rqs/JlUI7RJVGMhfVPr/UGfuC9poiXOEMQYu/XY8EMA== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2015 11:31:47.2419 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB1274 X-Topics: patch Cc: petri.savolainen@nokia.com, stuart.haslam@arm.com Subject: [lng-odp] [API NEXT PATCH v7 07/14] api: cpu: add new API to get per-CPU max frequency X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Hongbo Zhang This patch adds new API odp_cpu_hz_max_id() to get the corresponding max frequency for each CPU indexed by CPU ID. Signed-off-by: Hongbo Zhang --- include/odp/api/cpu.h | 11 +++++++++++ platform/linux-generic/odp_system_info.c | 10 +++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h index 96f7d77..7eb326d 100644 --- a/include/odp/api/cpu.h +++ b/include/odp/api/cpu.h @@ -84,6 +84,17 @@ uint64_t odp_cpu_hz(void); uint64_t odp_cpu_hz_max(void); /** + * Maximum CPU frequency of a CPU (in Hz) + * + * Returns maximum frequency of specified CPU + * + * @param id CPU ID + * + * @return CPU frequency in Hz + */ +uint64_t odp_cpu_hz_max_id(int id); + +/** * Current CPU cycle count * * Return current CPU cycle count. Cycle count may not be reset at ODP init diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index 55f5753..cff6d65 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -370,7 +370,15 @@ uint64_t odp_cpu_hz(void) uint64_t odp_cpu_hz_max(void) { - return odp_global_data.system_info.cpu_hz[0]; + return odp_cpu_hz_max_id(0); +} + +uint64_t odp_cpu_hz_max_id(int id) +{ + if (id >= 0 && id < MAX_CPU_NUMBER) + return odp_global_data.system_info.cpu_hz[id]; + else + return -1; } uint64_t odp_sys_huge_page_size(void)