From patchwork Thu Jul 21 14:49:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 995182 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6LEoKMn013608 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 21 Jul 2011 14:50:46 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QjuZi-0004Ck-Ei; Thu, 21 Jul 2011 14:50:06 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QjuZi-0005iD-2z; Thu, 21 Jul 2011 14:50:06 +0000 Received: from moutng.kundenserver.de ([212.227.17.8]) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QjuZZ-0005hq-R0 for linux-arm-kernel@lists.infradead.org; Thu, 21 Jul 2011 14:50:03 +0000 Received: from ocdc-kvm.localnet (deibp9eh1--blueice3n2.emea.ibm.com [195.212.29.180]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MSYbs-1QtqDa1HPQ-00SEaH; Thu, 21 Jul 2011 16:49:42 +0200 From: Arnd Bergmann To: "Russell King - ARM Linux" Subject: Re: [GIT PULL] MSM fix Date: Thu, 21 Jul 2011 16:49:39 +0200 User-Agent: KMail/1.12.2 (Linux/2.6.37; KDE/4.3.2; x86_64; ; ) References: <20110720203703.GA4495@huya.qualcomm.com> <20110720225010.GA18381@huya.qualcomm.com> <20110720225406.GB20310@n2100.arm.linux.org.uk> In-Reply-To: <20110720225406.GB20310@n2100.arm.linux.org.uk> MIME-Version: 1.0 Message-Id: <201107211649.39902.arnd@arndb.de> X-Provags-ID: V02:K0:DAEfr35NXKxP73k98sxxP7bVS2wc+HVTO9GKNJUeMG3 J83G8+K9QZCD6OQMH6W2Q/r7Xg59WjQGLHbbgMi2BV3HJKt3Jl BhUiMU42zWcKX4DTCjyeOwP6RTtZwmy5bRK/ZVaiWEMUeMKsPi wrI5QsDQYKL+8FE7UC91KE6+rb/nJ/hqUXzkHIBxYvB+Wl4jWX Qc/bwYAjC8GucFLUU+GAw== X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110721_104959_384635_66C62B63 X-CRM114-Status: GOOD ( 20.14 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.17.8 listed in list.dnswl.org] Cc: Nicolas Pitre , David Brown , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 21 Jul 2011 14:50:46 +0000 (UTC) On Thursday 21 July 2011, Russell King - ARM Linux wrote: > > It looks like it would apply to 2.6.38 and 39 as well. I'm not sure > > it qualifies under the "It must fix a real bug that bothers people". > > It would only apply if someone had set NR_CPUS to more than 2. > > Err, this makes no sense. MSM doesn't have a get_core_count function > and as far as I can see never has done in mainline. I've committed the version below now, with a clarified title. The patch looks reasonable to me, but there may be some issue I'm missing of course. The other platforms that used to have a get_core_count function no longer have that because you changed them to use scu_get_core_count, but that doesn't seem to apply to mach-msm. I did not add a stable tag though. Arnd 8<--- Subject: [PATCH] ARM: msm: platsmp: determine number of CPU cores at boot time Previously we just assumed there were CONFIG_NR_CPUS cpus present in the system. Instead, figure out the number of cpus from the MIDR register. Signed-off-by: Jeff Ohlstein Signed-off-by: David Brown [arnd: clarified patch title] Signed-off-by: Arnd Bergmann diff --git a/arch/arm/mach-msm/platsmp.c b/arch/arm/mach-msm/platsmp.c index 2034098..5ba77d0 100644 --- a/arch/arm/mach-msm/platsmp.c +++ b/arch/arm/mach-msm/platsmp.c @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -40,6 +41,12 @@ volatile int pen_release = -1; static DEFINE_SPINLOCK(boot_lock); +static inline int get_core_count(void) +{ + /* 1 + the PART[1:0] field of MIDR */ + return ((read_cpuid_id() >> 4) & 3) + 1; +} + void __cpuinit platform_secondary_init(unsigned int cpu) { /* Configure edge-triggered PPIs */ @@ -147,9 +154,9 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) */ void __init smp_init_cpus(void) { - unsigned int i; + unsigned int i, ncores = get_core_count(); - for (i = 0; i < NR_CPUS; i++) + for (i = 0; i < ncores; i++) set_cpu_possible(i, true); set_smp_cross_call(gic_raise_softirq);