Skip to content

Commit

Permalink
powerpc: Use encode avpn where we need only avpn values
Browse files Browse the repository at this point in the history
In all these cases we are doing something similar to

HPTE_V_COMPARE(hpte_v, want_v) which ignores the HPTE_V_LARGE bit

With MPSS support we would need actual page size to set HPTE_V_LARGE
bit and that won't be available in most of these cases. Since we are ignoring
HPTE_V_LARGE bit, use the  avpn value instead. There should not be any change
in behaviour after this patch.

Acked-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>
  • Loading branch information
Aneesh Kumar K.V authored and Benjamin Herrenschmidt committed Apr 30, 2013
1 parent 5c1f6ee commit 74f227b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions arch/powerpc/mm/hash_native_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ static long native_hpte_updatepp(unsigned long slot, unsigned long newpp,
unsigned long hpte_v, want_v;
int ret = 0;

want_v = hpte_encode_v(vpn, psize, ssize);
want_v = hpte_encode_avpn(vpn, psize, ssize);

DBG_LOW(" update(vpn=%016lx, avpnv=%016lx, group=%lx, newpp=%lx)",
vpn, want_v & HPTE_V_AVPN, slot, newpp);
Expand Down Expand Up @@ -288,7 +288,7 @@ static long native_hpte_find(unsigned long vpn, int psize, int ssize)
unsigned long want_v, hpte_v;

hash = hpt_hash(vpn, mmu_psize_defs[psize].shift, ssize);
want_v = hpte_encode_v(vpn, psize, ssize);
want_v = hpte_encode_avpn(vpn, psize, ssize);

/* Bolted mappings are only ever in the primary group */
slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
Expand Down Expand Up @@ -348,7 +348,7 @@ static void native_hpte_invalidate(unsigned long slot, unsigned long vpn,

DBG_LOW(" invalidate(vpn=%016lx, hash: %lx)\n", vpn, slot);

want_v = hpte_encode_v(vpn, psize, ssize);
want_v = hpte_encode_avpn(vpn, psize, ssize);
native_lock_hpte(hptep);
hpte_v = hptep->v;

Expand Down Expand Up @@ -520,7 +520,7 @@ static void native_flush_hash_range(unsigned long number, int local)
slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
slot += hidx & _PTEIDX_GROUP_IX;
hptep = htab_address + slot;
want_v = hpte_encode_v(vpn, psize, ssize);
want_v = hpte_encode_avpn(vpn, psize, ssize);
native_lock_hpte(hptep);
hpte_v = hptep->v;
if (!HPTE_V_COMPARE(hpte_v, want_v) ||
Expand Down
10 changes: 5 additions & 5 deletions arch/powerpc/platforms/cell/beat_htab.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ static long beat_lpar_hpte_updatepp(unsigned long slot,
u64 dummy0, dummy1;
unsigned long want_v;

want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M);
want_v = hpte_encode_avpn(vpn, psize, MMU_SEGSIZE_256M);

DBG_LOW(" update: "
"avpnv=%016lx, slot=%016lx, psize: %d, newpp %016lx ... ",
Expand Down Expand Up @@ -228,7 +228,7 @@ static long beat_lpar_hpte_find(unsigned long vpn, int psize)
unsigned long want_v, hpte_v;

hash = hpt_hash(vpn, mmu_psize_defs[psize].shift, MMU_SEGSIZE_256M);
want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M);
want_v = hpte_encode_avpn(vpn, psize, MMU_SEGSIZE_256M);

for (j = 0; j < 2; j++) {
slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
Expand Down Expand Up @@ -283,7 +283,7 @@ static void beat_lpar_hpte_invalidate(unsigned long slot, unsigned long vpn,

DBG_LOW(" inval : slot=%lx, va=%016lx, psize: %d, local: %d\n",
slot, va, psize, local);
want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M);
want_v = hpte_encode_avpn(vpn, psize, MMU_SEGSIZE_256M);

raw_spin_lock_irqsave(&beat_htab_lock, flags);
dummy1 = beat_lpar_hpte_getword0(slot);
Expand Down Expand Up @@ -372,7 +372,7 @@ static long beat_lpar_hpte_updatepp_v3(unsigned long slot,
unsigned long want_v;
unsigned long pss;

want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M);
want_v = hpte_encode_avpn(vpn, psize, MMU_SEGSIZE_256M);
pss = (psize == MMU_PAGE_4K) ? -1UL : mmu_psize_defs[psize].penc;

DBG_LOW(" update: "
Expand Down Expand Up @@ -402,7 +402,7 @@ static void beat_lpar_hpte_invalidate_v3(unsigned long slot, unsigned long vpn,

DBG_LOW(" inval : slot=%lx, vpn=%016lx, psize: %d, local: %d\n",
slot, vpn, psize, local);
want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M);
want_v = hpte_encode_avpn(vpn, psize, MMU_SEGSIZE_256M);
pss = (psize == MMU_PAGE_4K) ? -1UL : mmu_psize_defs[psize].penc;

lpar_rc = beat_invalidate_htab_entry3(0, slot, want_v, pss);
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/ps3/htab.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static long ps3_hpte_updatepp(unsigned long slot, unsigned long newpp,
unsigned long flags;
long ret;

want_v = hpte_encode_v(vpn, psize, ssize);
want_v = hpte_encode_avpn(vpn, psize, ssize);

spin_lock_irqsave(&ps3_htab_lock, flags);

Expand Down

0 comments on commit 74f227b

Please sign in to comment.