diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2005-07-13 04:11:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-13 14:25:25 -0400 |
commit | 96e2844999f99878fc5b03b81ccaa60580005b81 (patch) | |
tree | 353c1bc9a5602d556e6741f4a261010cde45e93b /include | |
parent | f13487c66c75f5db004a0631047309d9e7c5aab7 (diff) |
[PATCH] ppc64: kill bitfields in ppc64 hash code
This patch removes the use of bitfield types from the ppc64 hash table
manipulation code.
Signed-off-by: David Gibson <dwg@au1.ibm.com>
Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-ppc64/iSeries/HvCallHpt.h | 11 | ||||
-rw-r--r-- | include/asm-ppc64/machdep.h | 6 | ||||
-rw-r--r-- | include/asm-ppc64/mmu.h | 83 |
3 files changed, 36 insertions, 64 deletions
diff --git a/include/asm-ppc64/iSeries/HvCallHpt.h b/include/asm-ppc64/iSeries/HvCallHpt.h index 66f38222ff75..43a1969230b8 100644 --- a/include/asm-ppc64/iSeries/HvCallHpt.h +++ b/include/asm-ppc64/iSeries/HvCallHpt.h | |||
@@ -77,27 +77,26 @@ static inline u64 HvCallHpt_invalidateSetSwBitsGet(u32 hpteIndex, u8 bitson, | |||
77 | return compressedStatus; | 77 | return compressedStatus; |
78 | } | 78 | } |
79 | 79 | ||
80 | static inline u64 HvCallHpt_findValid(HPTE *hpte, u64 vpn) | 80 | static inline u64 HvCallHpt_findValid(hpte_t *hpte, u64 vpn) |
81 | { | 81 | { |
82 | return HvCall3Ret16(HvCallHptFindValid, hpte, vpn, 0, 0); | 82 | return HvCall3Ret16(HvCallHptFindValid, hpte, vpn, 0, 0); |
83 | } | 83 | } |
84 | 84 | ||
85 | static inline u64 HvCallHpt_findNextValid(HPTE *hpte, u32 hpteIndex, | 85 | static inline u64 HvCallHpt_findNextValid(hpte_t *hpte, u32 hpteIndex, |
86 | u8 bitson, u8 bitsoff) | 86 | u8 bitson, u8 bitsoff) |
87 | { | 87 | { |
88 | return HvCall3Ret16(HvCallHptFindNextValid, hpte, hpteIndex, | 88 | return HvCall3Ret16(HvCallHptFindNextValid, hpte, hpteIndex, |
89 | bitson, bitsoff); | 89 | bitson, bitsoff); |
90 | } | 90 | } |
91 | 91 | ||
92 | static inline void HvCallHpt_get(HPTE *hpte, u32 hpteIndex) | 92 | static inline void HvCallHpt_get(hpte_t *hpte, u32 hpteIndex) |
93 | { | 93 | { |
94 | HvCall2Ret16(HvCallHptGet, hpte, hpteIndex, 0); | 94 | HvCall2Ret16(HvCallHptGet, hpte, hpteIndex, 0); |
95 | } | 95 | } |
96 | 96 | ||
97 | static inline void HvCallHpt_addValidate(u32 hpteIndex, u32 hBit, HPTE *hpte) | 97 | static inline void HvCallHpt_addValidate(u32 hpteIndex, u32 hBit, hpte_t *hpte) |
98 | { | 98 | { |
99 | HvCall4(HvCallHptAddValidate, hpteIndex, hBit, (*((u64 *)hpte)), | 99 | HvCall4(HvCallHptAddValidate, hpteIndex, hBit, hpte->v, hpte->r); |
100 | (*(((u64 *)hpte)+1))); | ||
101 | } | 100 | } |
102 | 101 | ||
103 | #endif /* _HVCALLHPT_H */ | 102 | #endif /* _HVCALLHPT_H */ |
diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h index 1e6ad4824132..f0c1d2d92672 100644 --- a/include/asm-ppc64/machdep.h +++ b/include/asm-ppc64/machdep.h | |||
@@ -53,10 +53,8 @@ struct machdep_calls { | |||
53 | long (*hpte_insert)(unsigned long hpte_group, | 53 | long (*hpte_insert)(unsigned long hpte_group, |
54 | unsigned long va, | 54 | unsigned long va, |
55 | unsigned long prpn, | 55 | unsigned long prpn, |
56 | int secondary, | 56 | unsigned long vflags, |
57 | unsigned long hpteflags, | 57 | unsigned long rflags); |
58 | int bolted, | ||
59 | int large); | ||
60 | long (*hpte_remove)(unsigned long hpte_group); | 58 | long (*hpte_remove)(unsigned long hpte_group); |
61 | void (*flush_hash_range)(unsigned long context, | 59 | void (*flush_hash_range)(unsigned long context, |
62 | unsigned long number, | 60 | unsigned long number, |
diff --git a/include/asm-ppc64/mmu.h b/include/asm-ppc64/mmu.h index f373de5e3dd9..3d07ddd11e3b 100644 --- a/include/asm-ppc64/mmu.h +++ b/include/asm-ppc64/mmu.h | |||
@@ -60,6 +60,22 @@ | |||
60 | 60 | ||
61 | #define HPTES_PER_GROUP 8 | 61 | #define HPTES_PER_GROUP 8 |
62 | 62 | ||
63 | #define HPTE_V_AVPN_SHIFT 7 | ||
64 | #define HPTE_V_AVPN ASM_CONST(0xffffffffffffff80) | ||
65 | #define HPTE_V_AVPN_VAL(x) (((x) & HPTE_V_AVPN) >> HPTE_V_AVPN_SHIFT) | ||
66 | #define HPTE_V_BOLTED ASM_CONST(0x0000000000000010) | ||
67 | #define HPTE_V_LOCK ASM_CONST(0x0000000000000008) | ||
68 | #define HPTE_V_LARGE ASM_CONST(0x0000000000000004) | ||
69 | #define HPTE_V_SECONDARY ASM_CONST(0x0000000000000002) | ||
70 | #define HPTE_V_VALID ASM_CONST(0x0000000000000001) | ||
71 | |||
72 | #define HPTE_R_PP0 ASM_CONST(0x8000000000000000) | ||
73 | #define HPTE_R_TS ASM_CONST(0x4000000000000000) | ||
74 | #define HPTE_R_RPN_SHIFT 12 | ||
75 | #define HPTE_R_RPN ASM_CONST(0x3ffffffffffff000) | ||
76 | #define HPTE_R_FLAGS ASM_CONST(0x00000000000003ff) | ||
77 | #define HPTE_R_PP ASM_CONST(0x0000000000000003) | ||
78 | |||
63 | /* Values for PP (assumes Ks=0, Kp=1) */ | 79 | /* Values for PP (assumes Ks=0, Kp=1) */ |
64 | /* pp0 will always be 0 for linux */ | 80 | /* pp0 will always be 0 for linux */ |
65 | #define PP_RWXX 0 /* Supervisor read/write, User none */ | 81 | #define PP_RWXX 0 /* Supervisor read/write, User none */ |
@@ -69,54 +85,13 @@ | |||
69 | 85 | ||
70 | #ifndef __ASSEMBLY__ | 86 | #ifndef __ASSEMBLY__ |
71 | 87 | ||
72 | /* Hardware Page Table Entry */ | ||
73 | typedef struct { | ||
74 | unsigned long avpn:57; /* vsid | api == avpn */ | ||
75 | unsigned long : 2; /* Software use */ | ||
76 | unsigned long bolted: 1; /* HPTE is "bolted" */ | ||
77 | unsigned long lock: 1; /* lock on pSeries SMP */ | ||
78 | unsigned long l: 1; /* Virtual page is large (L=1) or 4 KB (L=0) */ | ||
79 | unsigned long h: 1; /* Hash function identifier */ | ||
80 | unsigned long v: 1; /* Valid (v=1) or invalid (v=0) */ | ||
81 | } Hpte_dword0; | ||
82 | |||
83 | typedef struct { | ||
84 | unsigned long pp0: 1; /* Page protection bit 0 */ | ||
85 | unsigned long ts: 1; /* Tag set bit */ | ||
86 | unsigned long rpn: 50; /* Real page number */ | ||
87 | unsigned long : 2; /* Reserved */ | ||
88 | unsigned long ac: 1; /* Address compare */ | ||
89 | unsigned long r: 1; /* Referenced */ | ||
90 | unsigned long c: 1; /* Changed */ | ||
91 | unsigned long w: 1; /* Write-thru cache mode */ | ||
92 | unsigned long i: 1; /* Cache inhibited */ | ||
93 | unsigned long m: 1; /* Memory coherence required */ | ||
94 | unsigned long g: 1; /* Guarded */ | ||
95 | unsigned long n: 1; /* No-execute */ | ||
96 | unsigned long pp: 2; /* Page protection bits 1:2 */ | ||
97 | } Hpte_dword1; | ||
98 | |||
99 | typedef struct { | ||
100 | char padding[6]; /* padding */ | ||
101 | unsigned long : 6; /* padding */ | ||
102 | unsigned long flags: 10; /* HPTE flags */ | ||
103 | } Hpte_dword1_flags; | ||
104 | |||
105 | typedef struct { | 88 | typedef struct { |
106 | union { | 89 | unsigned long v; |
107 | unsigned long dword0; | 90 | unsigned long r; |
108 | Hpte_dword0 dw0; | 91 | } hpte_t; |
109 | } dw0; | ||
110 | |||
111 | union { | ||
112 | unsigned long dword1; | ||
113 | Hpte_dword1 dw1; | ||
114 | Hpte_dword1_flags flags; | ||
115 | } dw1; | ||
116 | } HPTE; | ||
117 | 92 | ||
118 | extern HPTE * htab_address; | 93 | extern hpte_t *htab_address; |
119 | extern unsigned long htab_hash_mask; | 94 | extern unsigned long htab_hash_mask; |
120 | 95 | ||
121 | static inline unsigned long hpt_hash(unsigned long vpn, int large) | 96 | static inline unsigned long hpt_hash(unsigned long vpn, int large) |
122 | { | 97 | { |
@@ -181,18 +156,18 @@ static inline void tlbiel(unsigned long va) | |||
181 | asm volatile("ptesync": : :"memory"); | 156 | asm volatile("ptesync": : :"memory"); |
182 | } | 157 | } |
183 | 158 | ||
184 | static inline unsigned long slot2va(unsigned long avpn, unsigned long large, | 159 | static inline unsigned long slot2va(unsigned long hpte_v, unsigned long slot) |
185 | unsigned long secondary, unsigned long slot) | ||
186 | { | 160 | { |
161 | unsigned long avpn = HPTE_V_AVPN_VAL(hpte_v); | ||
187 | unsigned long va; | 162 | unsigned long va; |
188 | 163 | ||
189 | va = avpn << 23; | 164 | va = avpn << 23; |
190 | 165 | ||
191 | if (!large) { | 166 | if (! (hpte_v & HPTE_V_LARGE)) { |
192 | unsigned long vpi, pteg; | 167 | unsigned long vpi, pteg; |
193 | 168 | ||
194 | pteg = slot / HPTES_PER_GROUP; | 169 | pteg = slot / HPTES_PER_GROUP; |
195 | if (secondary) | 170 | if (hpte_v & HPTE_V_SECONDARY) |
196 | pteg = ~pteg; | 171 | pteg = ~pteg; |
197 | 172 | ||
198 | vpi = ((va >> 28) ^ pteg) & htab_hash_mask; | 173 | vpi = ((va >> 28) ^ pteg) & htab_hash_mask; |
@@ -219,11 +194,11 @@ extern void hpte_init_iSeries(void); | |||
219 | 194 | ||
220 | extern long pSeries_lpar_hpte_insert(unsigned long hpte_group, | 195 | extern long pSeries_lpar_hpte_insert(unsigned long hpte_group, |
221 | unsigned long va, unsigned long prpn, | 196 | unsigned long va, unsigned long prpn, |
222 | int secondary, unsigned long hpteflags, | 197 | unsigned long vflags, |
223 | int bolted, int large); | 198 | unsigned long rflags); |
224 | extern long native_hpte_insert(unsigned long hpte_group, unsigned long va, | 199 | extern long native_hpte_insert(unsigned long hpte_group, unsigned long va, |
225 | unsigned long prpn, int secondary, | 200 | unsigned long prpn, |
226 | unsigned long hpteflags, int bolted, int large); | 201 | unsigned long vflags, unsigned long rflags); |
227 | 202 | ||
228 | #endif /* __ASSEMBLY__ */ | 203 | #endif /* __ASSEMBLY__ */ |
229 | 204 | ||