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 /arch/ppc64/kernel/pSeries_lpar.c | |
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 'arch/ppc64/kernel/pSeries_lpar.c')
-rw-r--r-- | arch/ppc64/kernel/pSeries_lpar.c | 47 |
1 files changed, 16 insertions, 31 deletions
diff --git a/arch/ppc64/kernel/pSeries_lpar.c b/arch/ppc64/kernel/pSeries_lpar.c index 6534812db437..74dd144dcce8 100644 --- a/arch/ppc64/kernel/pSeries_lpar.c +++ b/arch/ppc64/kernel/pSeries_lpar.c | |||
@@ -277,31 +277,20 @@ void vpa_init(int cpu) | |||
277 | 277 | ||
278 | long pSeries_lpar_hpte_insert(unsigned long hpte_group, | 278 | long pSeries_lpar_hpte_insert(unsigned long hpte_group, |
279 | unsigned long va, unsigned long prpn, | 279 | unsigned long va, unsigned long prpn, |
280 | int secondary, unsigned long hpteflags, | 280 | unsigned long vflags, unsigned long rflags) |
281 | int bolted, int large) | ||
282 | { | 281 | { |
283 | unsigned long arpn = physRpn_to_absRpn(prpn); | 282 | unsigned long arpn = physRpn_to_absRpn(prpn); |
284 | unsigned long lpar_rc; | 283 | unsigned long lpar_rc; |
285 | unsigned long flags; | 284 | unsigned long flags; |
286 | unsigned long slot; | 285 | unsigned long slot; |
287 | HPTE lhpte; | 286 | unsigned long hpte_v, hpte_r; |
288 | unsigned long dummy0, dummy1; | 287 | unsigned long dummy0, dummy1; |
289 | 288 | ||
290 | /* Fill in the local HPTE with absolute rpn, avpn and flags */ | 289 | hpte_v = ((va >> 23) << HPTE_V_AVPN_SHIFT) | vflags | HPTE_V_VALID; |
291 | lhpte.dw1.dword1 = 0; | 290 | if (vflags & HPTE_V_LARGE) |
292 | lhpte.dw1.dw1.rpn = arpn; | 291 | hpte_v &= ~(1UL << HPTE_V_AVPN_SHIFT); |
293 | lhpte.dw1.flags.flags = hpteflags; | ||
294 | 292 | ||
295 | lhpte.dw0.dword0 = 0; | 293 | hpte_r = (arpn << HPTE_R_RPN_SHIFT) | rflags; |
296 | lhpte.dw0.dw0.avpn = va >> 23; | ||
297 | lhpte.dw0.dw0.h = secondary; | ||
298 | lhpte.dw0.dw0.bolted = bolted; | ||
299 | lhpte.dw0.dw0.v = 1; | ||
300 | |||
301 | if (large) { | ||
302 | lhpte.dw0.dw0.l = 1; | ||
303 | lhpte.dw0.dw0.avpn &= ~0x1UL; | ||
304 | } | ||
305 | 294 | ||
306 | /* Now fill in the actual HPTE */ | 295 | /* Now fill in the actual HPTE */ |
307 | /* Set CEC cookie to 0 */ | 296 | /* Set CEC cookie to 0 */ |
@@ -312,11 +301,11 @@ long pSeries_lpar_hpte_insert(unsigned long hpte_group, | |||
312 | flags = 0; | 301 | flags = 0; |
313 | 302 | ||
314 | /* XXX why is this here? - Anton */ | 303 | /* XXX why is this here? - Anton */ |
315 | if (hpteflags & (_PAGE_GUARDED|_PAGE_NO_CACHE)) | 304 | if (rflags & (_PAGE_GUARDED|_PAGE_NO_CACHE)) |
316 | lhpte.dw1.flags.flags &= ~_PAGE_COHERENT; | 305 | hpte_r &= ~_PAGE_COHERENT; |
317 | 306 | ||
318 | lpar_rc = plpar_hcall(H_ENTER, flags, hpte_group, lhpte.dw0.dword0, | 307 | lpar_rc = plpar_hcall(H_ENTER, flags, hpte_group, hpte_v, |
319 | lhpte.dw1.dword1, &slot, &dummy0, &dummy1); | 308 | hpte_r, &slot, &dummy0, &dummy1); |
320 | 309 | ||
321 | if (unlikely(lpar_rc == H_PTEG_Full)) | 310 | if (unlikely(lpar_rc == H_PTEG_Full)) |
322 | return -1; | 311 | return -1; |
@@ -332,7 +321,7 @@ long pSeries_lpar_hpte_insert(unsigned long hpte_group, | |||
332 | /* Because of iSeries, we have to pass down the secondary | 321 | /* Because of iSeries, we have to pass down the secondary |
333 | * bucket bit here as well | 322 | * bucket bit here as well |
334 | */ | 323 | */ |
335 | return (slot & 7) | (secondary << 3); | 324 | return (slot & 7) | (!!(vflags & HPTE_V_SECONDARY) << 3); |
336 | } | 325 | } |
337 | 326 | ||
338 | static DEFINE_SPINLOCK(pSeries_lpar_tlbie_lock); | 327 | static DEFINE_SPINLOCK(pSeries_lpar_tlbie_lock); |
@@ -427,22 +416,18 @@ static long pSeries_lpar_hpte_find(unsigned long vpn) | |||
427 | unsigned long hash; | 416 | unsigned long hash; |
428 | unsigned long i, j; | 417 | unsigned long i, j; |
429 | long slot; | 418 | long slot; |
430 | union { | 419 | unsigned long hpte_v; |
431 | unsigned long dword0; | ||
432 | Hpte_dword0 dw0; | ||
433 | } hpte_dw0; | ||
434 | Hpte_dword0 dw0; | ||
435 | 420 | ||
436 | hash = hpt_hash(vpn, 0); | 421 | hash = hpt_hash(vpn, 0); |
437 | 422 | ||
438 | for (j = 0; j < 2; j++) { | 423 | for (j = 0; j < 2; j++) { |
439 | slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; | 424 | slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; |
440 | for (i = 0; i < HPTES_PER_GROUP; i++) { | 425 | for (i = 0; i < HPTES_PER_GROUP; i++) { |
441 | hpte_dw0.dword0 = pSeries_lpar_hpte_getword0(slot); | 426 | hpte_v = pSeries_lpar_hpte_getword0(slot); |
442 | dw0 = hpte_dw0.dw0; | ||
443 | 427 | ||
444 | if ((dw0.avpn == (vpn >> 11)) && dw0.v && | 428 | if ((HPTE_V_AVPN_VAL(hpte_v) == (vpn >> 11)) |
445 | (dw0.h == j)) { | 429 | && (hpte_v & HPTE_V_VALID) |
430 | && (!!(hpte_v & HPTE_V_SECONDARY) == j)) { | ||
446 | /* HPTE matches */ | 431 | /* HPTE matches */ |
447 | if (j) | 432 | if (j) |
448 | slot = -slot; | 433 | slot = -slot; |