Skip to content

Commit 65d37f1

Browse files
hcahcaVasily Gorbik
authored andcommitted
s390/cmma: move arch_set_page_dat() to header file
In order to be usable for early boot code move the simple arch_set_page_dat() function to header file, and add its counter-part arch_set_page_nodat(). Also change the parameters, and the function name slightly. This is required since there aren't any struct pages available in early boot code, and renaming of functions is done to make sure that all users are converted to the new API. Instead of a pointer to a struct page a virtual address is passed, and instead of an order the number of pages for which the page state needs be set. Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
1 parent a3e89e2 commit 65d37f1

File tree

6 files changed

+28
-16
lines changed

6 files changed

+28
-16
lines changed

arch/s390/include/asm/page-states.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,21 @@ static inline void __set_page_stable_nodat(void *addr, unsigned long num_pages)
6060
__set_page_state(addr, num_pages, ESSA_SET_STABLE_NODAT);
6161
}
6262

63+
static inline void __arch_set_page_nodat(void *addr, unsigned long num_pages)
64+
{
65+
if (!cmma_flag)
66+
return;
67+
if (cmma_flag < 2)
68+
__set_page_stable_dat(addr, num_pages);
69+
else
70+
__set_page_stable_nodat(addr, num_pages);
71+
}
72+
73+
static inline void __arch_set_page_dat(void *addr, unsigned long num_pages)
74+
{
75+
if (!cmma_flag)
76+
return;
77+
__set_page_stable_dat(addr, num_pages);
78+
}
79+
6380
#endif

arch/s390/include/asm/page.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ static inline int page_reset_referenced(unsigned long addr)
164164
struct page;
165165
void arch_free_page(struct page *page, int order);
166166
void arch_alloc_page(struct page *page, int order);
167-
void arch_set_page_dat(struct page *page, int order);
168167

169168
static inline int devmem_is_allowed(unsigned long pfn)
170169
{

arch/s390/mm/gmap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <linux/ksm.h>
1919
#include <linux/mman.h>
2020
#include <linux/pgtable.h>
21-
21+
#include <asm/page-states.h>
2222
#include <asm/pgalloc.h>
2323
#include <asm/gmap.h>
2424
#include <asm/page.h>
@@ -33,7 +33,7 @@ static struct page *gmap_alloc_crst(void)
3333
page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER);
3434
if (!page)
3535
return NULL;
36-
arch_set_page_dat(page, CRST_ALLOC_ORDER);
36+
__arch_set_page_dat(page_to_virt(page), 1UL << CRST_ALLOC_ORDER);
3737
return page;
3838
}
3939

arch/s390/mm/page-states.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,3 @@ void arch_alloc_page(struct page *page, int order)
153153
else
154154
__set_page_stable_nodat(page_to_virt(page), 1UL << order);
155155
}
156-
157-
void arch_set_page_dat(struct page *page, int order)
158-
{
159-
if (!cmma_flag)
160-
return;
161-
__set_page_stable_dat(page_to_virt(page), 1UL << order);
162-
}

arch/s390/mm/pgalloc.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/slab.h>
1111
#include <linux/mm.h>
1212
#include <asm/mmu_context.h>
13+
#include <asm/page-states.h>
1314
#include <asm/pgalloc.h>
1415
#include <asm/gmap.h>
1516
#include <asm/tlb.h>
@@ -43,11 +44,13 @@ __initcall(page_table_register_sysctl);
4344
unsigned long *crst_table_alloc(struct mm_struct *mm)
4445
{
4546
struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL, CRST_ALLOC_ORDER);
47+
unsigned long *table;
4648

4749
if (!ptdesc)
4850
return NULL;
49-
arch_set_page_dat(ptdesc_page(ptdesc), CRST_ALLOC_ORDER);
50-
return (unsigned long *) ptdesc_to_virt(ptdesc);
51+
table = ptdesc_to_virt(ptdesc);
52+
__arch_set_page_dat(table, 1UL << CRST_ALLOC_ORDER);
53+
return table;
5154
}
5255

5356
void crst_table_free(struct mm_struct *mm, unsigned long *table)
@@ -145,7 +148,7 @@ struct page *page_table_alloc_pgste(struct mm_struct *mm)
145148
ptdesc = pagetable_alloc(GFP_KERNEL, 0);
146149
if (ptdesc) {
147150
table = (u64 *)ptdesc_to_virt(ptdesc);
148-
arch_set_page_dat(virt_to_page(table), 0);
151+
__arch_set_page_dat(table, 1);
149152
memset64(table, _PAGE_INVALID, PTRS_PER_PTE);
150153
memset64(table + PTRS_PER_PTE, 0, PTRS_PER_PTE);
151154
}
@@ -285,9 +288,9 @@ unsigned long *page_table_alloc(struct mm_struct *mm)
285288
pagetable_free(ptdesc);
286289
return NULL;
287290
}
288-
arch_set_page_dat(ptdesc_page(ptdesc), 0);
289291
/* Initialize page table */
290-
table = (unsigned long *) ptdesc_to_virt(ptdesc);
292+
table = ptdesc_to_virt(ptdesc);
293+
__arch_set_page_dat(table, 1);
291294
if (mm_alloc_pgste(mm)) {
292295
/* Return 4K page table with PGSTEs */
293296
INIT_LIST_HEAD(&ptdesc->pt_list);

arch/s390/mm/vmem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void *vmem_crst_alloc(unsigned long val)
5151
return NULL;
5252
crst_table_init(table, val);
5353
if (slab_is_available())
54-
arch_set_page_dat(virt_to_page(table), CRST_ALLOC_ORDER);
54+
__arch_set_page_dat(table, 1UL << CRST_ALLOC_ORDER);
5555
return table;
5656
}
5757

0 commit comments

Comments
 (0)