diff options
Diffstat (limited to 'arch/s390/kernel/smp.c')
-rw-r--r-- | arch/s390/kernel/smp.c | 50 |
1 files changed, 4 insertions, 46 deletions
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 56c16876b919..b4b6396e6cf0 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
@@ -475,10 +475,8 @@ static int __cpuinit smp_alloc_lowcore(int cpu) | |||
475 | { | 475 | { |
476 | unsigned long async_stack, panic_stack; | 476 | unsigned long async_stack, panic_stack; |
477 | struct _lowcore *lowcore; | 477 | struct _lowcore *lowcore; |
478 | int lc_order; | ||
479 | 478 | ||
480 | lc_order = sizeof(long) == 8 ? 1 : 0; | 479 | lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, LC_ORDER); |
481 | lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, lc_order); | ||
482 | if (!lowcore) | 480 | if (!lowcore) |
483 | return -ENOMEM; | 481 | return -ENOMEM; |
484 | async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER); | 482 | async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER); |
@@ -509,16 +507,14 @@ static int __cpuinit smp_alloc_lowcore(int cpu) | |||
509 | out: | 507 | out: |
510 | free_page(panic_stack); | 508 | free_page(panic_stack); |
511 | free_pages(async_stack, ASYNC_ORDER); | 509 | free_pages(async_stack, ASYNC_ORDER); |
512 | free_pages((unsigned long) lowcore, lc_order); | 510 | free_pages((unsigned long) lowcore, LC_ORDER); |
513 | return -ENOMEM; | 511 | return -ENOMEM; |
514 | } | 512 | } |
515 | 513 | ||
516 | static void smp_free_lowcore(int cpu) | 514 | static void smp_free_lowcore(int cpu) |
517 | { | 515 | { |
518 | struct _lowcore *lowcore; | 516 | struct _lowcore *lowcore; |
519 | int lc_order; | ||
520 | 517 | ||
521 | lc_order = sizeof(long) == 8 ? 1 : 0; | ||
522 | lowcore = lowcore_ptr[cpu]; | 518 | lowcore = lowcore_ptr[cpu]; |
523 | #ifndef CONFIG_64BIT | 519 | #ifndef CONFIG_64BIT |
524 | if (MACHINE_HAS_IEEE) | 520 | if (MACHINE_HAS_IEEE) |
@@ -528,7 +524,7 @@ static void smp_free_lowcore(int cpu) | |||
528 | #endif | 524 | #endif |
529 | free_page(lowcore->panic_stack - PAGE_SIZE); | 525 | free_page(lowcore->panic_stack - PAGE_SIZE); |
530 | free_pages(lowcore->async_stack - ASYNC_SIZE, ASYNC_ORDER); | 526 | free_pages(lowcore->async_stack - ASYNC_SIZE, ASYNC_ORDER); |
531 | free_pages((unsigned long) lowcore, lc_order); | 527 | free_pages((unsigned long) lowcore, LC_ORDER); |
532 | lowcore_ptr[cpu] = NULL; | 528 | lowcore_ptr[cpu] = NULL; |
533 | } | 529 | } |
534 | 530 | ||
@@ -664,7 +660,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
664 | unsigned long async_stack, panic_stack; | 660 | unsigned long async_stack, panic_stack; |
665 | struct _lowcore *lowcore; | 661 | struct _lowcore *lowcore; |
666 | unsigned int cpu; | 662 | unsigned int cpu; |
667 | int lc_order; | ||
668 | 663 | ||
669 | smp_detect_cpus(); | 664 | smp_detect_cpus(); |
670 | 665 | ||
@@ -674,8 +669,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
674 | print_cpu_info(); | 669 | print_cpu_info(); |
675 | 670 | ||
676 | /* Reallocate current lowcore, but keep its contents. */ | 671 | /* Reallocate current lowcore, but keep its contents. */ |
677 | lc_order = sizeof(long) == 8 ? 1 : 0; | 672 | lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, LC_ORDER); |
678 | lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, lc_order); | ||
679 | panic_stack = __get_free_page(GFP_KERNEL); | 673 | panic_stack = __get_free_page(GFP_KERNEL); |
680 | async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER); | 674 | async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER); |
681 | BUG_ON(!lowcore || !panic_stack || !async_stack); | 675 | BUG_ON(!lowcore || !panic_stack || !async_stack); |
@@ -1047,42 +1041,6 @@ out: | |||
1047 | static SYSDEV_CLASS_ATTR(dispatching, 0644, dispatching_show, | 1041 | static SYSDEV_CLASS_ATTR(dispatching, 0644, dispatching_show, |
1048 | dispatching_store); | 1042 | dispatching_store); |
1049 | 1043 | ||
1050 | /* | ||
1051 | * If the resume kernel runs on another cpu than the suspended kernel, | ||
1052 | * we have to switch the cpu IDs in the logical map. | ||
1053 | */ | ||
1054 | void smp_switch_boot_cpu_in_resume(u32 resume_phys_cpu_id, | ||
1055 | struct _lowcore *suspend_lowcore) | ||
1056 | { | ||
1057 | int cpu, suspend_cpu_id, resume_cpu_id; | ||
1058 | u32 suspend_phys_cpu_id; | ||
1059 | |||
1060 | suspend_phys_cpu_id = __cpu_logical_map[suspend_lowcore->cpu_nr]; | ||
1061 | suspend_cpu_id = suspend_lowcore->cpu_nr; | ||
1062 | |||
1063 | for_each_present_cpu(cpu) { | ||
1064 | if (__cpu_logical_map[cpu] == resume_phys_cpu_id) { | ||
1065 | resume_cpu_id = cpu; | ||
1066 | goto found; | ||
1067 | } | ||
1068 | } | ||
1069 | panic("Could not find resume cpu in logical map.\n"); | ||
1070 | |||
1071 | found: | ||
1072 | printk("Resume cpu ID: %i/%i\n", resume_phys_cpu_id, resume_cpu_id); | ||
1073 | printk("Suspend cpu ID: %i/%i\n", suspend_phys_cpu_id, suspend_cpu_id); | ||
1074 | |||
1075 | __cpu_logical_map[resume_cpu_id] = suspend_phys_cpu_id; | ||
1076 | __cpu_logical_map[suspend_cpu_id] = resume_phys_cpu_id; | ||
1077 | |||
1078 | lowcore_ptr[suspend_cpu_id]->cpu_addr = resume_phys_cpu_id; | ||
1079 | } | ||
1080 | |||
1081 | u32 smp_get_phys_cpu_id(void) | ||
1082 | { | ||
1083 | return __cpu_logical_map[smp_processor_id()]; | ||
1084 | } | ||
1085 | |||
1086 | static int __init topology_init(void) | 1044 | static int __init topology_init(void) |
1087 | { | 1045 | { |
1088 | int cpu; | 1046 | int cpu; |