]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[ARM] pgtable: rearrange file PTE bit allocation
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Sat, 11 Jul 2009 15:57:20 +0000 (16:57 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 11 Jul 2009 15:59:39 +0000 (16:59 +0100)
For future compatibility, we need to ensure that swap and file Linux
PTEs conform with the hardware PTEs "fault" encoding.  Swap PTEs
already fit in with this, but file PTEs do not.  Shift them by one
bit to ensure that they conform, using bit 2 to distinguish between
swap and file PTEs.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/include/asm/pgtable.h

index d575666d5c469db204d1c863bd5c6417603e0743..9655bce3d345255ae9e6eac29fe02bec8c9af28e 100644 (file)
@@ -162,8 +162,8 @@ extern void __pgd_error(const char *file, int line, unsigned long val);
  * entries are stored 1024 bytes below.
  */
 #define L_PTE_PRESENT          (1 << 0)
-#define L_PTE_FILE             (1 << 1)        /* only when !PRESENT */
 #define L_PTE_YOUNG            (1 << 1)
+#define L_PTE_FILE             (1 << 2)        /* only when !PRESENT */
 #define L_PTE_DIRTY            (1 << 6)
 #define L_PTE_WRITE            (1 << 7)
 #define L_PTE_USER             (1 << 8)
@@ -379,13 +379,13 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
  *
  *   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  *   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
- *   <--------------- offset --------------------> <--- type --> 0 0
+ *   <--------------- offset --------------------> <- type --> 0 0 0
  *
- * This gives us up to 127 swap files and 32GB per swap file.  Note that
+ * This gives us up to 63 swap files and 32GB per swap file.  Note that
  * the offset field is always non-zero.
  */
-#define __SWP_TYPE_SHIFT       2
-#define __SWP_TYPE_BITS                7
+#define __SWP_TYPE_SHIFT       3
+#define __SWP_TYPE_BITS                6
 #define __SWP_TYPE_MASK                ((1 << __SWP_TYPE_BITS) - 1)
 #define __SWP_OFFSET_SHIFT     (__SWP_TYPE_BITS + __SWP_TYPE_SHIFT)
 
@@ -409,13 +409,13 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
  *
  *   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  *   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
- *   <------------------------ offset -------------------------> 1 0
+ *   <----------------------- offset ------------------------> 1 0 0
  */
 #define pte_file(pte)          (pte_val(pte) & L_PTE_FILE)
-#define pte_to_pgoff(x)                (pte_val(x) >> 2)
-#define pgoff_to_pte(x)                __pte(((x) << 2) | L_PTE_FILE)
+#define pte_to_pgoff(x)                (pte_val(x) >> 3)
+#define pgoff_to_pte(x)                __pte(((x) << 3) | L_PTE_FILE)
 
-#define PTE_FILE_MAX_BITS      30
+#define PTE_FILE_MAX_BITS      29
 
 /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
 /* FIXME: this is not correct */