From patchwork Fri Feb 8 12:19:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Martin X-Patchwork-Id: 14698 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 855FC23F99 for ; Fri, 8 Feb 2013 12:20:03 +0000 (UTC) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by fiordland.canonical.com (Postfix) with ESMTP id EF61BA199B5 for ; Fri, 8 Feb 2013 12:20:02 +0000 (UTC) Received: by mail-ve0-f182.google.com with SMTP id ox1so3235878veb.41 for ; Fri, 08 Feb 2013 04:20:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=DYmxXmiWEAwjFQkI9ZpHfeYDi9ZonIop4k7LKItns0Q=; b=DWJv8MKn4sxj/S5Qhr3npT/8WS8zDPx0JO+YgkIxbPkAy+vuuTi67g+/kZSdxclRlf 5LfLNDapD3b9h8k5Jx1GD4K+upf0pG8iPC+mFC1tFnvfXXL9OMp8WoznBS21rK4xQCiN iLS4pBfolH/A12YIroiAQu+9q6v86e16ctIQGn53TMnX21CAlC5/LkZN93odfwHpVak0 8GFEE00GIXxR6ovNvpeZ+0DCGveCd76F3s5GsxoUwmLZkq9qJRYAJK3tSTTkdOcIn5GV mm8GunDeCaOl0Q9BFB1cx0yiCU7gozOYEX6Gcw5tbXCxKWh4c/Y2cmjpkbOZgJWtPocn hJuw== X-Received: by 10.52.27.50 with SMTP id q18mr5616285vdg.20.1360326002443; Fri, 08 Feb 2013 04:20:02 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.252.8 with SMTP id zo8csp142677vec; Fri, 8 Feb 2013 04:19:58 -0800 (PST) X-Received: by 10.180.87.170 with SMTP id az10mr2166580wib.3.1360325998392; Fri, 08 Feb 2013 04:19:58 -0800 (PST) Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) by mx.google.com with ESMTPS id v1si11238676wjv.81.2013.02.08.04.19.57 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 08 Feb 2013 04:19:58 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.174 is neither permitted nor denied by best guess record for domain of dave.martin@linaro.org) client-ip=209.85.212.174; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.174 is neither permitted nor denied by best guess record for domain of dave.martin@linaro.org) smtp.mail=dave.martin@linaro.org Received: by mail-wi0-f174.google.com with SMTP id hi8so754367wib.13 for ; Fri, 08 Feb 2013 04:19:57 -0800 (PST) X-Received: by 10.194.171.198 with SMTP id aw6mr9329158wjc.3.1360325994265; Fri, 08 Feb 2013 04:19:54 -0800 (PST) Received: from e103592.peterhouse.linaro.org (fw-lnat.cambridge.arm.com. [217.140.96.63]) by mx.google.com with ESMTPS id s10sm15119060wiw.4.2013.02.08.04.19.51 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 08 Feb 2013 04:19:52 -0800 (PST) From: Dave Martin To: linux-arm-kernel@lists.infradead.org Cc: patches@linaro.org, Nicolas Pitre , Lorenzo Pieralisi , Drew Richardson Subject: [PATCH] ARM: Allow modules to read cpu_logical_map Date: Fri, 8 Feb 2013 12:19:40 +0000 Message-Id: <1360325980-19089-1-git-send-email-dave.martin@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-Gm-Message-State: ALoCoQnTuJPjfKi95EPxUaDIZqXYZ6zjJtecqJOL8Dcu6n2jvv3Iako5PUOPsyC96hDHtM4JuWC0 It is reasonable for loadable modules to be CPU topology aware (particular examples include cpufreq and cpuidle drivers). This patch exports a new function cpu_get_hwid(cpu) to provide suitable read-only access outside vmlinux. Signed-off-by: Dave Martin --- Modules using this function will be arch-dependent and highly coupled to the kernel, so cpu_get_hwid() shouldn't be considered a stable API, especially while the details of kernel topology awareness are still under discussion: therefore, export only to GPL code for now. arch/arm/include/asm/smp_plat.h | 3 +++ arch/arm/kernel/setup.c | 7 +++++++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/arch/arm/include/asm/smp_plat.h b/arch/arm/include/asm/smp_plat.h index aaa61b6..518e466 100644 --- a/arch/arm/include/asm/smp_plat.h +++ b/arch/arm/include/asm/smp_plat.h @@ -66,4 +66,7 @@ static inline int get_logical_index(u32 mpidr) return -EINVAL; } +/* Read-only accessor for use by modules: */ +int cpu_get_hwid(int cpu); + #endif diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 3f6cbb2..1ac5e8b 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -429,6 +429,13 @@ void cpu_init(void) int __cpu_logical_map[NR_CPUS]; +/* Read-only accessor for use by modules: */ +int cpu_get_hwid(int cpu) +{ + return cpu_logical_map(cpu); +} +EXPORT_SYMBOL_GPL(cpu_get_hwid); + void __init smp_setup_processor_id(void) { int i;