From patchwork Fri Jun 18 00:33:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Blanchard X-Patchwork-Id: 56097 X-Patchwork-Delegate: benh@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 66BB41009BB for ; Fri, 18 Jun 2010 10:34:05 +1000 (EST) Received: by ozlabs.org (Postfix) id 50599B7D8B; Fri, 18 Jun 2010 10:33:59 +1000 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: by ozlabs.org (Postfix, from userid 1010) id 4D789B7D9B; Fri, 18 Jun 2010 10:33:59 +1000 (EST) Date: Fri, 18 Jun 2010 10:33:06 +1000 From: Anton Blanchard To: benh@kernel.crashing.org, paulmck@linux.vnet.ibm.com Subject: [PATCH] powerpc: Linux cannot run with 0 cores Message-ID: <20100618003306.GA3463@kryten> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Cc: linuxppc-dev@ozlabs.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org If we configure with CONFIG_SMP=n or set NR_CPUS less than the number of SMT threads we will set the max cores property to 0 in the ibm,client-architecture-support structure. On new versions of firmware that understand this property it obliges and terminates our partition. Use DIV_ROUND_UP so we handle not only the CONFIG_SMP=n case but also the case where NR_CPUS isn't a multiple of the number of SMT threads. Signed-off-by: Anton Blanchard Acked-by: Paul E. McKenney Index: linux-2.6/arch/powerpc/kernel/prom_init.c =================================================================== --- linux-2.6.orig/arch/powerpc/kernel/prom_init.c 2010-06-17 09:08:20.000000000 +1000 +++ linux-2.6/arch/powerpc/kernel/prom_init.c 2010-06-17 09:10:02.000000000 +1000 @@ -872,7 +872,7 @@ static void __init prom_send_capabilitie "ibm_architecture_vec structure inconsistent: 0x%x !\n", *cores); } else { - *cores = NR_CPUS / prom_count_smt_threads(); + *cores = DIV_ROUND_UP(NR_CPUS, prom_count_smt_threads()); prom_printf("Max number of cores passed to firmware: 0x%x\n", (unsigned long)*cores); }