From patchwork Wed Jan 29 10:24:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hao X-Patchwork-Id: 314951 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 355142C03CC for ; Wed, 29 Jan 2014 21:27:31 +1100 (EST) Received: from mail-pb0-x22c.google.com (mail-pb0-x22c.google.com [IPv6:2607:f8b0:400e:c01::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6F9E22C00BC for ; Wed, 29 Jan 2014 21:27:04 +1100 (EST) Received: by mail-pb0-f44.google.com with SMTP id rq2so1589370pbb.17 for ; Wed, 29 Jan 2014 02:26:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=EHhy+jY+kQ/W7KyuaWJwH1A3BWj8omL1IDhVoisHHTg=; b=s59HyLMFDBZ7MqwThXfQWIheO+uW2H9VNxe2pyrzRc9wBQRs5Pd/z5bf/D78Matv80 K1GKGeS9Wtn6ggDZWL3SurybZi3HiQh1+FS3imx6oaCkHp5VB2SqMemoy5N6UGLoGszq cvbA691lsWMDaRVQOENjW6Z/gB4/EBHMI4g5KGb2Jx/PbZiafrPsbxiA+jEjfh+/Vhqz qNvXVpV3G8yvo4N0k5SysqVQpnp5M0CiqducWWD6mSPYK1x+K43xs3dwcWd1GVqRIOj5 U3iAXLgz33A3atYQgjRBKRPKBDY/0wuthl/U0X3rQwa+cqmwgO22Vf94s/tAQ8tWDaTm S5FA== X-Received: by 10.66.221.103 with SMTP id qd7mr7075054pac.44.1390991217646; Wed, 29 Jan 2014 02:26:57 -0800 (PST) Received: from pek-khao-d1.corp.ad.wrs.com ([1.202.252.122]) by mx.google.com with ESMTPSA id da3sm5626366pbc.30.2014.01.29.02.26.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Jan 2014 02:26:56 -0800 (PST) From: Kevin Hao To: Benjamin Herrenschmidt Subject: [PATCH] powerpc/ppc32: fix the bug in the init of non-base exception stack for UP Date: Wed, 29 Jan 2014 18:24:54 +0800 Message-Id: <1390991094-16094-1-git-send-email-haokexin@gmail.com> X-Mailer: git-send-email 1.8.5.3 Cc: linuxppc X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" We would allocate one specific exception stack for each kind of non-base exceptions for every CPU. For ppc32 the CPU hard ID is used as the subscript to get the specific exception stack for one CPU. But for an UP kernel, there is only one element in the each kind of exception stack array. We would get stuck if the CPU hard ID is not equal to '0'. So in this case we should use the subscript '0' no matter what the CPU hard ID is. Signed-off-by: Kevin Hao --- arch/powerpc/kernel/irq.c | 5 +++++ arch/powerpc/kernel/setup_32.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 9729b23bfb0a..1d0848bba049 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -559,8 +559,13 @@ void exc_lvl_ctx_init(void) #ifdef CONFIG_PPC64 cpu_nr = i; #else +#ifdef CONFIG_SMP cpu_nr = get_hard_smp_processor_id(i); +#else + cpu_nr = 0; #endif +#endif + memset((void *)critirq_ctx[cpu_nr], 0, THREAD_SIZE); tp = critirq_ctx[cpu_nr]; tp->cpu = cpu_nr; diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index 2b0da27eaee4..04cc4fcca78b 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c @@ -247,7 +247,12 @@ static void __init exc_lvl_early_init(void) /* interrupt stacks must be in lowmem, we get that for free on ppc32 * as the memblock is limited to lowmem by MEMBLOCK_REAL_LIMIT */ for_each_possible_cpu(i) { +#ifdef CONFIG_SMP hw_cpu = get_hard_smp_processor_id(i); +#else + hw_cpu = 0; +#endif + critirq_ctx[hw_cpu] = (struct thread_info *) __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE)); #ifdef CONFIG_BOOKE