Skip to content

Commit

Permalink
mm/pkeys, powerpc, x86: Provide an empty vma_pkey() in linux/pkeys.h
Browse files Browse the repository at this point in the history
Consolidate the pkey handling by providing a common empty definition
of vma_pkey() in pkeys.h when CONFIG_ARCH_HAS_PKEYS=n.

This also removes another entanglement of pkeys.h and
asm/mmu_context.h.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Ram Pai <linuxram@us.ibm.com>
Reviewed-by: Dave Hansen <dave.hansen@intel.com>
  • Loading branch information
Michael Ellerman committed May 9, 2018
1 parent cd419a5 commit dbec10e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
5 changes: 0 additions & 5 deletions arch/powerpc/include/asm/mmu_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,6 @@ static inline bool arch_vma_access_permitted(struct vm_area_struct *vma,
#define thread_pkey_regs_restore(new_thread, old_thread)
#define thread_pkey_regs_init(thread)

static inline int vma_pkey(struct vm_area_struct *vma)
{
return 0;
}

static inline u64 pte_to_hpte_pkey_bits(u64 pteflags)
{
return 0x0UL;
Expand Down
5 changes: 0 additions & 5 deletions arch/x86/include/asm/mmu_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,6 @@ static inline int vma_pkey(struct vm_area_struct *vma)

return (vma->vm_flags & vma_pkey_mask) >> VM_PKEY_SHIFT;
}
#else
static inline int vma_pkey(struct vm_area_struct *vma)
{
return 0;
}
#endif

/*
Expand Down
5 changes: 5 additions & 0 deletions include/linux/pkeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
#define PKEY_DEDICATED_EXECUTE_ONLY 0
#define ARCH_VM_PKEY_FLAGS 0

static inline int vma_pkey(struct vm_area_struct *vma)
{
return 0;
}

static inline bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey)
{
return (pkey == 0);
Expand Down

0 comments on commit dbec10e

Please sign in to comment.