From patchwork Sat Feb 2 19:24:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Machek X-Patchwork-Id: 2084601 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 51E403FD2B for ; Sat, 2 Feb 2013 19:28:02 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U1ihG-0002a2-Ub; Sat, 02 Feb 2013 19:24:18 +0000 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U1ihD-0002ZY-3E for linux-arm-kernel@lists.infradead.org; Sat, 02 Feb 2013 19:24:16 +0000 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 5C5A180FA2; Sat, 2 Feb 2013 20:24:11 +0100 (CET) Date: Sat, 2 Feb 2013 20:24:09 +0100 From: Pavel Machek To: Dinh Nguyen Subject: Re: [PATCHv2 for soc 4/4] arm: socfpga: Add SMP support for actual socfpga harware Message-ID: <20130202192409.GA17736@amd.pavel.ucw.cz> References: <1359651943-21752-1-git-send-email-dinguyen@altera.com> <1359651943-21752-5-git-send-email-dinguyen@altera.com> <20130201035040.GE4838@quad.lixom.net> <20130201104655.GA3124@amd.pavel.ucw.cz> <71B37E0559AC6849A68C5BA94C509FB45A63D4E47D@SJ-ITMSG02.altera.priv.altera.com> <20130201153152.GS23505@n2100.arm.linux.org.uk> <1359736762.2932.1.camel@linux-builds1> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1359736762.2932.1.camel@linux-builds1> User-Agent: Mutt/1.5.20 (2009-06-14) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130202_142415_353802_D090BFD4 X-CRM114-Status: GOOD ( 22.87 ) 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 ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [195.113.26.193 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: "olof@lixom.net" , Russell King - ARM Linux , "arnd@arndb.de" , "linux-arm-kernel@lists.infradead.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: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Hi! > > > > I actually thought about that... but could not think of non-ugly way > > > > of doing that. I hope dts will normally be "right" for any production > > > > system... > > > > > > I think a panic is better just for the reason that if someone is > > > expecting SMP, but missed the warning message, and later finds out that > > > the secondary core never came up, it would save some debugging time. > > > > > > Since I have to send out a v3 from the 1st patch anyways, let me verify > > > that I can get the early warning. > > > > The choice is between a panic() at a point where the only way to find > > out is to throw in printascii() or a working printk, and ending up with > > an unbootable kernel, vs continuing the boot and having an almost > > working system which can be logged into and the messages viewed. > > > > If you have an application which relies on the second CPU coming up, > > why not have it verify that the second CPU came up (it's quite easy > > to do - there's POSIX standard libc calls to get the number of online > > CPUs). > > Point taken...thanks Russell. Well, I don't think we normally check dtbs for validity with user-helpful error messages, but it is relatively easy in this case. ---cut here--- Continue booting with second core disabled if cpu1-start-addr is not present in .dtb. Signed-off-by: Pavel Machek diff --git a/arch/arm/mach-socfpga/platsmp.c b/arch/arm/mach-socfpga/platsmp.c index 81e0da0..90facdd 100644 --- a/arch/arm/mach-socfpga/platsmp.c +++ b/arch/arm/mach-socfpga/platsmp.c @@ -82,6 +82,9 @@ static void __init socfpga_smp_init_cpus(void) ncores = 1; } #endif + if (!cpu1start_addr) + ncores = 1; + for (i = 0; i < ncores; i++) set_cpu_possible(i, true); diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c index 334c330..c3cd88b 100644 --- a/arch/arm/mach-socfpga/socfpga.c +++ b/arch/arm/mach-socfpga/socfpga.c @@ -74,10 +74,9 @@ static void __init socfpga_sysmgr_init(void) np = of_find_compatible_node(NULL, NULL, "altr,sys-mgr"); - if (of_property_read_u32(np, "cpu1-start-addr", (u32 *) &cpu1start_addr)) { - early_printk("Need cpu1-start-addr in device tree.\n"); - panic("Need cpu1-start-addr in device tree.\n"); - } + if (of_property_read_u32(np, "cpu1-start-addr", (u32 *) &cpu1start_addr)) + printk(KERN_ALERT "Need cpu1-start-addr in device tree for SMP operation.\n"); + sys_manager_base_addr = of_iomap(np, 0); np = of_find_compatible_node(NULL, NULL, "altr,rst-mgr");