diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2012-09-09 22:52:50 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-09-17 02:31:49 -0400 |
commit | 5524a27d39b68770f203d8d42eb5a95dde4933bc (patch) | |
tree | a238d67d29bce6fd893cd4c5545b5daf058ba5fd /arch/powerpc/platforms | |
parent | dcda287a9b26309ae43a091d0ecde16f8f61b4c0 (diff) |
powerpc/mm: Convert virtual address to vpn
This patch convert different functions to take virtual page number
instead of virtual address. Virtual page number is virtual address
shifted right by VPN_SHIFT (12) bits. This enable us to have an
address range of upto 76 bits.
Reviewed-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r-- | arch/powerpc/platforms/cell/beat_htab.c | 45 | ||||
-rw-r--r-- | arch/powerpc/platforms/ps3/htab.c | 22 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/lpar.c | 76 |
3 files changed, 65 insertions, 78 deletions
diff --git a/arch/powerpc/platforms/cell/beat_htab.c b/arch/powerpc/platforms/cell/beat_htab.c index b83077e13161..0f6f83988b3d 100644 --- a/arch/powerpc/platforms/cell/beat_htab.c +++ b/arch/powerpc/platforms/cell/beat_htab.c | |||
@@ -88,7 +88,7 @@ static inline unsigned int beat_read_mask(unsigned hpte_group) | |||
88 | } | 88 | } |
89 | 89 | ||
90 | static long beat_lpar_hpte_insert(unsigned long hpte_group, | 90 | static long beat_lpar_hpte_insert(unsigned long hpte_group, |
91 | unsigned long va, unsigned long pa, | 91 | unsigned long vpn, unsigned long pa, |
92 | unsigned long rflags, unsigned long vflags, | 92 | unsigned long rflags, unsigned long vflags, |
93 | int psize, int ssize) | 93 | int psize, int ssize) |
94 | { | 94 | { |
@@ -103,7 +103,7 @@ static long beat_lpar_hpte_insert(unsigned long hpte_group, | |||
103 | "rflags=%lx, vflags=%lx, psize=%d)\n", | 103 | "rflags=%lx, vflags=%lx, psize=%d)\n", |
104 | hpte_group, va, pa, rflags, vflags, psize); | 104 | hpte_group, va, pa, rflags, vflags, psize); |
105 | 105 | ||
106 | hpte_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M) | | 106 | hpte_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M) | |
107 | vflags | HPTE_V_VALID; | 107 | vflags | HPTE_V_VALID; |
108 | hpte_r = hpte_encode_r(pa, psize) | rflags; | 108 | hpte_r = hpte_encode_r(pa, psize) | rflags; |
109 | 109 | ||
@@ -184,14 +184,14 @@ static void beat_lpar_hptab_clear(void) | |||
184 | */ | 184 | */ |
185 | static long beat_lpar_hpte_updatepp(unsigned long slot, | 185 | static long beat_lpar_hpte_updatepp(unsigned long slot, |
186 | unsigned long newpp, | 186 | unsigned long newpp, |
187 | unsigned long va, | 187 | unsigned long vpn, |
188 | int psize, int ssize, int local) | 188 | int psize, int ssize, int local) |
189 | { | 189 | { |
190 | unsigned long lpar_rc; | 190 | unsigned long lpar_rc; |
191 | u64 dummy0, dummy1; | 191 | u64 dummy0, dummy1; |
192 | unsigned long want_v; | 192 | unsigned long want_v; |
193 | 193 | ||
194 | want_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M); | 194 | want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M); |
195 | 195 | ||
196 | DBG_LOW(" update: " | 196 | DBG_LOW(" update: " |
197 | "avpnv=%016lx, slot=%016lx, psize: %d, newpp %016lx ... ", | 197 | "avpnv=%016lx, slot=%016lx, psize: %d, newpp %016lx ... ", |
@@ -220,15 +220,15 @@ static long beat_lpar_hpte_updatepp(unsigned long slot, | |||
220 | return 0; | 220 | return 0; |
221 | } | 221 | } |
222 | 222 | ||
223 | static long beat_lpar_hpte_find(unsigned long va, int psize) | 223 | static long beat_lpar_hpte_find(unsigned long vpn, int psize) |
224 | { | 224 | { |
225 | unsigned long hash; | 225 | unsigned long hash; |
226 | unsigned long i, j; | 226 | unsigned long i, j; |
227 | long slot; | 227 | long slot; |
228 | unsigned long want_v, hpte_v; | 228 | unsigned long want_v, hpte_v; |
229 | 229 | ||
230 | hash = hpt_hash(va, mmu_psize_defs[psize].shift, MMU_SEGSIZE_256M); | 230 | hash = hpt_hash(vpn, mmu_psize_defs[psize].shift, MMU_SEGSIZE_256M); |
231 | want_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M); | 231 | want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M); |
232 | 232 | ||
233 | for (j = 0; j < 2; j++) { | 233 | for (j = 0; j < 2; j++) { |
234 | slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; | 234 | slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; |
@@ -255,14 +255,15 @@ static void beat_lpar_hpte_updateboltedpp(unsigned long newpp, | |||
255 | unsigned long ea, | 255 | unsigned long ea, |
256 | int psize, int ssize) | 256 | int psize, int ssize) |
257 | { | 257 | { |
258 | unsigned long lpar_rc, slot, vsid, va; | 258 | unsigned long vpn; |
259 | unsigned long lpar_rc, slot, vsid; | ||
259 | u64 dummy0, dummy1; | 260 | u64 dummy0, dummy1; |
260 | 261 | ||
261 | vsid = get_kernel_vsid(ea, MMU_SEGSIZE_256M); | 262 | vsid = get_kernel_vsid(ea, MMU_SEGSIZE_256M); |
262 | va = hpt_va(ea, vsid, MMU_SEGSIZE_256M); | 263 | vpn = hpt_vpn(ea, vsid, MMU_SEGSIZE_256M); |
263 | 264 | ||
264 | raw_spin_lock(&beat_htab_lock); | 265 | raw_spin_lock(&beat_htab_lock); |
265 | slot = beat_lpar_hpte_find(va, psize); | 266 | slot = beat_lpar_hpte_find(vpn, psize); |
266 | BUG_ON(slot == -1); | 267 | BUG_ON(slot == -1); |
267 | 268 | ||
268 | lpar_rc = beat_write_htab_entry(0, slot, 0, newpp, 0, 7, | 269 | lpar_rc = beat_write_htab_entry(0, slot, 0, newpp, 0, 7, |
@@ -272,7 +273,7 @@ static void beat_lpar_hpte_updateboltedpp(unsigned long newpp, | |||
272 | BUG_ON(lpar_rc != 0); | 273 | BUG_ON(lpar_rc != 0); |
273 | } | 274 | } |
274 | 275 | ||
275 | static void beat_lpar_hpte_invalidate(unsigned long slot, unsigned long va, | 276 | static void beat_lpar_hpte_invalidate(unsigned long slot, unsigned long vpn, |
276 | int psize, int ssize, int local) | 277 | int psize, int ssize, int local) |
277 | { | 278 | { |
278 | unsigned long want_v; | 279 | unsigned long want_v; |
@@ -282,7 +283,7 @@ static void beat_lpar_hpte_invalidate(unsigned long slot, unsigned long va, | |||
282 | 283 | ||
283 | DBG_LOW(" inval : slot=%lx, va=%016lx, psize: %d, local: %d\n", | 284 | DBG_LOW(" inval : slot=%lx, va=%016lx, psize: %d, local: %d\n", |
284 | slot, va, psize, local); | 285 | slot, va, psize, local); |
285 | want_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M); | 286 | want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M); |
286 | 287 | ||
287 | raw_spin_lock_irqsave(&beat_htab_lock, flags); | 288 | raw_spin_lock_irqsave(&beat_htab_lock, flags); |
288 | dummy1 = beat_lpar_hpte_getword0(slot); | 289 | dummy1 = beat_lpar_hpte_getword0(slot); |
@@ -311,7 +312,7 @@ void __init hpte_init_beat(void) | |||
311 | } | 312 | } |
312 | 313 | ||
313 | static long beat_lpar_hpte_insert_v3(unsigned long hpte_group, | 314 | static long beat_lpar_hpte_insert_v3(unsigned long hpte_group, |
314 | unsigned long va, unsigned long pa, | 315 | unsigned long vpn, unsigned long pa, |
315 | unsigned long rflags, unsigned long vflags, | 316 | unsigned long rflags, unsigned long vflags, |
316 | int psize, int ssize) | 317 | int psize, int ssize) |
317 | { | 318 | { |
@@ -322,11 +323,11 @@ static long beat_lpar_hpte_insert_v3(unsigned long hpte_group, | |||
322 | return -1; | 323 | return -1; |
323 | 324 | ||
324 | if (!(vflags & HPTE_V_BOLTED)) | 325 | if (!(vflags & HPTE_V_BOLTED)) |
325 | DBG_LOW("hpte_insert(group=%lx, va=%016lx, pa=%016lx, " | 326 | DBG_LOW("hpte_insert(group=%lx, vpn=%016lx, pa=%016lx, " |
326 | "rflags=%lx, vflags=%lx, psize=%d)\n", | 327 | "rflags=%lx, vflags=%lx, psize=%d)\n", |
327 | hpte_group, va, pa, rflags, vflags, psize); | 328 | hpte_group, vpn, pa, rflags, vflags, psize); |
328 | 329 | ||
329 | hpte_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M) | | 330 | hpte_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M) | |
330 | vflags | HPTE_V_VALID; | 331 | vflags | HPTE_V_VALID; |
331 | hpte_r = hpte_encode_r(pa, psize) | rflags; | 332 | hpte_r = hpte_encode_r(pa, psize) | rflags; |
332 | 333 | ||
@@ -364,14 +365,14 @@ static long beat_lpar_hpte_insert_v3(unsigned long hpte_group, | |||
364 | */ | 365 | */ |
365 | static long beat_lpar_hpte_updatepp_v3(unsigned long slot, | 366 | static long beat_lpar_hpte_updatepp_v3(unsigned long slot, |
366 | unsigned long newpp, | 367 | unsigned long newpp, |
367 | unsigned long va, | 368 | unsigned long vpn, |
368 | int psize, int ssize, int local) | 369 | int psize, int ssize, int local) |
369 | { | 370 | { |
370 | unsigned long lpar_rc; | 371 | unsigned long lpar_rc; |
371 | unsigned long want_v; | 372 | unsigned long want_v; |
372 | unsigned long pss; | 373 | unsigned long pss; |
373 | 374 | ||
374 | want_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M); | 375 | want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M); |
375 | pss = (psize == MMU_PAGE_4K) ? -1UL : mmu_psize_defs[psize].penc; | 376 | pss = (psize == MMU_PAGE_4K) ? -1UL : mmu_psize_defs[psize].penc; |
376 | 377 | ||
377 | DBG_LOW(" update: " | 378 | DBG_LOW(" update: " |
@@ -392,16 +393,16 @@ static long beat_lpar_hpte_updatepp_v3(unsigned long slot, | |||
392 | return 0; | 393 | return 0; |
393 | } | 394 | } |
394 | 395 | ||
395 | static void beat_lpar_hpte_invalidate_v3(unsigned long slot, unsigned long va, | 396 | static void beat_lpar_hpte_invalidate_v3(unsigned long slot, unsigned long vpn, |
396 | int psize, int ssize, int local) | 397 | int psize, int ssize, int local) |
397 | { | 398 | { |
398 | unsigned long want_v; | 399 | unsigned long want_v; |
399 | unsigned long lpar_rc; | 400 | unsigned long lpar_rc; |
400 | unsigned long pss; | 401 | unsigned long pss; |
401 | 402 | ||
402 | DBG_LOW(" inval : slot=%lx, va=%016lx, psize: %d, local: %d\n", | 403 | DBG_LOW(" inval : slot=%lx, vpn=%016lx, psize: %d, local: %d\n", |
403 | slot, va, psize, local); | 404 | slot, vpn, psize, local); |
404 | want_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M); | 405 | want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M); |
405 | pss = (psize == MMU_PAGE_4K) ? -1UL : mmu_psize_defs[psize].penc; | 406 | pss = (psize == MMU_PAGE_4K) ? -1UL : mmu_psize_defs[psize].penc; |
406 | 407 | ||
407 | lpar_rc = beat_invalidate_htab_entry3(0, slot, want_v, pss); | 408 | lpar_rc = beat_invalidate_htab_entry3(0, slot, want_v, pss); |
diff --git a/arch/powerpc/platforms/ps3/htab.c b/arch/powerpc/platforms/ps3/htab.c index 3124cf791ebb..d00d7b0a3bda 100644 --- a/arch/powerpc/platforms/ps3/htab.c +++ b/arch/powerpc/platforms/ps3/htab.c | |||
@@ -43,7 +43,7 @@ enum ps3_lpar_vas_id { | |||
43 | 43 | ||
44 | static DEFINE_SPINLOCK(ps3_htab_lock); | 44 | static DEFINE_SPINLOCK(ps3_htab_lock); |
45 | 45 | ||
46 | static long ps3_hpte_insert(unsigned long hpte_group, unsigned long va, | 46 | static long ps3_hpte_insert(unsigned long hpte_group, unsigned long vpn, |
47 | unsigned long pa, unsigned long rflags, unsigned long vflags, | 47 | unsigned long pa, unsigned long rflags, unsigned long vflags, |
48 | int psize, int ssize) | 48 | int psize, int ssize) |
49 | { | 49 | { |
@@ -61,7 +61,7 @@ static long ps3_hpte_insert(unsigned long hpte_group, unsigned long va, | |||
61 | */ | 61 | */ |
62 | vflags &= ~HPTE_V_SECONDARY; | 62 | vflags &= ~HPTE_V_SECONDARY; |
63 | 63 | ||
64 | hpte_v = hpte_encode_v(va, psize, ssize) | vflags | HPTE_V_VALID; | 64 | hpte_v = hpte_encode_v(vpn, psize, ssize) | vflags | HPTE_V_VALID; |
65 | hpte_r = hpte_encode_r(ps3_mm_phys_to_lpar(pa), psize) | rflags; | 65 | hpte_r = hpte_encode_r(ps3_mm_phys_to_lpar(pa), psize) | rflags; |
66 | 66 | ||
67 | spin_lock_irqsave(&ps3_htab_lock, flags); | 67 | spin_lock_irqsave(&ps3_htab_lock, flags); |
@@ -75,8 +75,8 @@ static long ps3_hpte_insert(unsigned long hpte_group, unsigned long va, | |||
75 | 75 | ||
76 | if (result) { | 76 | if (result) { |
77 | /* all entries bolted !*/ | 77 | /* all entries bolted !*/ |
78 | pr_info("%s:result=%d va=%lx pa=%lx ix=%lx v=%llx r=%llx\n", | 78 | pr_info("%s:result=%d vpn=%lx pa=%lx ix=%lx v=%llx r=%llx\n", |
79 | __func__, result, va, pa, hpte_group, hpte_v, hpte_r); | 79 | __func__, result, vpn, pa, hpte_group, hpte_v, hpte_r); |
80 | BUG(); | 80 | BUG(); |
81 | } | 81 | } |
82 | 82 | ||
@@ -107,7 +107,7 @@ static long ps3_hpte_remove(unsigned long hpte_group) | |||
107 | } | 107 | } |
108 | 108 | ||
109 | static long ps3_hpte_updatepp(unsigned long slot, unsigned long newpp, | 109 | static long ps3_hpte_updatepp(unsigned long slot, unsigned long newpp, |
110 | unsigned long va, int psize, int ssize, int local) | 110 | unsigned long vpn, int psize, int ssize, int local) |
111 | { | 111 | { |
112 | int result; | 112 | int result; |
113 | u64 hpte_v, want_v, hpte_rs; | 113 | u64 hpte_v, want_v, hpte_rs; |
@@ -115,7 +115,7 @@ static long ps3_hpte_updatepp(unsigned long slot, unsigned long newpp, | |||
115 | unsigned long flags; | 115 | unsigned long flags; |
116 | long ret; | 116 | long ret; |
117 | 117 | ||
118 | want_v = hpte_encode_v(va, psize, ssize); | 118 | want_v = hpte_encode_v(vpn, psize, ssize); |
119 | 119 | ||
120 | spin_lock_irqsave(&ps3_htab_lock, flags); | 120 | spin_lock_irqsave(&ps3_htab_lock, flags); |
121 | 121 | ||
@@ -125,8 +125,8 @@ static long ps3_hpte_updatepp(unsigned long slot, unsigned long newpp, | |||
125 | &hpte_rs); | 125 | &hpte_rs); |
126 | 126 | ||
127 | if (result) { | 127 | if (result) { |
128 | pr_info("%s: res=%d read va=%lx slot=%lx psize=%d\n", | 128 | pr_info("%s: res=%d read vpn=%lx slot=%lx psize=%d\n", |
129 | __func__, result, va, slot, psize); | 129 | __func__, result, vpn, slot, psize); |
130 | BUG(); | 130 | BUG(); |
131 | } | 131 | } |
132 | 132 | ||
@@ -159,7 +159,7 @@ static void ps3_hpte_updateboltedpp(unsigned long newpp, unsigned long ea, | |||
159 | panic("ps3_hpte_updateboltedpp() not implemented"); | 159 | panic("ps3_hpte_updateboltedpp() not implemented"); |
160 | } | 160 | } |
161 | 161 | ||
162 | static void ps3_hpte_invalidate(unsigned long slot, unsigned long va, | 162 | static void ps3_hpte_invalidate(unsigned long slot, unsigned long vpn, |
163 | int psize, int ssize, int local) | 163 | int psize, int ssize, int local) |
164 | { | 164 | { |
165 | unsigned long flags; | 165 | unsigned long flags; |
@@ -170,8 +170,8 @@ static void ps3_hpte_invalidate(unsigned long slot, unsigned long va, | |||
170 | result = lv1_write_htab_entry(PS3_LPAR_VAS_ID_CURRENT, slot, 0, 0); | 170 | result = lv1_write_htab_entry(PS3_LPAR_VAS_ID_CURRENT, slot, 0, 0); |
171 | 171 | ||
172 | if (result) { | 172 | if (result) { |
173 | pr_info("%s: res=%d va=%lx slot=%lx psize=%d\n", | 173 | pr_info("%s: res=%d vpn=%lx slot=%lx psize=%d\n", |
174 | __func__, result, va, slot, psize); | 174 | __func__, result, vpn, slot, psize); |
175 | BUG(); | 175 | BUG(); |
176 | } | 176 | } |
177 | 177 | ||
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 177055d0186b..0da39fed355a 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c | |||
@@ -107,9 +107,9 @@ void vpa_init(int cpu) | |||
107 | } | 107 | } |
108 | 108 | ||
109 | static long pSeries_lpar_hpte_insert(unsigned long hpte_group, | 109 | static long pSeries_lpar_hpte_insert(unsigned long hpte_group, |
110 | unsigned long va, unsigned long pa, | 110 | unsigned long vpn, unsigned long pa, |
111 | unsigned long rflags, unsigned long vflags, | 111 | unsigned long rflags, unsigned long vflags, |
112 | int psize, int ssize) | 112 | int psize, int ssize) |
113 | { | 113 | { |
114 | unsigned long lpar_rc; | 114 | unsigned long lpar_rc; |
115 | unsigned long flags; | 115 | unsigned long flags; |
@@ -117,11 +117,11 @@ static long pSeries_lpar_hpte_insert(unsigned long hpte_group, | |||
117 | unsigned long hpte_v, hpte_r; | 117 | unsigned long hpte_v, hpte_r; |
118 | 118 | ||
119 | if (!(vflags & HPTE_V_BOLTED)) | 119 | if (!(vflags & HPTE_V_BOLTED)) |
120 | pr_devel("hpte_insert(group=%lx, va=%016lx, pa=%016lx, " | 120 | pr_devel("hpte_insert(group=%lx, vpn=%016lx, " |
121 | "rflags=%lx, vflags=%lx, psize=%d)\n", | 121 | "pa=%016lx, rflags=%lx, vflags=%lx, psize=%d)\n", |
122 | hpte_group, va, pa, rflags, vflags, psize); | 122 | hpte_group, vpn, pa, rflags, vflags, psize); |
123 | 123 | ||
124 | hpte_v = hpte_encode_v(va, psize, ssize) | vflags | HPTE_V_VALID; | 124 | hpte_v = hpte_encode_v(vpn, psize, ssize) | vflags | HPTE_V_VALID; |
125 | hpte_r = hpte_encode_r(pa, psize) | rflags; | 125 | hpte_r = hpte_encode_r(pa, psize) | rflags; |
126 | 126 | ||
127 | if (!(vflags & HPTE_V_BOLTED)) | 127 | if (!(vflags & HPTE_V_BOLTED)) |
@@ -226,22 +226,6 @@ static void pSeries_lpar_hptab_clear(void) | |||
226 | } | 226 | } |
227 | 227 | ||
228 | /* | 228 | /* |
229 | * This computes the AVPN and B fields of the first dword of a HPTE, | ||
230 | * for use when we want to match an existing PTE. The bottom 7 bits | ||
231 | * of the returned value are zero. | ||
232 | */ | ||
233 | static inline unsigned long hpte_encode_avpn(unsigned long va, int psize, | ||
234 | int ssize) | ||
235 | { | ||
236 | unsigned long v; | ||
237 | |||
238 | v = (va >> 23) & ~(mmu_psize_defs[psize].avpnm); | ||
239 | v <<= HPTE_V_AVPN_SHIFT; | ||
240 | v |= ((unsigned long) ssize) << HPTE_V_SSIZE_SHIFT; | ||
241 | return v; | ||
242 | } | ||
243 | |||
244 | /* | ||
245 | * NOTE: for updatepp ops we are fortunate that the linux "newpp" bits and | 229 | * NOTE: for updatepp ops we are fortunate that the linux "newpp" bits and |
246 | * the low 3 bits of flags happen to line up. So no transform is needed. | 230 | * the low 3 bits of flags happen to line up. So no transform is needed. |
247 | * We can probably optimize here and assume the high bits of newpp are | 231 | * We can probably optimize here and assume the high bits of newpp are |
@@ -249,14 +233,14 @@ static inline unsigned long hpte_encode_avpn(unsigned long va, int psize, | |||
249 | */ | 233 | */ |
250 | static long pSeries_lpar_hpte_updatepp(unsigned long slot, | 234 | static long pSeries_lpar_hpte_updatepp(unsigned long slot, |
251 | unsigned long newpp, | 235 | unsigned long newpp, |
252 | unsigned long va, | 236 | unsigned long vpn, |
253 | int psize, int ssize, int local) | 237 | int psize, int ssize, int local) |
254 | { | 238 | { |
255 | unsigned long lpar_rc; | 239 | unsigned long lpar_rc; |
256 | unsigned long flags = (newpp & 7) | H_AVPN; | 240 | unsigned long flags = (newpp & 7) | H_AVPN; |
257 | unsigned long want_v; | 241 | unsigned long want_v; |
258 | 242 | ||
259 | want_v = hpte_encode_avpn(va, psize, ssize); | 243 | want_v = hpte_encode_avpn(vpn, psize, ssize); |
260 | 244 | ||
261 | pr_devel(" update: avpnv=%016lx, hash=%016lx, f=%lx, psize: %d ...", | 245 | pr_devel(" update: avpnv=%016lx, hash=%016lx, f=%lx, psize: %d ...", |
262 | want_v, slot, flags, psize); | 246 | want_v, slot, flags, psize); |
@@ -294,15 +278,15 @@ static unsigned long pSeries_lpar_hpte_getword0(unsigned long slot) | |||
294 | return dword0; | 278 | return dword0; |
295 | } | 279 | } |
296 | 280 | ||
297 | static long pSeries_lpar_hpte_find(unsigned long va, int psize, int ssize) | 281 | static long pSeries_lpar_hpte_find(unsigned long vpn, int psize, int ssize) |
298 | { | 282 | { |
299 | unsigned long hash; | 283 | unsigned long hash; |
300 | unsigned long i; | 284 | unsigned long i; |
301 | long slot; | 285 | long slot; |
302 | unsigned long want_v, hpte_v; | 286 | unsigned long want_v, hpte_v; |
303 | 287 | ||
304 | hash = hpt_hash(va, mmu_psize_defs[psize].shift, ssize); | 288 | hash = hpt_hash(vpn, mmu_psize_defs[psize].shift, ssize); |
305 | want_v = hpte_encode_avpn(va, psize, ssize); | 289 | want_v = hpte_encode_avpn(vpn, psize, ssize); |
306 | 290 | ||
307 | /* Bolted entries are always in the primary group */ | 291 | /* Bolted entries are always in the primary group */ |
308 | slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; | 292 | slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; |
@@ -322,12 +306,13 @@ static void pSeries_lpar_hpte_updateboltedpp(unsigned long newpp, | |||
322 | unsigned long ea, | 306 | unsigned long ea, |
323 | int psize, int ssize) | 307 | int psize, int ssize) |
324 | { | 308 | { |
325 | unsigned long lpar_rc, slot, vsid, va, flags; | 309 | unsigned long vpn; |
310 | unsigned long lpar_rc, slot, vsid, flags; | ||
326 | 311 | ||
327 | vsid = get_kernel_vsid(ea, ssize); | 312 | vsid = get_kernel_vsid(ea, ssize); |
328 | va = hpt_va(ea, vsid, ssize); | 313 | vpn = hpt_vpn(ea, vsid, ssize); |
329 | 314 | ||
330 | slot = pSeries_lpar_hpte_find(va, psize, ssize); | 315 | slot = pSeries_lpar_hpte_find(vpn, psize, ssize); |
331 | BUG_ON(slot == -1); | 316 | BUG_ON(slot == -1); |
332 | 317 | ||
333 | flags = newpp & 7; | 318 | flags = newpp & 7; |
@@ -336,17 +321,17 @@ static void pSeries_lpar_hpte_updateboltedpp(unsigned long newpp, | |||
336 | BUG_ON(lpar_rc != H_SUCCESS); | 321 | BUG_ON(lpar_rc != H_SUCCESS); |
337 | } | 322 | } |
338 | 323 | ||
339 | static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long va, | 324 | static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long vpn, |
340 | int psize, int ssize, int local) | 325 | int psize, int ssize, int local) |
341 | { | 326 | { |
342 | unsigned long want_v; | 327 | unsigned long want_v; |
343 | unsigned long lpar_rc; | 328 | unsigned long lpar_rc; |
344 | unsigned long dummy1, dummy2; | 329 | unsigned long dummy1, dummy2; |
345 | 330 | ||
346 | pr_devel(" inval : slot=%lx, va=%016lx, psize: %d, local: %d\n", | 331 | pr_devel(" inval : slot=%lx, vpn=%016lx, psize: %d, local: %d\n", |
347 | slot, va, psize, local); | 332 | slot, vpn, psize, local); |
348 | 333 | ||
349 | want_v = hpte_encode_avpn(va, psize, ssize); | 334 | want_v = hpte_encode_avpn(vpn, psize, ssize); |
350 | lpar_rc = plpar_pte_remove(H_AVPN, slot, want_v, &dummy1, &dummy2); | 335 | lpar_rc = plpar_pte_remove(H_AVPN, slot, want_v, &dummy1, &dummy2); |
351 | if (lpar_rc == H_NOT_FOUND) | 336 | if (lpar_rc == H_NOT_FOUND) |
352 | return; | 337 | return; |
@@ -357,15 +342,16 @@ static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long va, | |||
357 | static void pSeries_lpar_hpte_removebolted(unsigned long ea, | 342 | static void pSeries_lpar_hpte_removebolted(unsigned long ea, |
358 | int psize, int ssize) | 343 | int psize, int ssize) |
359 | { | 344 | { |
360 | unsigned long slot, vsid, va; | 345 | unsigned long vpn; |
346 | unsigned long slot, vsid; | ||
361 | 347 | ||
362 | vsid = get_kernel_vsid(ea, ssize); | 348 | vsid = get_kernel_vsid(ea, ssize); |
363 | va = hpt_va(ea, vsid, ssize); | 349 | vpn = hpt_vpn(ea, vsid, ssize); |
364 | 350 | ||
365 | slot = pSeries_lpar_hpte_find(va, psize, ssize); | 351 | slot = pSeries_lpar_hpte_find(vpn, psize, ssize); |
366 | BUG_ON(slot == -1); | 352 | BUG_ON(slot == -1); |
367 | 353 | ||
368 | pSeries_lpar_hpte_invalidate(slot, va, psize, ssize, 0); | 354 | pSeries_lpar_hpte_invalidate(slot, vpn, psize, ssize, 0); |
369 | } | 355 | } |
370 | 356 | ||
371 | /* Flag bits for H_BULK_REMOVE */ | 357 | /* Flag bits for H_BULK_REMOVE */ |
@@ -381,12 +367,12 @@ static void pSeries_lpar_hpte_removebolted(unsigned long ea, | |||
381 | */ | 367 | */ |
382 | static void pSeries_lpar_flush_hash_range(unsigned long number, int local) | 368 | static void pSeries_lpar_flush_hash_range(unsigned long number, int local) |
383 | { | 369 | { |
370 | unsigned long vpn; | ||
384 | unsigned long i, pix, rc; | 371 | unsigned long i, pix, rc; |
385 | unsigned long flags = 0; | 372 | unsigned long flags = 0; |
386 | struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); | 373 | struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); |
387 | int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE); | 374 | int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE); |
388 | unsigned long param[9]; | 375 | unsigned long param[9]; |
389 | unsigned long va; | ||
390 | unsigned long hash, index, shift, hidx, slot; | 376 | unsigned long hash, index, shift, hidx, slot; |
391 | real_pte_t pte; | 377 | real_pte_t pte; |
392 | int psize, ssize; | 378 | int psize, ssize; |
@@ -398,21 +384,21 @@ static void pSeries_lpar_flush_hash_range(unsigned long number, int local) | |||
398 | ssize = batch->ssize; | 384 | ssize = batch->ssize; |
399 | pix = 0; | 385 | pix = 0; |
400 | for (i = 0; i < number; i++) { | 386 | for (i = 0; i < number; i++) { |
401 | va = batch->vaddr[i]; | 387 | vpn = batch->vpn[i]; |
402 | pte = batch->pte[i]; | 388 | pte = batch->pte[i]; |
403 | pte_iterate_hashed_subpages(pte, psize, va, index, shift) { | 389 | pte_iterate_hashed_subpages(pte, psize, vpn, index, shift) { |
404 | hash = hpt_hash(va, shift, ssize); | 390 | hash = hpt_hash(vpn, shift, ssize); |
405 | hidx = __rpte_to_hidx(pte, index); | 391 | hidx = __rpte_to_hidx(pte, index); |
406 | if (hidx & _PTEIDX_SECONDARY) | 392 | if (hidx & _PTEIDX_SECONDARY) |
407 | hash = ~hash; | 393 | hash = ~hash; |
408 | slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; | 394 | slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; |
409 | slot += hidx & _PTEIDX_GROUP_IX; | 395 | slot += hidx & _PTEIDX_GROUP_IX; |
410 | if (!firmware_has_feature(FW_FEATURE_BULK_REMOVE)) { | 396 | if (!firmware_has_feature(FW_FEATURE_BULK_REMOVE)) { |
411 | pSeries_lpar_hpte_invalidate(slot, va, psize, | 397 | pSeries_lpar_hpte_invalidate(slot, vpn, psize, |
412 | ssize, local); | 398 | ssize, local); |
413 | } else { | 399 | } else { |
414 | param[pix] = HBR_REQUEST | HBR_AVPN | slot; | 400 | param[pix] = HBR_REQUEST | HBR_AVPN | slot; |
415 | param[pix+1] = hpte_encode_avpn(va, psize, | 401 | param[pix+1] = hpte_encode_avpn(vpn, psize, |
416 | ssize); | 402 | ssize); |
417 | pix += 2; | 403 | pix += 2; |
418 | if (pix == 8) { | 404 | if (pix == 8) { |