From patchwork Wed Jan 30 17:19:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 2069041 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 DDC383FD56 for ; Wed, 30 Jan 2013 17:27:10 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U0bOh-0006It-HR; Wed, 30 Jan 2013 17:24:31 +0000 Received: from [2002:4e20:1eda::1] (helo=caramon.arm.linux.org.uk) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U0bOd-0006IL-Vs for linux-arm-kernel@lists.infradead.org; Wed, 30 Jan 2013 17:24:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=caramon; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=NyeT2eij8dY+uhUnPYUTbHcfcJnVG1EPhspZQ9L91lg=; b=HTHW32XmyMXx36IveC2Re0TWsyUxf6N4ShT+Rde9kItoO9HPBalH2a/V8nlq1pQrbL/s49qX7tJk0QBaXTtbj8Cu4hue23FVkoguR7lB8NyMjo3q4BKjviQAIRJyTS/qCne6/ZVTgUeZ91w6mkfPQS96c1CyDpvX+JDd6eyOPMA=; Received: from n2100.arm.linux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:38765) by caramon.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1U0bJf-0001hs-OY; Wed, 30 Jan 2013 17:19:20 +0000 Received: from linux by n2100.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1U0bJe-0008FH-IF; Wed, 30 Jan 2013 17:19:18 +0000 Date: Wed, 30 Jan 2013 17:19:18 +0000 From: Russell King - ARM Linux To: Nicolas Pitre Subject: Re: Commit 384a290283fde63ba8dc671fca5420111cdac19a seems to break 11MPCore boot Message-ID: <20130130171918.GO23505@n2100.arm.linux.org.uk> References: <51093B0B.7010708@arm.com> <20130130162132.GM23505@n2100.arm.linux.org.uk> <20130130164535.GN23505@n2100.arm.linux.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20130130164535.GN23505@n2100.arm.linux.org.uk> User-Agent: Mutt/1.5.19 (2009-01-05) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130130_122428_478797_2469E573 X-CRM114-Status: GOOD ( 20.02 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.8 RDNS_NONE Delivered to internal network by a host with no rDNS Cc: Punit Agrawal , Will Deacon , Pawel Moll , "linux-arm-kernel@lists.infradead.org >> linux-arm-kernel@lists.infradead.org" , Steve Capper 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 On Wed, Jan 30, 2013 at 04:45:35PM +0000, Russell King - ARM Linux wrote: > What we could do is scan interrupts 0-31 for a non-zero value. If they're > all zero, we should complain. Otherwise, we use the first non-zero value > we find and validate it for a single bit set. And here's a patch to do this - I've not run this but it's just built successfully here. Anyone want to give it a go? I've decided that if we do hit the mask==0 case, we should just wail loudly - panic'ing will bring the kernel to a halt right there and then, which may be before any console drivers have been initialized (and the kernel message buffer is no longer easy to read). Moreover, panic()ing, along with the possibility of rebooting won't really fix this kind of error - it's rather fatal as far as that goes. So, I think just wailing at CRIT level is fine for this condition that should not occur. arch/arm/common/gic.c | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-) Tested-by: Will Deacon diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c index 36ae03a..3bcef49 100644 --- a/arch/arm/common/gic.c +++ b/arch/arm/common/gic.c @@ -351,6 +351,23 @@ void __init gic_cascade_irq(unsigned int gic_nr, unsigned int irq) irq_set_chained_handler(irq, gic_handle_cascade_irq); } +static u8 gic_get_cpumask(struct gic_chip_data *gic) +{ + void __iomem *base = gic_data_dist_base(gic); + u8 mask, i; + + for (i = mask = 0; i < 32; i++) { + mask = readl_relaxed(base + GIC_DIST_TARGET + i); + if (mask) + break; + } + + if (!mask) + pr_crit("GIC CPU mask not found - kernel will fail to boot.\n"); + + return mask; +} + static void __init gic_dist_init(struct gic_chip_data *gic) { unsigned int i; @@ -369,7 +386,9 @@ static void __init gic_dist_init(struct gic_chip_data *gic) /* * Set all global interrupts to this CPU only. */ - cpumask = readl_relaxed(base + GIC_DIST_TARGET + 0); + cpumask = gic_get_cpumask(gic); + cpumask |= cpumask << 8; + cpumask |= cpumask << 16; for (i = 32; i < gic_irqs; i += 4) writel_relaxed(cpumask, base + GIC_DIST_TARGET + i * 4 / 4); @@ -400,7 +419,7 @@ static void __cpuinit gic_cpu_init(struct gic_chip_data *gic) * Get what the GIC says our CPU mask is. */ BUG_ON(cpu >= NR_GIC_CPU_IF); - cpu_mask = readl_relaxed(dist_base + GIC_DIST_TARGET + 0); + cpu_mask = gic_get_cpumask(gic); gic_cpu_map[cpu] = cpu_mask; /*