scripts/spelling.txt: add "an one" pattern and fix typo instances
[linux-2.6-block.git] / arch / powerpc / include / asm / book3s / 64 / mmu.h
CommitLineData
11a6f6ab
AK
1#ifndef _ASM_POWERPC_BOOK3S_64_MMU_H_
2#define _ASM_POWERPC_BOOK3S_64_MMU_H_
3
4#ifndef __ASSEMBLY__
5/*
6 * Page size definition
7 *
8 * shift : is the "PAGE_SHIFT" value for that page size
9 * sllp : is a bit mask with the value of SLB L || LP to be or'ed
10 * directly to a slbmte "vsid" value
11 * penc : is the HPTE encoding mask for the "LP" field:
12 *
13 */
14struct mmu_psize_def {
15 unsigned int shift; /* number of bits */
16 int penc[MMU_PAGE_COUNT]; /* HPTE encoding */
17 unsigned int tlbiel; /* tlbiel supported for that page size */
18 unsigned long avpnm; /* bits to mask out in AVPN in the HPTE */
2bfd65e4
AK
19 union {
20 unsigned long sllp; /* SLB L||LP (exact mask to use in slbmte) */
21 unsigned long ap; /* Ap encoding used by PowerISA 3.0 */
22 };
11a6f6ab
AK
23};
24extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
566ca99a 25
11a6f6ab
AK
26#endif /* __ASSEMBLY__ */
27
11a6f6ab
AK
28/* 64-bit classic hash table MMU */
29#include <asm/book3s/64/mmu-hash.h>
11a6f6ab
AK
30
31#ifndef __ASSEMBLY__
e9983344
AK
32/*
33 * ISA 3.0 partiton and process table entry format
34 */
35struct prtb_entry {
36 __be64 prtb0;
37 __be64 prtb1;
38};
39extern struct prtb_entry *process_tb;
40
41struct patb_entry {
42 __be64 patb0;
43 __be64 patb1;
44};
45extern struct patb_entry *partition_tb;
46
dbcbfee0 47/* Bits in patb0 field */
e9983344 48#define PATB_HR (1UL << 63)
e9983344
AK
49#define RPDB_MASK 0x0ffffffffffff00fUL
50#define RPDB_SHIFT (1UL << 8)
dbcbfee0
PM
51#define RTS1_SHIFT 61 /* top 2 bits of radix tree size */
52#define RTS1_MASK (3UL << RTS1_SHIFT)
53#define RTS2_SHIFT 5 /* bottom 3 bits of radix tree size */
54#define RTS2_MASK (7UL << RTS2_SHIFT)
55#define RPDS_MASK 0x1f /* root page dir. size field */
56
57/* Bits in patb1 field */
58#define PATB_GR (1UL << 63) /* guest uses radix; must match HR */
59#define PRTS_MASK 0x1f /* process table size field */
60
e9983344
AK
61/*
62 * Limit process table to PAGE_SIZE table. This
63 * also limit the max pid we can support.
64 * MAX_USER_CONTEXT * 16 bytes of space.
65 */
66#define PRTB_SIZE_SHIFT (CONTEXT_BITS + 4)
67/*
68 * Power9 currently only support 64K partition table size.
69 */
70#define PATB_SIZE_SHIFT 16
11a6f6ab
AK
71
72typedef unsigned long mm_context_id_t;
73struct spinlock;
74
75typedef struct {
76 mm_context_id_t id;
77 u16 user_psize; /* page size index */
78
79#ifdef CONFIG_PPC_MM_SLICES
80 u64 low_slices_psize; /* SLB page size encodings */
81 unsigned char high_slices_psize[SLICE_ARRAY_SIZE];
82#else
83 u16 sllp; /* SLB page size encoding */
84#endif
85 unsigned long vdso_base;
86#ifdef CONFIG_PPC_SUBPAGE_PROT
87 struct subpage_prot_table spt;
88#endif /* CONFIG_PPC_SUBPAGE_PROT */
89#ifdef CONFIG_PPC_ICSWX
90 struct spinlock *cop_lockp; /* guard acop and cop_pid */
91 unsigned long acop; /* mask of enabled coprocessor types */
92 unsigned int cop_pid; /* pid value used with coprocessors */
93#endif /* CONFIG_PPC_ICSWX */
94#ifdef CONFIG_PPC_64K_PAGES
95 /* for 4K PTE fragment support */
96 void *pte_frag;
97#endif
98#ifdef CONFIG_SPAPR_TCE_IOMMU
99 struct list_head iommu_group_mem_list;
100#endif
101} mm_context_t;
102
103/*
104 * The current system page and segment sizes
105 */
106extern int mmu_linear_psize;
107extern int mmu_virtual_psize;
108extern int mmu_vmalloc_psize;
109extern int mmu_vmemmap_psize;
110extern int mmu_io_psize;
111
756d08d1 112/* MMU initialization */
1a01dc87 113void mmu_early_init_devtree(void);
bacf9cf8 114void hash__early_init_devtree(void);
2537b09c 115void radix__early_init_devtree(void);
2bfd65e4 116extern void radix_init_native(void);
756d08d1 117extern void hash__early_init_mmu(void);
2bfd65e4 118extern void radix__early_init_mmu(void);
756d08d1
AK
119static inline void early_init_mmu(void)
120{
2bfd65e4
AK
121 if (radix_enabled())
122 return radix__early_init_mmu();
756d08d1
AK
123 return hash__early_init_mmu();
124}
125extern void hash__early_init_mmu_secondary(void);
2bfd65e4 126extern void radix__early_init_mmu_secondary(void);
756d08d1
AK
127static inline void early_init_mmu_secondary(void)
128{
2bfd65e4
AK
129 if (radix_enabled())
130 return radix__early_init_mmu_secondary();
756d08d1
AK
131 return hash__early_init_mmu_secondary();
132}
133
134extern void hash__setup_initial_memory_limit(phys_addr_t first_memblock_base,
135 phys_addr_t first_memblock_size);
2bfd65e4
AK
136extern void radix__setup_initial_memory_limit(phys_addr_t first_memblock_base,
137 phys_addr_t first_memblock_size);
756d08d1
AK
138static inline void setup_initial_memory_limit(phys_addr_t first_memblock_base,
139 phys_addr_t first_memblock_size)
140{
b8f1b4f8 141 if (early_radix_enabled())
2bfd65e4
AK
142 return radix__setup_initial_memory_limit(first_memblock_base,
143 first_memblock_size);
756d08d1
AK
144 return hash__setup_initial_memory_limit(first_memblock_base,
145 first_memblock_size);
146}
eea8148c
ME
147
148extern int (*register_process_table)(unsigned long base, unsigned long page_size,
149 unsigned long tbl_size);
150
cc3d2940
PM
151#ifdef CONFIG_PPC_PSERIES
152extern void radix_init_pseries(void);
153#else
154static inline void radix_init_pseries(void) { };
155#endif
156
11a6f6ab
AK
157#endif /* __ASSEMBLY__ */
158#endif /* _ASM_POWERPC_BOOK3S_64_MMU_H_ */