linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: smp: allow get the core count from L2 control on A15
@ 2012-01-31 12:11 Kukjin Kim
  2012-01-31 14:13 ` Will Deacon
  2012-01-31 18:03 ` Russell King - ARM Linux
  0 siblings, 2 replies; 7+ messages in thread
From: Kukjin Kim @ 2012-01-31 12:11 UTC (permalink / raw)
  To: linux-arm-kernel


Actually, the number of A15 CPU core gets from L2 control
register not SCU configuration.

Suggested-by: Changhwan Youn <chaos.youn@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
---

Hi Russell,

As you know, the method of A15 core counting is different with A9.
So the function will be required on that but I'm not sure where the
function should be added at.

 arch/arm/include/asm/smp.h |    5 +++++
 arch/arm/kernel/smp.c      |   16 ++++++++++++++++
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h
index 1e5717a..b67084f 100644
--- a/arch/arm/include/asm/smp.h
+++ b/arch/arm/include/asm/smp.h
@@ -71,6 +71,11 @@ extern void platform_secondary_init(unsigned int cpu);
 extern void platform_smp_prepare_cpus(unsigned int);
 
 /*
+ * Get the number of CPU cores from the L2 control register on A15
+ */
+extern unsigned long a15_get_core_count(void);
+
+/*
  * Logical CPU mapping.
  */
 extern int __cpu_logical_map[NR_CPUS];
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 57db122..be4d31d 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -233,6 +233,22 @@ void __ref cpu_die(void)
 }
 #endif /* CONFIG_HOTPLUG_CPU */
 
+/*
+ * Get the number of CPU cores from the L2 control register on A15
+ */
+unsigned long a15_get_core_count(void)
+{
+	unsigned long val;
+
+	/* Read L2 control register */
+	asm volatile("mrc p15, 1, %0, c9, c0, 2" : "=r"(val));
+
+	/* [25:24] of L2 control register means core count - 1 */
+	val = ((val >> 24) & 0x3) + 1;
+
+	return val;
+}
+
 int __cpu_logical_map[NR_CPUS];
 
 void __init smp_setup_processor_id(void)
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-01-31 18:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-31 12:11 [PATCH] ARM: smp: allow get the core count from L2 control on A15 Kukjin Kim
2012-01-31 14:13 ` Will Deacon
2012-01-31 14:21   ` Kukjin Kim
2012-01-31 14:32     ` Will Deacon
2012-01-31 14:40       ` Kukjin Kim
2012-01-31 15:20         ` Lorenzo Pieralisi
2012-01-31 18:03 ` Russell King - ARM Linux

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).