Commit 9e427365 authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky

s390: convert remaining bootmem allocations to memblock

Get rid of all remaining alloc_bootmem calls and use memblock_alloc
instead everywhere.  This way we get rid of the inconsistent mixture
of alloc_bootmem and memblock_alloc usages.

Two of the alloc_bootmem_low calls within arch/s390/kernel/setup.c are
replaced with memblock_alloc calls that don't enforce that the
allocated memory is below 2GB. This restriction was never necessary.
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent cb9c6385
...@@ -304,7 +304,9 @@ static void __init setup_lowcore(void) ...@@ -304,7 +304,9 @@ static void __init setup_lowcore(void)
* Setup lowcore for boot cpu * Setup lowcore for boot cpu
*/ */
BUILD_BUG_ON(sizeof(struct lowcore) != LC_PAGES * 4096); BUILD_BUG_ON(sizeof(struct lowcore) != LC_PAGES * 4096);
lc = __alloc_bootmem_low(LC_PAGES * PAGE_SIZE, LC_PAGES * PAGE_SIZE, 0); lc = (struct lowcore *) memblock_alloc_base(sizeof(struct lowcore),
sizeof(struct lowcore),
MAX_DMA_ADDRESS);
lc->restart_psw.mask = PSW_KERNEL_BITS; lc->restart_psw.mask = PSW_KERNEL_BITS;
lc->restart_psw.addr = (unsigned long) restart_int_handler; lc->restart_psw.addr = (unsigned long) restart_int_handler;
lc->external_new_psw.mask = PSW_KERNEL_BITS | lc->external_new_psw.mask = PSW_KERNEL_BITS |
...@@ -324,11 +326,9 @@ static void __init setup_lowcore(void) ...@@ -324,11 +326,9 @@ static void __init setup_lowcore(void)
lc->clock_comparator = -1ULL; lc->clock_comparator = -1ULL;
lc->kernel_stack = ((unsigned long) &init_thread_union) lc->kernel_stack = ((unsigned long) &init_thread_union)
+ THREAD_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs); + THREAD_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs);
lc->async_stack = (unsigned long) lc->async_stack = memblock_alloc(ASYNC_SIZE, ASYNC_SIZE)
__alloc_bootmem(ASYNC_SIZE, ASYNC_SIZE, 0)
+ ASYNC_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs); + ASYNC_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs);
lc->panic_stack = (unsigned long) lc->panic_stack = memblock_alloc(PAGE_SIZE, PAGE_SIZE)
__alloc_bootmem(PAGE_SIZE, PAGE_SIZE, 0)
+ PAGE_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs); + PAGE_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs);
lc->current_task = (unsigned long)&init_task; lc->current_task = (unsigned long)&init_task;
lc->lpp = LPP_MAGIC; lc->lpp = LPP_MAGIC;
...@@ -350,7 +350,7 @@ static void __init setup_lowcore(void) ...@@ -350,7 +350,7 @@ static void __init setup_lowcore(void)
lc->last_update_timer = S390_lowcore.last_update_timer; lc->last_update_timer = S390_lowcore.last_update_timer;
lc->last_update_clock = S390_lowcore.last_update_clock; lc->last_update_clock = S390_lowcore.last_update_clock;
restart_stack = __alloc_bootmem(ASYNC_SIZE, ASYNC_SIZE, 0); restart_stack = (void *) memblock_alloc(ASYNC_SIZE, ASYNC_SIZE);
restart_stack += ASYNC_SIZE; restart_stack += ASYNC_SIZE;
/* /*
...@@ -413,7 +413,7 @@ static void __init setup_resources(void) ...@@ -413,7 +413,7 @@ static void __init setup_resources(void)
bss_resource.end = (unsigned long) &__bss_stop - 1; bss_resource.end = (unsigned long) &__bss_stop - 1;
for_each_memblock(memory, reg) { for_each_memblock(memory, reg) {
res = alloc_bootmem_low(sizeof(*res)); res = (void *) memblock_alloc(sizeof(*res), 8);
res->flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM; res->flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM;
res->name = "System RAM"; res->name = "System RAM";
...@@ -427,7 +427,7 @@ static void __init setup_resources(void) ...@@ -427,7 +427,7 @@ static void __init setup_resources(void)
std_res->start > res->end) std_res->start > res->end)
continue; continue;
if (std_res->end > res->end) { if (std_res->end > res->end) {
sub_res = alloc_bootmem_low(sizeof(*sub_res)); sub_res = (void *) memblock_alloc(sizeof(*sub_res), 8);
*sub_res = *std_res; *sub_res = *std_res;
sub_res->end = res->end; sub_res->end = res->end;
std_res->start = res->end + 1; std_res->start = res->end + 1;
......
...@@ -34,7 +34,7 @@ static void __ref *vmem_alloc_pages(unsigned int order) ...@@ -34,7 +34,7 @@ static void __ref *vmem_alloc_pages(unsigned int order)
if (slab_is_available()) if (slab_is_available())
return (void *)__get_free_pages(GFP_KERNEL, order); return (void *)__get_free_pages(GFP_KERNEL, order);
return alloc_bootmem_align(size, size); return (void *) memblock_alloc(size, size);
} }
static inline pud_t *vmem_pud_alloc(void) static inline pud_t *vmem_pud_alloc(void)
...@@ -61,17 +61,16 @@ pmd_t *vmem_pmd_alloc(void) ...@@ -61,17 +61,16 @@ pmd_t *vmem_pmd_alloc(void)
pte_t __ref *vmem_pte_alloc(void) pte_t __ref *vmem_pte_alloc(void)
{ {
unsigned long size = PTRS_PER_PTE * sizeof(pte_t);
pte_t *pte; pte_t *pte;
if (slab_is_available()) if (slab_is_available())
pte = (pte_t *) page_table_alloc(&init_mm); pte = (pte_t *) page_table_alloc(&init_mm);
else else
pte = alloc_bootmem_align(PTRS_PER_PTE * sizeof(pte_t), pte = (pte_t *) memblock_alloc(size, size);
PTRS_PER_PTE * sizeof(pte_t));
if (!pte) if (!pte)
return NULL; return NULL;
clear_table((unsigned long *) pte, _PAGE_INVALID, clear_table((unsigned long *) pte, _PAGE_INVALID, size);
PTRS_PER_PTE * sizeof(pte_t));
return pte; return pte;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment