diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-03-19 15:34:08 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-03-23 22:47:33 -0400 |
commit | 8d1cf34e7ad5c7738ce20d20bd7f002f562cb8b5 (patch) | |
tree | f731b8b2d3e71e7287bed977bdd7fc9ea6942d45 /arch/powerpc/include/asm/pte-hash64.h | |
parent | 2a7d55fda58eb4e3652252d4f71222bd1ff90c5e (diff) |
powerpc/mm: Tweak PTE bit combination definitions
This patch tweaks the way some PTE bit combinations are defined, in such a
way that the 32 and 64-bit variant become almost identical and that will
make it easier to bring in a new common pte-* file for the new variant
of the Book3-E support.
The combination of bits defining access to kernel pages are now clearly
separated from the combination used by userspace and the core VM. The
resulting generated code should remain identical unless I made a mistake.
Note: While at it, I removed a non-sensical statement related to CONFIG_KGDB
in ppc_mmu_32.c which could cause kernel mappings to be user accessible when
that option is enabled. Probably something that bitrot.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/include/asm/pte-hash64.h')
-rw-r--r-- | arch/powerpc/include/asm/pte-hash64.h | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/arch/powerpc/include/asm/pte-hash64.h b/arch/powerpc/include/asm/pte-hash64.h index 62766636cc1e..b61b7e4a18de 100644 --- a/arch/powerpc/include/asm/pte-hash64.h +++ b/arch/powerpc/include/asm/pte-hash64.h | |||
@@ -6,36 +6,41 @@ | |||
6 | * Common bits between 4K and 64K pages in a linux-style PTE. | 6 | * Common bits between 4K and 64K pages in a linux-style PTE. |
7 | * These match the bits in the (hardware-defined) PowerPC PTE as closely | 7 | * These match the bits in the (hardware-defined) PowerPC PTE as closely |
8 | * as possible. Additional bits may be defined in pgtable-hash64-*.h | 8 | * as possible. Additional bits may be defined in pgtable-hash64-*.h |
9 | * | ||
10 | * Note: We only support user read/write permissions. Supervisor always | ||
11 | * have full read/write to pages above PAGE_OFFSET (pages below that | ||
12 | * always use the user access permissions). | ||
13 | * | ||
14 | * We could create separate kernel read-only if we used the 3 PP bits | ||
15 | * combinations that newer processors provide but we currently don't. | ||
9 | */ | 16 | */ |
10 | #define _PAGE_PRESENT 0x0001 /* software: pte contains a translation */ | 17 | #define _PAGE_PRESENT 0x0001 /* software: pte contains a translation */ |
11 | #define _PAGE_USER 0x0002 /* matches one of the PP bits */ | 18 | #define _PAGE_USER 0x0002 /* matches one of the PP bits */ |
12 | #define _PAGE_FILE 0x0002 /* (!present only) software: pte holds file offset */ | 19 | #define _PAGE_FILE 0x0002 /* (!present only) software: pte holds file offset */ |
13 | #define _PAGE_EXEC 0x0004 /* No execute on POWER4 and newer (we invert) */ | 20 | #define _PAGE_EXEC 0x0004 /* No execute on POWER4 and newer (we invert) */ |
14 | #define _PAGE_GUARDED 0x0008 | 21 | #define _PAGE_GUARDED 0x0008 |
15 | #define _PAGE_COHERENT 0x0010 /* M: enforce memory coherence (SMP systems) */ | 22 | #define _PAGE_COHERENT 0x0010 /* M: enforce memory coherence (SMP systems) */ |
16 | #define _PAGE_NO_CACHE 0x0020 /* I: cache inhibit */ | 23 | #define _PAGE_NO_CACHE 0x0020 /* I: cache inhibit */ |
17 | #define _PAGE_WRITETHRU 0x0040 /* W: cache write-through */ | 24 | #define _PAGE_WRITETHRU 0x0040 /* W: cache write-through */ |
18 | #define _PAGE_DIRTY 0x0080 /* C: page changed */ | 25 | #define _PAGE_DIRTY 0x0080 /* C: page changed */ |
19 | #define _PAGE_ACCESSED 0x0100 /* R: page referenced */ | 26 | #define _PAGE_ACCESSED 0x0100 /* R: page referenced */ |
20 | #define _PAGE_RW 0x0200 /* software: user write access allowed */ | 27 | #define _PAGE_RW 0x0200 /* software: user write access allowed */ |
21 | #define _PAGE_BUSY 0x0800 /* software: PTE & hash are busy */ | 28 | #define _PAGE_BUSY 0x0800 /* software: PTE & hash are busy */ |
29 | |||
30 | /* No separate kernel read-only */ | ||
31 | #define _PAGE_KERNEL_RW (_PAGE_RW | _PAGE_DIRTY) /* user access blocked by key */ | ||
32 | #define _PAGE_KERNEL_RO _PAGE_KERNEL_RW | ||
22 | 33 | ||
23 | /* Strong Access Ordering */ | 34 | /* Strong Access Ordering */ |
24 | #define _PAGE_SAO (_PAGE_WRITETHRU | _PAGE_NO_CACHE | _PAGE_COHERENT) | 35 | #define _PAGE_SAO (_PAGE_WRITETHRU | _PAGE_NO_CACHE | _PAGE_COHERENT) |
25 | 36 | ||
26 | #define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_COHERENT) | 37 | /* No page size encoding in the linux PTE */ |
27 | 38 | #define _PAGE_PSIZE 0 | |
28 | #define _PAGE_WRENABLE (_PAGE_RW | _PAGE_DIRTY) | ||
29 | 39 | ||
30 | /* PTEIDX nibble */ | 40 | /* PTEIDX nibble */ |
31 | #define _PTEIDX_SECONDARY 0x8 | 41 | #define _PTEIDX_SECONDARY 0x8 |
32 | #define _PTEIDX_GROUP_IX 0x7 | 42 | #define _PTEIDX_GROUP_IX 0x7 |
33 | 43 | ||
34 | #define PAGE_PROT_BITS (_PAGE_GUARDED | _PAGE_COHERENT | \ | ||
35 | _PAGE_NO_CACHE | _PAGE_WRITETHRU | \ | ||
36 | _PAGE_4K_PFN | _PAGE_RW | _PAGE_USER | \ | ||
37 | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_EXEC) | ||
38 | |||
39 | 44 | ||
40 | #ifdef CONFIG_PPC_64K_PAGES | 45 | #ifdef CONFIG_PPC_64K_PAGES |
41 | #include <asm/pte-hash64-64k.h> | 46 | #include <asm/pte-hash64-64k.h> |