diff options
Diffstat (limited to 'arch/s390/kernel/smp.c')
-rw-r--r-- | arch/s390/kernel/smp.c | 73 |
1 files changed, 52 insertions, 21 deletions
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index cbfcfd02a43a..7dbe00c76c6b 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
@@ -1,8 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * arch/s390/kernel/smp.c | 2 | * arch/s390/kernel/smp.c |
3 | * | 3 | * |
4 | * S390 version | 4 | * Copyright (C) IBM Corp. 1999,2006 |
5 | * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation | ||
6 | * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), | 5 | * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), |
7 | * Martin Schwidefsky (schwidefsky@de.ibm.com) | 6 | * Martin Schwidefsky (schwidefsky@de.ibm.com) |
8 | * Heiko Carstens (heiko.carstens@de.ibm.com) | 7 | * Heiko Carstens (heiko.carstens@de.ibm.com) |
@@ -41,8 +40,6 @@ | |||
41 | #include <asm/cpcmd.h> | 40 | #include <asm/cpcmd.h> |
42 | #include <asm/tlbflush.h> | 41 | #include <asm/tlbflush.h> |
43 | 42 | ||
44 | /* prototypes */ | ||
45 | |||
46 | extern volatile int __cpu_logical_map[]; | 43 | extern volatile int __cpu_logical_map[]; |
47 | 44 | ||
48 | /* | 45 | /* |
@@ -51,13 +48,11 @@ extern volatile int __cpu_logical_map[]; | |||
51 | 48 | ||
52 | struct _lowcore *lowcore_ptr[NR_CPUS]; | 49 | struct _lowcore *lowcore_ptr[NR_CPUS]; |
53 | 50 | ||
54 | cpumask_t cpu_online_map; | 51 | cpumask_t cpu_online_map = CPU_MASK_NONE; |
55 | cpumask_t cpu_possible_map; | 52 | cpumask_t cpu_possible_map = CPU_MASK_NONE; |
56 | 53 | ||
57 | static struct task_struct *current_set[NR_CPUS]; | 54 | static struct task_struct *current_set[NR_CPUS]; |
58 | 55 | ||
59 | EXPORT_SYMBOL(cpu_online_map); | ||
60 | |||
61 | /* | 56 | /* |
62 | * Reboot, halt and power_off routines for SMP. | 57 | * Reboot, halt and power_off routines for SMP. |
63 | */ | 58 | */ |
@@ -490,10 +485,10 @@ void smp_ctl_clear_bit(int cr, int bit) { | |||
490 | * Lets check how many CPUs we have. | 485 | * Lets check how many CPUs we have. |
491 | */ | 486 | */ |
492 | 487 | ||
493 | void | 488 | static unsigned int |
494 | __init smp_check_cpus(unsigned int max_cpus) | 489 | __init smp_count_cpus(void) |
495 | { | 490 | { |
496 | int cpu, num_cpus; | 491 | unsigned int cpu, num_cpus; |
497 | __u16 boot_cpu_addr; | 492 | __u16 boot_cpu_addr; |
498 | 493 | ||
499 | /* | 494 | /* |
@@ -503,22 +498,20 @@ __init smp_check_cpus(unsigned int max_cpus) | |||
503 | boot_cpu_addr = S390_lowcore.cpu_data.cpu_addr; | 498 | boot_cpu_addr = S390_lowcore.cpu_data.cpu_addr; |
504 | current_thread_info()->cpu = 0; | 499 | current_thread_info()->cpu = 0; |
505 | num_cpus = 1; | 500 | num_cpus = 1; |
506 | for (cpu = 0; cpu <= 65535 && num_cpus < max_cpus; cpu++) { | 501 | for (cpu = 0; cpu <= 65535; cpu++) { |
507 | if ((__u16) cpu == boot_cpu_addr) | 502 | if ((__u16) cpu == boot_cpu_addr) |
508 | continue; | 503 | continue; |
509 | __cpu_logical_map[num_cpus] = (__u16) cpu; | 504 | __cpu_logical_map[1] = (__u16) cpu; |
510 | if (signal_processor(num_cpus, sigp_sense) == | 505 | if (signal_processor(1, sigp_sense) == |
511 | sigp_not_operational) | 506 | sigp_not_operational) |
512 | continue; | 507 | continue; |
513 | cpu_set(num_cpus, cpu_present_map); | ||
514 | num_cpus++; | 508 | num_cpus++; |
515 | } | 509 | } |
516 | 510 | ||
517 | for (cpu = 1; cpu < max_cpus; cpu++) | ||
518 | cpu_set(cpu, cpu_possible_map); | ||
519 | |||
520 | printk("Detected %d CPU's\n",(int) num_cpus); | 511 | printk("Detected %d CPU's\n",(int) num_cpus); |
521 | printk("Boot cpu address %2X\n", boot_cpu_addr); | 512 | printk("Boot cpu address %2X\n", boot_cpu_addr); |
513 | |||
514 | return num_cpus; | ||
522 | } | 515 | } |
523 | 516 | ||
524 | /* | 517 | /* |
@@ -679,6 +672,44 @@ __cpu_up(unsigned int cpu) | |||
679 | return 0; | 672 | return 0; |
680 | } | 673 | } |
681 | 674 | ||
675 | static unsigned int __initdata additional_cpus; | ||
676 | static unsigned int __initdata possible_cpus; | ||
677 | |||
678 | void __init smp_setup_cpu_possible_map(void) | ||
679 | { | ||
680 | unsigned int phy_cpus, pos_cpus, cpu; | ||
681 | |||
682 | phy_cpus = smp_count_cpus(); | ||
683 | pos_cpus = min(phy_cpus + additional_cpus, (unsigned int) NR_CPUS); | ||
684 | |||
685 | if (possible_cpus) | ||
686 | pos_cpus = min(possible_cpus, (unsigned int) NR_CPUS); | ||
687 | |||
688 | for (cpu = 0; cpu < pos_cpus; cpu++) | ||
689 | cpu_set(cpu, cpu_possible_map); | ||
690 | |||
691 | phy_cpus = min(phy_cpus, pos_cpus); | ||
692 | |||
693 | for (cpu = 0; cpu < phy_cpus; cpu++) | ||
694 | cpu_set(cpu, cpu_present_map); | ||
695 | } | ||
696 | |||
697 | #ifdef CONFIG_HOTPLUG_CPU | ||
698 | |||
699 | static int __init setup_additional_cpus(char *s) | ||
700 | { | ||
701 | additional_cpus = simple_strtoul(s, NULL, 0); | ||
702 | return 0; | ||
703 | } | ||
704 | early_param("additional_cpus", setup_additional_cpus); | ||
705 | |||
706 | static int __init setup_possible_cpus(char *s) | ||
707 | { | ||
708 | possible_cpus = simple_strtoul(s, NULL, 0); | ||
709 | return 0; | ||
710 | } | ||
711 | early_param("possible_cpus", setup_possible_cpus); | ||
712 | |||
682 | int | 713 | int |
683 | __cpu_disable(void) | 714 | __cpu_disable(void) |
684 | { | 715 | { |
@@ -747,6 +778,8 @@ cpu_die(void) | |||
747 | for(;;); | 778 | for(;;); |
748 | } | 779 | } |
749 | 780 | ||
781 | #endif /* CONFIG_HOTPLUG_CPU */ | ||
782 | |||
750 | /* | 783 | /* |
751 | * Cycle through the processors and setup structures. | 784 | * Cycle through the processors and setup structures. |
752 | */ | 785 | */ |
@@ -760,7 +793,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
760 | /* request the 0x1201 emergency signal external interrupt */ | 793 | /* request the 0x1201 emergency signal external interrupt */ |
761 | if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0) | 794 | if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0) |
762 | panic("Couldn't request external interrupt 0x1201"); | 795 | panic("Couldn't request external interrupt 0x1201"); |
763 | smp_check_cpus(max_cpus); | ||
764 | memset(lowcore_ptr,0,sizeof(lowcore_ptr)); | 796 | memset(lowcore_ptr,0,sizeof(lowcore_ptr)); |
765 | /* | 797 | /* |
766 | * Initialize prefix pages and stacks for all possible cpus | 798 | * Initialize prefix pages and stacks for all possible cpus |
@@ -809,8 +841,6 @@ void __devinit smp_prepare_boot_cpu(void) | |||
809 | BUG_ON(smp_processor_id() != 0); | 841 | BUG_ON(smp_processor_id() != 0); |
810 | 842 | ||
811 | cpu_set(0, cpu_online_map); | 843 | cpu_set(0, cpu_online_map); |
812 | cpu_set(0, cpu_present_map); | ||
813 | cpu_set(0, cpu_possible_map); | ||
814 | S390_lowcore.percpu_offset = __per_cpu_offset[0]; | 844 | S390_lowcore.percpu_offset = __per_cpu_offset[0]; |
815 | current_set[0] = current; | 845 | current_set[0] = current; |
816 | } | 846 | } |
@@ -849,6 +879,7 @@ static int __init topology_init(void) | |||
849 | 879 | ||
850 | subsys_initcall(topology_init); | 880 | subsys_initcall(topology_init); |
851 | 881 | ||
882 | EXPORT_SYMBOL(cpu_online_map); | ||
852 | EXPORT_SYMBOL(cpu_possible_map); | 883 | EXPORT_SYMBOL(cpu_possible_map); |
853 | EXPORT_SYMBOL(lowcore_ptr); | 884 | EXPORT_SYMBOL(lowcore_ptr); |
854 | EXPORT_SYMBOL(smp_ctl_set_bit); | 885 | EXPORT_SYMBOL(smp_ctl_set_bit); |