[PATCH -V3 03/11] arch/powerpc: Convert virtual address to vpn
Aneesh Kumar K.V
aneesh.kumar at linux.vnet.ibm.com
Tue Jul 10 16:12:47 EST 2012
Stephen Rothwell <sfr at canb.auug.org.au> writes:
> Hi Aneesh,
>
> On Mon, 9 Jul 2012 18:43:33 +0530 "Aneesh Kumar K.V" <aneesh.kumar at linux.vnet.ibm.com> wrote:
>>
>> diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
>> index 1c65a59..1c984a6 100644
>> --- a/arch/powerpc/include/asm/mmu-hash64.h
>> +++ b/arch/powerpc/include/asm/mmu-hash64.h
>> @@ -154,9 +155,25 @@ struct mmu_psize_def
>> #define MMU_SEGSIZE_256M 0
>> #define MMU_SEGSIZE_1T 1
>>
>> +/*
>> + * encode page number shift.
>> + * Inorder to fit the 78 bit va in a 64 bit variable we shift the va by
>> + * 12 bits. This enable us to address upto 76 bit va.
>> + * For hpt hash from a va we can ignore the page size bits of va and for
>> + * hpte encoding we ignore upto 23 bits of va. So ignoring lower 12 bits ensure
>> + * we work in all cases including 4k page size.
>> + */
>> +#define VPN_SHIFT 12
>>
>> +static inline unsigned long hpte_encode_avpn(unsigned long vpn, int psize,
>> + int ssize)
>> +{
>> + unsigned long v;
>> + /*
>> + * The AVA field omits the low-order 23 bits of the 78 bits VA.
>> + * These bits are not needed in the PTE, because the
>> + * low-order b of these bits are part of the byte offset
>> + * into the virtual page and, if b < 23, the high-order
>> + * 23-b of these bits are always used in selecting the
>> + * PTEGs to be searched
>> + */
>> + BUG_ON(VPN_SHIFT > 23);
>
> Could/should this be BUILD_BUG_ON()?
>
Yes. Will update.
-aneesh
More information about the Linuxppc-dev
mailing list