瀏覽代碼

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>
Michael Ellerman 7 年之前
父節點
當前提交
3f36c94239
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      arch/x86/include/asm/pkeys.h

+ 5 - 0
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.