aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2012-11-02 08:28:48 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2012-11-23 05:14:31 -0500
commit0a4ccc992978ef552dc86ac68bc1ec62cf268e2a (patch)
tree92deb5bc88a71baa94f72f88b529854958a9002c /arch/s390
parent6b70a92080be508e16b2f53efba39e5155eff809 (diff)
s390/mm: move kernel_page_present/kernel_map_pages to page_attr.c
Keep related functions together and move to appropriate file. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/mm/init.c28
-rw-r--r--arch/s390/mm/pageattr.c43
-rw-r--r--arch/s390/mm/pgtable.c16
3 files changed, 43 insertions, 44 deletions
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index c6188ef72d33..ae672f41c464 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -158,34 +158,6 @@ void __init mem_init(void)
158 PFN_ALIGN((unsigned long)&_eshared) - 1); 158 PFN_ALIGN((unsigned long)&_eshared) - 1);
159} 159}
160 160
161#ifdef CONFIG_DEBUG_PAGEALLOC
162void kernel_map_pages(struct page *page, int numpages, int enable)
163{
164 pgd_t *pgd;
165 pud_t *pud;
166 pmd_t *pmd;
167 pte_t *pte;
168 unsigned long address;
169 int i;
170
171 for (i = 0; i < numpages; i++) {
172 address = page_to_phys(page + i);
173 pgd = pgd_offset_k(address);
174 pud = pud_offset(pgd, address);
175 pmd = pmd_offset(pud, address);
176 pte = pte_offset_kernel(pmd, address);
177 if (!enable) {
178 __ptep_ipte(address, pte);
179 pte_val(*pte) = _PAGE_TYPE_EMPTY;
180 continue;
181 }
182 *pte = mk_pte_phys(address, __pgprot(_PAGE_TYPE_RW));
183 /* Flush cpu write queue. */
184 mb();
185 }
186}
187#endif
188
189void free_init_pages(char *what, unsigned long begin, unsigned long end) 161void free_init_pages(char *what, unsigned long begin, unsigned long end)
190{ 162{
191 unsigned long addr = begin; 163 unsigned long addr = begin;
diff --git a/arch/s390/mm/pageattr.c b/arch/s390/mm/pageattr.c
index 73c3da393e88..29ccee3651f4 100644
--- a/arch/s390/mm/pageattr.c
+++ b/arch/s390/mm/pageattr.c
@@ -105,3 +105,46 @@ int set_memory_x(unsigned long addr, int numpages)
105{ 105{
106 return 0; 106 return 0;
107} 107}
108
109#ifdef CONFIG_DEBUG_PAGEALLOC
110void kernel_map_pages(struct page *page, int numpages, int enable)
111{
112 unsigned long address;
113 pgd_t *pgd;
114 pud_t *pud;
115 pmd_t *pmd;
116 pte_t *pte;
117 int i;
118
119 for (i = 0; i < numpages; i++) {
120 address = page_to_phys(page + i);
121 pgd = pgd_offset_k(address);
122 pud = pud_offset(pgd, address);
123 pmd = pmd_offset(pud, address);
124 pte = pte_offset_kernel(pmd, address);
125 if (!enable) {
126 __ptep_ipte(address, pte);
127 pte_val(*pte) = _PAGE_TYPE_EMPTY;
128 continue;
129 }
130 *pte = mk_pte_phys(address, __pgprot(_PAGE_TYPE_RW));
131 }
132}
133
134#ifdef CONFIG_HIBERNATION
135bool kernel_page_present(struct page *page)
136{
137 unsigned long addr;
138 int cc;
139
140 addr = page_to_phys(page);
141 asm volatile(
142 " lra %1,0(%1)\n"
143 " ipm %0\n"
144 " srl %0,28"
145 : "=d" (cc), "+a" (addr) : : "cc");
146 return cc == 0;
147}
148#endif /* CONFIG_HIBERNATION */
149
150#endif /* CONFIG_DEBUG_PAGEALLOC */
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index c8188a18af05..ae44d2a34313 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -881,22 +881,6 @@ int s390_enable_sie(void)
881} 881}
882EXPORT_SYMBOL_GPL(s390_enable_sie); 882EXPORT_SYMBOL_GPL(s390_enable_sie);
883 883
884#if defined(CONFIG_DEBUG_PAGEALLOC) && defined(CONFIG_HIBERNATION)
885bool kernel_page_present(struct page *page)
886{
887 unsigned long addr;
888 int cc;
889
890 addr = page_to_phys(page);
891 asm volatile(
892 " lra %1,0(%1)\n"
893 " ipm %0\n"
894 " srl %0,28"
895 : "=d" (cc), "+a" (addr) : : "cc");
896 return cc == 0;
897}
898#endif /* CONFIG_HIBERNATION && CONFIG_DEBUG_PAGEALLOC */
899
900#ifdef CONFIG_TRANSPARENT_HUGEPAGE 884#ifdef CONFIG_TRANSPARENT_HUGEPAGE
901int pmdp_clear_flush_young(struct vm_area_struct *vma, unsigned long address, 885int pmdp_clear_flush_young(struct vm_area_struct *vma, unsigned long address,
902 pmd_t *pmdp) 886 pmd_t *pmdp)