summaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2018-04-13 23:54:36 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2018-05-09 11:51:28 +1000
commit3f36c94239658a79a4deeb84a2e0ebf005f083fc (patch)
tree937ffb0918f11333454e4f9f2e9458580275fa52 /arch/x86
parent555934a71bb479ce109722807b374f2d98aefe89 (diff)
downloadlinux-stable-3f36c94239658a79a4deeb84a2e0ebf005f083fc.tar.gz
linux-stable-3f36c94239658a79a4deeb84a2e0ebf005f083fc.tar.bz2
linux-stable-3f36c94239658a79a4deeb84a2e0ebf005f083fc.zip
x86/pkeys: Add arch_pkeys_enabled()
This will be used in future patches to check for arch support for pkeys in generic code. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Reviewed-by: Dave Hansen <dave.hansen@intel.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/include/asm/pkeys.h5
1 files changed, 5 insertions, 0 deletions
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.