pgtable.h 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067
  1. /*
  2. * include/asm-s390/pgtable.h
  3. *
  4. * S390 version
  5. * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
  6. * Author(s): Hartmut Penner (hp@de.ibm.com)
  7. * Ulrich Weigand (weigand@de.ibm.com)
  8. * Martin Schwidefsky (schwidefsky@de.ibm.com)
  9. *
  10. * Derived from "include/asm-i386/pgtable.h"
  11. */
  12. #ifndef _ASM_S390_PGTABLE_H
  13. #define _ASM_S390_PGTABLE_H
  14. /*
  15. * The Linux memory management assumes a three-level page table setup. For
  16. * s390 31 bit we "fold" the mid level into the top-level page table, so
  17. * that we physically have the same two-level page table as the s390 mmu
  18. * expects in 31 bit mode. For s390 64 bit we use three of the five levels
  19. * the hardware provides (region first and region second tables are not
  20. * used).
  21. *
  22. * The "pgd_xxx()" functions are trivial for a folded two-level
  23. * setup: the pgd is never bad, and a pmd always exists (as it's folded
  24. * into the pgd entry)
  25. *
  26. * This file contains the functions and defines necessary to modify and use
  27. * the S390 page table tree.
  28. */
  29. #ifndef __ASSEMBLY__
  30. #include <linux/mm_types.h>
  31. #include <asm/bitops.h>
  32. #include <asm/bug.h>
  33. #include <asm/processor.h>
  34. extern pgd_t swapper_pg_dir[] __attribute__ ((aligned (4096)));
  35. extern void paging_init(void);
  36. extern void vmem_map_init(void);
  37. /*
  38. * The S390 doesn't have any external MMU info: the kernel page
  39. * tables contain all the necessary information.
  40. */
  41. #define update_mmu_cache(vma, address, pte) do { } while (0)
  42. /*
  43. * ZERO_PAGE is a global shared page that is always zero: used
  44. * for zero-mapped memory areas etc..
  45. */
  46. extern char empty_zero_page[PAGE_SIZE];
  47. #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
  48. #endif /* !__ASSEMBLY__ */
  49. /*
  50. * PMD_SHIFT determines the size of the area a second-level page
  51. * table can map
  52. * PGDIR_SHIFT determines what a third-level page table entry can map
  53. */
  54. #ifndef __s390x__
  55. # define PMD_SHIFT 20
  56. # define PUD_SHIFT 20
  57. # define PGDIR_SHIFT 20
  58. #else /* __s390x__ */
  59. # define PMD_SHIFT 20
  60. # define PUD_SHIFT 31
  61. # define PGDIR_SHIFT 42
  62. #endif /* __s390x__ */
  63. #define PMD_SIZE (1UL << PMD_SHIFT)
  64. #define PMD_MASK (~(PMD_SIZE-1))
  65. #define PUD_SIZE (1UL << PUD_SHIFT)
  66. #define PUD_MASK (~(PUD_SIZE-1))
  67. #define PGDIR_SIZE (1UL << PGDIR_SHIFT)
  68. #define PGDIR_MASK (~(PGDIR_SIZE-1))
  69. /*
  70. * entries per page directory level: the S390 is two-level, so
  71. * we don't really have any PMD directory physically.
  72. * for S390 segment-table entries are combined to one PGD
  73. * that leads to 1024 pte per pgd
  74. */
  75. #define PTRS_PER_PTE 256
  76. #ifndef __s390x__
  77. #define PTRS_PER_PMD 1
  78. #define PTRS_PER_PUD 1
  79. #else /* __s390x__ */
  80. #define PTRS_PER_PMD 2048
  81. #define PTRS_PER_PUD 2048
  82. #endif /* __s390x__ */
  83. #define PTRS_PER_PGD 2048
  84. #define FIRST_USER_ADDRESS 0
  85. #define pte_ERROR(e) \
  86. printk("%s:%d: bad pte %p.\n", __FILE__, __LINE__, (void *) pte_val(e))
  87. #define pmd_ERROR(e) \
  88. printk("%s:%d: bad pmd %p.\n", __FILE__, __LINE__, (void *) pmd_val(e))
  89. #define pud_ERROR(e) \
  90. printk("%s:%d: bad pud %p.\n", __FILE__, __LINE__, (void *) pud_val(e))
  91. #define pgd_ERROR(e) \
  92. printk("%s:%d: bad pgd %p.\n", __FILE__, __LINE__, (void *) pgd_val(e))
  93. #ifndef __ASSEMBLY__
  94. /*
  95. * The vmalloc area will always be on the topmost area of the kernel
  96. * mapping. We reserve 96MB (31bit) / 1GB (64bit) for vmalloc,
  97. * which should be enough for any sane case.
  98. * By putting vmalloc at the top, we maximise the gap between physical
  99. * memory and vmalloc to catch misplaced memory accesses. As a side
  100. * effect, this also makes sure that 64 bit module code cannot be used
  101. * as system call address.
  102. */
  103. #ifndef __s390x__
  104. #define VMALLOC_START 0x78000000UL
  105. #define VMALLOC_END 0x7e000000UL
  106. #define VMEM_MAP_END 0x80000000UL
  107. #else /* __s390x__ */
  108. #define VMALLOC_START 0x3e000000000UL
  109. #define VMALLOC_END 0x3e040000000UL
  110. #define VMEM_MAP_END 0x40000000000UL
  111. #endif /* __s390x__ */
  112. /*
  113. * VMEM_MAX_PHYS is the highest physical address that can be added to the 1:1
  114. * mapping. This needs to be calculated at compile time since the size of the
  115. * VMEM_MAP is static but the size of struct page can change.
  116. */
  117. #define VMEM_MAX_PAGES ((VMEM_MAP_END - VMALLOC_END) / sizeof(struct page))
  118. #define VMEM_MAX_PFN min(VMALLOC_START >> PAGE_SHIFT, VMEM_MAX_PAGES)
  119. #define VMEM_MAX_PHYS ((VMEM_MAX_PFN << PAGE_SHIFT) & ~((16 << 20) - 1))
  120. #define VMEM_MAP ((struct page *) VMALLOC_END)
  121. /*
  122. * A 31 bit pagetable entry of S390 has following format:
  123. * | PFRA | | OS |
  124. * 0 0IP0
  125. * 00000000001111111111222222222233
  126. * 01234567890123456789012345678901
  127. *
  128. * I Page-Invalid Bit: Page is not available for address-translation
  129. * P Page-Protection Bit: Store access not possible for page
  130. *
  131. * A 31 bit segmenttable entry of S390 has following format:
  132. * | P-table origin | |PTL
  133. * 0 IC
  134. * 00000000001111111111222222222233
  135. * 01234567890123456789012345678901
  136. *
  137. * I Segment-Invalid Bit: Segment is not available for address-translation
  138. * C Common-Segment Bit: Segment is not private (PoP 3-30)
  139. * PTL Page-Table-Length: Page-table length (PTL+1*16 entries -> up to 256)
  140. *
  141. * The 31 bit segmenttable origin of S390 has following format:
  142. *
  143. * |S-table origin | | STL |
  144. * X **GPS
  145. * 00000000001111111111222222222233
  146. * 01234567890123456789012345678901
  147. *
  148. * X Space-Switch event:
  149. * G Segment-Invalid Bit: *
  150. * P Private-Space Bit: Segment is not private (PoP 3-30)
  151. * S Storage-Alteration:
  152. * STL Segment-Table-Length: Segment-table length (STL+1*16 entries -> up to 2048)
  153. *
  154. * A 64 bit pagetable entry of S390 has following format:
  155. * | PFRA |0IP0| OS |
  156. * 0000000000111111111122222222223333333333444444444455555555556666
  157. * 0123456789012345678901234567890123456789012345678901234567890123
  158. *
  159. * I Page-Invalid Bit: Page is not available for address-translation
  160. * P Page-Protection Bit: Store access not possible for page
  161. *
  162. * A 64 bit segmenttable entry of S390 has following format:
  163. * | P-table origin | TT
  164. * 0000000000111111111122222222223333333333444444444455555555556666
  165. * 0123456789012345678901234567890123456789012345678901234567890123
  166. *
  167. * I Segment-Invalid Bit: Segment is not available for address-translation
  168. * C Common-Segment Bit: Segment is not private (PoP 3-30)
  169. * P Page-Protection Bit: Store access not possible for page
  170. * TT Type 00
  171. *
  172. * A 64 bit region table entry of S390 has following format:
  173. * | S-table origin | TF TTTL
  174. * 0000000000111111111122222222223333333333444444444455555555556666
  175. * 0123456789012345678901234567890123456789012345678901234567890123
  176. *
  177. * I Segment-Invalid Bit: Segment is not available for address-translation
  178. * TT Type 01
  179. * TF
  180. * TL Table length
  181. *
  182. * The 64 bit regiontable origin of S390 has following format:
  183. * | region table origon | DTTL
  184. * 0000000000111111111122222222223333333333444444444455555555556666
  185. * 0123456789012345678901234567890123456789012345678901234567890123
  186. *
  187. * X Space-Switch event:
  188. * G Segment-Invalid Bit:
  189. * P Private-Space Bit:
  190. * S Storage-Alteration:
  191. * R Real space
  192. * TL Table-Length:
  193. *
  194. * A storage key has the following format:
  195. * | ACC |F|R|C|0|
  196. * 0 3 4 5 6 7
  197. * ACC: access key
  198. * F : fetch protection bit
  199. * R : referenced bit
  200. * C : changed bit
  201. */
  202. /* Hardware bits in the page table entry */
  203. #define _PAGE_RO 0x200 /* HW read-only bit */
  204. #define _PAGE_INVALID 0x400 /* HW invalid bit */
  205. /* Software bits in the page table entry */
  206. #define _PAGE_SWT 0x001 /* SW pte type bit t */
  207. #define _PAGE_SWX 0x002 /* SW pte type bit x */
  208. /* Six different types of pages. */
  209. #define _PAGE_TYPE_EMPTY 0x400
  210. #define _PAGE_TYPE_NONE 0x401
  211. #define _PAGE_TYPE_SWAP 0x403
  212. #define _PAGE_TYPE_FILE 0x601 /* bit 0x002 is used for offset !! */
  213. #define _PAGE_TYPE_RO 0x200
  214. #define _PAGE_TYPE_RW 0x000
  215. #define _PAGE_TYPE_EX_RO 0x202
  216. #define _PAGE_TYPE_EX_RW 0x002
  217. /*
  218. * PTE type bits are rather complicated. handle_pte_fault uses pte_present,
  219. * pte_none and pte_file to find out the pte type WITHOUT holding the page
  220. * table lock. ptep_clear_flush on the other hand uses ptep_clear_flush to
  221. * invalidate a given pte. ipte sets the hw invalid bit and clears all tlbs
  222. * for the page. The page table entry is set to _PAGE_TYPE_EMPTY afterwards.
  223. * This change is done while holding the lock, but the intermediate step
  224. * of a previously valid pte with the hw invalid bit set can be observed by
  225. * handle_pte_fault. That makes it necessary that all valid pte types with
  226. * the hw invalid bit set must be distinguishable from the four pte types
  227. * empty, none, swap and file.
  228. *
  229. * irxt ipte irxt
  230. * _PAGE_TYPE_EMPTY 1000 -> 1000
  231. * _PAGE_TYPE_NONE 1001 -> 1001
  232. * _PAGE_TYPE_SWAP 1011 -> 1011
  233. * _PAGE_TYPE_FILE 11?1 -> 11?1
  234. * _PAGE_TYPE_RO 0100 -> 1100
  235. * _PAGE_TYPE_RW 0000 -> 1000
  236. * _PAGE_TYPE_EX_RO 0110 -> 1110
  237. * _PAGE_TYPE_EX_RW 0010 -> 1010
  238. *
  239. * pte_none is true for bits combinations 1000, 1010, 1100, 1110
  240. * pte_present is true for bits combinations 0000, 0010, 0100, 0110, 1001
  241. * pte_file is true for bits combinations 1101, 1111
  242. * swap pte is 1011 and 0001, 0011, 0101, 0111 are invalid.
  243. */
  244. /* Page status table bits for virtualization */
  245. #define RCP_PCL_BIT 55
  246. #define RCP_HR_BIT 54
  247. #define RCP_HC_BIT 53
  248. #define RCP_GR_BIT 50
  249. #define RCP_GC_BIT 49
  250. #ifndef __s390x__
  251. /* Bits in the segment table address-space-control-element */
  252. #define _ASCE_SPACE_SWITCH 0x80000000UL /* space switch event */
  253. #define _ASCE_ORIGIN_MASK 0x7ffff000UL /* segment table origin */
  254. #define _ASCE_PRIVATE_SPACE 0x100 /* private space control */
  255. #define _ASCE_ALT_EVENT 0x80 /* storage alteration event control */
  256. #define _ASCE_TABLE_LENGTH 0x7f /* 128 x 64 entries = 8k */
  257. /* Bits in the segment table entry */
  258. #define _SEGMENT_ENTRY_ORIGIN 0x7fffffc0UL /* page table origin */
  259. #define _SEGMENT_ENTRY_INV 0x20 /* invalid segment table entry */
  260. #define _SEGMENT_ENTRY_COMMON 0x10 /* common segment bit */
  261. #define _SEGMENT_ENTRY_PTL 0x0f /* page table length */
  262. #define _SEGMENT_ENTRY (_SEGMENT_ENTRY_PTL)
  263. #define _SEGMENT_ENTRY_EMPTY (_SEGMENT_ENTRY_INV)
  264. #else /* __s390x__ */
  265. /* Bits in the segment/region table address-space-control-element */
  266. #define _ASCE_ORIGIN ~0xfffUL/* segment table origin */
  267. #define _ASCE_PRIVATE_SPACE 0x100 /* private space control */
  268. #define _ASCE_ALT_EVENT 0x80 /* storage alteration event control */
  269. #define _ASCE_SPACE_SWITCH 0x40 /* space switch event */
  270. #define _ASCE_REAL_SPACE 0x20 /* real space control */
  271. #define _ASCE_TYPE_MASK 0x0c /* asce table type mask */
  272. #define _ASCE_TYPE_REGION1 0x0c /* region first table type */
  273. #define _ASCE_TYPE_REGION2 0x08 /* region second table type */
  274. #define _ASCE_TYPE_REGION3 0x04 /* region third table type */
  275. #define _ASCE_TYPE_SEGMENT 0x00 /* segment table type */
  276. #define _ASCE_TABLE_LENGTH 0x03 /* region table length */
  277. /* Bits in the region table entry */
  278. #define _REGION_ENTRY_ORIGIN ~0xfffUL/* region/segment table origin */
  279. #define _REGION_ENTRY_INV 0x20 /* invalid region table entry */
  280. #define _REGION_ENTRY_TYPE_MASK 0x0c /* region/segment table type mask */
  281. #define _REGION_ENTRY_TYPE_R1 0x0c /* region first table type */
  282. #define _REGION_ENTRY_TYPE_R2 0x08 /* region second table type */
  283. #define _REGION_ENTRY_TYPE_R3 0x04 /* region third table type */
  284. #define _REGION_ENTRY_LENGTH 0x03 /* region third length */
  285. #define _REGION1_ENTRY (_REGION_ENTRY_TYPE_R1 | _REGION_ENTRY_LENGTH)
  286. #define _REGION1_ENTRY_EMPTY (_REGION_ENTRY_TYPE_R1 | _REGION_ENTRY_INV)
  287. #define _REGION2_ENTRY (_REGION_ENTRY_TYPE_R2 | _REGION_ENTRY_LENGTH)
  288. #define _REGION2_ENTRY_EMPTY (_REGION_ENTRY_TYPE_R2 | _REGION_ENTRY_INV)
  289. #define _REGION3_ENTRY (_REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_LENGTH)
  290. #define _REGION3_ENTRY_EMPTY (_REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_INV)
  291. /* Bits in the segment table entry */
  292. #define _SEGMENT_ENTRY_ORIGIN ~0x7ffUL/* segment table origin */
  293. #define _SEGMENT_ENTRY_RO 0x200 /* page protection bit */
  294. #define _SEGMENT_ENTRY_INV 0x20 /* invalid segment table entry */
  295. #define _SEGMENT_ENTRY (0)
  296. #define _SEGMENT_ENTRY_EMPTY (_SEGMENT_ENTRY_INV)
  297. #endif /* __s390x__ */
  298. /*
  299. * A user page table pointer has the space-switch-event bit, the
  300. * private-space-control bit and the storage-alteration-event-control
  301. * bit set. A kernel page table pointer doesn't need them.
  302. */
  303. #define _ASCE_USER_BITS (_ASCE_SPACE_SWITCH | _ASCE_PRIVATE_SPACE | \
  304. _ASCE_ALT_EVENT)
  305. /* Bits int the storage key */
  306. #define _PAGE_CHANGED 0x02 /* HW changed bit */
  307. #define _PAGE_REFERENCED 0x04 /* HW referenced bit */
  308. /*
  309. * Page protection definitions.
  310. */
  311. #define PAGE_NONE __pgprot(_PAGE_TYPE_NONE)
  312. #define PAGE_RO __pgprot(_PAGE_TYPE_RO)
  313. #define PAGE_RW __pgprot(_PAGE_TYPE_RW)
  314. #define PAGE_EX_RO __pgprot(_PAGE_TYPE_EX_RO)
  315. #define PAGE_EX_RW __pgprot(_PAGE_TYPE_EX_RW)
  316. #define PAGE_KERNEL PAGE_RW
  317. #define PAGE_COPY PAGE_RO
  318. /*
  319. * Dependent on the EXEC_PROTECT option s390 can do execute protection.
  320. * Write permission always implies read permission. In theory with a
  321. * primary/secondary page table execute only can be implemented but
  322. * it would cost an additional bit in the pte to distinguish all the
  323. * different pte types. To avoid that execute permission currently
  324. * implies read permission as well.
  325. */
  326. /*xwr*/
  327. #define __P000 PAGE_NONE
  328. #define __P001 PAGE_RO
  329. #define __P010 PAGE_RO
  330. #define __P011 PAGE_RO
  331. #define __P100 PAGE_EX_RO
  332. #define __P101 PAGE_EX_RO
  333. #define __P110 PAGE_EX_RO
  334. #define __P111 PAGE_EX_RO
  335. #define __S000 PAGE_NONE
  336. #define __S001 PAGE_RO
  337. #define __S010 PAGE_RW
  338. #define __S011 PAGE_RW
  339. #define __S100 PAGE_EX_RO
  340. #define __S101 PAGE_EX_RO
  341. #define __S110 PAGE_EX_RW
  342. #define __S111 PAGE_EX_RW
  343. #ifndef __s390x__
  344. # define PxD_SHADOW_SHIFT 1
  345. #else /* __s390x__ */
  346. # define PxD_SHADOW_SHIFT 2
  347. #endif /* __s390x__ */
  348. static inline void *get_shadow_table(void *table)
  349. {
  350. unsigned long addr, offset;
  351. struct page *page;
  352. addr = (unsigned long) table;
  353. offset = addr & ((PAGE_SIZE << PxD_SHADOW_SHIFT) - 1);
  354. page = virt_to_page((void *)(addr ^ offset));
  355. return (void *)(addr_t)(page->index ? (page->index | offset) : 0UL);
  356. }
  357. /*
  358. * Certain architectures need to do special things when PTEs
  359. * within a page table are directly modified. Thus, the following
  360. * hook is made available.
  361. */
  362. static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
  363. pte_t *ptep, pte_t entry)
  364. {
  365. *ptep = entry;
  366. if (mm->context.noexec) {
  367. if (!(pte_val(entry) & _PAGE_INVALID) &&
  368. (pte_val(entry) & _PAGE_SWX))
  369. pte_val(entry) |= _PAGE_RO;
  370. else
  371. pte_val(entry) = _PAGE_TYPE_EMPTY;
  372. ptep[PTRS_PER_PTE] = entry;
  373. }
  374. }
  375. /*
  376. * pgd/pmd/pte query functions
  377. */
  378. #ifndef __s390x__
  379. static inline int pgd_present(pgd_t pgd) { return 1; }
  380. static inline int pgd_none(pgd_t pgd) { return 0; }
  381. static inline int pgd_bad(pgd_t pgd) { return 0; }
  382. static inline int pud_present(pud_t pud) { return 1; }
  383. static inline int pud_none(pud_t pud) { return 0; }
  384. static inline int pud_bad(pud_t pud) { return 0; }
  385. #else /* __s390x__ */
  386. static inline int pgd_present(pgd_t pgd)
  387. {
  388. if ((pgd_val(pgd) & _REGION_ENTRY_TYPE_MASK) < _REGION_ENTRY_TYPE_R2)
  389. return 1;
  390. return (pgd_val(pgd) & _REGION_ENTRY_ORIGIN) != 0UL;
  391. }
  392. static inline int pgd_none(pgd_t pgd)
  393. {
  394. if ((pgd_val(pgd) & _REGION_ENTRY_TYPE_MASK) < _REGION_ENTRY_TYPE_R2)
  395. return 0;
  396. return (pgd_val(pgd) & _REGION_ENTRY_INV) != 0UL;
  397. }
  398. static inline int pgd_bad(pgd_t pgd)
  399. {
  400. /*
  401. * With dynamic page table levels the pgd can be a region table
  402. * entry or a segment table entry. Check for the bit that are
  403. * invalid for either table entry.
  404. */
  405. unsigned long mask =
  406. ~_SEGMENT_ENTRY_ORIGIN & ~_REGION_ENTRY_INV &
  407. ~_REGION_ENTRY_TYPE_MASK & ~_REGION_ENTRY_LENGTH;
  408. return (pgd_val(pgd) & mask) != 0;
  409. }
  410. static inline int pud_present(pud_t pud)
  411. {
  412. if ((pud_val(pud) & _REGION_ENTRY_TYPE_MASK) < _REGION_ENTRY_TYPE_R3)
  413. return 1;
  414. return (pud_val(pud) & _REGION_ENTRY_ORIGIN) != 0UL;
  415. }
  416. static inline int pud_none(pud_t pud)
  417. {
  418. if ((pud_val(pud) & _REGION_ENTRY_TYPE_MASK) < _REGION_ENTRY_TYPE_R3)
  419. return 0;
  420. return (pud_val(pud) & _REGION_ENTRY_INV) != 0UL;
  421. }
  422. static inline int pud_bad(pud_t pud)
  423. {
  424. /*
  425. * With dynamic page table levels the pud can be a region table
  426. * entry or a segment table entry. Check for the bit that are
  427. * invalid for either table entry.
  428. */
  429. unsigned long mask =
  430. ~_SEGMENT_ENTRY_ORIGIN & ~_REGION_ENTRY_INV &
  431. ~_REGION_ENTRY_TYPE_MASK & ~_REGION_ENTRY_LENGTH;
  432. return (pud_val(pud) & mask) != 0;
  433. }
  434. #endif /* __s390x__ */
  435. static inline int pmd_present(pmd_t pmd)
  436. {
  437. return (pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN) != 0UL;
  438. }
  439. static inline int pmd_none(pmd_t pmd)
  440. {
  441. return (pmd_val(pmd) & _SEGMENT_ENTRY_INV) != 0UL;
  442. }
  443. static inline int pmd_bad(pmd_t pmd)
  444. {
  445. unsigned long mask = ~_SEGMENT_ENTRY_ORIGIN & ~_SEGMENT_ENTRY_INV;
  446. return (pmd_val(pmd) & mask) != _SEGMENT_ENTRY;
  447. }
  448. static inline int pte_none(pte_t pte)
  449. {
  450. return (pte_val(pte) & _PAGE_INVALID) && !(pte_val(pte) & _PAGE_SWT);
  451. }
  452. static inline int pte_present(pte_t pte)
  453. {
  454. unsigned long mask = _PAGE_RO | _PAGE_INVALID | _PAGE_SWT | _PAGE_SWX;
  455. return (pte_val(pte) & mask) == _PAGE_TYPE_NONE ||
  456. (!(pte_val(pte) & _PAGE_INVALID) &&
  457. !(pte_val(pte) & _PAGE_SWT));
  458. }
  459. static inline int pte_file(pte_t pte)
  460. {
  461. unsigned long mask = _PAGE_RO | _PAGE_INVALID | _PAGE_SWT;
  462. return (pte_val(pte) & mask) == _PAGE_TYPE_FILE;
  463. }
  464. #define __HAVE_ARCH_PTE_SAME
  465. #define pte_same(a,b) (pte_val(a) == pte_val(b))
  466. static inline void rcp_lock(pte_t *ptep)
  467. {
  468. #ifdef CONFIG_PGSTE
  469. unsigned long *pgste = (unsigned long *) (ptep + PTRS_PER_PTE);
  470. preempt_disable();
  471. while (test_and_set_bit(RCP_PCL_BIT, pgste))
  472. ;
  473. #endif
  474. }
  475. static inline void rcp_unlock(pte_t *ptep)
  476. {
  477. #ifdef CONFIG_PGSTE
  478. unsigned long *pgste = (unsigned long *) (ptep + PTRS_PER_PTE);
  479. clear_bit(RCP_PCL_BIT, pgste);
  480. preempt_enable();
  481. #endif
  482. }
  483. /* forward declaration for SetPageUptodate in page-flags.h*/
  484. static inline void page_clear_dirty(struct page *page);
  485. #include <linux/page-flags.h>
  486. static inline void ptep_rcp_copy(pte_t *ptep)
  487. {
  488. #ifdef CONFIG_PGSTE
  489. struct page *page = virt_to_page(pte_val(*ptep));
  490. unsigned int skey;
  491. unsigned long *pgste = (unsigned long *) (ptep + PTRS_PER_PTE);
  492. skey = page_get_storage_key(page_to_phys(page));
  493. if (skey & _PAGE_CHANGED)
  494. set_bit_simple(RCP_GC_BIT, pgste);
  495. if (skey & _PAGE_REFERENCED)
  496. set_bit_simple(RCP_GR_BIT, pgste);
  497. if (test_and_clear_bit_simple(RCP_HC_BIT, pgste))
  498. SetPageDirty(page);
  499. if (test_and_clear_bit_simple(RCP_HR_BIT, pgste))
  500. SetPageReferenced(page);
  501. #endif
  502. }
  503. /*
  504. * query functions pte_write/pte_dirty/pte_young only work if
  505. * pte_present() is true. Undefined behaviour if not..
  506. */
  507. static inline int pte_write(pte_t pte)
  508. {
  509. return (pte_val(pte) & _PAGE_RO) == 0;
  510. }
  511. static inline int pte_dirty(pte_t pte)
  512. {
  513. /* A pte is neither clean nor dirty on s/390. The dirty bit
  514. * is in the storage key. See page_test_and_clear_dirty for
  515. * details.
  516. */
  517. return 0;
  518. }
  519. static inline int pte_young(pte_t pte)
  520. {
  521. /* A pte is neither young nor old on s/390. The young bit
  522. * is in the storage key. See page_test_and_clear_young for
  523. * details.
  524. */
  525. return 0;
  526. }
  527. /*
  528. * pgd/pmd/pte modification functions
  529. */
  530. #ifndef __s390x__
  531. #define pgd_clear(pgd) do { } while (0)
  532. #define pud_clear(pud) do { } while (0)
  533. #else /* __s390x__ */
  534. static inline void pgd_clear_kernel(pgd_t * pgd)
  535. {
  536. if ((pgd_val(*pgd) & _REGION_ENTRY_TYPE_MASK) == _REGION_ENTRY_TYPE_R2)
  537. pgd_val(*pgd) = _REGION2_ENTRY_EMPTY;
  538. }
  539. static inline void pgd_clear(pgd_t * pgd)
  540. {
  541. pgd_t *shadow = get_shadow_table(pgd);
  542. pgd_clear_kernel(pgd);
  543. if (shadow)
  544. pgd_clear_kernel(shadow);
  545. }
  546. static inline void pud_clear_kernel(pud_t *pud)
  547. {
  548. if ((pud_val(*pud) & _REGION_ENTRY_TYPE_MASK) == _REGION_ENTRY_TYPE_R3)
  549. pud_val(*pud) = _REGION3_ENTRY_EMPTY;
  550. }
  551. static inline void pud_clear(pud_t *pud)
  552. {
  553. pud_t *shadow = get_shadow_table(pud);
  554. pud_clear_kernel(pud);
  555. if (shadow)
  556. pud_clear_kernel(shadow);
  557. }
  558. #endif /* __s390x__ */
  559. static inline void pmd_clear_kernel(pmd_t * pmdp)
  560. {
  561. pmd_val(*pmdp) = _SEGMENT_ENTRY_EMPTY;
  562. }
  563. static inline void pmd_clear(pmd_t *pmd)
  564. {
  565. pmd_t *shadow = get_shadow_table(pmd);
  566. pmd_clear_kernel(pmd);
  567. if (shadow)
  568. pmd_clear_kernel(shadow);
  569. }
  570. static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
  571. {
  572. if (mm->context.pgstes)
  573. ptep_rcp_copy(ptep);
  574. pte_val(*ptep) = _PAGE_TYPE_EMPTY;
  575. if (mm->context.noexec)
  576. pte_val(ptep[PTRS_PER_PTE]) = _PAGE_TYPE_EMPTY;
  577. }
  578. /*
  579. * The following pte modification functions only work if
  580. * pte_present() is true. Undefined behaviour if not..
  581. */
  582. static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
  583. {
  584. pte_val(pte) &= PAGE_MASK;
  585. pte_val(pte) |= pgprot_val(newprot);
  586. return pte;
  587. }
  588. static inline pte_t pte_wrprotect(pte_t pte)
  589. {
  590. /* Do not clobber _PAGE_TYPE_NONE pages! */
  591. if (!(pte_val(pte) & _PAGE_INVALID))
  592. pte_val(pte) |= _PAGE_RO;
  593. return pte;
  594. }
  595. static inline pte_t pte_mkwrite(pte_t pte)
  596. {
  597. pte_val(pte) &= ~_PAGE_RO;
  598. return pte;
  599. }
  600. static inline pte_t pte_mkclean(pte_t pte)
  601. {
  602. /* The only user of pte_mkclean is the fork() code.
  603. We must *not* clear the *physical* page dirty bit
  604. just because fork() wants to clear the dirty bit in
  605. *one* of the page's mappings. So we just do nothing. */
  606. return pte;
  607. }
  608. static inline pte_t pte_mkdirty(pte_t pte)
  609. {
  610. /* We do not explicitly set the dirty bit because the
  611. * sske instruction is slow. It is faster to let the
  612. * next instruction set the dirty bit.
  613. */
  614. return pte;
  615. }
  616. static inline pte_t pte_mkold(pte_t pte)
  617. {
  618. /* S/390 doesn't keep its dirty/referenced bit in the pte.
  619. * There is no point in clearing the real referenced bit.
  620. */
  621. return pte;
  622. }
  623. static inline pte_t pte_mkyoung(pte_t pte)
  624. {
  625. /* S/390 doesn't keep its dirty/referenced bit in the pte.
  626. * There is no point in setting the real referenced bit.
  627. */
  628. return pte;
  629. }
  630. #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
  631. static inline int ptep_test_and_clear_young(struct vm_area_struct *vma,
  632. unsigned long addr, pte_t *ptep)
  633. {
  634. #ifdef CONFIG_PGSTE
  635. unsigned long physpage;
  636. int young;
  637. unsigned long *pgste;
  638. if (!vma->vm_mm->context.pgstes)
  639. return 0;
  640. physpage = pte_val(*ptep) & PAGE_MASK;
  641. pgste = (unsigned long *) (ptep + PTRS_PER_PTE);
  642. young = ((page_get_storage_key(physpage) & _PAGE_REFERENCED) != 0);
  643. rcp_lock(ptep);
  644. if (young)
  645. set_bit_simple(RCP_GR_BIT, pgste);
  646. young |= test_and_clear_bit_simple(RCP_HR_BIT, pgste);
  647. rcp_unlock(ptep);
  648. return young;
  649. #endif
  650. return 0;
  651. }
  652. #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
  653. static inline int ptep_clear_flush_young(struct vm_area_struct *vma,
  654. unsigned long address, pte_t *ptep)
  655. {
  656. /* No need to flush TLB
  657. * On s390 reference bits are in storage key and never in TLB
  658. * With virtualization we handle the reference bit, without we
  659. * we can simply return */
  660. #ifdef CONFIG_PGSTE
  661. return ptep_test_and_clear_young(vma, address, ptep);
  662. #endif
  663. return 0;
  664. }
  665. static inline void __ptep_ipte(unsigned long address, pte_t *ptep)
  666. {
  667. if (!(pte_val(*ptep) & _PAGE_INVALID)) {
  668. #ifndef __s390x__
  669. /* pto must point to the start of the segment table */
  670. pte_t *pto = (pte_t *) (((unsigned long) ptep) & 0x7ffffc00);
  671. #else
  672. /* ipte in zarch mode can do the math */
  673. pte_t *pto = ptep;
  674. #endif
  675. asm volatile(
  676. " ipte %2,%3"
  677. : "=m" (*ptep) : "m" (*ptep),
  678. "a" (pto), "a" (address));
  679. }
  680. }
  681. static inline void ptep_invalidate(struct mm_struct *mm,
  682. unsigned long address, pte_t *ptep)
  683. {
  684. if (mm->context.pgstes) {
  685. rcp_lock(ptep);
  686. __ptep_ipte(address, ptep);
  687. ptep_rcp_copy(ptep);
  688. pte_val(*ptep) = _PAGE_TYPE_EMPTY;
  689. rcp_unlock(ptep);
  690. return;
  691. }
  692. __ptep_ipte(address, ptep);
  693. pte_val(*ptep) = _PAGE_TYPE_EMPTY;
  694. if (mm->context.noexec) {
  695. __ptep_ipte(address, ptep + PTRS_PER_PTE);
  696. pte_val(*(ptep + PTRS_PER_PTE)) = _PAGE_TYPE_EMPTY;
  697. }
  698. }
  699. /*
  700. * This is hard to understand. ptep_get_and_clear and ptep_clear_flush
  701. * both clear the TLB for the unmapped pte. The reason is that
  702. * ptep_get_and_clear is used in common code (e.g. change_pte_range)
  703. * to modify an active pte. The sequence is
  704. * 1) ptep_get_and_clear
  705. * 2) set_pte_at
  706. * 3) flush_tlb_range
  707. * On s390 the tlb needs to get flushed with the modification of the pte
  708. * if the pte is active. The only way how this can be implemented is to
  709. * have ptep_get_and_clear do the tlb flush. In exchange flush_tlb_range
  710. * is a nop.
  711. */
  712. #define __HAVE_ARCH_PTEP_GET_AND_CLEAR
  713. #define ptep_get_and_clear(__mm, __address, __ptep) \
  714. ({ \
  715. pte_t __pte = *(__ptep); \
  716. if (atomic_read(&(__mm)->mm_users) > 1 || \
  717. (__mm) != current->active_mm) \
  718. ptep_invalidate(__mm, __address, __ptep); \
  719. else \
  720. pte_clear((__mm), (__address), (__ptep)); \
  721. __pte; \
  722. })
  723. #define __HAVE_ARCH_PTEP_CLEAR_FLUSH
  724. static inline pte_t ptep_clear_flush(struct vm_area_struct *vma,
  725. unsigned long address, pte_t *ptep)
  726. {
  727. pte_t pte = *ptep;
  728. ptep_invalidate(vma->vm_mm, address, ptep);
  729. return pte;
  730. }
  731. /*
  732. * The batched pte unmap code uses ptep_get_and_clear_full to clear the
  733. * ptes. Here an optimization is possible. tlb_gather_mmu flushes all
  734. * tlbs of an mm if it can guarantee that the ptes of the mm_struct
  735. * cannot be accessed while the batched unmap is running. In this case
  736. * full==1 and a simple pte_clear is enough. See tlb.h.
  737. */
  738. #define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
  739. static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm,
  740. unsigned long addr,
  741. pte_t *ptep, int full)
  742. {
  743. pte_t pte = *ptep;
  744. if (full)
  745. pte_clear(mm, addr, ptep);
  746. else
  747. ptep_invalidate(mm, addr, ptep);
  748. return pte;
  749. }
  750. #define __HAVE_ARCH_PTEP_SET_WRPROTECT
  751. #define ptep_set_wrprotect(__mm, __addr, __ptep) \
  752. ({ \
  753. pte_t __pte = *(__ptep); \
  754. if (pte_write(__pte)) { \
  755. if (atomic_read(&(__mm)->mm_users) > 1 || \
  756. (__mm) != current->active_mm) \
  757. ptep_invalidate(__mm, __addr, __ptep); \
  758. set_pte_at(__mm, __addr, __ptep, pte_wrprotect(__pte)); \
  759. } \
  760. })
  761. #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
  762. #define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __dirty) \
  763. ({ \
  764. int __changed = !pte_same(*(__ptep), __entry); \
  765. if (__changed) { \
  766. ptep_invalidate((__vma)->vm_mm, __addr, __ptep); \
  767. set_pte_at((__vma)->vm_mm, __addr, __ptep, __entry); \
  768. } \
  769. __changed; \
  770. })
  771. /*
  772. * Test and clear dirty bit in storage key.
  773. * We can't clear the changed bit atomically. This is a potential
  774. * race against modification of the referenced bit. This function
  775. * should therefore only be called if it is not mapped in any
  776. * address space.
  777. */
  778. #define __HAVE_ARCH_PAGE_TEST_DIRTY
  779. static inline int page_test_dirty(struct page *page)
  780. {
  781. return (page_get_storage_key(page_to_phys(page)) & _PAGE_CHANGED) != 0;
  782. }
  783. #define __HAVE_ARCH_PAGE_CLEAR_DIRTY
  784. static inline void page_clear_dirty(struct page *page)
  785. {
  786. page_set_storage_key(page_to_phys(page), PAGE_DEFAULT_KEY);
  787. }
  788. /*
  789. * Test and clear referenced bit in storage key.
  790. */
  791. #define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG
  792. static inline int page_test_and_clear_young(struct page *page)
  793. {
  794. unsigned long physpage = page_to_phys(page);
  795. int ccode;
  796. asm volatile(
  797. " rrbe 0,%1\n"
  798. " ipm %0\n"
  799. " srl %0,28\n"
  800. : "=d" (ccode) : "a" (physpage) : "cc" );
  801. return ccode & 2;
  802. }
  803. /*
  804. * Conversion functions: convert a page and protection to a page entry,
  805. * and a page entry and page directory to the page they refer to.
  806. */
  807. static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
  808. {
  809. pte_t __pte;
  810. pte_val(__pte) = physpage + pgprot_val(pgprot);
  811. return __pte;
  812. }
  813. static inline pte_t mk_pte(struct page *page, pgprot_t pgprot)
  814. {
  815. unsigned long physpage = page_to_phys(page);
  816. return mk_pte_phys(physpage, pgprot);
  817. }
  818. #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
  819. #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
  820. #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
  821. #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1))
  822. #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
  823. #define pgd_offset_k(address) pgd_offset(&init_mm, address)
  824. #ifndef __s390x__
  825. #define pmd_deref(pmd) (pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN)
  826. #define pud_deref(pmd) ({ BUG(); 0UL; })
  827. #define pgd_deref(pmd) ({ BUG(); 0UL; })
  828. #define pud_offset(pgd, address) ((pud_t *) pgd)
  829. #define pmd_offset(pud, address) ((pmd_t *) pud + pmd_index(address))
  830. #else /* __s390x__ */
  831. #define pmd_deref(pmd) (pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN)
  832. #define pud_deref(pud) (pud_val(pud) & _REGION_ENTRY_ORIGIN)
  833. #define pgd_deref(pgd) (pgd_val(pgd) & _REGION_ENTRY_ORIGIN)
  834. static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address)
  835. {
  836. pud_t *pud = (pud_t *) pgd;
  837. if ((pgd_val(*pgd) & _REGION_ENTRY_TYPE_MASK) == _REGION_ENTRY_TYPE_R2)
  838. pud = (pud_t *) pgd_deref(*pgd);
  839. return pud + pud_index(address);
  840. }
  841. static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
  842. {
  843. pmd_t *pmd = (pmd_t *) pud;
  844. if ((pud_val(*pud) & _REGION_ENTRY_TYPE_MASK) == _REGION_ENTRY_TYPE_R3)
  845. pmd = (pmd_t *) pud_deref(*pud);
  846. return pmd + pmd_index(address);
  847. }
  848. #endif /* __s390x__ */
  849. #define pfn_pte(pfn,pgprot) mk_pte_phys(__pa((pfn) << PAGE_SHIFT),(pgprot))
  850. #define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT)
  851. #define pte_page(x) pfn_to_page(pte_pfn(x))
  852. #define pmd_page(pmd) pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)
  853. /* Find an entry in the lowest level page table.. */
  854. #define pte_offset(pmd, addr) ((pte_t *) pmd_deref(*(pmd)) + pte_index(addr))
  855. #define pte_offset_kernel(pmd, address) pte_offset(pmd,address)
  856. #define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address)
  857. #define pte_offset_map_nested(pmd, address) pte_offset_kernel(pmd, address)
  858. #define pte_unmap(pte) do { } while (0)
  859. #define pte_unmap_nested(pte) do { } while (0)
  860. /*
  861. * 31 bit swap entry format:
  862. * A page-table entry has some bits we have to treat in a special way.
  863. * Bits 0, 20 and bit 23 have to be zero, otherwise an specification
  864. * exception will occur instead of a page translation exception. The
  865. * specifiation exception has the bad habit not to store necessary
  866. * information in the lowcore.
  867. * Bit 21 and bit 22 are the page invalid bit and the page protection
  868. * bit. We set both to indicate a swapped page.
  869. * Bit 30 and 31 are used to distinguish the different page types. For
  870. * a swapped page these bits need to be zero.
  871. * This leaves the bits 1-19 and bits 24-29 to store type and offset.
  872. * We use the 5 bits from 25-29 for the type and the 20 bits from 1-19
  873. * plus 24 for the offset.
  874. * 0| offset |0110|o|type |00|
  875. * 0 0000000001111111111 2222 2 22222 33
  876. * 0 1234567890123456789 0123 4 56789 01
  877. *
  878. * 64 bit swap entry format:
  879. * A page-table entry has some bits we have to treat in a special way.
  880. * Bits 52 and bit 55 have to be zero, otherwise an specification
  881. * exception will occur instead of a page translation exception. The
  882. * specifiation exception has the bad habit not to store necessary
  883. * information in the lowcore.
  884. * Bit 53 and bit 54 are the page invalid bit and the page protection
  885. * bit. We set both to indicate a swapped page.
  886. * Bit 62 and 63 are used to distinguish the different page types. For
  887. * a swapped page these bits need to be zero.
  888. * This leaves the bits 0-51 and bits 56-61 to store type and offset.
  889. * We use the 5 bits from 57-61 for the type and the 53 bits from 0-51
  890. * plus 56 for the offset.
  891. * | offset |0110|o|type |00|
  892. * 0000000000111111111122222222223333333333444444444455 5555 5 55566 66
  893. * 0123456789012345678901234567890123456789012345678901 2345 6 78901 23
  894. */
  895. #ifndef __s390x__
  896. #define __SWP_OFFSET_MASK (~0UL >> 12)
  897. #else
  898. #define __SWP_OFFSET_MASK (~0UL >> 11)
  899. #endif
  900. static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
  901. {
  902. pte_t pte;
  903. offset &= __SWP_OFFSET_MASK;
  904. pte_val(pte) = _PAGE_TYPE_SWAP | ((type & 0x1f) << 2) |
  905. ((offset & 1UL) << 7) | ((offset & ~1UL) << 11);
  906. return pte;
  907. }
  908. #define __swp_type(entry) (((entry).val >> 2) & 0x1f)
  909. #define __swp_offset(entry) (((entry).val >> 11) | (((entry).val >> 7) & 1))
  910. #define __swp_entry(type,offset) ((swp_entry_t) { pte_val(mk_swap_pte((type),(offset))) })
  911. #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
  912. #define __swp_entry_to_pte(x) ((pte_t) { (x).val })
  913. #ifndef __s390x__
  914. # define PTE_FILE_MAX_BITS 26
  915. #else /* __s390x__ */
  916. # define PTE_FILE_MAX_BITS 59
  917. #endif /* __s390x__ */
  918. #define pte_to_pgoff(__pte) \
  919. ((((__pte).pte >> 12) << 7) + (((__pte).pte >> 1) & 0x7f))
  920. #define pgoff_to_pte(__off) \
  921. ((pte_t) { ((((__off) & 0x7f) << 1) + (((__off) >> 7) << 12)) \
  922. | _PAGE_TYPE_FILE })
  923. #endif /* !__ASSEMBLY__ */
  924. #define kern_addr_valid(addr) (1)
  925. extern int add_shared_memory(unsigned long start, unsigned long size);
  926. extern int remove_shared_memory(unsigned long start, unsigned long size);
  927. extern int s390_enable_sie(void);
  928. /*
  929. * No page table caches to initialise
  930. */
  931. #define pgtable_cache_init() do { } while (0)
  932. #define __HAVE_ARCH_MEMMAP_INIT
  933. extern void memmap_init(unsigned long, int, unsigned long, unsigned long);
  934. #include <asm-generic/pgtable.h>
  935. #endif /* _S390_PAGE_H */