diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2009-09-22 16:58:49 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-09-22 16:58:45 -0400 |
commit | 3fd26a7793fb21b88ccf1e238670b2a508fcf835 (patch) | |
tree | 47b6b2068d7c5ee584dde5f90defd55757f002bb | |
parent | 07805ac81c81634623042408ffea6bbad3160bfa (diff) |
[S390] smp: introduce LC_ORDER and simplify lowcore handling
Removes a couple of simple code duplications. But before I have to do
this again, just simplify it.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | arch/s390/include/asm/lowcore.h | 6 | ||||
-rw-r--r-- | arch/s390/kernel/smp.c | 14 |
2 files changed, 10 insertions, 10 deletions
diff --git a/arch/s390/include/asm/lowcore.h b/arch/s390/include/asm/lowcore.h index 6bc9426a6fbf..8c5570366a0e 100644 --- a/arch/s390/include/asm/lowcore.h +++ b/arch/s390/include/asm/lowcore.h | |||
@@ -189,6 +189,12 @@ union save_area { | |||
189 | #define SAVE_AREA_BASE SAVE_AREA_BASE_S390X | 189 | #define SAVE_AREA_BASE SAVE_AREA_BASE_S390X |
190 | #endif | 190 | #endif |
191 | 191 | ||
192 | #ifndef __s390x__ | ||
193 | #define LC_ORDER 0 | ||
194 | #else | ||
195 | #define LC_ORDER 1 | ||
196 | #endif | ||
197 | |||
192 | struct _lowcore | 198 | struct _lowcore |
193 | { | 199 | { |
194 | #ifndef __s390x__ | 200 | #ifndef __s390x__ |
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 56c16876b919..6f14734abe72 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); |