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.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
index 7c1287ccf788..35d90a4720fd 100644
--- a/arch/s390/mm/vmem.c
+++ b/arch/s390/mm/vmem.c
@@ -69,7 +69,19 @@ static void __ref *vmem_alloc_pages(unsigned int order)
69 return alloc_bootmem_pages((1 << order) * PAGE_SIZE); 69 return alloc_bootmem_pages((1 << order) * PAGE_SIZE);
70} 70}
71 71
72#define vmem_pud_alloc() ({ BUG(); ((pud_t *) NULL); }) 72static inline pud_t *vmem_pud_alloc(void)
73{
74 pud_t *pud = NULL;
75
76#ifdef CONFIG_64BIT
77 pud = vmem_alloc_pages(2);
78 if (!pud)
79 return NULL;
80 pud_val(*pud) = _REGION3_ENTRY_EMPTY;
81 memcpy(pud + 1, pud, (PTRS_PER_PUD - 1)*sizeof(pud_t));
82#endif
83 return pud;
84}
73 85
74static inline pmd_t *vmem_pmd_alloc(void) 86static inline pmd_t *vmem_pmd_alloc(void)
75{ 87{
@@ -84,13 +96,18 @@ static inline pmd_t *vmem_pmd_alloc(void)
84 return pmd; 96 return pmd;
85} 97}
86 98
87static inline pte_t *vmem_pte_alloc(void) 99static pte_t __init_refok *vmem_pte_alloc(void)
88{ 100{
89 pte_t *pte = vmem_alloc_pages(0); 101 pte_t *pte;
90 102
103 if (slab_is_available())
104 pte = (pte_t *) page_table_alloc(&init_mm);
105 else
106 pte = alloc_bootmem(PTRS_PER_PTE * sizeof(pte_t));
91 if (!pte) 107 if (!pte)
92 return NULL; 108 return NULL;
93 clear_table((unsigned long *) pte, _PAGE_TYPE_EMPTY, PAGE_SIZE); 109 clear_table((unsigned long *) pte, _PAGE_TYPE_EMPTY,
110 PTRS_PER_PTE * sizeof(pte_t));
94 return pte; 111 return pte;
95} 112}
96 113
@@ -360,6 +377,9 @@ void __init vmem_map_init(void)
360{ 377{
361 int i; 378 int i;
362 379
380 INIT_LIST_HEAD(&init_mm.context.crst_list);
381 INIT_LIST_HEAD(&init_mm.context.pgtable_list);
382 init_mm.context.noexec = 0;
363 NODE_DATA(0)->node_mem_map = VMEM_MAP; 383 NODE_DATA(0)->node_mem_map = VMEM_MAP;
364 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) 384 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++)
365 vmem_add_mem(memory_chunk[i].addr, memory_chunk[i].size); 385 vmem_add_mem(memory_chunk[i].addr, memory_chunk[i].size);