Received: by 10.192.165.148 with SMTP id m20csp4407586imm; Tue, 8 May 2018 08:01:23 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoAnXdt52w8zu4zUfg+k5/ixa1XiEJXyy45m8ekYVzjHCI1EuZ1Z3uMEKhthU7uOzuyGBuN X-Received: by 10.98.8.131 with SMTP id 3mr39909016pfi.154.1525791683672; Tue, 08 May 2018 08:01:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525791683; cv=none; d=google.com; s=arc-20160816; b=w1tIEK3YP+0aFFDhNLM8+NI8ARcAnFDSkpzHK6SfB/4d0+LYhZCEgLnlhxEl7iWwbT ijW8KllriPv+bvaxVHgzeI43iRx5tC0ZBGFD/GTrZCYEn9IG+jg/pd20PnEu12Tmf1dk 2xImigKN2xN4j9NM38ZnIAX4CWoZii7ajpxCPlbN5/Lk/hV5lgaqGw9RPijdacyzfaEG Yc+WVuu7HDdCxlpN1P3TJFyVvLzlJQ5aP0dtftx658I6FHjl/ciYUBBIF1ll9gCaTQLY CeMcU2sRHBTqA9iz8miHkqkAdgJd3wzQ0IGO/yeOZZ8mTL2sve1WTEVWR/AS3wu9Cgbb sLyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=bQ9Wdwuoi38Hmefn9oy3QtinMU9bRGMVHTNJUihe7kg=; b=wCefBoGOv6AQi3Z5916HXvAcrETfQR5NFxQA1Xb33yNRKWJ++NVMVjmCIGgVfhw0Ob rz7kwvmuxnD26n8gPqy3vniWG68fy8PQsuA/jSVvMTIdL4Lf2ASxt6tK7WhRcIjhL+QT UdbTgFSI2+BwqzeUdrCxvapbOPobE91idmvtvcW0NXgiLdsPx9VrkjAlDFJ/YYhs6ThP k/F3YejWQRdGeNCH+xNXk2J4dvXcXn95ZHF1xP+XXAieKZm3wEcCdm/AlIBoUxlnCIfQ HTYXUE5d8jVj4YUTJh9h+dxZZNTM2g5hvhSpGBANAOy2xwPNbz0Dgx+/WskuScKYoGxN G74Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o5-v6si13539062plh.556.2018.05.08.08.01.08; Tue, 08 May 2018 08:01:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932806AbeEHPAD (ORCPT + 99 others); Tue, 8 May 2018 11:00:03 -0400 Received: from ozlabs.org ([203.11.71.1]:44627 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932599AbeEHPAA (ORCPT ); Tue, 8 May 2018 11:00:00 -0400 Received: by ozlabs.org (Postfix, from userid 1034) id 40gN275Xcmz9s4q; Wed, 9 May 2018 00:59:59 +1000 (AEST) From: Michael Ellerman To: linuxram@us.ibm.com Cc: mingo@redhat.com, linuxppc-dev@ozlabs.org, linux-mm@kvack.org, x86@kernel.org, linux-kernel@vger.kernel.org, dave.hansen@intel.com Subject: [PATCH 5/8] x86/pkeys: Move vma_pkey() into asm/pkeys.h Date: Wed, 9 May 2018 00:59:45 +1000 Message-Id: <20180508145948.9492-6-mpe@ellerman.id.au> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180508145948.9492-1-mpe@ellerman.id.au> References: <20180508145948.9492-1-mpe@ellerman.id.au> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move the last remaining pkey helper, vma_pkey() into asm/pkeys.h Signed-off-by: Michael Ellerman --- arch/x86/include/asm/mmu_context.h | 10 ---------- arch/x86/include/asm/pkeys.h | 8 ++++++++ include/linux/pkeys.h | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h index 3d748bdf44a7..59e1fadef401 100644 --- a/arch/x86/include/asm/mmu_context.h +++ b/arch/x86/include/asm/mmu_context.h @@ -288,16 +288,6 @@ static inline void arch_unmap(struct mm_struct *mm, struct vm_area_struct *vma, mpx_notify_unmap(mm, vma, start, end); } -#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS -static inline int vma_pkey(struct vm_area_struct *vma) -{ - unsigned long vma_pkey_mask = VM_PKEY_BIT0 | VM_PKEY_BIT1 | - VM_PKEY_BIT2 | VM_PKEY_BIT3; - - return (vma->vm_flags & vma_pkey_mask) >> VM_PKEY_SHIFT; -} -#endif - /* * We only want to enforce protection keys on the current process * because we effectively have no access to PKRU for other diff --git a/arch/x86/include/asm/pkeys.h b/arch/x86/include/asm/pkeys.h index a0ba1ffda0df..0e5f749158e4 100644 --- a/arch/x86/include/asm/pkeys.h +++ b/arch/x86/include/asm/pkeys.h @@ -106,4 +106,12 @@ extern int __arch_set_user_pkey_access(struct task_struct *tsk, int pkey, unsigned long init_val); extern void copy_init_pkru_to_fpregs(void); +static inline int vma_pkey(struct vm_area_struct *vma) +{ + unsigned long vma_pkey_mask = VM_PKEY_BIT0 | VM_PKEY_BIT1 | + VM_PKEY_BIT2 | VM_PKEY_BIT3; + + return (vma->vm_flags & vma_pkey_mask) >> VM_PKEY_SHIFT; +} + #endif /*_ASM_X86_PKEYS_H */ diff --git a/include/linux/pkeys.h b/include/linux/pkeys.h index aad54663763b..946cb773b79f 100644 --- a/include/linux/pkeys.h +++ b/include/linux/pkeys.h @@ -2,7 +2,7 @@ #ifndef _LINUX_PKEYS_H #define _LINUX_PKEYS_H -#include +#include #ifdef CONFIG_ARCH_HAS_PKEYS #include -- 2.14.1