[PATCH 02/25] powerpc: define an additional vma bit for protection keys.
Aneesh Kumar K.V
aneesh.kumar at linux.vnet.ibm.com
Mon Oct 23 20:28:55 AEDT 2017
"Aneesh Kumar K.V" <aneesh.kumar at linux.vnet.ibm.com> writes:
> Ram Pai <linuxram at us.ibm.com> writes:
>
>> powerpc needs an additional vma bit to support 32 keys.
>> Till the additional vma bit lands in include/linux/mm.h
>> we have to define it in powerpc specific header file.
>> This is needed to get pkeys working on power.
>>
>> Signed-off-by: Ram Pai <linuxram at us.ibm.com>
>> ---
>> arch/powerpc/include/asm/pkeys.h | 18 ++++++++++++++++++
>> 1 files changed, 18 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/powerpc/include/asm/pkeys.h b/arch/powerpc/include/asm/pkeys.h
>> index c02305a..44e01a2 100644
>> --- a/arch/powerpc/include/asm/pkeys.h
>> +++ b/arch/powerpc/include/asm/pkeys.h
>> @@ -3,6 +3,24 @@
>>
>> extern bool pkey_inited;
>> extern bool pkey_execute_disable_support;
>> +
>> +/*
>> + * powerpc needs an additional vma bit to support 32 keys.
>> + * Till the additional vma bit lands in include/linux/mm.h
>> + * we have to carry the hunk below. This is needed to get
>> + * pkeys working on power. -- Ram
>> + */
>> +#ifndef VM_HIGH_ARCH_BIT_4
>> +#define VM_HIGH_ARCH_BIT_4 36
>> +#define VM_HIGH_ARCH_4 BIT(VM_HIGH_ARCH_BIT_4)
>> +#define VM_PKEY_SHIFT VM_HIGH_ARCH_BIT_0
>> +#define VM_PKEY_BIT0 VM_HIGH_ARCH_0
>> +#define VM_PKEY_BIT1 VM_HIGH_ARCH_1
>> +#define VM_PKEY_BIT2 VM_HIGH_ARCH_2
>> +#define VM_PKEY_BIT3 VM_HIGH_ARCH_3
>> +#define VM_PKEY_BIT4 VM_HIGH_ARCH_4
>> +#endif
>> +
>> #define ARCH_VM_PKEY_FLAGS 0
>
> Do we want them in pkeys.h ? Even if they are arch specific for the
> existing ones we have them in include/linux/mm.h. IIUC, vmflags details
> are always in mm.h? This will be the first exception to that?
Also can we move that
#if defined (CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS)
# define VM_PKEY_SHIFT VM_HIGH_ARCH_BIT_0
# define VM_PKEY_BIT0 VM_HIGH_ARCH_0 /* A protection key is a 4-bit value */
# define VM_PKEY_BIT1 VM_HIGH_ARCH_1
# define VM_PKEY_BIT2 VM_HIGH_ARCH_2
# define VM_PKEY_BIT3 VM_HIGH_ARCH_3
#endif
to
#if defined (CONFIG_ARCH_HAS_PKEYS)
# define VM_PKEY_SHIFT VM_HIGH_ARCH_BIT_0
# define VM_PKEY_BIT0 VM_HIGH_ARCH_0 /* A protection key is a 4-bit value */
# define VM_PKEY_BIT1 VM_HIGH_ARCH_1
# define VM_PKEY_BIT2 VM_HIGH_ARCH_2
# define VM_PKEY_BIT3 VM_HIGH_ARCH_3
#endif
And then later update the generic to handle PKEY_BIT4?
-aneesh
More information about the Linuxppc-dev
mailing list