linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: dave.martin@linaro.org (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	[thread overview]
Message-ID: <1360325980-19089-1-git-send-email-dave.martin@linaro.org> (raw)

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 <dave.martin@linaro.org>
---
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;
-- 
1.7.4.1

             reply	other threads:[~2013-02-08 12:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-08 12:19 Dave Martin [this message]
2013-02-08 12:26 ` [PATCH] ARM: Allow modules to read cpu_logical_map Russell King - ARM Linux
2013-02-08 14:32   ` Dave Martin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1360325980-19089-1-git-send-email-dave.martin@linaro.org \
    --to=dave.martin@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).