From patchwork Tue May 8 14:59:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Ellerman X-Patchwork-Id: 10386293 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5849360236 for ; Tue, 8 May 2018 15:00:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4550D28E20 for ; Tue, 8 May 2018 15:00:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 390C728DD5; Tue, 8 May 2018 15:00:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B163228DD5 for ; Tue, 8 May 2018 15:00:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 615E56B0294; Tue, 8 May 2018 11:00:03 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5A9D86B0295; Tue, 8 May 2018 11:00:03 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3CF296B0296; Tue, 8 May 2018 11:00:03 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f198.google.com (mail-pf0-f198.google.com [209.85.192.198]) by kanga.kvack.org (Postfix) with ESMTP id E57BC6B0294 for ; Tue, 8 May 2018 11:00:02 -0400 (EDT) Received: by mail-pf0-f198.google.com with SMTP id z1so8773453pfh.3 for ; Tue, 08 May 2018 08:00:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=bQ9Wdwuoi38Hmefn9oy3QtinMU9bRGMVHTNJUihe7kg=; b=QHQBn+eAm4lHQ2aYfgyq1E4RtygxOhUW6RGKC+ZlA6au0kyfWSNmh2HNHxeEruakR1 tfWmOkLTFKL+ckQRf2AH39xnZDCC1thoBwl2QHJNgBk8SSy56eBIDOaHWHeYStaIzP43 8qgU+6huxQYy04QewMtjigTo/O5IFeXA5hLMQ3NZCg10YHxoUoQ8TrUURaCD7bu7gg4I CLCRuZ/4YUnbDv+U3KHjSKPajhwsHpaOcj78uE9JSKB9NMDgrYK0V1w7Dmtg+EG28kpQ a9hXCrqG21Ia8iSdnAkSjWkHKZCzwCuhWCrpN3xXj4hHmTitPIGeEL1jqJzAjZuxTVA4 O0MQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of michael@ozlabs.org designates 2401:3900:2:1::2 as permitted sender) smtp.mailfrom=michael@ozlabs.org X-Gm-Message-State: ALQs6tBkPb5z8SPzKrsV1+HR4A7YGIjQ/q8LjovKlNEf2eFBaEMYxJ0e VwZuADfOk96ohCIG3omtNBi/ZYTkZn2+X4ttQ6e2Fbr+Y53QPs5/qOES7drD6cBfa3hy/1SD6Ym /RjV4Eevq/wScGVi04iq7OHwnlI9TDckuzQSsSJcQBJC41lYC8/J6aHdpRd64LYQ= X-Received: by 2002:a17:902:6006:: with SMTP id r6-v6mr40945826plj.70.1525791602641; Tue, 08 May 2018 08:00:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpdPCtuuW0uUzJbne8NcdG4l83NxOkU5W/gOmqu/92qgHB8nd1U6jk2OZbzRQa3o2fqEn8y X-Received: by 2002:a17:902:6006:: with SMTP id r6-v6mr40945791plj.70.1525791601913; Tue, 08 May 2018 08:00:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525791601; cv=none; d=google.com; s=arc-20160816; b=nthlTxzwNwLrZfgyQXCHRT/NDEUxIiQFRvuoTpLzgQSvOOhje+e7TRDVpw+08jSyGP u2Sznv+VmdW0gt8V+B45geapDSApwwfdrfpg9TvKxBV0ZSaCmAXvChXyiJuPEgoUgDPi lBKcVyt+TRNv0N0zv/n7BvVqAf4YeeovnzRbOTIqSPRgYUSSczFwUexUEZmWKT6b/XdN +Wj75VgJh7VgAiVHe3jQDr5uCzhZvskJdoYBv91ZzK8Btk9V2BcsB7grlY+FDz4VK/lN SUADX0JyLg2ostLSwMUXQuVT//e3Ube8+9rMv73n8QqbOh/QhIaNtQKmCKYVFI2JEiHu FoXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=bQ9Wdwuoi38Hmefn9oy3QtinMU9bRGMVHTNJUihe7kg=; b=e4sfhvHjw/MglG4wKQhqokiXlw3EM5hbf9+5PkydlVzoJN89Q10/GUXA3sGbzzCtKd xpJ8Og5yr1G7riIh1OE2TXyOU2uLZYSuje9LqzIGcbhhOVC0crNNnC2bC7vgmcuIii6r mylcFi0gC5ZBwjFgCV4k5GhGy0ifLAvDr2z0WfvaVfuyZBR68qncubgYk0nPc/FkY9Xb JnUp8PxRn0pkTBJ6u6QbVIRPMGs1Iq5UxNQGLMDvbnnLMF/9bEOWFkB8AKUd3C3OLoTu bocQ8bIfMd81kgSzH5ujTfO7TXdIY0e5vNHxQrUPC1hD6kKiSILJr1OTRNvfRSIUAnT/ idFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of michael@ozlabs.org designates 2401:3900:2:1::2 as permitted sender) smtp.mailfrom=michael@ozlabs.org Received: from ozlabs.org (ozlabs.org. [2401:3900:2:1::2]) by mx.google.com with ESMTPS id y26-v6si13074947pgv.202.2018.05.08.08.00.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 May 2018 08:00:01 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@ozlabs.org designates 2401:3900:2:1::2 as permitted sender) client-ip=2401:3900:2:1::2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of michael@ozlabs.org designates 2401:3900:2:1::2 as permitted sender) smtp.mailfrom=michael@ozlabs.org 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> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Move the last remaining pkey helper, vma_pkey() into asm/pkeys.h Signed-off-by: Michael Ellerman Reviewed-by: Dave Hansen --- 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