diff options
Diffstat (limited to 'arch/s390/kernel/smp.c')
| -rw-r--r-- | arch/s390/kernel/smp.c | 69 |
1 files changed, 52 insertions, 17 deletions
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 0d1ad5dbe2b1..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 = CPU_MASK_ALL; | 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,19 +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 | printk("Detected %d CPU's\n",(int) num_cpus); | 511 | printk("Detected %d CPU's\n",(int) num_cpus); |
| 518 | printk("Boot cpu address %2X\n", boot_cpu_addr); | 512 | printk("Boot cpu address %2X\n", boot_cpu_addr); |
| 513 | |||
| 514 | return num_cpus; | ||
| 519 | } | 515 | } |
| 520 | 516 | ||
| 521 | /* | 517 | /* |
| @@ -676,6 +672,44 @@ __cpu_up(unsigned int cpu) | |||
| 676 | return 0; | 672 | return 0; |
| 677 | } | 673 | } |
| 678 | 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 | |||
| 679 | int | 713 | int |
| 680 | __cpu_disable(void) | 714 | __cpu_disable(void) |
| 681 | { | 715 | { |
| @@ -744,6 +778,8 @@ cpu_die(void) | |||
| 744 | for(;;); | 778 | for(;;); |
| 745 | } | 779 | } |
| 746 | 780 | ||
| 781 | #endif /* CONFIG_HOTPLUG_CPU */ | ||
| 782 | |||
| 747 | /* | 783 | /* |
| 748 | * Cycle through the processors and setup structures. | 784 | * Cycle through the processors and setup structures. |
| 749 | */ | 785 | */ |
| @@ -757,7 +793,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
| 757 | /* request the 0x1201 emergency signal external interrupt */ | 793 | /* request the 0x1201 emergency signal external interrupt */ |
| 758 | if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0) | 794 | if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0) |
| 759 | panic("Couldn't request external interrupt 0x1201"); | 795 | panic("Couldn't request external interrupt 0x1201"); |
| 760 | smp_check_cpus(max_cpus); | ||
| 761 | memset(lowcore_ptr,0,sizeof(lowcore_ptr)); | 796 | memset(lowcore_ptr,0,sizeof(lowcore_ptr)); |
| 762 | /* | 797 | /* |
| 763 | * Initialize prefix pages and stacks for all possible cpus | 798 | * Initialize prefix pages and stacks for all possible cpus |
| @@ -806,7 +841,6 @@ void __devinit smp_prepare_boot_cpu(void) | |||
| 806 | BUG_ON(smp_processor_id() != 0); | 841 | BUG_ON(smp_processor_id() != 0); |
| 807 | 842 | ||
| 808 | cpu_set(0, cpu_online_map); | 843 | cpu_set(0, cpu_online_map); |
| 809 | cpu_set(0, cpu_present_map); | ||
| 810 | S390_lowcore.percpu_offset = __per_cpu_offset[0]; | 844 | S390_lowcore.percpu_offset = __per_cpu_offset[0]; |
| 811 | current_set[0] = current; | 845 | current_set[0] = current; |
| 812 | } | 846 | } |
| @@ -845,6 +879,7 @@ static int __init topology_init(void) | |||
| 845 | 879 | ||
| 846 | subsys_initcall(topology_init); | 880 | subsys_initcall(topology_init); |
| 847 | 881 | ||
| 882 | EXPORT_SYMBOL(cpu_online_map); | ||
| 848 | EXPORT_SYMBOL(cpu_possible_map); | 883 | EXPORT_SYMBOL(cpu_possible_map); |
| 849 | EXPORT_SYMBOL(lowcore_ptr); | 884 | EXPORT_SYMBOL(lowcore_ptr); |
| 850 | EXPORT_SYMBOL(smp_ctl_set_bit); | 885 | EXPORT_SYMBOL(smp_ctl_set_bit); |
