aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/mm/vmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/mm/vmem.c')
-rw-r--r--arch/s390/mm/vmem.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
index ffab84db6907..8b268fcc4612 100644
--- a/arch/s390/mm/vmem.c
+++ b/arch/s390/mm/vmem.c
@@ -191,19 +191,16 @@ static void vmem_remove_range(unsigned long start, unsigned long size)
191/* 191/*
192 * Add a backed mem_map array to the virtual mem_map array. 192 * Add a backed mem_map array to the virtual mem_map array.
193 */ 193 */
194int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node) 194int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
195{ 195{
196 unsigned long address, start_addr, end_addr; 196 unsigned long address = start;
197 pgd_t *pg_dir; 197 pgd_t *pg_dir;
198 pud_t *pu_dir; 198 pud_t *pu_dir;
199 pmd_t *pm_dir; 199 pmd_t *pm_dir;
200 pte_t *pt_dir; 200 pte_t *pt_dir;
201 int ret = -ENOMEM; 201 int ret = -ENOMEM;
202 202
203 start_addr = (unsigned long) start; 203 for (address = start; address < end;) {
204 end_addr = (unsigned long) (start + nr);
205
206 for (address = start_addr; address < end_addr;) {
207 pg_dir = pgd_offset_k(address); 204 pg_dir = pgd_offset_k(address);
208 if (pgd_none(*pg_dir)) { 205 if (pgd_none(*pg_dir)) {
209 pu_dir = vmem_pud_alloc(); 206 pu_dir = vmem_pud_alloc();
@@ -262,14 +259,14 @@ int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node)
262 } 259 }
263 address += PAGE_SIZE; 260 address += PAGE_SIZE;
264 } 261 }
265 memset(start, 0, nr * sizeof(struct page)); 262 memset((void *)start, 0, end - start);
266 ret = 0; 263 ret = 0;
267out: 264out:
268 flush_tlb_kernel_range(start_addr, end_addr); 265 flush_tlb_kernel_range(start, end);
269 return ret; 266 return ret;
270} 267}
271 268
272void vmemmap_free(struct page *memmap, unsigned long nr_pages) 269void vmemmap_free(unsigned long start, unsigned long end)
273{ 270{
274} 271}
275 272
@@ -378,9 +375,8 @@ void __init vmem_map_init(void)
378 375
379 ro_start = PFN_ALIGN((unsigned long)&_stext); 376 ro_start = PFN_ALIGN((unsigned long)&_stext);
380 ro_end = (unsigned long)&_eshared & PAGE_MASK; 377 ro_end = (unsigned long)&_eshared & PAGE_MASK;
381 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) { 378 for (i = 0; i < MEMORY_CHUNKS; i++) {
382 if (memory_chunk[i].type == CHUNK_CRASHK || 379 if (!memory_chunk[i].size)
383 memory_chunk[i].type == CHUNK_OLDMEM)
384 continue; 380 continue;
385 start = memory_chunk[i].addr; 381 start = memory_chunk[i].addr;
386 end = memory_chunk[i].addr + memory_chunk[i].size; 382 end = memory_chunk[i].addr + memory_chunk[i].size;
@@ -415,9 +411,6 @@ static int __init vmem_convert_memory_chunk(void)
415 for (i = 0; i < MEMORY_CHUNKS; i++) { 411 for (i = 0; i < MEMORY_CHUNKS; i++) {
416 if (!memory_chunk[i].size) 412 if (!memory_chunk[i].size)
417 continue; 413 continue;
418 if (memory_chunk[i].type == CHUNK_CRASHK ||
419 memory_chunk[i].type == CHUNK_OLDMEM)
420 continue;
421 seg = kzalloc(sizeof(*seg), GFP_KERNEL); 414 seg = kzalloc(sizeof(*seg), GFP_KERNEL);
422 if (!seg) 415 if (!seg)
423 panic("Out of memory...\n"); 416 panic("Out of memory...\n");