From patchwork Tue May 8 14:59:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Ellerman X-Patchwork-Id: 10386297 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 0D047602D8 for ; Tue, 8 May 2018 15:00:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2B2C28DD7 for ; Tue, 8 May 2018 15:00:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E79F528E1C; Tue, 8 May 2018 15:00:23 +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=unavailable 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 BF02228E2A for ; Tue, 8 May 2018 15:00:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1DC436B0295; Tue, 8 May 2018 11:00:04 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 161B76B0297; Tue, 8 May 2018 11:00:04 -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 EC2FD6B0298; 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-pl0-f70.google.com (mail-pl0-f70.google.com [209.85.160.70]) by kanga.kvack.org (Postfix) with ESMTP id BB6466B0295 for ; Tue, 8 May 2018 11:00:03 -0400 (EDT) Received: by mail-pl0-f70.google.com with SMTP id a14-v6so1918597plt.7 for ; Tue, 08 May 2018 08:00:03 -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=v2MGWf8uxmd5gMJ5mIJYz/xcPhGK5NpO4jGqBrA0qMY=; b=W/Yz50ntOUKdCynb8WR8NGuIytPL//CDczV4UY6+3c7H+Qk9QqbvNbUI41P10n6YcA ceEPYJG/ekwTtI8RrLxEQ1Pum6KuVgwDVTr3jEZasJLPKoFcs97ma8aNdKwgpNWSyWbu ZaZhqxBoI4bmQRN+bPyRiVbgHXRhavhdH6Iglh6RtN6ILGKG8su2BUmpZTq6E9Zhko6y G2mbuDoU+LxsGw9q84iColTirCN1dxQXBmT6gYfpbWbuvuPTHr6EibEsBLuWImi/V6Op b3A/xJojdbpTSMSRRM8ZON/kBGFr/ff8WpjOUOjln0bpgOty47Xw4aOFk4LOZAKg5+Y+ RN4w== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of michael@ozlabs.org designates 203.11.71.1 as permitted sender) smtp.mailfrom=michael@ozlabs.org X-Gm-Message-State: ALQs6tDNGunq8gpExEMxh34n4z9eukpY+IAmnUZOtomCd25hXUcDYVJ/ iAqjUjTW8/vIZqa9ZvexDfHCbCtqh8/cD10z18jvV7vml7T4JUAV8rg+/iuA+9yHMGg3kDr/7zL PV0CFzetMvOS092zePa1+gQJzh+Ns4OxWWc9yqSiRsPzTChbdT407OXeES0ku1Cw= X-Received: by 2002:a17:902:2c83:: with SMTP id n3-v6mr29753974plb.140.1525791603477; Tue, 08 May 2018 08:00:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrWneAjBDjMQvJKkklYQeHQwTvd2rYawxMDRQdvLzzq8X8uJ7RGeW/PktY8ZbW5yOjJLNOR X-Received: by 2002:a17:902:2c83:: with SMTP id n3-v6mr29753931plb.140.1525791602778; Tue, 08 May 2018 08:00:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525791602; cv=none; d=google.com; s=arc-20160816; b=ZEZkIROakzs5anhAxXm6nhiSNwgSrML2h5ee5KysgehuMAfevoisJrJFWDw5VIhBWp PLpjiaPPGOuY8A2ewHKUEFjnbG9s//M+Vj8RfZ4PLnk3rFZjQTFEgFLUDz4gkjlXLsEf g5ae8O655qMjP9BSA/6lflm6siQic4x84sbAcTX9DMsilRpx3vqBD9BBXa2CJbL4YFB7 906rURf49JHhS10W6I0Dzte8ATdinSqDKziJAKGO+/6DLlmg5kpSYLf7ib5LSww4UB5+ rdy9n5iBf7XayXoO4bpuHUy9gq7TSyxK6OEKDd9tATYc/OSfjhvlqbL8zZRaGMW4HNRG hwrg== 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=v2MGWf8uxmd5gMJ5mIJYz/xcPhGK5NpO4jGqBrA0qMY=; b=FptPhNZUDJKaCeiJ2sqX5cKZZcCRMiT8HyNDKaDesQXd6QkfpucwbB5zZIROW8zyQZ mYzDl4SvEQflRg2d0jDja7tuORw2pbJFC8xDrjOjshL+fWY5fy6cURV5wT8SGE8iDhKy iwMs7TqLyez9TUii/gyqbBl3SiQ5kDGDYa7UIdpgFWHgmhErRj+lS3stsi5xkunCYgip w/4CGzoYhHwcxgD6txiWTKKYFSLg3/8lNX57wTNsqduusXftf83vOyxuhSheTrJ24P7w oNvrtjpVM2xSsa5Ol9C+TB/atlTep8griZdJvVJUd9M3OQ70DhgiIIKPr+wo+iR6+NJq AgTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of michael@ozlabs.org designates 203.11.71.1 as permitted sender) smtp.mailfrom=michael@ozlabs.org Received: from ozlabs.org (ozlabs.org. [203.11.71.1]) by mx.google.com with ESMTPS id j11-v6si5102894plt.325.2018.05.08.08.00.02 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 May 2018 08:00:02 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@ozlabs.org designates 203.11.71.1 as permitted sender) client-ip=203.11.71.1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of michael@ozlabs.org designates 203.11.71.1 as permitted sender) smtp.mailfrom=michael@ozlabs.org Received: by ozlabs.org (Postfix, from userid 1034) id 40gN284wShz9s35; Wed, 9 May 2018 01:00:00 +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 6/8] x86/pkeys: Add arch_pkeys_enabled() Date: Wed, 9 May 2018 00:59:46 +1000 Message-Id: <20180508145948.9492-7-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.000049, 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 This will be used in future patches to check for arch support for pkeys in generic code. Signed-off-by: Michael Ellerman --- arch/x86/include/asm/pkeys.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/include/asm/pkeys.h b/arch/x86/include/asm/pkeys.h index 0e5f749158e4..c1957f8f7c1b 100644 --- a/arch/x86/include/asm/pkeys.h +++ b/arch/x86/include/asm/pkeys.h @@ -7,6 +7,11 @@ extern int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, unsigned long init_val); +static inline bool arch_pkeys_enabled(void) +{ + return boot_cpu_has(X86_FEATURE_OSPKE); +} + /* * Try to dedicate one of the protection keys to be used as an * execute-only protection key.