Subject: Re: [PATCH -V5 13/13] arch/powerpc: Update VSID allocation documentation

From: Paul Mackerras <[email-masked]>
Date: Wed, 1 Aug 2012 15:35:05 +1000

On Mon, Jul 30, 2012 at 04:52:19PM +0530, Aneesh Kumar K.V wrote:
> From: "Aneesh Kumar K.V" <[email-masked]>
> 
> This update the proto-VSID and VSID scramble related information
> to be more generic by using names instead of current values.

Comments below...

> - * VSID allocation
> + * VSID allocation (256MB segment)
>   *
> - * We first generate a 36-bit "proto-VSID".  For kernel addresses this
> - * is equal to the ESID, for user addresses it is:
> - *	(context << 15) | (esid & 0x7fff)
> + * We first generate a 38-bit "proto-VSID".  For kernel addresses this
> + * is equal to the ESID | 1 << 37, for user addresses it is:
> + *	(context << USER_ESID_BITS) | (esid & (1U << USER_ESID_BITS))
					      ^^^^^^^^^^^^^^^^^^^^^^
should be ((1U << USER_ESID_BITS) - 1)

>   *
> - * The two forms are distinguishable because the top bit is 0 for user
> - * addresses, whereas the top two bits are 1 for kernel addresses.
> - * Proto-VSIDs with the top two bits equal to 0b10 are reserved for
> - * now.
> + * This splits the proto-VSID into the below range
> + *  0 - (2^(CONTEXT_BITS + USER_ESID_BITS) - 1) : User proto-VSID range
> + *  2^(CONTEXT_BITS + USER_ESID_BITS) - 2^(VSID_BITS) : Kernel proto-VSID range

Perhaps point out also that CONTEXT_BITS + USER_ESID_BITS == VSID_BITS - 1,
that is, you have assigned half of the space to user processes and half
to the kernel.

> -/*
> - * WARNING - If you change these you must make sure the asm
> - * implementations in slb_allocate (slb_low.S), do_stab_bolted
> - * (head.S) and ASM_VSID_SCRAMBLE (below) are changed accordingly.
> - */

Are you absolutely sure that nothing in the assembly code would need
to be changed if someone changed these definitions?

Paul.