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: tip-bot for Dave Martin X-Patchwork-Id: 2115451 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 5B7E6DFE75 for ; Fri, 8 Feb 2013 12:23:11 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U3mvz-0004n6-3h; Fri, 08 Feb 2013 12:20:03 +0000 Received: from wi-in-x0229.1e100.net ([2a00:1450:400c:c05::229] helo=mail-wi0-x229.google.com) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1U3mvv-0004mW-Vu for linux-arm-kernel@lists.infradead.org; Fri, 08 Feb 2013 12:20:00 +0000 Received: by mail-wi0-f169.google.com with SMTP id l13so832834wie.4 for ; Fri, 08 Feb 2013 04:19:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=DYmxXmiWEAwjFQkI9ZpHfeYDi9ZonIop4k7LKItns0Q=; b=Frojix7ihoDecCq9FCxkTIIegh3f2ZPzxrwWa6tvmmiXgq18Q1z1sztgq0GblKgpwe pmRBW59PEHlwm0aLx5xDHPHu0bJPS/crUpTL7+K8zB491/Dlw3p1aKQt7aQFjmbGwnsk TcOMJ/upNxuzDE5Sqsc+PBDg9rBEaQvSDM+WcqrMdZ5nTKYEjbQtUziflbE3i/HFO4ZO aQGzi3Roj5VVwrhyHchBnhZJUbAQmjSuyC64CH213uvZ0yWc80D6DH9Kz1c7h9PvbNHi /4o32ljYZi/1vhSs6Q5W6Tqh7GUHRvFo0qbANDH2A4P/mbhWOG8Wrk3yOo5LAve0a2zA i3wA== 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 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: ALoCoQmT1dwmpxVK4yeSy0Snw2xktROMhSOh/OD8c2I4214m1KeP0HqeeCh0VEao9m8JBQz4NYeG X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130208_072000_162409_BE3C4626 X-CRM114-Status: GOOD ( 10.79 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Nicolas Pitre , Drew Richardson , Lorenzo Pieralisi , patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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;