On Wed, Mar 06, 2013 at 11:40:11AM +0530, Aneesh Kumar K.V wrote: > From: "Aneesh Kumar K.V" <aneesh.ku...@linux.vnet.ibm.com> > > We look at both the segment base page size and actual page size and store > the pte-lp-encodings in an array per base page size. > > We also update all relevant functions to take actual page size argument > so that we can use the correct PTE LP encoding in HPTE. This should also > get the basic Multiple Page Size per Segment (MPSS) support. This is needed > to enable THP on ppc64.
[snip] > --- a/arch/powerpc/include/asm/mmu-hash64.h > +++ b/arch/powerpc/include/asm/mmu-hash64.h > @@ -154,7 +154,7 @@ extern unsigned long htab_hash_mask; > struct mmu_psize_def > { > unsigned int shift; /* number of bits */ > - unsigned int penc; /* HPTE encoding */ > + unsigned int penc[MMU_PAGE_COUNT]; /* HPTE encoding */ Since we are using -1 as an invalid flag, it would be better to change penc[] to be an array of int (or signed int) rather than unsigned int. That would eliminate a few (signed int) casts in your subsequent patches. > +static inline int hpte_actual_psize(struct hash_pte *hptep, int psize) > +{ > + int i, shift; > + unsigned int mask; > + /* Look at the 8 bit LP value */ > + unsigned int lp = (hptep->r >> LP_SHIFT) & ((1 << LP_BITS) - 1); > + > + /* First check if it is large page */ > + if (!(hptep->v & HPTE_V_LARGE)) > + return MMU_PAGE_4K; > + > + /* start from 1 ignoring MMU_PAGE_4K */ > + for (i = 1; i < MMU_PAGE_COUNT; i++) { > + /* valid entries have a shift value */ > + if (!mmu_psize_defs[i].shift) > + continue; > + /* > + * encoding bits per actual page size > + * PTE LP actual page size > + * rrrr rrrz ≥8KB > + * rrrr rrzz ≥16KB > + * rrrr rzzz ≥32KB > + * rrrr zzzz ≥64KB > + * ....... > + */ > + shift = mmu_psize_defs[i].shift - > + mmu_psize_defs[MMU_PAGE_4K].shift; The memory reference for mmu_psize_defs[MMU_PAGE_4K].shift seems unnecessary here. Just use LP_SHIFT, same as when you calculated lp. Paul. _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev