aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-02-10 19:45:56 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-10 19:45:56 -0500
commit992de5a8eca7cbd3215e3eb2c439b2c11582a58b (patch)
tree863988f84c1dd57a02fa337ecbce49263a3b9511 /arch
parentb2718bffb4088faf13092db30c1ebf088ddee52e (diff)
parentd5b3cf7139b8770af4ed8bb36a1ab9d290ac39e9 (diff)
Merge branch 'akpm' (patches from Andrew)
Merge misc updates from Andrew Morton: "Bite-sized chunks this time, to avoid the MTA ratelimiting woes. - fs/notify updates - ocfs2 - some of MM" That laconic "some MM" is mainly the removal of remap_file_pages(), which is a big simplification of the VM, and which gets rid of a *lot* of random cruft and special cases because we no longer support the non-linear mappings that it used. From a user interface perspective, nothing has changed, because the remap_file_pages() syscall still exists, it's just done by emulating the old behavior by creating a lot of individual small mappings instead of one non-linear one. The emulation is slower than the old "native" non-linear mappings, but nobody really uses or cares about remap_file_pages(), and simplifying the VM is a big advantage. * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (78 commits) memcg: zap memcg_slab_caches and memcg_slab_mutex memcg: zap memcg_name argument of memcg_create_kmem_cache memcg: zap __memcg_{charge,uncharge}_slab mm/page_alloc.c: place zone_id check before VM_BUG_ON_PAGE check mm: hugetlb: fix type of hugetlb_treat_as_movable variable mm, hugetlb: remove unnecessary lower bound on sysctl handlers"? mm: memory: merge shared-writable dirtying branches in do_wp_page() mm: memory: remove ->vm_file check on shared writable vmas xtensa: drop _PAGE_FILE and pte_file()-related helpers x86: drop _PAGE_FILE and pte_file()-related helpers unicore32: drop pte_file()-related helpers um: drop _PAGE_FILE and pte_file()-related helpers tile: drop pte_file()-related helpers sparc: drop pte_file()-related helpers sh: drop _PAGE_FILE and pte_file()-related helpers score: drop _PAGE_FILE and pte_file()-related helpers s390: drop pte_file()-related helpers parisc: drop _PAGE_FILE and pte_file()-related helpers openrisc: drop _PAGE_FILE and pte_file()-related helpers nios2: drop _PAGE_FILE and pte_file()-related helpers ...
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/include/asm/pgtable.h7
-rw-r--r--arch/arc/include/asm/pgtable.h13
-rw-r--r--arch/arm/include/asm/pgtable-2level.h1
-rw-r--r--arch/arm/include/asm/pgtable-3level.h1
-rw-r--r--arch/arm/include/asm/pgtable-nommu.h2
-rw-r--r--arch/arm/include/asm/pgtable.h20
-rw-r--r--arch/arm/mm/proc-macros.S2
-rw-r--r--arch/arm64/include/asm/pgtable.h22
-rw-r--r--arch/avr32/include/asm/pgtable.h25
-rw-r--r--arch/blackfin/include/asm/pgtable.h5
-rw-r--r--arch/c6x/include/asm/pgtable.h5
-rw-r--r--arch/cris/include/arch-v10/arch/mmu.h3
-rw-r--r--arch/cris/include/arch-v32/arch/mmu.h3
-rw-r--r--arch/cris/include/asm/pgtable.h4
-rw-r--r--arch/frv/include/asm/pgtable.h27
-rw-r--r--arch/hexagon/include/asm/pgtable.h60
-rw-r--r--arch/ia64/include/asm/pgtable.h25
-rw-r--r--arch/m32r/include/asm/pgtable-2level.h4
-rw-r--r--arch/m32r/include/asm/pgtable.h11
-rw-r--r--arch/m68k/include/asm/mcf_pgtable.h23
-rw-r--r--arch/m68k/include/asm/motorola_pgtable.h15
-rw-r--r--arch/m68k/include/asm/pgtable_no.h2
-rw-r--r--arch/m68k/include/asm/sun3_pgtable.h15
-rw-r--r--arch/metag/include/asm/pgtable.h6
-rw-r--r--arch/microblaze/include/asm/pgtable.h11
-rw-r--r--arch/mips/include/asm/pgtable-32.h36
-rw-r--r--arch/mips/include/asm/pgtable-64.h9
-rw-r--r--arch/mips/include/asm/pgtable-bits.h9
-rw-r--r--arch/mips/include/asm/pgtable.h2
-rw-r--r--arch/mn10300/include/asm/pgtable.h17
-rw-r--r--arch/nios2/include/asm/pgtable-bits.h1
-rw-r--r--arch/nios2/include/asm/pgtable.h10
-rw-r--r--arch/openrisc/include/asm/pgtable.h8
-rw-r--r--arch/openrisc/kernel/head.S5
-rw-r--r--arch/parisc/include/asm/pgtable.h10
-rw-r--r--arch/s390/include/asm/pgtable.h29
-rw-r--r--arch/score/include/asm/pgtable-bits.h1
-rw-r--r--arch/score/include/asm/pgtable.h18
-rw-r--r--arch/sh/Kconfig2
-rw-r--r--arch/sh/boards/mach-se/7343/irq.c3
-rw-r--r--arch/sh/boards/mach-se/7722/irq.c3
-rw-r--r--arch/sh/include/asm/pgtable_32.h30
-rw-r--r--arch/sh/include/asm/pgtable_64.h9
-rw-r--r--arch/sparc/include/asm/pgtable_32.h24
-rw-r--r--arch/sparc/include/asm/pgtable_64.h40
-rw-r--r--arch/sparc/include/asm/pgtsrmmu.h14
-rw-r--r--arch/tile/include/asm/pgtable.h11
-rw-r--r--arch/tile/mm/homecache.c4
-rw-r--r--arch/um/include/asm/pgtable-2level.h9
-rw-r--r--arch/um/include/asm/pgtable-3level.h20
-rw-r--r--arch/um/include/asm/pgtable.h9
-rw-r--r--arch/unicore32/include/asm/pgtable-hwdef.h1
-rw-r--r--arch/unicore32/include/asm/pgtable.h14
-rw-r--r--arch/x86/include/asm/pgtable-2level.h38
-rw-r--r--arch/x86/include/asm/pgtable-3level.h12
-rw-r--r--arch/x86/include/asm/pgtable.h20
-rw-r--r--arch/x86/include/asm/pgtable_64.h6
-rw-r--r--arch/x86/include/asm/pgtable_types.h3
-rw-r--r--arch/x86/mm/hugetlbpage.c11
-rw-r--r--arch/xtensa/include/asm/pgtable.h10
60 files changed, 71 insertions, 689 deletions
diff --git a/arch/alpha/include/asm/pgtable.h b/arch/alpha/include/asm/pgtable.h
index d8f9b7e89234..fce22cf88ee9 100644
--- a/arch/alpha/include/asm/pgtable.h
+++ b/arch/alpha/include/asm/pgtable.h
@@ -73,7 +73,6 @@ struct vm_area_struct;
73/* .. and these are ours ... */ 73/* .. and these are ours ... */
74#define _PAGE_DIRTY 0x20000 74#define _PAGE_DIRTY 0x20000
75#define _PAGE_ACCESSED 0x40000 75#define _PAGE_ACCESSED 0x40000
76#define _PAGE_FILE 0x80000 /* set:pagecache, unset:swap */
77 76
78/* 77/*
79 * NOTE! The "accessed" bit isn't necessarily exact: it can be kept exactly 78 * NOTE! The "accessed" bit isn't necessarily exact: it can be kept exactly
@@ -268,7 +267,6 @@ extern inline void pgd_clear(pgd_t * pgdp) { pgd_val(*pgdp) = 0; }
268extern inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_FOW); } 267extern inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_FOW); }
269extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 268extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
270extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 269extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
271extern inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
272extern inline int pte_special(pte_t pte) { return 0; } 270extern inline int pte_special(pte_t pte) { return 0; }
273 271
274extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_FOW; return pte; } 272extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_FOW; return pte; }
@@ -345,11 +343,6 @@ extern inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
345#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 343#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
346#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 344#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
347 345
348#define pte_to_pgoff(pte) (pte_val(pte) >> 32)
349#define pgoff_to_pte(off) ((pte_t) { ((off) << 32) | _PAGE_FILE })
350
351#define PTE_FILE_MAX_BITS 32
352
353#ifndef CONFIG_DISCONTIGMEM 346#ifndef CONFIG_DISCONTIGMEM
354#define kern_addr_valid(addr) (1) 347#define kern_addr_valid(addr) (1)
355#endif 348#endif
diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index 6b0b7f7ef783..bdc8ccaf390d 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -61,7 +61,6 @@
61#define _PAGE_WRITE (1<<4) /* Page has user write perm (H) */ 61#define _PAGE_WRITE (1<<4) /* Page has user write perm (H) */
62#define _PAGE_READ (1<<5) /* Page has user read perm (H) */ 62#define _PAGE_READ (1<<5) /* Page has user read perm (H) */
63#define _PAGE_MODIFIED (1<<6) /* Page modified (dirty) (S) */ 63#define _PAGE_MODIFIED (1<<6) /* Page modified (dirty) (S) */
64#define _PAGE_FILE (1<<7) /* page cache/ swap (S) */
65#define _PAGE_GLOBAL (1<<8) /* Page is global (H) */ 64#define _PAGE_GLOBAL (1<<8) /* Page is global (H) */
66#define _PAGE_PRESENT (1<<10) /* TLB entry is valid (H) */ 65#define _PAGE_PRESENT (1<<10) /* TLB entry is valid (H) */
67 66
@@ -73,7 +72,6 @@
73#define _PAGE_READ (1<<3) /* Page has user read perm (H) */ 72#define _PAGE_READ (1<<3) /* Page has user read perm (H) */
74#define _PAGE_ACCESSED (1<<4) /* Page is accessed (S) */ 73#define _PAGE_ACCESSED (1<<4) /* Page is accessed (S) */
75#define _PAGE_MODIFIED (1<<5) /* Page modified (dirty) (S) */ 74#define _PAGE_MODIFIED (1<<5) /* Page modified (dirty) (S) */
76#define _PAGE_FILE (1<<6) /* page cache/ swap (S) */
77#define _PAGE_GLOBAL (1<<8) /* Page is global (H) */ 75#define _PAGE_GLOBAL (1<<8) /* Page is global (H) */
78#define _PAGE_PRESENT (1<<9) /* TLB entry is valid (H) */ 76#define _PAGE_PRESENT (1<<9) /* TLB entry is valid (H) */
79#define _PAGE_SHARED_CODE (1<<11) /* Shared Code page with cmn vaddr 77#define _PAGE_SHARED_CODE (1<<11) /* Shared Code page with cmn vaddr
@@ -268,15 +266,6 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
268 pte; \ 266 pte; \
269}) 267})
270 268
271/* TBD: Non linear mapping stuff */
272static inline int pte_file(pte_t pte)
273{
274 return pte_val(pte) & _PAGE_FILE;
275}
276
277#define PTE_FILE_MAX_BITS 30
278#define pgoff_to_pte(x) __pte(x)
279#define pte_to_pgoff(x) (pte_val(x) >> 2)
280#define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT) 269#define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT)
281#define pfn_pte(pfn, prot) (__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))) 270#define pfn_pte(pfn, prot) (__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)))
282#define __pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 271#define __pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
@@ -364,7 +353,7 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
364 353
365/* Encode swap {type,off} tuple into PTE 354/* Encode swap {type,off} tuple into PTE
366 * We reserve 13 bits for 5-bit @type, keeping bits 12-5 zero, ensuring that 355 * We reserve 13 bits for 5-bit @type, keeping bits 12-5 zero, ensuring that
367 * both PAGE_FILE and PAGE_PRESENT are zero in a PTE holding swap "identifier" 356 * PAGE_PRESENT is zero in a PTE holding swap "identifier"
368 */ 357 */
369#define __swp_entry(type, off) ((swp_entry_t) { \ 358#define __swp_entry(type, off) ((swp_entry_t) { \
370 ((type) & 0x1f) | ((off) << 13) }) 359 ((type) & 0x1f) | ((off) << 13) })
diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h
index f0279411847d..bcc5e300413f 100644
--- a/arch/arm/include/asm/pgtable-2level.h
+++ b/arch/arm/include/asm/pgtable-2level.h
@@ -118,7 +118,6 @@
118#define L_PTE_VALID (_AT(pteval_t, 1) << 0) /* Valid */ 118#define L_PTE_VALID (_AT(pteval_t, 1) << 0) /* Valid */
119#define L_PTE_PRESENT (_AT(pteval_t, 1) << 0) 119#define L_PTE_PRESENT (_AT(pteval_t, 1) << 0)
120#define L_PTE_YOUNG (_AT(pteval_t, 1) << 1) 120#define L_PTE_YOUNG (_AT(pteval_t, 1) << 1)
121#define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */
122#define L_PTE_DIRTY (_AT(pteval_t, 1) << 6) 121#define L_PTE_DIRTY (_AT(pteval_t, 1) << 6)
123#define L_PTE_RDONLY (_AT(pteval_t, 1) << 7) 122#define L_PTE_RDONLY (_AT(pteval_t, 1) << 7)
124#define L_PTE_USER (_AT(pteval_t, 1) << 8) 123#define L_PTE_USER (_AT(pteval_t, 1) << 8)
diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h
index a31ecdad4b59..18dbc82f85e5 100644
--- a/arch/arm/include/asm/pgtable-3level.h
+++ b/arch/arm/include/asm/pgtable-3level.h
@@ -77,7 +77,6 @@
77 */ 77 */
78#define L_PTE_VALID (_AT(pteval_t, 1) << 0) /* Valid */ 78#define L_PTE_VALID (_AT(pteval_t, 1) << 0) /* Valid */
79#define L_PTE_PRESENT (_AT(pteval_t, 3) << 0) /* Present */ 79#define L_PTE_PRESENT (_AT(pteval_t, 3) << 0) /* Present */
80#define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */
81#define L_PTE_USER (_AT(pteval_t, 1) << 6) /* AP[1] */ 80#define L_PTE_USER (_AT(pteval_t, 1) << 6) /* AP[1] */
82#define L_PTE_SHARED (_AT(pteval_t, 3) << 8) /* SH[1:0], inner shareable */ 81#define L_PTE_SHARED (_AT(pteval_t, 3) << 8) /* SH[1:0], inner shareable */
83#define L_PTE_YOUNG (_AT(pteval_t, 1) << 10) /* AF */ 82#define L_PTE_YOUNG (_AT(pteval_t, 1) << 10) /* AF */
diff --git a/arch/arm/include/asm/pgtable-nommu.h b/arch/arm/include/asm/pgtable-nommu.h
index 0642228ff785..c35e53ee6663 100644
--- a/arch/arm/include/asm/pgtable-nommu.h
+++ b/arch/arm/include/asm/pgtable-nommu.h
@@ -54,8 +54,6 @@
54 54
55typedef pte_t *pte_addr_t; 55typedef pte_t *pte_addr_t;
56 56
57static inline int pte_file(pte_t pte) { return 0; }
58
59/* 57/*
60 * ZERO_PAGE is a global shared page that is always zero: used 58 * ZERO_PAGE is a global shared page that is always zero: used
61 * for zero-mapped memory areas etc.. 59 * for zero-mapped memory areas etc..
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index d5cac545ba33..f40354198bad 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -318,12 +318,12 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
318 * 318 *
319 * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 319 * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
320 * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 320 * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
321 * <--------------- offset ----------------------> < type -> 0 0 0 321 * <--------------- offset ------------------------> < type -> 0 0
322 * 322 *
323 * This gives us up to 31 swap files and 64GB per swap file. Note that 323 * This gives us up to 31 swap files and 128GB per swap file. Note that
324 * the offset field is always non-zero. 324 * the offset field is always non-zero.
325 */ 325 */
326#define __SWP_TYPE_SHIFT 3 326#define __SWP_TYPE_SHIFT 2
327#define __SWP_TYPE_BITS 5 327#define __SWP_TYPE_BITS 5
328#define __SWP_TYPE_MASK ((1 << __SWP_TYPE_BITS) - 1) 328#define __SWP_TYPE_MASK ((1 << __SWP_TYPE_BITS) - 1)
329#define __SWP_OFFSET_SHIFT (__SWP_TYPE_BITS + __SWP_TYPE_SHIFT) 329#define __SWP_OFFSET_SHIFT (__SWP_TYPE_BITS + __SWP_TYPE_SHIFT)
@@ -342,20 +342,6 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
342 */ 342 */
343#define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > __SWP_TYPE_BITS) 343#define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > __SWP_TYPE_BITS)
344 344
345/*
346 * Encode and decode a file entry. File entries are stored in the Linux
347 * page tables as follows:
348 *
349 * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
350 * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
351 * <----------------------- offset ------------------------> 1 0 0
352 */
353#define pte_file(pte) (pte_val(pte) & L_PTE_FILE)
354#define pte_to_pgoff(x) (pte_val(x) >> 3)
355#define pgoff_to_pte(x) __pte(((x) << 3) | L_PTE_FILE)
356
357#define PTE_FILE_MAX_BITS 29
358
359/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ 345/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
360/* FIXME: this is not correct */ 346/* FIXME: this is not correct */
361#define kern_addr_valid(addr) (1) 347#define kern_addr_valid(addr) (1)
diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index ba1196c968d8..082b9f2f7e90 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -98,7 +98,7 @@
98#endif 98#endif
99#if !defined (CONFIG_ARM_LPAE) && \ 99#if !defined (CONFIG_ARM_LPAE) && \
100 (L_PTE_XN+L_PTE_USER+L_PTE_RDONLY+L_PTE_DIRTY+L_PTE_YOUNG+\ 100 (L_PTE_XN+L_PTE_USER+L_PTE_RDONLY+L_PTE_DIRTY+L_PTE_YOUNG+\
101 L_PTE_FILE+L_PTE_PRESENT) > L_PTE_SHARED 101 L_PTE_PRESENT) > L_PTE_SHARED
102#error Invalid Linux PTE bit settings 102#error Invalid Linux PTE bit settings
103#endif 103#endif
104#endif /* CONFIG_MMU */ 104#endif /* CONFIG_MMU */
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 210d632aa5ad..4c445057169d 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -25,7 +25,6 @@
25 * Software defined PTE bits definition. 25 * Software defined PTE bits definition.
26 */ 26 */
27#define PTE_VALID (_AT(pteval_t, 1) << 0) 27#define PTE_VALID (_AT(pteval_t, 1) << 0)
28#define PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !pte_present() */
29#define PTE_DIRTY (_AT(pteval_t, 1) << 55) 28#define PTE_DIRTY (_AT(pteval_t, 1) << 55)
30#define PTE_SPECIAL (_AT(pteval_t, 1) << 56) 29#define PTE_SPECIAL (_AT(pteval_t, 1) << 56)
31#define PTE_WRITE (_AT(pteval_t, 1) << 57) 30#define PTE_WRITE (_AT(pteval_t, 1) << 57)
@@ -469,13 +468,12 @@ extern pgd_t idmap_pg_dir[PTRS_PER_PGD];
469/* 468/*
470 * Encode and decode a swap entry: 469 * Encode and decode a swap entry:
471 * bits 0-1: present (must be zero) 470 * bits 0-1: present (must be zero)
472 * bit 2: PTE_FILE 471 * bits 2-7: swap type
473 * bits 3-8: swap type 472 * bits 8-57: swap offset
474 * bits 9-57: swap offset
475 */ 473 */
476#define __SWP_TYPE_SHIFT 3 474#define __SWP_TYPE_SHIFT 2
477#define __SWP_TYPE_BITS 6 475#define __SWP_TYPE_BITS 6
478#define __SWP_OFFSET_BITS 49 476#define __SWP_OFFSET_BITS 50
479#define __SWP_TYPE_MASK ((1 << __SWP_TYPE_BITS) - 1) 477#define __SWP_TYPE_MASK ((1 << __SWP_TYPE_BITS) - 1)
480#define __SWP_OFFSET_SHIFT (__SWP_TYPE_BITS + __SWP_TYPE_SHIFT) 478#define __SWP_OFFSET_SHIFT (__SWP_TYPE_BITS + __SWP_TYPE_SHIFT)
481#define __SWP_OFFSET_MASK ((1UL << __SWP_OFFSET_BITS) - 1) 479#define __SWP_OFFSET_MASK ((1UL << __SWP_OFFSET_BITS) - 1)
@@ -493,18 +491,6 @@ extern pgd_t idmap_pg_dir[PTRS_PER_PGD];
493 */ 491 */
494#define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > __SWP_TYPE_BITS) 492#define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > __SWP_TYPE_BITS)
495 493
496/*
497 * Encode and decode a file entry:
498 * bits 0-1: present (must be zero)
499 * bit 2: PTE_FILE
500 * bits 3-57: file offset / PAGE_SIZE
501 */
502#define pte_file(pte) (pte_val(pte) & PTE_FILE)
503#define pte_to_pgoff(x) (pte_val(x) >> 3)
504#define pgoff_to_pte(x) __pte(((x) << 3) | PTE_FILE)
505
506#define PTE_FILE_MAX_BITS 55
507
508extern int kern_addr_valid(unsigned long addr); 494extern int kern_addr_valid(unsigned long addr);
509 495
510#include <asm-generic/pgtable.h> 496#include <asm-generic/pgtable.h>
diff --git a/arch/avr32/include/asm/pgtable.h b/arch/avr32/include/asm/pgtable.h
index 4beff97e2033..ac7a817e2126 100644
--- a/arch/avr32/include/asm/pgtable.h
+++ b/arch/avr32/include/asm/pgtable.h
@@ -86,9 +86,6 @@ extern struct page *empty_zero_page;
86#define _PAGE_BIT_PRESENT 10 86#define _PAGE_BIT_PRESENT 10
87#define _PAGE_BIT_ACCESSED 11 /* software: page was accessed */ 87#define _PAGE_BIT_ACCESSED 11 /* software: page was accessed */
88 88
89/* The following flags are only valid when !PRESENT */
90#define _PAGE_BIT_FILE 0 /* software: pagecache or swap? */
91
92#define _PAGE_WT (1 << _PAGE_BIT_WT) 89#define _PAGE_WT (1 << _PAGE_BIT_WT)
93#define _PAGE_DIRTY (1 << _PAGE_BIT_DIRTY) 90#define _PAGE_DIRTY (1 << _PAGE_BIT_DIRTY)
94#define _PAGE_EXECUTE (1 << _PAGE_BIT_EXECUTE) 91#define _PAGE_EXECUTE (1 << _PAGE_BIT_EXECUTE)
@@ -101,7 +98,6 @@ extern struct page *empty_zero_page;
101/* Software flags */ 98/* Software flags */
102#define _PAGE_ACCESSED (1 << _PAGE_BIT_ACCESSED) 99#define _PAGE_ACCESSED (1 << _PAGE_BIT_ACCESSED)
103#define _PAGE_PRESENT (1 << _PAGE_BIT_PRESENT) 100#define _PAGE_PRESENT (1 << _PAGE_BIT_PRESENT)
104#define _PAGE_FILE (1 << _PAGE_BIT_FILE)
105 101
106/* 102/*
107 * Page types, i.e. sizes. _PAGE_TYPE_NONE corresponds to what is 103 * Page types, i.e. sizes. _PAGE_TYPE_NONE corresponds to what is
@@ -210,14 +206,6 @@ static inline int pte_special(pte_t pte)
210 return 0; 206 return 0;
211} 207}
212 208
213/*
214 * The following only work if pte_present() is not true.
215 */
216static inline int pte_file(pte_t pte)
217{
218 return pte_val(pte) & _PAGE_FILE;
219}
220
221/* Mutator functions for PTE bits */ 209/* Mutator functions for PTE bits */
222static inline pte_t pte_wrprotect(pte_t pte) 210static inline pte_t pte_wrprotect(pte_t pte)
223{ 211{
@@ -329,7 +317,6 @@ extern void update_mmu_cache(struct vm_area_struct * vma,
329 * Encode and decode a swap entry 317 * Encode and decode a swap entry
330 * 318 *
331 * Constraints: 319 * Constraints:
332 * _PAGE_FILE at bit 0
333 * _PAGE_TYPE_* at bits 2-3 (for emulating _PAGE_PROTNONE) 320 * _PAGE_TYPE_* at bits 2-3 (for emulating _PAGE_PROTNONE)
334 * _PAGE_PRESENT at bit 10 321 * _PAGE_PRESENT at bit 10
335 * 322 *
@@ -346,18 +333,6 @@ extern void update_mmu_cache(struct vm_area_struct * vma,
346#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 333#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
347#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 334#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
348 335
349/*
350 * Encode and decode a nonlinear file mapping entry. We have to
351 * preserve _PAGE_FILE and _PAGE_PRESENT here. _PAGE_TYPE_* isn't
352 * necessary, since _PAGE_FILE implies !_PAGE_PROTNONE (?)
353 */
354#define PTE_FILE_MAX_BITS 30
355#define pte_to_pgoff(pte) (((pte_val(pte) >> 1) & 0x1ff) \
356 | ((pte_val(pte) >> 11) << 9))
357#define pgoff_to_pte(off) ((pte_t) { ((((off) & 0x1ff) << 1) \
358 | (((off) >> 9) << 11) \
359 | _PAGE_FILE) })
360
361typedef pte_t *pte_addr_t; 336typedef pte_t *pte_addr_t;
362 337
363#define kern_addr_valid(addr) (1) 338#define kern_addr_valid(addr) (1)
diff --git a/arch/blackfin/include/asm/pgtable.h b/arch/blackfin/include/asm/pgtable.h
index 0b049019eba7..b88a1558b0b9 100644
--- a/arch/blackfin/include/asm/pgtable.h
+++ b/arch/blackfin/include/asm/pgtable.h
@@ -45,11 +45,6 @@ extern void paging_init(void);
45#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 45#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
46#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 46#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
47 47
48static inline int pte_file(pte_t pte)
49{
50 return 0;
51}
52
53#define set_pte(pteptr, pteval) (*(pteptr) = pteval) 48#define set_pte(pteptr, pteval) (*(pteptr) = pteval)
54#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval) 49#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval)
55 50
diff --git a/arch/c6x/include/asm/pgtable.h b/arch/c6x/include/asm/pgtable.h
index c0eed5b18860..78d4483ba40c 100644
--- a/arch/c6x/include/asm/pgtable.h
+++ b/arch/c6x/include/asm/pgtable.h
@@ -50,11 +50,6 @@ extern void paging_init(void);
50#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 50#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
51#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 51#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
52 52
53static inline int pte_file(pte_t pte)
54{
55 return 0;
56}
57
58#define set_pte(pteptr, pteval) (*(pteptr) = pteval) 53#define set_pte(pteptr, pteval) (*(pteptr) = pteval)
59#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval) 54#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval)
60 55
diff --git a/arch/cris/include/arch-v10/arch/mmu.h b/arch/cris/include/arch-v10/arch/mmu.h
index e829e5a37bbe..47a5dd21749d 100644
--- a/arch/cris/include/arch-v10/arch/mmu.h
+++ b/arch/cris/include/arch-v10/arch/mmu.h
@@ -58,7 +58,6 @@ typedef struct
58/* Bits the HW doesn't care about but the kernel uses them in SW */ 58/* Bits the HW doesn't care about but the kernel uses them in SW */
59 59
60#define _PAGE_PRESENT (1<<4) /* page present in memory */ 60#define _PAGE_PRESENT (1<<4) /* page present in memory */
61#define _PAGE_FILE (1<<5) /* set: pagecache, unset: swap (when !PRESENT) */
62#define _PAGE_ACCESSED (1<<5) /* simulated in software using valid bit */ 61#define _PAGE_ACCESSED (1<<5) /* simulated in software using valid bit */
63#define _PAGE_MODIFIED (1<<6) /* simulated in software using we bit */ 62#define _PAGE_MODIFIED (1<<6) /* simulated in software using we bit */
64#define _PAGE_READ (1<<7) /* read-enabled */ 63#define _PAGE_READ (1<<7) /* read-enabled */
@@ -105,6 +104,4 @@ typedef struct
105#define __S110 PAGE_SHARED 104#define __S110 PAGE_SHARED
106#define __S111 PAGE_SHARED 105#define __S111 PAGE_SHARED
107 106
108#define PTE_FILE_MAX_BITS 26
109
110#endif 107#endif
diff --git a/arch/cris/include/arch-v32/arch/mmu.h b/arch/cris/include/arch-v32/arch/mmu.h
index c1a13e05e963..e6db1616dee5 100644
--- a/arch/cris/include/arch-v32/arch/mmu.h
+++ b/arch/cris/include/arch-v32/arch/mmu.h
@@ -53,7 +53,6 @@ typedef struct
53 * software. 53 * software.
54 */ 54 */
55#define _PAGE_PRESENT (1 << 5) /* Page is present in memory. */ 55#define _PAGE_PRESENT (1 << 5) /* Page is present in memory. */
56#define _PAGE_FILE (1 << 6) /* 1=pagecache, 0=swap (when !present) */
57#define _PAGE_ACCESSED (1 << 6) /* Simulated in software using valid bit. */ 56#define _PAGE_ACCESSED (1 << 6) /* Simulated in software using valid bit. */
58#define _PAGE_MODIFIED (1 << 7) /* Simulated in software using we bit. */ 57#define _PAGE_MODIFIED (1 << 7) /* Simulated in software using we bit. */
59#define _PAGE_READ (1 << 8) /* Read enabled. */ 58#define _PAGE_READ (1 << 8) /* Read enabled. */
@@ -108,6 +107,4 @@ typedef struct
108#define __S110 PAGE_SHARED_EXEC 107#define __S110 PAGE_SHARED_EXEC
109#define __S111 PAGE_SHARED_EXEC 108#define __S111 PAGE_SHARED_EXEC
110 109
111#define PTE_FILE_MAX_BITS 25
112
113#endif /* _ASM_CRIS_ARCH_MMU_H */ 110#endif /* _ASM_CRIS_ARCH_MMU_H */
diff --git a/arch/cris/include/asm/pgtable.h b/arch/cris/include/asm/pgtable.h
index 8b8c86793225..e824257971c4 100644
--- a/arch/cris/include/asm/pgtable.h
+++ b/arch/cris/include/asm/pgtable.h
@@ -114,7 +114,6 @@ extern unsigned long empty_zero_page;
114static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } 114static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
115static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; } 115static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; }
116static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 116static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
117static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
118static inline int pte_special(pte_t pte) { return 0; } 117static inline int pte_special(pte_t pte) { return 0; }
119 118
120static inline pte_t pte_wrprotect(pte_t pte) 119static inline pte_t pte_wrprotect(pte_t pte)
@@ -290,9 +289,6 @@ static inline void update_mmu_cache(struct vm_area_struct * vma,
290 */ 289 */
291#define pgtable_cache_init() do { } while (0) 290#define pgtable_cache_init() do { } while (0)
292 291
293#define pte_to_pgoff(x) (pte_val(x) >> 6)
294#define pgoff_to_pte(x) __pte(((x) << 6) | _PAGE_FILE)
295
296typedef pte_t *pte_addr_t; 292typedef pte_t *pte_addr_t;
297 293
298#endif /* __ASSEMBLY__ */ 294#endif /* __ASSEMBLY__ */
diff --git a/arch/frv/include/asm/pgtable.h b/arch/frv/include/asm/pgtable.h
index eb0110acd19b..c49699d5902d 100644
--- a/arch/frv/include/asm/pgtable.h
+++ b/arch/frv/include/asm/pgtable.h
@@ -62,10 +62,6 @@ typedef pte_t *pte_addr_t;
62#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 62#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
63#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 63#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
64 64
65#ifndef __ASSEMBLY__
66static inline int pte_file(pte_t pte) { return 0; }
67#endif
68
69#define ZERO_PAGE(vaddr) ({ BUG(); NULL; }) 65#define ZERO_PAGE(vaddr) ({ BUG(); NULL; })
70 66
71#define swapper_pg_dir ((pgd_t *) NULL) 67#define swapper_pg_dir ((pgd_t *) NULL)
@@ -298,7 +294,6 @@ static inline pmd_t *pmd_offset(pud_t *dir, unsigned long address)
298 294
299#define _PAGE_RESERVED_MASK (xAMPRx_RESERVED8 | xAMPRx_RESERVED13) 295#define _PAGE_RESERVED_MASK (xAMPRx_RESERVED8 | xAMPRx_RESERVED13)
300 296
301#define _PAGE_FILE 0x002 /* set:pagecache unset:swap */
302#define _PAGE_PROTNONE 0x000 /* If not present */ 297#define _PAGE_PROTNONE 0x000 /* If not present */
303 298
304#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) 299#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
@@ -463,27 +458,15 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
463 * Handle swap and file entries 458 * Handle swap and file entries
464 * - the PTE is encoded in the following format: 459 * - the PTE is encoded in the following format:
465 * bit 0: Must be 0 (!_PAGE_PRESENT) 460 * bit 0: Must be 0 (!_PAGE_PRESENT)
466 * bit 1: Type: 0 for swap, 1 for file (_PAGE_FILE) 461 * bits 1-6: Swap type
467 * bits 2-7: Swap type 462 * bits 7-31: Swap offset
468 * bits 8-31: Swap offset
469 * bits 2-31: File pgoff
470 */ 463 */
471#define __swp_type(x) (((x).val >> 2) & 0x1f) 464#define __swp_type(x) (((x).val >> 1) & 0x1f)
472#define __swp_offset(x) ((x).val >> 8) 465#define __swp_offset(x) ((x).val >> 7)
473#define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 2) | ((offset) << 8) }) 466#define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 1) | ((offset) << 7) })
474#define __pte_to_swp_entry(_pte) ((swp_entry_t) { (_pte).pte }) 467#define __pte_to_swp_entry(_pte) ((swp_entry_t) { (_pte).pte })
475#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 468#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
476 469
477static inline int pte_file(pte_t pte)
478{
479 return pte.pte & _PAGE_FILE;
480}
481
482#define PTE_FILE_MAX_BITS 29
483
484#define pte_to_pgoff(PTE) ((PTE).pte >> 2)
485#define pgoff_to_pte(off) __pte((off) << 2 | _PAGE_FILE)
486
487/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ 470/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
488#define PageSkip(page) (0) 471#define PageSkip(page) (0)
489#define kern_addr_valid(addr) (1) 472#define kern_addr_valid(addr) (1)
diff --git a/arch/hexagon/include/asm/pgtable.h b/arch/hexagon/include/asm/pgtable.h
index d8bd54fa431e..6e35e71d2aea 100644
--- a/arch/hexagon/include/asm/pgtable.h
+++ b/arch/hexagon/include/asm/pgtable.h
@@ -62,13 +62,6 @@ extern unsigned long zero_page_mask;
62#define _PAGE_ACCESSED (1<<2) 62#define _PAGE_ACCESSED (1<<2)
63 63
64/* 64/*
65 * _PAGE_FILE is only meaningful if _PAGE_PRESENT is false, while
66 * _PAGE_DIRTY is only meaningful if _PAGE_PRESENT is true.
67 * So we can overload the bit...
68 */
69#define _PAGE_FILE _PAGE_DIRTY /* set: pagecache, unset = swap */
70
71/*
72 * For now, let's say that Valid and Present are the same thing. 65 * For now, let's say that Valid and Present are the same thing.
73 * Alternatively, we could say that it's the "or" of R, W, and X 66 * Alternatively, we could say that it's the "or" of R, W, and X
74 * permissions. 67 * permissions.
@@ -456,57 +449,36 @@ static inline int pte_exec(pte_t pte)
456#define pgtable_cache_init() do { } while (0) 449#define pgtable_cache_init() do { } while (0)
457 450
458/* 451/*
459 * Swap/file PTE definitions. If _PAGE_PRESENT is zero, the rest of the 452 * Swap/file PTE definitions. If _PAGE_PRESENT is zero, the rest of the PTE is
460 * PTE is interpreted as swap information. Depending on the _PAGE_FILE 453 * interpreted as swap information. The remaining free bits are interpreted as
461 * bit, the remaining free bits are eitehr interpreted as a file offset 454 * swap type/offset tuple. Rather than have the TLB fill handler test
462 * or a swap type/offset tuple. Rather than have the TLB fill handler 455 * _PAGE_PRESENT, we're going to reserve the permissions bits and set them to
463 * test _PAGE_PRESENT, we're going to reserve the permissions bits 456 * all zeros for swap entries, which speeds up the miss handler at the cost of
464 * and set them to all zeros for swap entries, which speeds up the 457 * 3 bits of offset. That trade-off can be revisited if necessary, but Hexagon
465 * miss handler at the cost of 3 bits of offset. That trade-off can 458 * processor architecture and target applications suggest a lot of TLB misses
466 * be revisited if necessary, but Hexagon processor architecture and 459 * and not much swap space.
467 * target applications suggest a lot of TLB misses and not much swap space.
468 * 460 *
469 * Format of swap PTE: 461 * Format of swap PTE:
470 * bit 0: Present (zero) 462 * bit 0: Present (zero)
471 * bit 1: _PAGE_FILE (zero) 463 * bits 1-5: swap type (arch independent layer uses 5 bits max)
472 * bits 2-6: swap type (arch independent layer uses 5 bits max) 464 * bits 6-9: bits 3:0 of offset
473 * bits 7-9: bits 2:0 of offset 465 * bits 10-12: effectively _PAGE_PROTNONE (all zero)
474 * bits 10-12: effectively _PAGE_PROTNONE (all zero) 466 * bits 13-31: bits 22:4 of swap offset
475 * bits 13-31: bits 21:3 of swap offset
476 *
477 * Format of file PTE:
478 * bit 0: Present (zero)
479 * bit 1: _PAGE_FILE (zero)
480 * bits 2-9: bits 7:0 of offset
481 * bits 10-12: effectively _PAGE_PROTNONE (all zero)
482 * bits 13-31: bits 26:8 of swap offset
483 * 467 *
484 * The split offset makes some of the following macros a little gnarly, 468 * The split offset makes some of the following macros a little gnarly,
485 * but there's plenty of precedent for this sort of thing. 469 * but there's plenty of precedent for this sort of thing.
486 */ 470 */
487#define PTE_FILE_MAX_BITS 27
488 471
489/* Used for swap PTEs */ 472/* Used for swap PTEs */
490#define __swp_type(swp_pte) (((swp_pte).val >> 2) & 0x1f) 473#define __swp_type(swp_pte) (((swp_pte).val >> 1) & 0x1f)
491 474
492#define __swp_offset(swp_pte) \ 475#define __swp_offset(swp_pte) \
493 ((((swp_pte).val >> 7) & 0x7) | (((swp_pte).val >> 10) & 0x003ffff8)) 476 ((((swp_pte).val >> 6) & 0xf) | (((swp_pte).val >> 9) & 0x7ffff0))
494 477
495#define __swp_entry(type, offset) \ 478#define __swp_entry(type, offset) \
496 ((swp_entry_t) { \ 479 ((swp_entry_t) { \
497 ((type << 2) | \ 480 ((type << 1) | \
498 ((offset & 0x3ffff8) << 10) | ((offset & 0x7) << 7)) }) 481 ((offset & 0x7ffff0) << 9) | ((offset & 0xf) << 6)) })
499
500/* Used for file PTEs */
501#define pte_file(pte) \
502 ((pte_val(pte) & (_PAGE_FILE | _PAGE_PRESENT)) == _PAGE_FILE)
503
504#define pte_to_pgoff(pte) \
505 (((pte_val(pte) >> 2) & 0xff) | ((pte_val(pte) >> 5) & 0x07ffff00))
506
507#define pgoff_to_pte(off) \
508 ((pte_t) { ((((off) & 0x7ffff00) << 5) | (((off) & 0xff) << 2)\
509 | _PAGE_FILE) })
510 482
511/* Oh boy. There are a lot of possible arch overrides found in this file. */ 483/* Oh boy. There are a lot of possible arch overrides found in this file. */
512#include <asm-generic/pgtable.h> 484#include <asm-generic/pgtable.h>
diff --git a/arch/ia64/include/asm/pgtable.h b/arch/ia64/include/asm/pgtable.h
index 7935115398a6..2f07bb3dda91 100644
--- a/arch/ia64/include/asm/pgtable.h
+++ b/arch/ia64/include/asm/pgtable.h
@@ -57,9 +57,6 @@
57#define _PAGE_ED (__IA64_UL(1) << 52) /* exception deferral */ 57#define _PAGE_ED (__IA64_UL(1) << 52) /* exception deferral */
58#define _PAGE_PROTNONE (__IA64_UL(1) << 63) 58#define _PAGE_PROTNONE (__IA64_UL(1) << 63)
59 59
60/* Valid only for a PTE with the present bit cleared: */
61#define _PAGE_FILE (1 << 1) /* see swap & file pte remarks below */
62
63#define _PFN_MASK _PAGE_PPN_MASK 60#define _PFN_MASK _PAGE_PPN_MASK
64/* Mask of bits which may be changed by pte_modify(); the odd bits are there for _PAGE_PROTNONE */ 61/* Mask of bits which may be changed by pte_modify(); the odd bits are there for _PAGE_PROTNONE */
65#define _PAGE_CHG_MASK (_PAGE_P | _PAGE_PROTNONE | _PAGE_PL_MASK | _PAGE_AR_MASK | _PAGE_ED) 62#define _PAGE_CHG_MASK (_PAGE_P | _PAGE_PROTNONE | _PAGE_PL_MASK | _PAGE_AR_MASK | _PAGE_ED)
@@ -300,7 +297,6 @@ extern unsigned long VMALLOC_END;
300#define pte_exec(pte) ((pte_val(pte) & _PAGE_AR_RX) != 0) 297#define pte_exec(pte) ((pte_val(pte) & _PAGE_AR_RX) != 0)
301#define pte_dirty(pte) ((pte_val(pte) & _PAGE_D) != 0) 298#define pte_dirty(pte) ((pte_val(pte) & _PAGE_D) != 0)
302#define pte_young(pte) ((pte_val(pte) & _PAGE_A) != 0) 299#define pte_young(pte) ((pte_val(pte) & _PAGE_A) != 0)
303#define pte_file(pte) ((pte_val(pte) & _PAGE_FILE) != 0)
304#define pte_special(pte) 0 300#define pte_special(pte) 0
305 301
306/* 302/*
@@ -472,27 +468,16 @@ extern void paging_init (void);
472 * 468 *
473 * Format of swap pte: 469 * Format of swap pte:
474 * bit 0 : present bit (must be zero) 470 * bit 0 : present bit (must be zero)
475 * bit 1 : _PAGE_FILE (must be zero) 471 * bits 1- 7: swap-type
476 * bits 2- 8: swap-type 472 * bits 8-62: swap offset
477 * bits 9-62: swap offset
478 * bit 63 : _PAGE_PROTNONE bit
479 *
480 * Format of file pte:
481 * bit 0 : present bit (must be zero)
482 * bit 1 : _PAGE_FILE (must be one)
483 * bits 2-62: file_offset/PAGE_SIZE
484 * bit 63 : _PAGE_PROTNONE bit 473 * bit 63 : _PAGE_PROTNONE bit
485 */ 474 */
486#define __swp_type(entry) (((entry).val >> 2) & 0x7f) 475#define __swp_type(entry) (((entry).val >> 1) & 0x7f)
487#define __swp_offset(entry) (((entry).val << 1) >> 10) 476#define __swp_offset(entry) (((entry).val << 1) >> 9)
488#define __swp_entry(type,offset) ((swp_entry_t) { ((type) << 2) | ((long) (offset) << 9) }) 477#define __swp_entry(type,offset) ((swp_entry_t) { ((type) << 1) | ((long) (offset) << 8) })
489#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 478#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
490#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 479#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
491 480
492#define PTE_FILE_MAX_BITS 61
493#define pte_to_pgoff(pte) ((pte_val(pte) << 1) >> 3)
494#define pgoff_to_pte(off) ((pte_t) { ((off) << 2) | _PAGE_FILE })
495
496/* 481/*
497 * ZERO_PAGE is a global shared page that is always zero: used 482 * ZERO_PAGE is a global shared page that is always zero: used
498 * for zero-mapped memory areas etc.. 483 * for zero-mapped memory areas etc..
diff --git a/arch/m32r/include/asm/pgtable-2level.h b/arch/m32r/include/asm/pgtable-2level.h
index 9cdaf7350ef6..8fd8ee70266a 100644
--- a/arch/m32r/include/asm/pgtable-2level.h
+++ b/arch/m32r/include/asm/pgtable-2level.h
@@ -70,9 +70,5 @@ static inline pmd_t *pmd_offset(pgd_t * dir, unsigned long address)
70#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) 70#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
71#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) 71#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
72 72
73#define PTE_FILE_MAX_BITS 29
74#define pte_to_pgoff(pte) (((pte_val(pte) >> 2) & 0x7f) | (((pte_val(pte) >> 10)) << 7))
75#define pgoff_to_pte(off) ((pte_t) { (((off) & 0x7f) << 2) | (((off) >> 7) << 10) | _PAGE_FILE })
76
77#endif /* __KERNEL__ */ 73#endif /* __KERNEL__ */
78#endif /* _ASM_M32R_PGTABLE_2LEVEL_H */ 74#endif /* _ASM_M32R_PGTABLE_2LEVEL_H */
diff --git a/arch/m32r/include/asm/pgtable.h b/arch/m32r/include/asm/pgtable.h
index 103ce6710f07..050f7a686e3d 100644
--- a/arch/m32r/include/asm/pgtable.h
+++ b/arch/m32r/include/asm/pgtable.h
@@ -80,8 +80,6 @@ extern unsigned long empty_zero_page[1024];
80 */ 80 */
81 81
82#define _PAGE_BIT_DIRTY 0 /* software: page changed */ 82#define _PAGE_BIT_DIRTY 0 /* software: page changed */
83#define _PAGE_BIT_FILE 0 /* when !present: nonlinear file
84 mapping */
85#define _PAGE_BIT_PRESENT 1 /* Valid: page is valid */ 83#define _PAGE_BIT_PRESENT 1 /* Valid: page is valid */
86#define _PAGE_BIT_GLOBAL 2 /* Global */ 84#define _PAGE_BIT_GLOBAL 2 /* Global */
87#define _PAGE_BIT_LARGE 3 /* Large */ 85#define _PAGE_BIT_LARGE 3 /* Large */
@@ -93,7 +91,6 @@ extern unsigned long empty_zero_page[1024];
93#define _PAGE_BIT_PROTNONE 9 /* software: if not present */ 91#define _PAGE_BIT_PROTNONE 9 /* software: if not present */
94 92
95#define _PAGE_DIRTY (1UL << _PAGE_BIT_DIRTY) 93#define _PAGE_DIRTY (1UL << _PAGE_BIT_DIRTY)
96#define _PAGE_FILE (1UL << _PAGE_BIT_FILE)
97#define _PAGE_PRESENT (1UL << _PAGE_BIT_PRESENT) 94#define _PAGE_PRESENT (1UL << _PAGE_BIT_PRESENT)
98#define _PAGE_GLOBAL (1UL << _PAGE_BIT_GLOBAL) 95#define _PAGE_GLOBAL (1UL << _PAGE_BIT_GLOBAL)
99#define _PAGE_LARGE (1UL << _PAGE_BIT_LARGE) 96#define _PAGE_LARGE (1UL << _PAGE_BIT_LARGE)
@@ -206,14 +203,6 @@ static inline int pte_write(pte_t pte)
206 return pte_val(pte) & _PAGE_WRITE; 203 return pte_val(pte) & _PAGE_WRITE;
207} 204}
208 205
209/*
210 * The following only works if pte_present() is not true.
211 */
212static inline int pte_file(pte_t pte)
213{
214 return pte_val(pte) & _PAGE_FILE;
215}
216
217static inline int pte_special(pte_t pte) 206static inline int pte_special(pte_t pte)
218{ 207{
219 return 0; 208 return 0;
diff --git a/arch/m68k/include/asm/mcf_pgtable.h b/arch/m68k/include/asm/mcf_pgtable.h
index 3c793682e5d9..2500ce04fcc4 100644
--- a/arch/m68k/include/asm/mcf_pgtable.h
+++ b/arch/m68k/include/asm/mcf_pgtable.h
@@ -35,7 +35,6 @@
35 * hitting hardware. 35 * hitting hardware.
36 */ 36 */
37#define CF_PAGE_DIRTY 0x00000001 37#define CF_PAGE_DIRTY 0x00000001
38#define CF_PAGE_FILE 0x00000200
39#define CF_PAGE_ACCESSED 0x00001000 38#define CF_PAGE_ACCESSED 0x00001000
40 39
41#define _PAGE_CACHE040 0x020 /* 68040 cache mode, cachable, copyback */ 40#define _PAGE_CACHE040 0x020 /* 68040 cache mode, cachable, copyback */
@@ -243,11 +242,6 @@ static inline int pte_young(pte_t pte)
243 return pte_val(pte) & CF_PAGE_ACCESSED; 242 return pte_val(pte) & CF_PAGE_ACCESSED;
244} 243}
245 244
246static inline int pte_file(pte_t pte)
247{
248 return pte_val(pte) & CF_PAGE_FILE;
249}
250
251static inline int pte_special(pte_t pte) 245static inline int pte_special(pte_t pte)
252{ 246{
253 return 0; 247 return 0;
@@ -391,26 +385,13 @@ static inline void cache_page(void *vaddr)
391 *ptep = pte_mkcache(*ptep); 385 *ptep = pte_mkcache(*ptep);
392} 386}
393 387
394#define PTE_FILE_MAX_BITS 21
395#define PTE_FILE_SHIFT 11
396
397static inline unsigned long pte_to_pgoff(pte_t pte)
398{
399 return pte_val(pte) >> PTE_FILE_SHIFT;
400}
401
402static inline pte_t pgoff_to_pte(unsigned pgoff)
403{
404 return __pte((pgoff << PTE_FILE_SHIFT) + CF_PAGE_FILE);
405}
406
407/* 388/*
408 * Encode and de-code a swap entry (must be !pte_none(e) && !pte_present(e)) 389 * Encode and de-code a swap entry (must be !pte_none(e) && !pte_present(e))
409 */ 390 */
410#define __swp_type(x) ((x).val & 0xFF) 391#define __swp_type(x) ((x).val & 0xFF)
411#define __swp_offset(x) ((x).val >> PTE_FILE_SHIFT) 392#define __swp_offset(x) ((x).val >> 11)
412#define __swp_entry(typ, off) ((swp_entry_t) { (typ) | \ 393#define __swp_entry(typ, off) ((swp_entry_t) { (typ) | \
413 (off << PTE_FILE_SHIFT) }) 394 (off << 11) })
414#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 395#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
415#define __swp_entry_to_pte(x) (__pte((x).val)) 396#define __swp_entry_to_pte(x) (__pte((x).val))
416 397
diff --git a/arch/m68k/include/asm/motorola_pgtable.h b/arch/m68k/include/asm/motorola_pgtable.h
index e0fdd4d08075..0085aab80e5a 100644
--- a/arch/m68k/include/asm/motorola_pgtable.h
+++ b/arch/m68k/include/asm/motorola_pgtable.h
@@ -28,7 +28,6 @@
28#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_NOCACHE) 28#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_NOCACHE)
29 29
30#define _PAGE_PROTNONE 0x004 30#define _PAGE_PROTNONE 0x004
31#define _PAGE_FILE 0x008 /* pagecache or swap? */
32 31
33#ifndef __ASSEMBLY__ 32#ifndef __ASSEMBLY__
34 33
@@ -168,7 +167,6 @@ static inline void pgd_set(pgd_t *pgdp, pmd_t *pmdp)
168static inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_RONLY); } 167static inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_RONLY); }
169static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 168static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
170static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 169static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
171static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
172static inline int pte_special(pte_t pte) { return 0; } 170static inline int pte_special(pte_t pte) { return 0; }
173 171
174static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_RONLY; return pte; } 172static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_RONLY; return pte; }
@@ -266,19 +264,6 @@ static inline void cache_page(void *vaddr)
266 } 264 }
267} 265}
268 266
269#define PTE_FILE_MAX_BITS 28
270
271static inline unsigned long pte_to_pgoff(pte_t pte)
272{
273 return pte.pte >> 4;
274}
275
276static inline pte_t pgoff_to_pte(unsigned off)
277{
278 pte_t pte = { (off << 4) + _PAGE_FILE };
279 return pte;
280}
281
282/* Encode and de-code a swap entry (must be !pte_none(e) && !pte_present(e)) */ 267/* Encode and de-code a swap entry (must be !pte_none(e) && !pte_present(e)) */
283#define __swp_type(x) (((x).val >> 4) & 0xff) 268#define __swp_type(x) (((x).val >> 4) & 0xff)
284#define __swp_offset(x) ((x).val >> 12) 269#define __swp_offset(x) ((x).val >> 12)
diff --git a/arch/m68k/include/asm/pgtable_no.h b/arch/m68k/include/asm/pgtable_no.h
index 11859b86b1f9..ac7d87a02335 100644
--- a/arch/m68k/include/asm/pgtable_no.h
+++ b/arch/m68k/include/asm/pgtable_no.h
@@ -37,8 +37,6 @@ extern void paging_init(void);
37#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 37#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
38#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 38#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
39 39
40static inline int pte_file(pte_t pte) { return 0; }
41
42/* 40/*
43 * ZERO_PAGE is a global shared page that is always zero: used 41 * ZERO_PAGE is a global shared page that is always zero: used
44 * for zero-mapped memory areas etc.. 42 * for zero-mapped memory areas etc..
diff --git a/arch/m68k/include/asm/sun3_pgtable.h b/arch/m68k/include/asm/sun3_pgtable.h
index f55aa04161e8..48657f9fdece 100644
--- a/arch/m68k/include/asm/sun3_pgtable.h
+++ b/arch/m68k/include/asm/sun3_pgtable.h
@@ -38,8 +38,6 @@
38#define _PAGE_PRESENT (SUN3_PAGE_VALID) 38#define _PAGE_PRESENT (SUN3_PAGE_VALID)
39#define _PAGE_ACCESSED (SUN3_PAGE_ACCESSED) 39#define _PAGE_ACCESSED (SUN3_PAGE_ACCESSED)
40 40
41#define PTE_FILE_MAX_BITS 28
42
43/* Compound page protection values. */ 41/* Compound page protection values. */
44//todo: work out which ones *should* have SUN3_PAGE_NOCACHE and fix... 42//todo: work out which ones *should* have SUN3_PAGE_NOCACHE and fix...
45// is it just PAGE_KERNEL and PAGE_SHARED? 43// is it just PAGE_KERNEL and PAGE_SHARED?
@@ -168,7 +166,6 @@ static inline void pgd_clear (pgd_t *pgdp) {}
168static inline int pte_write(pte_t pte) { return pte_val(pte) & SUN3_PAGE_WRITEABLE; } 166static inline int pte_write(pte_t pte) { return pte_val(pte) & SUN3_PAGE_WRITEABLE; }
169static inline int pte_dirty(pte_t pte) { return pte_val(pte) & SUN3_PAGE_MODIFIED; } 167static inline int pte_dirty(pte_t pte) { return pte_val(pte) & SUN3_PAGE_MODIFIED; }
170static inline int pte_young(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; } 168static inline int pte_young(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; }
171static inline int pte_file(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; }
172static inline int pte_special(pte_t pte) { return 0; } 169static inline int pte_special(pte_t pte) { return 0; }
173 170
174static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_WRITEABLE; return pte; } 171static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_WRITEABLE; return pte; }
@@ -202,18 +199,6 @@ static inline pmd_t *pmd_offset (pgd_t *pgd, unsigned long address)
202 return (pmd_t *) pgd; 199 return (pmd_t *) pgd;
203} 200}
204 201
205static inline unsigned long pte_to_pgoff(pte_t pte)
206{
207 return pte.pte & SUN3_PAGE_PGNUM_MASK;
208}
209
210static inline pte_t pgoff_to_pte(unsigned off)
211{
212 pte_t pte = { off + SUN3_PAGE_ACCESSED };
213 return pte;
214}
215
216
217/* Find an entry in the third-level pagetable. */ 202/* Find an entry in the third-level pagetable. */
218#define pte_index(address) ((address >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) 203#define pte_index(address) ((address >> PAGE_SHIFT) & (PTRS_PER_PTE-1))
219#define pte_offset_kernel(pmd, address) ((pte_t *) __pmd_page(*pmd) + pte_index(address)) 204#define pte_offset_kernel(pmd, address) ((pte_t *) __pmd_page(*pmd) + pte_index(address))
diff --git a/arch/metag/include/asm/pgtable.h b/arch/metag/include/asm/pgtable.h
index 0d9dc5487296..d0604c0a8702 100644
--- a/arch/metag/include/asm/pgtable.h
+++ b/arch/metag/include/asm/pgtable.h
@@ -47,7 +47,6 @@
47 */ 47 */
48#define _PAGE_ACCESSED _PAGE_ALWAYS_ZERO_1 48#define _PAGE_ACCESSED _PAGE_ALWAYS_ZERO_1
49#define _PAGE_DIRTY _PAGE_ALWAYS_ZERO_2 49#define _PAGE_DIRTY _PAGE_ALWAYS_ZERO_2
50#define _PAGE_FILE _PAGE_ALWAYS_ZERO_3
51 50
52/* Pages owned, and protected by, the kernel. */ 51/* Pages owned, and protected by, the kernel. */
53#define _PAGE_KERNEL _PAGE_PRIV 52#define _PAGE_KERNEL _PAGE_PRIV
@@ -219,7 +218,6 @@ extern unsigned long empty_zero_page;
219static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } 218static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
220static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 219static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
221static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 220static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
222static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
223static inline int pte_special(pte_t pte) { return 0; } 221static inline int pte_special(pte_t pte) { return 0; }
224 222
225static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= (~_PAGE_WRITE); return pte; } 223static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= (~_PAGE_WRITE); return pte; }
@@ -327,10 +325,6 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
327#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 325#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
328#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 326#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
329 327
330#define PTE_FILE_MAX_BITS 22
331#define pte_to_pgoff(x) (pte_val(x) >> 10)
332#define pgoff_to_pte(x) __pte(((x) << 10) | _PAGE_FILE)
333
334#define kern_addr_valid(addr) (1) 328#define kern_addr_valid(addr) (1)
335 329
336/* 330/*
diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index df19d0c47be8..91b9b46fbb5d 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -40,10 +40,6 @@ extern int mem_init_done;
40#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 40#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
41#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 41#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
42 42
43#ifndef __ASSEMBLY__
44static inline int pte_file(pte_t pte) { return 0; }
45#endif /* __ASSEMBLY__ */
46
47#define ZERO_PAGE(vaddr) ({ BUG(); NULL; }) 43#define ZERO_PAGE(vaddr) ({ BUG(); NULL; })
48 44
49#define swapper_pg_dir ((pgd_t *) NULL) 45#define swapper_pg_dir ((pgd_t *) NULL)
@@ -207,7 +203,6 @@ static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
207 203
208/* Definitions for MicroBlaze. */ 204/* Definitions for MicroBlaze. */
209#define _PAGE_GUARDED 0x001 /* G: page is guarded from prefetch */ 205#define _PAGE_GUARDED 0x001 /* G: page is guarded from prefetch */
210#define _PAGE_FILE 0x001 /* when !present: nonlinear file mapping */
211#define _PAGE_PRESENT 0x002 /* software: PTE contains a translation */ 206#define _PAGE_PRESENT 0x002 /* software: PTE contains a translation */
212#define _PAGE_NO_CACHE 0x004 /* I: caching is inhibited */ 207#define _PAGE_NO_CACHE 0x004 /* I: caching is inhibited */
213#define _PAGE_WRITETHRU 0x008 /* W: caching is write-through */ 208#define _PAGE_WRITETHRU 0x008 /* W: caching is write-through */
@@ -337,7 +332,6 @@ static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
337static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXEC; } 332static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXEC; }
338static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 333static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
339static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 334static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
340static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
341 335
342static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } 336static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; }
343static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } 337static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; }
@@ -499,11 +493,6 @@ static inline pmd_t *pmd_offset(pgd_t *dir, unsigned long address)
499 493
500#define pte_unmap(pte) kunmap_atomic(pte) 494#define pte_unmap(pte) kunmap_atomic(pte)
501 495
502/* Encode and decode a nonlinear file mapping entry */
503#define PTE_FILE_MAX_BITS 29
504#define pte_to_pgoff(pte) (pte_val(pte) >> 3)
505#define pgoff_to_pte(off) ((pte_t) { ((off) << 3) | _PAGE_FILE })
506
507extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; 496extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
508 497
509/* 498/*
diff --git a/arch/mips/include/asm/pgtable-32.h b/arch/mips/include/asm/pgtable-32.h
index 68984b612f9d..16aa9f23e17b 100644
--- a/arch/mips/include/asm/pgtable-32.h
+++ b/arch/mips/include/asm/pgtable-32.h
@@ -161,22 +161,6 @@ pfn_pte(unsigned long pfn, pgprot_t prot)
161#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 161#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
162#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 162#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
163 163
164/*
165 * Encode and decode a nonlinear file mapping entry
166 */
167#define pte_to_pgoff(_pte) ((((_pte).pte >> 1 ) & 0x07) | \
168 (((_pte).pte >> 2 ) & 0x38) | \
169 (((_pte).pte >> 10) << 6 ))
170
171#define pgoff_to_pte(off) ((pte_t) { (((off) & 0x07) << 1 ) | \
172 (((off) & 0x38) << 2 ) | \
173 (((off) >> 6 ) << 10) | \
174 _PAGE_FILE })
175
176/*
177 * Bits 0, 4, 8, and 9 are taken, split up 28 bits of offset into this range:
178 */
179#define PTE_FILE_MAX_BITS 28
180#else 164#else
181 165
182#if defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32) 166#if defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32)
@@ -188,13 +172,6 @@ pfn_pte(unsigned long pfn, pgprot_t prot)
188#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_high }) 172#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_high })
189#define __swp_entry_to_pte(x) ((pte_t) { 0, (x).val }) 173#define __swp_entry_to_pte(x) ((pte_t) { 0, (x).val })
190 174
191/*
192 * Bits 0 and 1 of pte_high are taken, use the rest for the page offset...
193 */
194#define pte_to_pgoff(_pte) ((_pte).pte_high >> 2)
195#define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) << 2 })
196
197#define PTE_FILE_MAX_BITS 30
198#else 175#else
199/* 176/*
200 * Constraints: 177 * Constraints:
@@ -209,19 +186,6 @@ pfn_pte(unsigned long pfn, pgprot_t prot)
209#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 186#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
210#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 187#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
211 188
212/*
213 * Encode and decode a nonlinear file mapping entry
214 */
215#define pte_to_pgoff(_pte) ((((_pte).pte >> 1) & 0x7) | \
216 (((_pte).pte >> 2) & 0x8) | \
217 (((_pte).pte >> 8) << 4))
218
219#define pgoff_to_pte(off) ((pte_t) { (((off) & 0x7) << 1) | \
220 (((off) & 0x8) << 2) | \
221 (((off) >> 4) << 8) | \
222 _PAGE_FILE })
223
224#define PTE_FILE_MAX_BITS 28
225#endif /* defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32) */ 189#endif /* defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32) */
226 190
227#endif /* defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) */ 191#endif /* defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) */
diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h
index e1c49a96807d..1659bb91ae21 100644
--- a/arch/mips/include/asm/pgtable-64.h
+++ b/arch/mips/include/asm/pgtable-64.h
@@ -291,13 +291,4 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
291#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 291#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
292#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 292#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
293 293
294/*
295 * Bits 0, 4, 6, and 7 are taken. Let's leave bits 1, 2, 3, and 5 alone to
296 * make things easier, and only use the upper 56 bits for the page offset...
297 */
298#define PTE_FILE_MAX_BITS 56
299
300#define pte_to_pgoff(_pte) ((_pte).pte >> 8)
301#define pgoff_to_pte(off) ((pte_t) { ((off) << 8) | _PAGE_FILE })
302
303#endif /* _ASM_PGTABLE_64_H */ 294#endif /* _ASM_PGTABLE_64_H */
diff --git a/arch/mips/include/asm/pgtable-bits.h b/arch/mips/include/asm/pgtable-bits.h
index ca11f14f40a3..fc807aa5ec8d 100644
--- a/arch/mips/include/asm/pgtable-bits.h
+++ b/arch/mips/include/asm/pgtable-bits.h
@@ -48,8 +48,6 @@
48 48
49/* 49/*
50 * The following bits are implemented in software 50 * The following bits are implemented in software
51 *
52 * _PAGE_FILE semantics: set:pagecache unset:swap
53 */ 51 */
54#define _PAGE_PRESENT_SHIFT (_CACHE_SHIFT + 3) 52#define _PAGE_PRESENT_SHIFT (_CACHE_SHIFT + 3)
55#define _PAGE_PRESENT (1 << _PAGE_PRESENT_SHIFT) 53#define _PAGE_PRESENT (1 << _PAGE_PRESENT_SHIFT)
@@ -64,7 +62,6 @@
64 62
65#define _PAGE_SILENT_READ _PAGE_VALID 63#define _PAGE_SILENT_READ _PAGE_VALID
66#define _PAGE_SILENT_WRITE _PAGE_DIRTY 64#define _PAGE_SILENT_WRITE _PAGE_DIRTY
67#define _PAGE_FILE _PAGE_MODIFIED
68 65
69#define _PFN_SHIFT (PAGE_SHIFT - 12 + _CACHE_SHIFT + 3) 66#define _PFN_SHIFT (PAGE_SHIFT - 12 + _CACHE_SHIFT + 3)
70 67
@@ -72,8 +69,6 @@
72 69
73/* 70/*
74 * The following are implemented by software 71 * The following are implemented by software
75 *
76 * _PAGE_FILE semantics: set:pagecache unset:swap
77 */ 72 */
78#define _PAGE_PRESENT_SHIFT 0 73#define _PAGE_PRESENT_SHIFT 0
79#define _PAGE_PRESENT (1 << _PAGE_PRESENT_SHIFT) 74#define _PAGE_PRESENT (1 << _PAGE_PRESENT_SHIFT)
@@ -85,8 +80,6 @@
85#define _PAGE_ACCESSED (1 << _PAGE_ACCESSED_SHIFT) 80#define _PAGE_ACCESSED (1 << _PAGE_ACCESSED_SHIFT)
86#define _PAGE_MODIFIED_SHIFT 4 81#define _PAGE_MODIFIED_SHIFT 4
87#define _PAGE_MODIFIED (1 << _PAGE_MODIFIED_SHIFT) 82#define _PAGE_MODIFIED (1 << _PAGE_MODIFIED_SHIFT)
88#define _PAGE_FILE_SHIFT 4
89#define _PAGE_FILE (1 << _PAGE_FILE_SHIFT)
90 83
91/* 84/*
92 * And these are the hardware TLB bits 85 * And these are the hardware TLB bits
@@ -116,7 +109,6 @@
116 * The following bits are implemented in software 109 * The following bits are implemented in software
117 * 110 *
118 * _PAGE_READ / _PAGE_READ_SHIFT should be unused if cpu_has_rixi. 111 * _PAGE_READ / _PAGE_READ_SHIFT should be unused if cpu_has_rixi.
119 * _PAGE_FILE semantics: set:pagecache unset:swap
120 */ 112 */
121#define _PAGE_PRESENT_SHIFT (0) 113#define _PAGE_PRESENT_SHIFT (0)
122#define _PAGE_PRESENT (1 << _PAGE_PRESENT_SHIFT) 114#define _PAGE_PRESENT (1 << _PAGE_PRESENT_SHIFT)
@@ -128,7 +120,6 @@
128#define _PAGE_ACCESSED (1 << _PAGE_ACCESSED_SHIFT) 120#define _PAGE_ACCESSED (1 << _PAGE_ACCESSED_SHIFT)
129#define _PAGE_MODIFIED_SHIFT (_PAGE_ACCESSED_SHIFT + 1) 121#define _PAGE_MODIFIED_SHIFT (_PAGE_ACCESSED_SHIFT + 1)
130#define _PAGE_MODIFIED (1 << _PAGE_MODIFIED_SHIFT) 122#define _PAGE_MODIFIED (1 << _PAGE_MODIFIED_SHIFT)
131#define _PAGE_FILE (_PAGE_MODIFIED)
132 123
133#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT 124#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
134/* huge tlb page */ 125/* huge tlb page */
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
index 62a6ba383d4f..583ff4215479 100644
--- a/arch/mips/include/asm/pgtable.h
+++ b/arch/mips/include/asm/pgtable.h
@@ -231,7 +231,6 @@ extern pgd_t swapper_pg_dir[];
231static inline int pte_write(pte_t pte) { return pte.pte_low & _PAGE_WRITE; } 231static inline int pte_write(pte_t pte) { return pte.pte_low & _PAGE_WRITE; }
232static inline int pte_dirty(pte_t pte) { return pte.pte_low & _PAGE_MODIFIED; } 232static inline int pte_dirty(pte_t pte) { return pte.pte_low & _PAGE_MODIFIED; }
233static inline int pte_young(pte_t pte) { return pte.pte_low & _PAGE_ACCESSED; } 233static inline int pte_young(pte_t pte) { return pte.pte_low & _PAGE_ACCESSED; }
234static inline int pte_file(pte_t pte) { return pte.pte_low & _PAGE_FILE; }
235 234
236static inline pte_t pte_wrprotect(pte_t pte) 235static inline pte_t pte_wrprotect(pte_t pte)
237{ 236{
@@ -287,7 +286,6 @@ static inline pte_t pte_mkyoung(pte_t pte)
287static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } 286static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
288static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; } 287static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; }
289static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 288static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
290static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
291 289
292static inline pte_t pte_wrprotect(pte_t pte) 290static inline pte_t pte_wrprotect(pte_t pte)
293{ 291{
diff --git a/arch/mn10300/include/asm/pgtable.h b/arch/mn10300/include/asm/pgtable.h
index 2ddaa67e7983..629181ae111e 100644
--- a/arch/mn10300/include/asm/pgtable.h
+++ b/arch/mn10300/include/asm/pgtable.h
@@ -134,7 +134,6 @@ extern pte_t kernel_vmalloc_ptes[(VMALLOC_END - VMALLOC_START) / PAGE_SIZE];
134#define _PAGE_NX 0 /* no-execute bit */ 134#define _PAGE_NX 0 /* no-execute bit */
135 135
136/* If _PAGE_VALID is clear, we use these: */ 136/* If _PAGE_VALID is clear, we use these: */
137#define _PAGE_FILE xPTEL2_C /* set:pagecache unset:swap */
138#define _PAGE_PROTNONE 0x000 /* If not present */ 137#define _PAGE_PROTNONE 0x000 /* If not present */
139 138
140#define __PAGE_PROT_UWAUX 0x010 139#define __PAGE_PROT_UWAUX 0x010
@@ -241,11 +240,6 @@ static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
241static inline int pte_write(pte_t pte) { return pte_val(pte) & __PAGE_PROT_WRITE; } 240static inline int pte_write(pte_t pte) { return pte_val(pte) & __PAGE_PROT_WRITE; }
242static inline int pte_special(pte_t pte){ return 0; } 241static inline int pte_special(pte_t pte){ return 0; }
243 242
244/*
245 * The following only works if pte_present() is not true.
246 */
247static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
248
249static inline pte_t pte_rdprotect(pte_t pte) 243static inline pte_t pte_rdprotect(pte_t pte)
250{ 244{
251 pte_val(pte) &= ~(__PAGE_PROT_USER|__PAGE_PROT_UWAUX); return pte; 245 pte_val(pte) &= ~(__PAGE_PROT_USER|__PAGE_PROT_UWAUX); return pte;
@@ -338,16 +332,11 @@ static inline int pte_exec_kernel(pte_t pte)
338 return 1; 332 return 1;
339} 333}
340 334
341#define PTE_FILE_MAX_BITS 30
342
343#define pte_to_pgoff(pte) (pte_val(pte) >> 2)
344#define pgoff_to_pte(off) __pte((off) << 2 | _PAGE_FILE)
345
346/* Encode and de-code a swap entry */ 335/* Encode and de-code a swap entry */
347#define __swp_type(x) (((x).val >> 2) & 0x3f) 336#define __swp_type(x) (((x).val >> 1) & 0x3f)
348#define __swp_offset(x) ((x).val >> 8) 337#define __swp_offset(x) ((x).val >> 7)
349#define __swp_entry(type, offset) \ 338#define __swp_entry(type, offset) \
350 ((swp_entry_t) { ((type) << 2) | ((offset) << 8) }) 339 ((swp_entry_t) { ((type) << 1) | ((offset) << 7) })
351#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 340#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
352#define __swp_entry_to_pte(x) __pte((x).val) 341#define __swp_entry_to_pte(x) __pte((x).val)
353 342
diff --git a/arch/nios2/include/asm/pgtable-bits.h b/arch/nios2/include/asm/pgtable-bits.h
index ce9e7069aa96..bfddff383e89 100644
--- a/arch/nios2/include/asm/pgtable-bits.h
+++ b/arch/nios2/include/asm/pgtable-bits.h
@@ -30,6 +30,5 @@
30#define _PAGE_PRESENT (1<<25) /* PTE contains a translation */ 30#define _PAGE_PRESENT (1<<25) /* PTE contains a translation */
31#define _PAGE_ACCESSED (1<<26) /* page referenced */ 31#define _PAGE_ACCESSED (1<<26) /* page referenced */
32#define _PAGE_DIRTY (1<<27) /* dirty page */ 32#define _PAGE_DIRTY (1<<27) /* dirty page */
33#define _PAGE_FILE (1<<28) /* PTE used for file mapping or swap */
34 33
35#endif /* _ASM_NIOS2_PGTABLE_BITS_H */ 34#endif /* _ASM_NIOS2_PGTABLE_BITS_H */
diff --git a/arch/nios2/include/asm/pgtable.h b/arch/nios2/include/asm/pgtable.h
index ccbaffd47671..7b292e3a3138 100644
--- a/arch/nios2/include/asm/pgtable.h
+++ b/arch/nios2/include/asm/pgtable.h
@@ -112,8 +112,6 @@ static inline int pte_dirty(pte_t pte) \
112 { return pte_val(pte) & _PAGE_DIRTY; } 112 { return pte_val(pte) & _PAGE_DIRTY; }
113static inline int pte_young(pte_t pte) \ 113static inline int pte_young(pte_t pte) \
114 { return pte_val(pte) & _PAGE_ACCESSED; } 114 { return pte_val(pte) & _PAGE_ACCESSED; }
115static inline int pte_file(pte_t pte) \
116 { return pte_val(pte) & _PAGE_FILE; }
117static inline int pte_special(pte_t pte) { return 0; } 115static inline int pte_special(pte_t pte) { return 0; }
118 116
119#define pgprot_noncached pgprot_noncached 117#define pgprot_noncached pgprot_noncached
@@ -272,8 +270,7 @@ static inline void pte_clear(struct mm_struct *mm,
272 __FILE__, __LINE__, pgd_val(e)) 270 __FILE__, __LINE__, pgd_val(e))
273 271
274/* 272/*
275 * Encode and decode a swap entry (must be !pte_none(pte) && !pte_present(pte) 273 * Encode and decode a swap entry (must be !pte_none(pte) && !pte_present(pte):
276 * && !pte_file(pte)):
277 * 274 *
278 * 31 30 29 28 27 26 25 24 23 22 21 20 19 18 ... 1 0 275 * 31 30 29 28 27 26 25 24 23 22 21 20 19 18 ... 1 0
279 * 0 0 0 0 type. 0 0 0 0 0 0 offset......... 276 * 0 0 0 0 type. 0 0 0 0 0 0 offset.........
@@ -290,11 +287,6 @@ static inline void pte_clear(struct mm_struct *mm,
290#define __swp_entry_to_pte(swp) ((pte_t) { (swp).val }) 287#define __swp_entry_to_pte(swp) ((pte_t) { (swp).val })
291#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 288#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
292 289
293/* Encode and decode a nonlinear file mapping entry */
294#define PTE_FILE_MAX_BITS 25
295#define pte_to_pgoff(pte) (pte_val(pte) & 0x1ffffff)
296#define pgoff_to_pte(off) __pte(((off) & 0x1ffffff) | _PAGE_FILE)
297
298#define kern_addr_valid(addr) (1) 290#define kern_addr_valid(addr) (1)
299 291
300#include <asm-generic/pgtable.h> 292#include <asm-generic/pgtable.h>
diff --git a/arch/openrisc/include/asm/pgtable.h b/arch/openrisc/include/asm/pgtable.h
index 37bf6a3ef8f4..18994ccb1185 100644
--- a/arch/openrisc/include/asm/pgtable.h
+++ b/arch/openrisc/include/asm/pgtable.h
@@ -125,7 +125,6 @@ extern void paging_init(void);
125#define _PAGE_CC 0x001 /* software: pte contains a translation */ 125#define _PAGE_CC 0x001 /* software: pte contains a translation */
126#define _PAGE_CI 0x002 /* cache inhibit */ 126#define _PAGE_CI 0x002 /* cache inhibit */
127#define _PAGE_WBC 0x004 /* write back cache */ 127#define _PAGE_WBC 0x004 /* write back cache */
128#define _PAGE_FILE 0x004 /* set: pagecache, unset: swap (when !PRESENT) */
129#define _PAGE_WOM 0x008 /* weakly ordered memory */ 128#define _PAGE_WOM 0x008 /* weakly ordered memory */
130 129
131#define _PAGE_A 0x010 /* accessed */ 130#define _PAGE_A 0x010 /* accessed */
@@ -240,7 +239,6 @@ static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
240static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXEC; } 239static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXEC; }
241static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 240static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
242static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 241static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
243static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
244static inline int pte_special(pte_t pte) { return 0; } 242static inline int pte_special(pte_t pte) { return 0; }
245static inline pte_t pte_mkspecial(pte_t pte) { return pte; } 243static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
246 244
@@ -438,12 +436,6 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
438#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 436#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
439#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 437#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
440 438
441/* Encode and decode a nonlinear file mapping entry */
442
443#define PTE_FILE_MAX_BITS 26
444#define pte_to_pgoff(x) (pte_val(x) >> 6)
445#define pgoff_to_pte(x) __pte(((x) << 6) | _PAGE_FILE)
446
447#define kern_addr_valid(addr) (1) 439#define kern_addr_valid(addr) (1)
448 440
449#include <asm-generic/pgtable.h> 441#include <asm-generic/pgtable.h>
diff --git a/arch/openrisc/kernel/head.S b/arch/openrisc/kernel/head.S
index 1d3c9c28ac25..f14793306b03 100644
--- a/arch/openrisc/kernel/head.S
+++ b/arch/openrisc/kernel/head.S
@@ -754,11 +754,6 @@ _dc_enable:
754 754
755/* ===============================================[ page table masks ]=== */ 755/* ===============================================[ page table masks ]=== */
756 756
757/* bit 4 is used in hardware as write back cache bit. we never use this bit
758 * explicitly, so we can reuse it as _PAGE_FILE bit and mask it out when
759 * writing into hardware pte's
760 */
761
762#define DTLB_UP_CONVERT_MASK 0x3fa 757#define DTLB_UP_CONVERT_MASK 0x3fa
763#define ITLB_UP_CONVERT_MASK 0x3a 758#define ITLB_UP_CONVERT_MASK 0x3a
764 759
diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h
index 22b89d1edba7..1d49a4a7749b 100644
--- a/arch/parisc/include/asm/pgtable.h
+++ b/arch/parisc/include/asm/pgtable.h
@@ -146,7 +146,6 @@ extern void purge_tlb_entries(struct mm_struct *, unsigned long);
146#define _PAGE_GATEWAY_BIT 28 /* (0x008) privilege promotion allowed */ 146#define _PAGE_GATEWAY_BIT 28 /* (0x008) privilege promotion allowed */
147#define _PAGE_DMB_BIT 27 /* (0x010) Data Memory Break enable (B bit) */ 147#define _PAGE_DMB_BIT 27 /* (0x010) Data Memory Break enable (B bit) */
148#define _PAGE_DIRTY_BIT 26 /* (0x020) Page Dirty (D bit) */ 148#define _PAGE_DIRTY_BIT 26 /* (0x020) Page Dirty (D bit) */
149#define _PAGE_FILE_BIT _PAGE_DIRTY_BIT /* overload this bit */
150#define _PAGE_REFTRAP_BIT 25 /* (0x040) Page Ref. Trap enable (T bit) */ 149#define _PAGE_REFTRAP_BIT 25 /* (0x040) Page Ref. Trap enable (T bit) */
151#define _PAGE_NO_CACHE_BIT 24 /* (0x080) Uncached Page (U bit) */ 150#define _PAGE_NO_CACHE_BIT 24 /* (0x080) Uncached Page (U bit) */
152#define _PAGE_ACCESSED_BIT 23 /* (0x100) Software: Page Accessed */ 151#define _PAGE_ACCESSED_BIT 23 /* (0x100) Software: Page Accessed */
@@ -167,13 +166,6 @@ extern void purge_tlb_entries(struct mm_struct *, unsigned long);
167/* PFN_PTE_SHIFT defines the shift of a PTE value to access the PFN field */ 166/* PFN_PTE_SHIFT defines the shift of a PTE value to access the PFN field */
168#define PFN_PTE_SHIFT 12 167#define PFN_PTE_SHIFT 12
169 168
170
171/* this is how many bits may be used by the file functions */
172#define PTE_FILE_MAX_BITS (BITS_PER_LONG - PTE_SHIFT)
173
174#define pte_to_pgoff(pte) (pte_val(pte) >> PTE_SHIFT)
175#define pgoff_to_pte(off) ((pte_t) { ((off) << PTE_SHIFT) | _PAGE_FILE })
176
177#define _PAGE_READ (1 << xlate_pabit(_PAGE_READ_BIT)) 169#define _PAGE_READ (1 << xlate_pabit(_PAGE_READ_BIT))
178#define _PAGE_WRITE (1 << xlate_pabit(_PAGE_WRITE_BIT)) 170#define _PAGE_WRITE (1 << xlate_pabit(_PAGE_WRITE_BIT))
179#define _PAGE_RW (_PAGE_READ | _PAGE_WRITE) 171#define _PAGE_RW (_PAGE_READ | _PAGE_WRITE)
@@ -186,7 +178,6 @@ extern void purge_tlb_entries(struct mm_struct *, unsigned long);
186#define _PAGE_ACCESSED (1 << xlate_pabit(_PAGE_ACCESSED_BIT)) 178#define _PAGE_ACCESSED (1 << xlate_pabit(_PAGE_ACCESSED_BIT))
187#define _PAGE_PRESENT (1 << xlate_pabit(_PAGE_PRESENT_BIT)) 179#define _PAGE_PRESENT (1 << xlate_pabit(_PAGE_PRESENT_BIT))
188#define _PAGE_USER (1 << xlate_pabit(_PAGE_USER_BIT)) 180#define _PAGE_USER (1 << xlate_pabit(_PAGE_USER_BIT))
189#define _PAGE_FILE (1 << xlate_pabit(_PAGE_FILE_BIT))
190 181
191#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _PAGE_DIRTY | _PAGE_ACCESSED) 182#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _PAGE_DIRTY | _PAGE_ACCESSED)
192#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) 183#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
@@ -344,7 +335,6 @@ static inline void pgd_clear(pgd_t * pgdp) { }
344static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 335static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
345static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 336static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
346static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } 337static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
347static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
348static inline int pte_special(pte_t pte) { return 0; } 338static inline int pte_special(pte_t pte) { return 0; }
349 339
350static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } 340static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; }
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 5e102422c9ab..ffb1d8ce97ae 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -249,10 +249,10 @@ static inline int is_module_addr(void *addr)
249 _PAGE_YOUNG) 249 _PAGE_YOUNG)
250 250
251/* 251/*
252 * handle_pte_fault uses pte_present, pte_none and pte_file to find out the 252 * handle_pte_fault uses pte_present and pte_none to find out the pte type
253 * pte type WITHOUT holding the page table lock. The _PAGE_PRESENT bit 253 * WITHOUT holding the page table lock. The _PAGE_PRESENT bit is used to
254 * is used to distinguish present from not-present ptes. It is changed only 254 * distinguish present from not-present ptes. It is changed only with the page
255 * with the page table lock held. 255 * table lock held.
256 * 256 *
257 * The following table gives the different possible bit combinations for 257 * The following table gives the different possible bit combinations for
258 * the pte hardware and software bits in the last 12 bits of a pte: 258 * the pte hardware and software bits in the last 12 bits of a pte:
@@ -279,7 +279,6 @@ static inline int is_module_addr(void *addr)
279 * 279 *
280 * pte_present is true for the bit pattern .xx...xxxxx1, (pte & 0x001) == 0x001 280 * pte_present is true for the bit pattern .xx...xxxxx1, (pte & 0x001) == 0x001
281 * pte_none is true for the bit pattern .10...xxxx00, (pte & 0x603) == 0x400 281 * pte_none is true for the bit pattern .10...xxxx00, (pte & 0x603) == 0x400
282 * pte_file is true for the bit pattern .11...xxxxx0, (pte & 0x601) == 0x600
283 * pte_swap is true for the bit pattern .10...xxxx10, (pte & 0x603) == 0x402 282 * pte_swap is true for the bit pattern .10...xxxx10, (pte & 0x603) == 0x402
284 */ 283 */
285 284
@@ -671,13 +670,6 @@ static inline int pte_swap(pte_t pte)
671 == (_PAGE_INVALID | _PAGE_TYPE); 670 == (_PAGE_INVALID | _PAGE_TYPE);
672} 671}
673 672
674static inline int pte_file(pte_t pte)
675{
676 /* Bit pattern: (pte & 0x601) == 0x600 */
677 return (pte_val(pte) & (_PAGE_INVALID | _PAGE_PROTECT | _PAGE_PRESENT))
678 == (_PAGE_INVALID | _PAGE_PROTECT);
679}
680
681static inline int pte_special(pte_t pte) 673static inline int pte_special(pte_t pte)
682{ 674{
683 return (pte_val(pte) & _PAGE_SPECIAL); 675 return (pte_val(pte) & _PAGE_SPECIAL);
@@ -1756,19 +1748,6 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
1756#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 1748#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
1757#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 1749#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
1758 1750
1759#ifndef CONFIG_64BIT
1760# define PTE_FILE_MAX_BITS 26
1761#else /* CONFIG_64BIT */
1762# define PTE_FILE_MAX_BITS 59
1763#endif /* CONFIG_64BIT */
1764
1765#define pte_to_pgoff(__pte) \
1766 ((((__pte).pte >> 12) << 7) + (((__pte).pte >> 1) & 0x7f))
1767
1768#define pgoff_to_pte(__off) \
1769 ((pte_t) { ((((__off) & 0x7f) << 1) + (((__off) >> 7) << 12)) \
1770 | _PAGE_INVALID | _PAGE_PROTECT })
1771
1772#endif /* !__ASSEMBLY__ */ 1751#endif /* !__ASSEMBLY__ */
1773 1752
1774#define kern_addr_valid(addr) (1) 1753#define kern_addr_valid(addr) (1)
diff --git a/arch/score/include/asm/pgtable-bits.h b/arch/score/include/asm/pgtable-bits.h
index 7d65a96a82e5..0e5c6f466520 100644
--- a/arch/score/include/asm/pgtable-bits.h
+++ b/arch/score/include/asm/pgtable-bits.h
@@ -6,7 +6,6 @@
6#define _PAGE_WRITE (1<<7) /* implemented in software */ 6#define _PAGE_WRITE (1<<7) /* implemented in software */
7#define _PAGE_PRESENT (1<<9) /* implemented in software */ 7#define _PAGE_PRESENT (1<<9) /* implemented in software */
8#define _PAGE_MODIFIED (1<<10) /* implemented in software */ 8#define _PAGE_MODIFIED (1<<10) /* implemented in software */
9#define _PAGE_FILE (1<<10)
10 9
11#define _PAGE_GLOBAL (1<<0) 10#define _PAGE_GLOBAL (1<<0)
12#define _PAGE_VALID (1<<1) 11#define _PAGE_VALID (1<<1)
diff --git a/arch/score/include/asm/pgtable.h b/arch/score/include/asm/pgtable.h
index db96ad9afc03..5170ffdea643 100644
--- a/arch/score/include/asm/pgtable.h
+++ b/arch/score/include/asm/pgtable.h
@@ -90,15 +90,6 @@ static inline void pmd_clear(pmd_t *pmdp)
90 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) 90 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
91#define pte_unmap(pte) ((void)(pte)) 91#define pte_unmap(pte) ((void)(pte))
92 92
93/*
94 * Bits 9(_PAGE_PRESENT) and 10(_PAGE_FILE)are taken,
95 * split up 30 bits of offset into this range:
96 */
97#define PTE_FILE_MAX_BITS 30
98#define pte_to_pgoff(_pte) \
99 (((_pte).pte & 0x1ff) | (((_pte).pte >> 11) << 9))
100#define pgoff_to_pte(off) \
101 ((pte_t) {((off) & 0x1ff) | (((off) >> 9) << 11) | _PAGE_FILE})
102#define __pte_to_swp_entry(pte) \ 93#define __pte_to_swp_entry(pte) \
103 ((swp_entry_t) { pte_val(pte)}) 94 ((swp_entry_t) { pte_val(pte)})
104#define __swp_entry_to_pte(x) ((pte_t) {(x).val}) 95#define __swp_entry_to_pte(x) ((pte_t) {(x).val})
@@ -169,8 +160,8 @@ static inline pgprot_t pgprot_noncached(pgprot_t _prot)
169} 160}
170 161
171#define __swp_type(x) ((x).val & 0x1f) 162#define __swp_type(x) ((x).val & 0x1f)
172#define __swp_offset(x) ((x).val >> 11) 163#define __swp_offset(x) ((x).val >> 10)
173#define __swp_entry(type, offset) ((swp_entry_t){(type) | ((offset) << 11)}) 164#define __swp_entry(type, offset) ((swp_entry_t){(type) | ((offset) << 10)})
174 165
175extern unsigned long empty_zero_page; 166extern unsigned long empty_zero_page;
176extern unsigned long zero_page_mask; 167extern unsigned long zero_page_mask;
@@ -198,11 +189,6 @@ static inline int pte_young(pte_t pte)
198 return pte_val(pte) & _PAGE_ACCESSED; 189 return pte_val(pte) & _PAGE_ACCESSED;
199} 190}
200 191
201static inline int pte_file(pte_t pte)
202{
203 return pte_val(pte) & _PAGE_FILE;
204}
205
206#define pte_special(pte) (0) 192#define pte_special(pte) (0)
207 193
208static inline pte_t pte_wrprotect(pte_t pte) 194static inline pte_t pte_wrprotect(pte_t pte)
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 0f09f5285d5e..eb4ef274ae9b 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -1,7 +1,7 @@
1config SUPERH 1config SUPERH
2 def_bool y 2 def_bool y
3 select ARCH_MIGHT_HAVE_PC_PARPORT 3 select ARCH_MIGHT_HAVE_PC_PARPORT
4 select EXPERT 4 select HAVE_PATA_PLATFORM
5 select CLKDEV_LOOKUP 5 select CLKDEV_LOOKUP
6 select HAVE_IDE if HAS_IOPORT_MAP 6 select HAVE_IDE if HAS_IOPORT_MAP
7 select HAVE_MEMBLOCK 7 select HAVE_MEMBLOCK
diff --git a/arch/sh/boards/mach-se/7343/irq.c b/arch/sh/boards/mach-se/7343/irq.c
index 7646bf0486c2..1087dba9b015 100644
--- a/arch/sh/boards/mach-se/7343/irq.c
+++ b/arch/sh/boards/mach-se/7343/irq.c
@@ -14,9 +14,6 @@
14#define DRV_NAME "SE7343-FPGA" 14#define DRV_NAME "SE7343-FPGA"
15#define pr_fmt(fmt) DRV_NAME ": " fmt 15#define pr_fmt(fmt) DRV_NAME ": " fmt
16 16
17#define irq_reg_readl ioread16
18#define irq_reg_writel iowrite16
19
20#include <linux/init.h> 17#include <linux/init.h>
21#include <linux/irq.h> 18#include <linux/irq.h>
22#include <linux/interrupt.h> 19#include <linux/interrupt.h>
diff --git a/arch/sh/boards/mach-se/7722/irq.c b/arch/sh/boards/mach-se/7722/irq.c
index f5e2af1bf040..00e699232621 100644
--- a/arch/sh/boards/mach-se/7722/irq.c
+++ b/arch/sh/boards/mach-se/7722/irq.c
@@ -11,9 +11,6 @@
11#define DRV_NAME "SE7722-FPGA" 11#define DRV_NAME "SE7722-FPGA"
12#define pr_fmt(fmt) DRV_NAME ": " fmt 12#define pr_fmt(fmt) DRV_NAME ": " fmt
13 13
14#define irq_reg_readl ioread16
15#define irq_reg_writel iowrite16
16
17#include <linux/init.h> 14#include <linux/init.h>
18#include <linux/irq.h> 15#include <linux/irq.h>
19#include <linux/interrupt.h> 16#include <linux/interrupt.h>
diff --git a/arch/sh/include/asm/pgtable_32.h b/arch/sh/include/asm/pgtable_32.h
index 0bce3d81569e..c646e563abce 100644
--- a/arch/sh/include/asm/pgtable_32.h
+++ b/arch/sh/include/asm/pgtable_32.h
@@ -26,8 +26,6 @@
26 * and timing control which (together with bit 0) are moved into the 26 * and timing control which (together with bit 0) are moved into the
27 * old-style PTEA on the parts that support it. 27 * old-style PTEA on the parts that support it.
28 * 28 *
29 * XXX: Leave the _PAGE_FILE and _PAGE_WT overhaul for a rainy day.
30 *
31 * SH-X2 MMUs and extended PTEs 29 * SH-X2 MMUs and extended PTEs
32 * 30 *
33 * SH-X2 supports an extended mode TLB with split data arrays due to the 31 * SH-X2 supports an extended mode TLB with split data arrays due to the
@@ -51,7 +49,6 @@
51#define _PAGE_PRESENT 0x100 /* V-bit : page is valid */ 49#define _PAGE_PRESENT 0x100 /* V-bit : page is valid */
52#define _PAGE_PROTNONE 0x200 /* software: if not present */ 50#define _PAGE_PROTNONE 0x200 /* software: if not present */
53#define _PAGE_ACCESSED 0x400 /* software: page referenced */ 51#define _PAGE_ACCESSED 0x400 /* software: page referenced */
54#define _PAGE_FILE _PAGE_WT /* software: pagecache or swap? */
55#define _PAGE_SPECIAL 0x800 /* software: special page */ 52#define _PAGE_SPECIAL 0x800 /* software: special page */
56 53
57#define _PAGE_SZ_MASK (_PAGE_SZ0 | _PAGE_SZ1) 54#define _PAGE_SZ_MASK (_PAGE_SZ0 | _PAGE_SZ1)
@@ -105,14 +102,13 @@ static inline unsigned long copy_ptea_attributes(unsigned long x)
105/* Mask which drops unused bits from the PTEL value */ 102/* Mask which drops unused bits from the PTEL value */
106#if defined(CONFIG_CPU_SH3) 103#if defined(CONFIG_CPU_SH3)
107#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED| \ 104#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED| \
108 _PAGE_FILE | _PAGE_SZ1 | \ 105 _PAGE_SZ1 | _PAGE_HW_SHARED)
109 _PAGE_HW_SHARED)
110#elif defined(CONFIG_X2TLB) 106#elif defined(CONFIG_X2TLB)
111/* Get rid of the legacy PR/SZ bits when using extended mode */ 107/* Get rid of the legacy PR/SZ bits when using extended mode */
112#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED | \ 108#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED | \
113 _PAGE_FILE | _PAGE_PR_MASK | _PAGE_SZ_MASK) 109 _PAGE_PR_MASK | _PAGE_SZ_MASK)
114#else 110#else
115#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED | _PAGE_FILE) 111#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED)
116#endif 112#endif
117 113
118#define _PAGE_FLAGS_HARDWARE_MASK (phys_addr_mask() & ~(_PAGE_CLEAR_FLAGS)) 114#define _PAGE_FLAGS_HARDWARE_MASK (phys_addr_mask() & ~(_PAGE_CLEAR_FLAGS))
@@ -343,7 +339,6 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
343#define pte_not_present(pte) (!((pte).pte_low & _PAGE_PRESENT)) 339#define pte_not_present(pte) (!((pte).pte_low & _PAGE_PRESENT))
344#define pte_dirty(pte) ((pte).pte_low & _PAGE_DIRTY) 340#define pte_dirty(pte) ((pte).pte_low & _PAGE_DIRTY)
345#define pte_young(pte) ((pte).pte_low & _PAGE_ACCESSED) 341#define pte_young(pte) ((pte).pte_low & _PAGE_ACCESSED)
346#define pte_file(pte) ((pte).pte_low & _PAGE_FILE)
347#define pte_special(pte) ((pte).pte_low & _PAGE_SPECIAL) 342#define pte_special(pte) ((pte).pte_low & _PAGE_SPECIAL)
348 343
349#ifdef CONFIG_X2TLB 344#ifdef CONFIG_X2TLB
@@ -445,7 +440,6 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
445 * Encode and de-code a swap entry 440 * Encode and de-code a swap entry
446 * 441 *
447 * Constraints: 442 * Constraints:
448 * _PAGE_FILE at bit 0
449 * _PAGE_PRESENT at bit 8 443 * _PAGE_PRESENT at bit 8
450 * _PAGE_PROTNONE at bit 9 444 * _PAGE_PROTNONE at bit 9
451 * 445 *
@@ -453,9 +447,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
453 * swap offset into bits 10:30. For the 64-bit PTE case, we keep the 447 * swap offset into bits 10:30. For the 64-bit PTE case, we keep the
454 * preserved bits in the low 32-bits and use the upper 32 as the swap 448 * preserved bits in the low 32-bits and use the upper 32 as the swap
455 * offset (along with a 5-bit type), following the same approach as x86 449 * offset (along with a 5-bit type), following the same approach as x86
456 * PAE. This keeps the logic quite simple, and allows for a full 32 450 * PAE. This keeps the logic quite simple.
457 * PTE_FILE_MAX_BITS, as opposed to the 29-bits we're constrained with
458 * in the pte_low case.
459 * 451 *
460 * As is evident by the Alpha code, if we ever get a 64-bit unsigned 452 * As is evident by the Alpha code, if we ever get a 64-bit unsigned
461 * long (swp_entry_t) to match up with the 64-bit PTEs, this all becomes 453 * long (swp_entry_t) to match up with the 64-bit PTEs, this all becomes
@@ -471,13 +463,6 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
471#define __pte_to_swp_entry(pte) ((swp_entry_t){ (pte).pte_high }) 463#define __pte_to_swp_entry(pte) ((swp_entry_t){ (pte).pte_high })
472#define __swp_entry_to_pte(x) ((pte_t){ 0, (x).val }) 464#define __swp_entry_to_pte(x) ((pte_t){ 0, (x).val })
473 465
474/*
475 * Encode and decode a nonlinear file mapping entry
476 */
477#define pte_to_pgoff(pte) ((pte).pte_high)
478#define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) })
479
480#define PTE_FILE_MAX_BITS 32
481#else 466#else
482#define __swp_type(x) ((x).val & 0xff) 467#define __swp_type(x) ((x).val & 0xff)
483#define __swp_offset(x) ((x).val >> 10) 468#define __swp_offset(x) ((x).val >> 10)
@@ -485,13 +470,6 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
485 470
486#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> 1 }) 471#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> 1 })
487#define __swp_entry_to_pte(x) ((pte_t) { (x).val << 1 }) 472#define __swp_entry_to_pte(x) ((pte_t) { (x).val << 1 })
488
489/*
490 * Encode and decode a nonlinear file mapping entry
491 */
492#define PTE_FILE_MAX_BITS 29
493#define pte_to_pgoff(pte) (pte_val(pte) >> 1)
494#define pgoff_to_pte(off) ((pte_t) { ((off) << 1) | _PAGE_FILE })
495#endif 473#endif
496 474
497#endif /* __ASSEMBLY__ */ 475#endif /* __ASSEMBLY__ */
diff --git a/arch/sh/include/asm/pgtable_64.h b/arch/sh/include/asm/pgtable_64.h
index dda8c82601b9..07424968df62 100644
--- a/arch/sh/include/asm/pgtable_64.h
+++ b/arch/sh/include/asm/pgtable_64.h
@@ -107,7 +107,6 @@ static __inline__ void set_pte(pte_t *pteptr, pte_t pteval)
107#define _PAGE_DEVICE 0x001 /* CB0: if uncacheable, 1->device (i.e. no write-combining or reordering at bus level) */ 107#define _PAGE_DEVICE 0x001 /* CB0: if uncacheable, 1->device (i.e. no write-combining or reordering at bus level) */
108#define _PAGE_CACHABLE 0x002 /* CB1: uncachable/cachable */ 108#define _PAGE_CACHABLE 0x002 /* CB1: uncachable/cachable */
109#define _PAGE_PRESENT 0x004 /* software: page referenced */ 109#define _PAGE_PRESENT 0x004 /* software: page referenced */
110#define _PAGE_FILE 0x004 /* software: only when !present */
111#define _PAGE_SIZE0 0x008 /* SZ0-bit : size of page */ 110#define _PAGE_SIZE0 0x008 /* SZ0-bit : size of page */
112#define _PAGE_SIZE1 0x010 /* SZ1-bit : size of page */ 111#define _PAGE_SIZE1 0x010 /* SZ1-bit : size of page */
113#define _PAGE_SHARED 0x020 /* software: reflects PTEH's SH */ 112#define _PAGE_SHARED 0x020 /* software: reflects PTEH's SH */
@@ -129,7 +128,7 @@ static __inline__ void set_pte(pte_t *pteptr, pte_t pteval)
129#define _PAGE_WIRED _PAGE_EXT(0x001) /* software: wire the tlb entry */ 128#define _PAGE_WIRED _PAGE_EXT(0x001) /* software: wire the tlb entry */
130#define _PAGE_SPECIAL _PAGE_EXT(0x002) 129#define _PAGE_SPECIAL _PAGE_EXT(0x002)
131 130
132#define _PAGE_CLEAR_FLAGS (_PAGE_PRESENT | _PAGE_FILE | _PAGE_SHARED | \ 131#define _PAGE_CLEAR_FLAGS (_PAGE_PRESENT | _PAGE_SHARED | \
133 _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_WIRED) 132 _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_WIRED)
134 133
135/* Mask which drops software flags */ 134/* Mask which drops software flags */
@@ -260,7 +259,6 @@ static __inline__ void set_pte(pte_t *pteptr, pte_t pteval)
260 */ 259 */
261static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 260static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
262static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 261static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
263static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
264static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } 262static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
265static inline int pte_special(pte_t pte){ return pte_val(pte) & _PAGE_SPECIAL; } 263static inline int pte_special(pte_t pte){ return pte_val(pte) & _PAGE_SPECIAL; }
266 264
@@ -304,11 +302,6 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
304#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 302#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
305#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 303#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
306 304
307/* Encode and decode a nonlinear file mapping entry */
308#define PTE_FILE_MAX_BITS 29
309#define pte_to_pgoff(pte) (pte_val(pte))
310#define pgoff_to_pte(off) ((pte_t) { (off) | _PAGE_FILE })
311
312#endif /* !__ASSEMBLY__ */ 305#endif /* !__ASSEMBLY__ */
313 306
314#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) 307#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h
index b9b91ae19fe1..b2f7dc46a7d1 100644
--- a/arch/sparc/include/asm/pgtable_32.h
+++ b/arch/sparc/include/asm/pgtable_32.h
@@ -221,14 +221,6 @@ static inline int pte_young(pte_t pte)
221 return pte_val(pte) & SRMMU_REF; 221 return pte_val(pte) & SRMMU_REF;
222} 222}
223 223
224/*
225 * The following only work if pte_present() is not true.
226 */
227static inline int pte_file(pte_t pte)
228{
229 return pte_val(pte) & SRMMU_FILE;
230}
231
232static inline int pte_special(pte_t pte) 224static inline int pte_special(pte_t pte)
233{ 225{
234 return 0; 226 return 0;
@@ -375,22 +367,6 @@ static inline swp_entry_t __swp_entry(unsigned long type, unsigned long offset)
375#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 367#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
376#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 368#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
377 369
378/* file-offset-in-pte helpers */
379static inline unsigned long pte_to_pgoff(pte_t pte)
380{
381 return pte_val(pte) >> SRMMU_PTE_FILE_SHIFT;
382}
383
384static inline pte_t pgoff_to_pte(unsigned long pgoff)
385{
386 return __pte((pgoff << SRMMU_PTE_FILE_SHIFT) | SRMMU_FILE);
387}
388
389/*
390 * This is made a constant because mm/fremap.c required a constant.
391 */
392#define PTE_FILE_MAX_BITS 24
393
394static inline unsigned long 370static inline unsigned long
395__get_phys (unsigned long addr) 371__get_phys (unsigned long addr)
396{ 372{
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
index 1ff9e7864168..2ac7873ad6fd 100644
--- a/arch/sparc/include/asm/pgtable_64.h
+++ b/arch/sparc/include/asm/pgtable_64.h
@@ -137,7 +137,6 @@ bool kern_addr_valid(unsigned long addr);
137#define _PAGE_SOFT_4U _AC(0x0000000000001F80,UL) /* Software bits: */ 137#define _PAGE_SOFT_4U _AC(0x0000000000001F80,UL) /* Software bits: */
138#define _PAGE_EXEC_4U _AC(0x0000000000001000,UL) /* Executable SW bit */ 138#define _PAGE_EXEC_4U _AC(0x0000000000001000,UL) /* Executable SW bit */
139#define _PAGE_MODIFIED_4U _AC(0x0000000000000800,UL) /* Modified (dirty) */ 139#define _PAGE_MODIFIED_4U _AC(0x0000000000000800,UL) /* Modified (dirty) */
140#define _PAGE_FILE_4U _AC(0x0000000000000800,UL) /* Pagecache page */
141#define _PAGE_ACCESSED_4U _AC(0x0000000000000400,UL) /* Accessed (ref'd) */ 140#define _PAGE_ACCESSED_4U _AC(0x0000000000000400,UL) /* Accessed (ref'd) */
142#define _PAGE_READ_4U _AC(0x0000000000000200,UL) /* Readable SW Bit */ 141#define _PAGE_READ_4U _AC(0x0000000000000200,UL) /* Readable SW Bit */
143#define _PAGE_WRITE_4U _AC(0x0000000000000100,UL) /* Writable SW Bit */ 142#define _PAGE_WRITE_4U _AC(0x0000000000000100,UL) /* Writable SW Bit */
@@ -167,7 +166,6 @@ bool kern_addr_valid(unsigned long addr);
167#define _PAGE_EXEC_4V _AC(0x0000000000000080,UL) /* Executable Page */ 166#define _PAGE_EXEC_4V _AC(0x0000000000000080,UL) /* Executable Page */
168#define _PAGE_W_4V _AC(0x0000000000000040,UL) /* Writable */ 167#define _PAGE_W_4V _AC(0x0000000000000040,UL) /* Writable */
169#define _PAGE_SOFT_4V _AC(0x0000000000000030,UL) /* Software bits */ 168#define _PAGE_SOFT_4V _AC(0x0000000000000030,UL) /* Software bits */
170#define _PAGE_FILE_4V _AC(0x0000000000000020,UL) /* Pagecache page */
171#define _PAGE_PRESENT_4V _AC(0x0000000000000010,UL) /* Present */ 169#define _PAGE_PRESENT_4V _AC(0x0000000000000010,UL) /* Present */
172#define _PAGE_RESV_4V _AC(0x0000000000000008,UL) /* Reserved */ 170#define _PAGE_RESV_4V _AC(0x0000000000000008,UL) /* Reserved */
173#define _PAGE_SZ16GB_4V _AC(0x0000000000000007,UL) /* 16GB Page */ 171#define _PAGE_SZ16GB_4V _AC(0x0000000000000007,UL) /* 16GB Page */
@@ -332,22 +330,6 @@ static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
332} 330}
333#endif 331#endif
334 332
335static inline pte_t pgoff_to_pte(unsigned long off)
336{
337 off <<= PAGE_SHIFT;
338
339 __asm__ __volatile__(
340 "\n661: or %0, %2, %0\n"
341 " .section .sun4v_1insn_patch, \"ax\"\n"
342 " .word 661b\n"
343 " or %0, %3, %0\n"
344 " .previous\n"
345 : "=r" (off)
346 : "0" (off), "i" (_PAGE_FILE_4U), "i" (_PAGE_FILE_4V));
347
348 return __pte(off);
349}
350
351static inline pgprot_t pgprot_noncached(pgprot_t prot) 333static inline pgprot_t pgprot_noncached(pgprot_t prot)
352{ 334{
353 unsigned long val = pgprot_val(prot); 335 unsigned long val = pgprot_val(prot);
@@ -609,22 +591,6 @@ static inline unsigned long pte_exec(pte_t pte)
609 return (pte_val(pte) & mask); 591 return (pte_val(pte) & mask);
610} 592}
611 593
612static inline unsigned long pte_file(pte_t pte)
613{
614 unsigned long val = pte_val(pte);
615
616 __asm__ __volatile__(
617 "\n661: and %0, %2, %0\n"
618 " .section .sun4v_1insn_patch, \"ax\"\n"
619 " .word 661b\n"
620 " and %0, %3, %0\n"
621 " .previous\n"
622 : "=r" (val)
623 : "0" (val), "i" (_PAGE_FILE_4U), "i" (_PAGE_FILE_4V));
624
625 return val;
626}
627
628static inline unsigned long pte_present(pte_t pte) 594static inline unsigned long pte_present(pte_t pte)
629{ 595{
630 unsigned long val = pte_val(pte); 596 unsigned long val = pte_val(pte);
@@ -971,12 +937,6 @@ pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp);
971#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 937#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
972#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 938#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
973 939
974/* File offset in PTE support. */
975unsigned long pte_file(pte_t);
976#define pte_to_pgoff(pte) (pte_val(pte) >> PAGE_SHIFT)
977pte_t pgoff_to_pte(unsigned long);
978#define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL)
979
980int page_in_phys_avail(unsigned long paddr); 940int page_in_phys_avail(unsigned long paddr);
981 941
982/* 942/*
diff --git a/arch/sparc/include/asm/pgtsrmmu.h b/arch/sparc/include/asm/pgtsrmmu.h
index 79da17866fa8..ae51a111a8c7 100644
--- a/arch/sparc/include/asm/pgtsrmmu.h
+++ b/arch/sparc/include/asm/pgtsrmmu.h
@@ -80,10 +80,6 @@
80#define SRMMU_PRIV 0x1c 80#define SRMMU_PRIV 0x1c
81#define SRMMU_PRIV_RDONLY 0x18 81#define SRMMU_PRIV_RDONLY 0x18
82 82
83#define SRMMU_FILE 0x40 /* Implemented in software */
84
85#define SRMMU_PTE_FILE_SHIFT 8 /* == 32-PTE_FILE_MAX_BITS */
86
87#define SRMMU_CHG_MASK (0xffffff00 | SRMMU_REF | SRMMU_DIRTY) 83#define SRMMU_CHG_MASK (0xffffff00 | SRMMU_REF | SRMMU_DIRTY)
88 84
89/* SRMMU swap entry encoding 85/* SRMMU swap entry encoding
@@ -94,13 +90,13 @@
94 * oooooooooooooooooootttttRRRRRRRR 90 * oooooooooooooooooootttttRRRRRRRR
95 * fedcba9876543210fedcba9876543210 91 * fedcba9876543210fedcba9876543210
96 * 92 *
97 * The bottom 8 bits are reserved for protection and status bits, especially 93 * The bottom 7 bits are reserved for protection and status bits, especially
98 * FILE and PRESENT. 94 * PRESENT.
99 */ 95 */
100#define SRMMU_SWP_TYPE_MASK 0x1f 96#define SRMMU_SWP_TYPE_MASK 0x1f
101#define SRMMU_SWP_TYPE_SHIFT SRMMU_PTE_FILE_SHIFT 97#define SRMMU_SWP_TYPE_SHIFT 7
102#define SRMMU_SWP_OFF_MASK 0x7ffff 98#define SRMMU_SWP_OFF_MASK 0xfffff
103#define SRMMU_SWP_OFF_SHIFT (SRMMU_PTE_FILE_SHIFT + 5) 99#define SRMMU_SWP_OFF_SHIFT (SRMMU_SWP_TYPE_SHIFT + 5)
104 100
105/* Some day I will implement true fine grained access bits for 101/* Some day I will implement true fine grained access bits for
106 * user pages because the SRMMU gives us the capabilities to 102 * user pages because the SRMMU gives us the capabilities to
diff --git a/arch/tile/include/asm/pgtable.h b/arch/tile/include/asm/pgtable.h
index 5d1950788c69..bc75b6ef2e79 100644
--- a/arch/tile/include/asm/pgtable.h
+++ b/arch/tile/include/asm/pgtable.h
@@ -285,17 +285,6 @@ extern void start_mm_caching(struct mm_struct *mm);
285extern void check_mm_caching(struct mm_struct *prev, struct mm_struct *next); 285extern void check_mm_caching(struct mm_struct *prev, struct mm_struct *next);
286 286
287/* 287/*
288 * Support non-linear file mappings (see sys_remap_file_pages).
289 * This is defined by CLIENT1 set but CLIENT0 and _PAGE_PRESENT clear, and the
290 * file offset in the 32 high bits.
291 */
292#define _PAGE_FILE HV_PTE_CLIENT1
293#define PTE_FILE_MAX_BITS 32
294#define pte_file(pte) (hv_pte_get_client1(pte) && !hv_pte_get_client0(pte))
295#define pte_to_pgoff(pte) ((pte).val >> 32)
296#define pgoff_to_pte(off) ((pte_t) { (((long long)(off)) << 32) | _PAGE_FILE })
297
298/*
299 * Encode and de-code a swap entry (see <linux/swapops.h>). 288 * Encode and de-code a swap entry (see <linux/swapops.h>).
300 * We put the swap file type+offset in the 32 high bits; 289 * We put the swap file type+offset in the 32 high bits;
301 * I believe we can just leave the low bits clear. 290 * I believe we can just leave the low bits clear.
diff --git a/arch/tile/mm/homecache.c b/arch/tile/mm/homecache.c
index cd3387370ebb..0029b3fb651b 100644
--- a/arch/tile/mm/homecache.c
+++ b/arch/tile/mm/homecache.c
@@ -263,10 +263,6 @@ static int pte_to_home(pte_t pte)
263/* Update the home of a PTE if necessary (can also be used for a pgprot_t). */ 263/* Update the home of a PTE if necessary (can also be used for a pgprot_t). */
264pte_t pte_set_home(pte_t pte, int home) 264pte_t pte_set_home(pte_t pte, int home)
265{ 265{
266 /* Check for non-linear file mapping "PTEs" and pass them through. */
267 if (pte_file(pte))
268 return pte;
269
270#if CHIP_HAS_MMIO() 266#if CHIP_HAS_MMIO()
271 /* Check for MMIO mappings and pass them through. */ 267 /* Check for MMIO mappings and pass them through. */
272 if (hv_pte_get_mode(pte) == HV_PTE_MODE_MMIO) 268 if (hv_pte_get_mode(pte) == HV_PTE_MODE_MMIO)
diff --git a/arch/um/include/asm/pgtable-2level.h b/arch/um/include/asm/pgtable-2level.h
index f534b73e753e..7afe86035fa7 100644
--- a/arch/um/include/asm/pgtable-2level.h
+++ b/arch/um/include/asm/pgtable-2level.h
@@ -41,13 +41,4 @@ static inline void pgd_mkuptodate(pgd_t pgd) { }
41#define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot)) 41#define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot))
42#define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot)) 42#define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot))
43 43
44/*
45 * Bits 0 through 4 are taken
46 */
47#define PTE_FILE_MAX_BITS 27
48
49#define pte_to_pgoff(pte) (pte_val(pte) >> 5)
50
51#define pgoff_to_pte(off) ((pte_t) { ((off) << 5) + _PAGE_FILE })
52
53#endif 44#endif
diff --git a/arch/um/include/asm/pgtable-3level.h b/arch/um/include/asm/pgtable-3level.h
index 0032f9212e74..344c559c0a17 100644
--- a/arch/um/include/asm/pgtable-3level.h
+++ b/arch/um/include/asm/pgtable-3level.h
@@ -112,25 +112,5 @@ static inline pmd_t pfn_pmd(pfn_t page_nr, pgprot_t pgprot)
112 return __pmd((page_nr << PAGE_SHIFT) | pgprot_val(pgprot)); 112 return __pmd((page_nr << PAGE_SHIFT) | pgprot_val(pgprot));
113} 113}
114 114
115/*
116 * Bits 0 through 3 are taken in the low part of the pte,
117 * put the 32 bits of offset into the high part.
118 */
119#define PTE_FILE_MAX_BITS 32
120
121#ifdef CONFIG_64BIT
122
123#define pte_to_pgoff(p) ((p).pte >> 32)
124
125#define pgoff_to_pte(off) ((pte_t) { ((off) << 32) | _PAGE_FILE })
126
127#else
128
129#define pte_to_pgoff(pte) ((pte).pte_high)
130
131#define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) })
132
133#endif
134
135#endif 115#endif
136 116
diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h
index bf974f712af7..2324b624f195 100644
--- a/arch/um/include/asm/pgtable.h
+++ b/arch/um/include/asm/pgtable.h
@@ -18,7 +18,6 @@
18#define _PAGE_ACCESSED 0x080 18#define _PAGE_ACCESSED 0x080
19#define _PAGE_DIRTY 0x100 19#define _PAGE_DIRTY 0x100
20/* If _PAGE_PRESENT is clear, we use these: */ 20/* If _PAGE_PRESENT is clear, we use these: */
21#define _PAGE_FILE 0x008 /* nonlinear file mapping, saved PTE; unset:swap */
22#define _PAGE_PROTNONE 0x010 /* if the user mapped it with PROT_NONE; 21#define _PAGE_PROTNONE 0x010 /* if the user mapped it with PROT_NONE;
23 pte_present gives true */ 22 pte_present gives true */
24 23
@@ -151,14 +150,6 @@ static inline int pte_write(pte_t pte)
151 !(pte_get_bits(pte, _PAGE_PROTNONE))); 150 !(pte_get_bits(pte, _PAGE_PROTNONE)));
152} 151}
153 152
154/*
155 * The following only works if pte_present() is not true.
156 */
157static inline int pte_file(pte_t pte)
158{
159 return pte_get_bits(pte, _PAGE_FILE);
160}
161
162static inline int pte_dirty(pte_t pte) 153static inline int pte_dirty(pte_t pte)
163{ 154{
164 return pte_get_bits(pte, _PAGE_DIRTY); 155 return pte_get_bits(pte, _PAGE_DIRTY);
diff --git a/arch/unicore32/include/asm/pgtable-hwdef.h b/arch/unicore32/include/asm/pgtable-hwdef.h
index 7314e859cca0..e37fa471c2be 100644
--- a/arch/unicore32/include/asm/pgtable-hwdef.h
+++ b/arch/unicore32/include/asm/pgtable-hwdef.h
@@ -44,7 +44,6 @@
44#define PTE_TYPE_INVALID (3 << 0) 44#define PTE_TYPE_INVALID (3 << 0)
45 45
46#define PTE_PRESENT (1 << 2) 46#define PTE_PRESENT (1 << 2)
47#define PTE_FILE (1 << 3) /* only when !PRESENT */
48#define PTE_YOUNG (1 << 3) 47#define PTE_YOUNG (1 << 3)
49#define PTE_DIRTY (1 << 4) 48#define PTE_DIRTY (1 << 4)
50#define PTE_CACHEABLE (1 << 5) 49#define PTE_CACHEABLE (1 << 5)
diff --git a/arch/unicore32/include/asm/pgtable.h b/arch/unicore32/include/asm/pgtable.h
index ed6f7d000fba..818d0f5598e3 100644
--- a/arch/unicore32/include/asm/pgtable.h
+++ b/arch/unicore32/include/asm/pgtable.h
@@ -283,20 +283,6 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
283#define MAX_SWAPFILES_CHECK() \ 283#define MAX_SWAPFILES_CHECK() \
284 BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > __SWP_TYPE_BITS) 284 BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > __SWP_TYPE_BITS)
285 285
286/*
287 * Encode and decode a file entry. File entries are stored in the Linux
288 * page tables as follows:
289 *
290 * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
291 * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
292 * <----------------------- offset ----------------------> 1 0 0 0
293 */
294#define pte_file(pte) (pte_val(pte) & PTE_FILE)
295#define pte_to_pgoff(x) (pte_val(x) >> 4)
296#define pgoff_to_pte(x) __pte(((x) << 4) | PTE_FILE)
297
298#define PTE_FILE_MAX_BITS 28
299
300/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ 286/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
301/* FIXME: this is not correct */ 287/* FIXME: this is not correct */
302#define kern_addr_valid(addr) (1) 288#define kern_addr_valid(addr) (1)
diff --git a/arch/x86/include/asm/pgtable-2level.h b/arch/x86/include/asm/pgtable-2level.h
index 206a87fdd22d..fd74a11959de 100644
--- a/arch/x86/include/asm/pgtable-2level.h
+++ b/arch/x86/include/asm/pgtable-2level.h
@@ -62,44 +62,8 @@ static inline unsigned long pte_bitop(unsigned long value, unsigned int rightshi
62 return ((value >> rightshift) & mask) << leftshift; 62 return ((value >> rightshift) & mask) << leftshift;
63} 63}
64 64
65/*
66 * Bits _PAGE_BIT_PRESENT, _PAGE_BIT_FILE and _PAGE_BIT_PROTNONE are taken,
67 * split up the 29 bits of offset into this range.
68 */
69#define PTE_FILE_MAX_BITS 29
70#define PTE_FILE_SHIFT1 (_PAGE_BIT_PRESENT + 1)
71#define PTE_FILE_SHIFT2 (_PAGE_BIT_FILE + 1)
72#define PTE_FILE_SHIFT3 (_PAGE_BIT_PROTNONE + 1)
73#define PTE_FILE_BITS1 (PTE_FILE_SHIFT2 - PTE_FILE_SHIFT1 - 1)
74#define PTE_FILE_BITS2 (PTE_FILE_SHIFT3 - PTE_FILE_SHIFT2 - 1)
75
76#define PTE_FILE_MASK1 ((1U << PTE_FILE_BITS1) - 1)
77#define PTE_FILE_MASK2 ((1U << PTE_FILE_BITS2) - 1)
78
79#define PTE_FILE_LSHIFT2 (PTE_FILE_BITS1)
80#define PTE_FILE_LSHIFT3 (PTE_FILE_BITS1 + PTE_FILE_BITS2)
81
82static __always_inline pgoff_t pte_to_pgoff(pte_t pte)
83{
84 return (pgoff_t)
85 (pte_bitop(pte.pte_low, PTE_FILE_SHIFT1, PTE_FILE_MASK1, 0) +
86 pte_bitop(pte.pte_low, PTE_FILE_SHIFT2, PTE_FILE_MASK2, PTE_FILE_LSHIFT2) +
87 pte_bitop(pte.pte_low, PTE_FILE_SHIFT3, -1UL, PTE_FILE_LSHIFT3));
88}
89
90static __always_inline pte_t pgoff_to_pte(pgoff_t off)
91{
92 return (pte_t){
93 .pte_low =
94 pte_bitop(off, 0, PTE_FILE_MASK1, PTE_FILE_SHIFT1) +
95 pte_bitop(off, PTE_FILE_LSHIFT2, PTE_FILE_MASK2, PTE_FILE_SHIFT2) +
96 pte_bitop(off, PTE_FILE_LSHIFT3, -1UL, PTE_FILE_SHIFT3) +
97 _PAGE_FILE,
98 };
99}
100
101/* Encode and de-code a swap entry */ 65/* Encode and de-code a swap entry */
102#define SWP_TYPE_BITS (_PAGE_BIT_FILE - _PAGE_BIT_PRESENT - 1) 66#define SWP_TYPE_BITS 5
103#define SWP_OFFSET_SHIFT (_PAGE_BIT_PROTNONE + 1) 67#define SWP_OFFSET_SHIFT (_PAGE_BIT_PROTNONE + 1)
104 68
105#define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > SWP_TYPE_BITS) 69#define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > SWP_TYPE_BITS)
diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h
index 81bb91b49a88..cdaa58c9b39e 100644
--- a/arch/x86/include/asm/pgtable-3level.h
+++ b/arch/x86/include/asm/pgtable-3level.h
@@ -176,18 +176,6 @@ static inline pmd_t native_pmdp_get_and_clear(pmd_t *pmdp)
176#define native_pmdp_get_and_clear(xp) native_local_pmdp_get_and_clear(xp) 176#define native_pmdp_get_and_clear(xp) native_local_pmdp_get_and_clear(xp)
177#endif 177#endif
178 178
179/*
180 * Bits 0, 6 and 7 are taken in the low part of the pte,
181 * put the 32 bits of offset into the high part.
182 *
183 * For soft-dirty tracking 11 bit is taken from
184 * the low part of pte as well.
185 */
186#define pte_to_pgoff(pte) ((pte).pte_high)
187#define pgoff_to_pte(off) \
188 ((pte_t) { { .pte_low = _PAGE_FILE, .pte_high = (off) } })
189#define PTE_FILE_MAX_BITS 32
190
191/* Encode and de-code a swap entry */ 179/* Encode and de-code a swap entry */
192#define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > 5) 180#define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > 5)
193#define __swp_type(x) (((x).val) & 0x1f) 181#define __swp_type(x) (((x).val) & 0x1f)
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index e8a5454acc99..0fe03f834fb1 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -115,11 +115,6 @@ static inline int pte_write(pte_t pte)
115 return pte_flags(pte) & _PAGE_RW; 115 return pte_flags(pte) & _PAGE_RW;
116} 116}
117 117
118static inline int pte_file(pte_t pte)
119{
120 return pte_flags(pte) & _PAGE_FILE;
121}
122
123static inline int pte_huge(pte_t pte) 118static inline int pte_huge(pte_t pte)
124{ 119{
125 return pte_flags(pte) & _PAGE_PSE; 120 return pte_flags(pte) & _PAGE_PSE;
@@ -329,21 +324,6 @@ static inline pmd_t pmd_mksoft_dirty(pmd_t pmd)
329 return pmd_set_flags(pmd, _PAGE_SOFT_DIRTY); 324 return pmd_set_flags(pmd, _PAGE_SOFT_DIRTY);
330} 325}
331 326
332static inline pte_t pte_file_clear_soft_dirty(pte_t pte)
333{
334 return pte_clear_flags(pte, _PAGE_SOFT_DIRTY);
335}
336
337static inline pte_t pte_file_mksoft_dirty(pte_t pte)
338{
339 return pte_set_flags(pte, _PAGE_SOFT_DIRTY);
340}
341
342static inline int pte_file_soft_dirty(pte_t pte)
343{
344 return pte_flags(pte) & _PAGE_SOFT_DIRTY;
345}
346
347#endif /* CONFIG_HAVE_ARCH_SOFT_DIRTY */ 327#endif /* CONFIG_HAVE_ARCH_SOFT_DIRTY */
348 328
349/* 329/*
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
index 4572b2f30237..e227970f983e 100644
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -133,10 +133,6 @@ static inline int pgd_large(pgd_t pgd) { return 0; }
133/* PUD - Level3 access */ 133/* PUD - Level3 access */
134 134
135/* PMD - Level 2 access */ 135/* PMD - Level 2 access */
136#define pte_to_pgoff(pte) ((pte_val((pte)) & PHYSICAL_PAGE_MASK) >> PAGE_SHIFT)
137#define pgoff_to_pte(off) ((pte_t) { .pte = ((off) << PAGE_SHIFT) | \
138 _PAGE_FILE })
139#define PTE_FILE_MAX_BITS __PHYSICAL_MASK_SHIFT
140 136
141/* PTE - Level 1 access. */ 137/* PTE - Level 1 access. */
142 138
@@ -145,7 +141,7 @@ static inline int pgd_large(pgd_t pgd) { return 0; }
145#define pte_unmap(pte) ((void)(pte))/* NOP */ 141#define pte_unmap(pte) ((void)(pte))/* NOP */
146 142
147/* Encode and de-code a swap entry */ 143/* Encode and de-code a swap entry */
148#define SWP_TYPE_BITS (_PAGE_BIT_FILE - _PAGE_BIT_PRESENT - 1) 144#define SWP_TYPE_BITS 5
149#ifdef CONFIG_NUMA_BALANCING 145#ifdef CONFIG_NUMA_BALANCING
150/* Automatic NUMA balancing needs to be distinguishable from swap entries */ 146/* Automatic NUMA balancing needs to be distinguishable from swap entries */
151#define SWP_OFFSET_SHIFT (_PAGE_BIT_PROTNONE + 2) 147#define SWP_OFFSET_SHIFT (_PAGE_BIT_PROTNONE + 2)
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
index 25bcd4a89517..5185a4f599ec 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -38,8 +38,6 @@
38/* If _PAGE_BIT_PRESENT is clear, we use these: */ 38/* If _PAGE_BIT_PRESENT is clear, we use these: */
39/* - if the user mapped it with PROT_NONE; pte_present gives true */ 39/* - if the user mapped it with PROT_NONE; pte_present gives true */
40#define _PAGE_BIT_PROTNONE _PAGE_BIT_GLOBAL 40#define _PAGE_BIT_PROTNONE _PAGE_BIT_GLOBAL
41/* - set: nonlinear file mapping, saved PTE; unset:swap */
42#define _PAGE_BIT_FILE _PAGE_BIT_DIRTY
43 41
44#define _PAGE_PRESENT (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT) 42#define _PAGE_PRESENT (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT)
45#define _PAGE_RW (_AT(pteval_t, 1) << _PAGE_BIT_RW) 43#define _PAGE_RW (_AT(pteval_t, 1) << _PAGE_BIT_RW)
@@ -114,7 +112,6 @@
114#define _PAGE_NX (_AT(pteval_t, 0)) 112#define _PAGE_NX (_AT(pteval_t, 0))
115#endif 113#endif
116 114
117#define _PAGE_FILE (_AT(pteval_t, 1) << _PAGE_BIT_FILE)
118#define _PAGE_PROTNONE (_AT(pteval_t, 1) << _PAGE_BIT_PROTNONE) 115#define _PAGE_PROTNONE (_AT(pteval_t, 1) << _PAGE_BIT_PROTNONE)
119 116
120#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \ 117#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \
diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c
index 8b977ebf9388..bca0aa3a003f 100644
--- a/arch/x86/mm/hugetlbpage.c
+++ b/arch/x86/mm/hugetlbpage.c
@@ -178,4 +178,15 @@ static __init int setup_hugepagesz(char *opt)
178 return 1; 178 return 1;
179} 179}
180__setup("hugepagesz=", setup_hugepagesz); 180__setup("hugepagesz=", setup_hugepagesz);
181
182#ifdef CONFIG_CMA
183static __init int gigantic_pages_init(void)
184{
185 /* With CMA we can allocate gigantic pages at runtime */
186 if (cpu_has_gbpages && !size_to_hstate(1UL << PUD_SHIFT))
187 hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT);
188 return 0;
189}
190arch_initcall(gigantic_pages_init);
191#endif
181#endif 192#endif
diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h
index 872bf0194e6d..01b80dce9d65 100644
--- a/arch/xtensa/include/asm/pgtable.h
+++ b/arch/xtensa/include/asm/pgtable.h
@@ -89,8 +89,6 @@
89 * (PAGE_NONE)| PPN | 0 | 00 | ADW | 01 | 11 | 11 | 89 * (PAGE_NONE)| PPN | 0 | 00 | ADW | 01 | 11 | 11 |
90 * +-----------------------------------------+ 90 * +-----------------------------------------+
91 * swap | index | type | 01 | 11 | 00 | 91 * swap | index | type | 01 | 11 | 00 |
92 * +- - - - - - - - - - - - - - - - - - - - -+
93 * file | file offset | 01 | 11 | 10 |
94 * +-----------------------------------------+ 92 * +-----------------------------------------+
95 * 93 *
96 * For T1050 hardware and earlier the layout differs for present and (PAGE_NONE) 94 * For T1050 hardware and earlier the layout differs for present and (PAGE_NONE)
@@ -111,7 +109,6 @@
111 * index swap offset / PAGE_SIZE (bit 11-31: 21 bits -> 8 GB) 109 * index swap offset / PAGE_SIZE (bit 11-31: 21 bits -> 8 GB)
112 * (note that the index is always non-zero) 110 * (note that the index is always non-zero)
113 * type swap type (5 bits -> 32 types) 111 * type swap type (5 bits -> 32 types)
114 * file offset 26-bit offset into the file, in increments of PAGE_SIZE
115 * 112 *
116 * Notes: 113 * Notes:
117 * - (PROT_NONE) is a special case of 'present' but causes an exception for 114 * - (PROT_NONE) is a special case of 'present' but causes an exception for
@@ -144,7 +141,6 @@
144#define _PAGE_HW_VALID 0x00 141#define _PAGE_HW_VALID 0x00
145#define _PAGE_NONE 0x0f 142#define _PAGE_NONE 0x0f
146#endif 143#endif
147#define _PAGE_FILE (1<<1) /* file mapped page, only if !present */
148 144
149#define _PAGE_USER (1<<4) /* user access (ring=1) */ 145#define _PAGE_USER (1<<4) /* user access (ring=1) */
150 146
@@ -260,7 +256,6 @@ static inline void pgtable_cache_init(void) { }
260static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITABLE; } 256static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITABLE; }
261static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 257static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
262static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 258static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
263static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
264static inline int pte_special(pte_t pte) { return 0; } 259static inline int pte_special(pte_t pte) { return 0; }
265 260
266static inline pte_t pte_wrprotect(pte_t pte) 261static inline pte_t pte_wrprotect(pte_t pte)
@@ -390,11 +385,6 @@ ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
390#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 385#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
391#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 386#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
392 387
393#define PTE_FILE_MAX_BITS 26
394#define pte_to_pgoff(pte) (pte_val(pte) >> 6)
395#define pgoff_to_pte(off) \
396 ((pte_t) { ((off) << 6) | _PAGE_CA_INVALID | _PAGE_FILE | _PAGE_USER })
397
398#endif /* !defined (__ASSEMBLY__) */ 388#endif /* !defined (__ASSEMBLY__) */
399 389
400 390