From 33ad5e4b6cab3ad8cf3afda49b66393f1833150e Mon Sep 17 00:00:00 2001 From: Anton Blanchard Date: Thu, 17 Jun 2010 14:33:06 +0000 Subject: [PATCH] powerpc: Linux cannot run with 0 cores 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 Signed-off-by: Benjamin Herrenschmidt --- arch/powerpc/kernel/prom_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 97d4bd9..3b6f8ae 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c @@ -872,7 +872,7 @@ static void __init prom_send_capabilities(void) "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); } -- 2.7.4