Ram Pai writes:
> Total 32 keys are available on power7 and above. However
> pkey 0,1 are reserved. So effectively we have 30 pkeys.
>
> On 4K kernels, we do not have 5 bits in the PTE to
> represent all the keys; we only have 3bits.Two of those
> keys are reserved; pkey 0 and pkey 1. So effectively we
> have 6 pkeys.
>
> This patch keeps track of reserved keys, allocated keys
> and keys that are currently free.
>
> Also it adds skeletal functions and macros, that the
> architecture-independent code expects to be available.
>
> Signed-off-by: Ram Pai
> ---
> arch/powerpc/include/asm/book3s/64/mmu.h |9
> arch/powerpc/include/asm/mmu_context.h |1 +
> arch/powerpc/include/asm/pkeys.h | 72
> --
> arch/powerpc/mm/mmu_context_book3s64.c |2 +
> arch/powerpc/mm/pkeys.c | 28
> 5 files changed, 108 insertions(+), 4 deletions(-)
This doesn't build for me, with pseries_le_defconfig. I assume it built
for you. So something has changed upstream maybe?
In file included from ../include/linux/pkeys.h:8:0,
from ../mm/mprotect.c:26:
../mm/mprotect.c: In function ‘do_mprotect_pkey’:
../arch/powerpc/include/asm/pkeys.h:27:29: error: ‘VM_PKEY_BIT0’ undeclared
(first use in this function)
#define ARCH_VM_PKEY_FLAGS (VM_PKEY_BIT0 | VM_PKEY_BIT1 | VM_PKEY_BIT2 | \
^
../mm/mprotect.c:470:6: note: in expansion of macro ‘ARCH_VM_PKEY_FLAGS’
ARCH_VM_PKEY_FLAGS;
^~
../arch/powerpc/include/asm/pkeys.h:27:29: note: each undeclared identifier is
reported only once for each function it appears in
#define ARCH_VM_PKEY_FLAGS (VM_PKEY_BIT0 | VM_PKEY_BIT1 | VM_PKEY_BIT2 | \
^
../mm/mprotect.c:470:6: note: in expansion of macro ‘ARCH_VM_PKEY_FLAGS’
ARCH_VM_PKEY_FLAGS;
^~
../arch/powerpc/include/asm/pkeys.h:27:44: error: ‘VM_PKEY_BIT1’ undeclared
(first use in this function)
#define ARCH_VM_PKEY_FLAGS (VM_PKEY_BIT0 | VM_PKEY_BIT1 | VM_PKEY_BIT2 | \
^
../mm/mprotect.c:470:6: note: in expansion of macro ‘ARCH_VM_PKEY_FLAGS’
ARCH_VM_PKEY_FLAGS;
^~
../arch/powerpc/include/asm/pkeys.h:27:59: error: ‘VM_PKEY_BIT2’ undeclared
(first use in this function)
#define ARCH_VM_PKEY_FLAGS (VM_PKEY_BIT0 | VM_PKEY_BIT1 | VM_PKEY_BIT2 | \
^
../mm/mprotect.c:470:6: note: in expansion of macro ‘ARCH_VM_PKEY_FLAGS’
ARCH_VM_PKEY_FLAGS;
^~
../arch/powerpc/include/asm/pkeys.h:28:5: error: ‘VM_PKEY_BIT3’ undeclared
(first use in this function)
VM_PKEY_BIT3 | VM_PKEY_BIT4)
^
../mm/mprotect.c:470:6: note: in expansion of macro ‘ARCH_VM_PKEY_FLAGS’
ARCH_VM_PKEY_FLAGS;
^~
../arch/powerpc/include/asm/pkeys.h:28:20: error: ‘VM_PKEY_BIT4’ undeclared
(first use in this function)
VM_PKEY_BIT3 | VM_PKEY_BIT4)
^
../mm/mprotect.c:470:6: note: in expansion of macro ‘ARCH_VM_PKEY_FLAGS’
ARCH_VM_PKEY_FLAGS;
^~
../scripts/Makefile.build:311: recipe for target 'mm/mprotect.o' failed
cheers