From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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) 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) From: Michael Ellerman 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> In-Reply-To: <20180508145948.9492-1-mpe@ellerman.id.au> References: <20180508145948.9492-1-mpe@ellerman.id.au> Sender: owner-linux-mm@kvack.org List-ID: 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 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. -- 2.14.1