[PATCH -V2 11/26] powerpc: Fix hpte_decode to use the correct decoding for page sizes

Paul Mackerras paulus at samba.org
Wed Mar 13 13:56:14 EST 2013


On Wed, Mar 06, 2013 at 11:40:12AM +0530, Aneesh Kumar K.V wrote:
> From: "Aneesh Kumar K.V" <aneesh.kumar at linux.vnet.ibm.com>
> 
> As per ISA doc, we encode base and actual page size in the LP bits of
> PTE. The number of bit used to encode the page sizes depend on actual
> page size.  ISA doc lists this as
> 
>    PTE LP     actual page size
> rrrr rrrz 	≥8KB
> rrrr rrzz	≥16KB
> rrrr rzzz 	≥32KB
> rrrr zzzz 	≥64KB
> rrrz zzzz 	≥128KB
> rrzz zzzz 	≥256KB
> rzzz zzzz	≥512KB
> zzzz zzzz 	≥1MB
> 
> ISA doc also says
> "The values of the “z” bits used to specify each size, along with all possible
> values of “r” bits in the LP field, must result in LP values distinct from
> other LP values for other sizes."
> 
> based on the above update hpte_decode to use the correct decoding for LP bits.
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar at linux.vnet.ibm.com>
[snip]
> +				shift = mmu_psize_defs[a_size].shift -
> +					mmu_psize_defs[MMU_PAGE_4K].shift;

"mmu_psize_defs[MMU_PAGE_4K].shift" seems like an overly complicated
way to write "LP_SHIFT" (or even "12").  After all, you did:

> +	unsigned int lp = (hpte->r >> LP_SHIFT) & ((1 << LP_BITS) - 1);

earlier.  If LP_SHIFT is good enough in that expression it's good
enough when calculating shift.

Apart from that minor nit,

Acked-by: Paul Mackerras <paulus at samba.org>


More information about the Linuxppc-dev mailing list