11/*
22 * arch/s390/kernel/smp.c
33 *
4- * S390 version
5- * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
4+ * Copyright (C) IBM Corp. 1999,2006
65 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
76 * Martin Schwidefsky (schwidefsky@de.ibm.com)
87 * Heiko Carstens (heiko.carstens@de.ibm.com)
4140#include <asm/cpcmd.h>
4241#include <asm/tlbflush.h>
4342
44- /* prototypes */
45-
4643extern volatile int __cpu_logical_map [];
4744
4845/*
@@ -51,13 +48,11 @@ extern volatile int __cpu_logical_map[];
5148
5249struct _lowcore * lowcore_ptr [NR_CPUS ];
5350
54- cpumask_t cpu_online_map ;
55- cpumask_t cpu_possible_map = CPU_MASK_ALL ;
51+ cpumask_t cpu_online_map = CPU_MASK_NONE ;
52+ cpumask_t cpu_possible_map = CPU_MASK_NONE ;
5653
5754static struct task_struct * current_set [NR_CPUS ];
5855
59- EXPORT_SYMBOL (cpu_online_map );
60-
6156/*
6257 * Reboot, halt and power_off routines for SMP.
6358 */
@@ -490,10 +485,10 @@ void smp_ctl_clear_bit(int cr, int bit) {
490485 * Lets check how many CPUs we have.
491486 */
492487
493- void
494- __init smp_check_cpus ( unsigned int max_cpus )
488+ static unsigned int
489+ __init smp_count_cpus ( void )
495490{
496- int cpu , num_cpus ;
491+ unsigned int cpu , num_cpus ;
497492 __u16 boot_cpu_addr ;
498493
499494 /*
@@ -503,19 +498,20 @@ __init smp_check_cpus(unsigned int max_cpus)
503498 boot_cpu_addr = S390_lowcore .cpu_data .cpu_addr ;
504499 current_thread_info ()-> cpu = 0 ;
505500 num_cpus = 1 ;
506- for (cpu = 0 ; cpu <= 65535 && num_cpus < max_cpus ; cpu ++ ) {
501+ for (cpu = 0 ; cpu <= 65535 ; cpu ++ ) {
507502 if ((__u16 ) cpu == boot_cpu_addr )
508503 continue ;
509- __cpu_logical_map [num_cpus ] = (__u16 ) cpu ;
510- if (signal_processor (num_cpus , sigp_sense ) ==
504+ __cpu_logical_map [1 ] = (__u16 ) cpu ;
505+ if (signal_processor (1 , sigp_sense ) ==
511506 sigp_not_operational )
512507 continue ;
513- cpu_set (num_cpus , cpu_present_map );
514508 num_cpus ++ ;
515509 }
516510
517511 printk ("Detected %d CPU's\n" ,(int ) num_cpus );
518512 printk ("Boot cpu address %2X\n" , boot_cpu_addr );
513+
514+ return num_cpus ;
519515}
520516
521517/*
@@ -676,6 +672,32 @@ __cpu_up(unsigned int cpu)
676672 return 0 ;
677673}
678674
675+ static unsigned int __initdata additional_cpus ;
676+
677+ void __init smp_setup_cpu_possible_map (void )
678+ {
679+ unsigned int pcpus , cpu ;
680+
681+ pcpus = smp_count_cpus () + additional_cpus ;
682+
683+ if (pcpus > NR_CPUS )
684+ pcpus = NR_CPUS ;
685+
686+ for (cpu = 0 ; cpu < pcpus ; cpu ++ )
687+ cpu_set (cpu , cpu_possible_map );
688+
689+ cpu_present_map = cpu_possible_map ;
690+ }
691+
692+ #ifdef CONFIG_HOTPLUG_CPU
693+
694+ static int __init setup_additional_cpus (char * s )
695+ {
696+ additional_cpus = simple_strtoul (s , NULL , 0 );
697+ return 0 ;
698+ }
699+ early_param ("additional_cpus" , setup_additional_cpus );
700+
679701int
680702__cpu_disable (void )
681703{
@@ -744,6 +766,8 @@ cpu_die(void)
744766 for (;;);
745767}
746768
769+ #endif /* CONFIG_HOTPLUG_CPU */
770+
747771/*
748772 * Cycle through the processors and setup structures.
749773 */
@@ -757,7 +781,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
757781 /* request the 0x1201 emergency signal external interrupt */
758782 if (register_external_interrupt (0x1201 , do_ext_call_interrupt ) != 0 )
759783 panic ("Couldn't request external interrupt 0x1201" );
760- smp_check_cpus (max_cpus );
761784 memset (lowcore_ptr ,0 ,sizeof (lowcore_ptr ));
762785 /*
763786 * Initialize prefix pages and stacks for all possible cpus
@@ -806,14 +829,12 @@ void __devinit smp_prepare_boot_cpu(void)
806829 BUG_ON (smp_processor_id () != 0 );
807830
808831 cpu_set (0 , cpu_online_map );
809- cpu_set (0 , cpu_present_map );
810832 S390_lowcore .percpu_offset = __per_cpu_offset [0 ];
811833 current_set [0 ] = current ;
812834}
813835
814836void smp_cpus_done (unsigned int max_cpus )
815837{
816- cpu_present_map = cpu_possible_map ;
817838}
818839
819840/*
@@ -845,6 +866,7 @@ static int __init topology_init(void)
845866
846867subsys_initcall (topology_init );
847868
869+ EXPORT_SYMBOL (cpu_online_map );
848870EXPORT_SYMBOL (cpu_possible_map );
849871EXPORT_SYMBOL (lowcore_ptr );
850872EXPORT_SYMBOL (smp_ctl_set_bit );
0 commit comments