[PATCH 26/30] x86, kaiser: add a function to check for KAISER being enabled

2017-11-10 Thread Dave Hansen

From: Dave Hansen 

Currently, all of the checks for KAISER are compile-time checks.

Runtime checks are needed for turning it on/off at runtime.

Add a function to do that.

Signed-off-by: Dave Hansen 
Cc: Moritz Lipp 
Cc: Daniel Gruss 
Cc: Michael Schwarz 
Cc: Richard Fellner 
Cc: Andy Lutomirski 
Cc: Linus Torvalds 
Cc: Kees Cook 
Cc: Hugh Dickins 
Cc: x...@kernel.org
---

 b/arch/x86/include/asm/kaiser.h |5 +
 b/include/linux/kaiser.h|4 
 2 files changed, 9 insertions(+)

diff -puN arch/x86/include/asm/kaiser.h~kaiser-dynamic-check-func 
arch/x86/include/asm/kaiser.h
--- a/arch/x86/include/asm/kaiser.h~kaiser-dynamic-check-func   2017-11-10 
11:22:19.435244924 -0800
+++ b/arch/x86/include/asm/kaiser.h 2017-11-10 11:22:19.440244924 -0800
@@ -50,6 +50,11 @@ extern void kaiser_remove_mapping(unsign
  */
 extern void kaiser_init(void);
 
+static inline bool kaiser_active(void)
+{
+   extern int kaiser_enabled;
+   return kaiser_enabled;
+}
 #endif
 
 #endif /* __ASSEMBLY__ */
diff -puN include/linux/kaiser.h~kaiser-dynamic-check-func 
include/linux/kaiser.h
--- a/include/linux/kaiser.h~kaiser-dynamic-check-func  2017-11-10 
11:22:19.437244924 -0800
+++ b/include/linux/kaiser.h2017-11-10 11:22:19.440244924 -0800
@@ -25,5 +25,9 @@ static inline int kaiser_add_mapping(uns
return 0;
 }
 
+static inline bool kaiser_active(void)
+{
+   return 0;
+}
 #endif /* !CONFIG_KAISER */
 #endif /* _INCLUDE_KAISER_H */
_


[PATCH 26/30] x86, kaiser: add a function to check for KAISER being enabled

2017-11-10 Thread Dave Hansen

From: Dave Hansen 

Currently, all of the checks for KAISER are compile-time checks.

Runtime checks are needed for turning it on/off at runtime.

Add a function to do that.

Signed-off-by: Dave Hansen 
Cc: Moritz Lipp 
Cc: Daniel Gruss 
Cc: Michael Schwarz 
Cc: Richard Fellner 
Cc: Andy Lutomirski 
Cc: Linus Torvalds 
Cc: Kees Cook 
Cc: Hugh Dickins 
Cc: x...@kernel.org
---

 b/arch/x86/include/asm/kaiser.h |5 +
 b/include/linux/kaiser.h|4 
 2 files changed, 9 insertions(+)

diff -puN arch/x86/include/asm/kaiser.h~kaiser-dynamic-check-func 
arch/x86/include/asm/kaiser.h
--- a/arch/x86/include/asm/kaiser.h~kaiser-dynamic-check-func   2017-11-10 
11:22:19.435244924 -0800
+++ b/arch/x86/include/asm/kaiser.h 2017-11-10 11:22:19.440244924 -0800
@@ -50,6 +50,11 @@ extern void kaiser_remove_mapping(unsign
  */
 extern void kaiser_init(void);
 
+static inline bool kaiser_active(void)
+{
+   extern int kaiser_enabled;
+   return kaiser_enabled;
+}
 #endif
 
 #endif /* __ASSEMBLY__ */
diff -puN include/linux/kaiser.h~kaiser-dynamic-check-func 
include/linux/kaiser.h
--- a/include/linux/kaiser.h~kaiser-dynamic-check-func  2017-11-10 
11:22:19.437244924 -0800
+++ b/include/linux/kaiser.h2017-11-10 11:22:19.440244924 -0800
@@ -25,5 +25,9 @@ static inline int kaiser_add_mapping(uns
return 0;
 }
 
+static inline bool kaiser_active(void)
+{
+   return 0;
+}
 #endif /* !CONFIG_KAISER */
 #endif /* _INCLUDE_KAISER_H */
_


[PATCH 26/30] x86, kaiser: add a function to check for KAISER being enabled

2017-11-08 Thread Dave Hansen

From: Dave Hansen 

Currently, all of the checks for KAISER are compile-time checks.
We also need runtime checks if we are going to turn it on/off at
runtime.

Add a function to do that.

Signed-off-by: Dave Hansen 
Cc: Moritz Lipp 
Cc: Daniel Gruss 
Cc: Michael Schwarz 
Cc: Richard Fellner 
Cc: Andy Lutomirski 
Cc: Linus Torvalds 
Cc: Kees Cook 
Cc: Hugh Dickins 
Cc: x...@kernel.org
---

 b/arch/x86/include/asm/kaiser.h |5 +
 b/include/linux/kaiser.h|4 
 2 files changed, 9 insertions(+)

diff -puN arch/x86/include/asm/kaiser.h~kaiser-dynamic-check-func 
arch/x86/include/asm/kaiser.h
--- a/arch/x86/include/asm/kaiser.h~kaiser-dynamic-check-func   2017-11-08 
10:45:40.224681368 -0800
+++ b/arch/x86/include/asm/kaiser.h 2017-11-08 10:45:40.229681368 -0800
@@ -50,6 +50,11 @@ extern void kaiser_remove_mapping(unsign
  */
 extern void kaiser_init(void);
 
+static inline bool kaiser_active(void)
+{
+   extern int kaiser_enabled;
+   return kaiser_enabled;
+}
 #endif
 
 #endif /* __ASSEMBLY__ */
diff -puN include/linux/kaiser.h~kaiser-dynamic-check-func 
include/linux/kaiser.h
--- a/include/linux/kaiser.h~kaiser-dynamic-check-func  2017-11-08 
10:45:40.225681368 -0800
+++ b/include/linux/kaiser.h2017-11-08 10:45:40.229681368 -0800
@@ -25,5 +25,9 @@ static inline int kaiser_add_mapping(uns
return 0;
 }
 
+static inline bool kaiser_active(void)
+{
+   return 0;
+}
 #endif /* !CONFIG_KAISER */
 #endif /* _INCLUDE_KAISER_H */
_


[PATCH 26/30] x86, kaiser: add a function to check for KAISER being enabled

2017-11-08 Thread Dave Hansen

From: Dave Hansen 

Currently, all of the checks for KAISER are compile-time checks.
We also need runtime checks if we are going to turn it on/off at
runtime.

Add a function to do that.

Signed-off-by: Dave Hansen 
Cc: Moritz Lipp 
Cc: Daniel Gruss 
Cc: Michael Schwarz 
Cc: Richard Fellner 
Cc: Andy Lutomirski 
Cc: Linus Torvalds 
Cc: Kees Cook 
Cc: Hugh Dickins 
Cc: x...@kernel.org
---

 b/arch/x86/include/asm/kaiser.h |5 +
 b/include/linux/kaiser.h|4 
 2 files changed, 9 insertions(+)

diff -puN arch/x86/include/asm/kaiser.h~kaiser-dynamic-check-func 
arch/x86/include/asm/kaiser.h
--- a/arch/x86/include/asm/kaiser.h~kaiser-dynamic-check-func   2017-11-08 
10:45:40.224681368 -0800
+++ b/arch/x86/include/asm/kaiser.h 2017-11-08 10:45:40.229681368 -0800
@@ -50,6 +50,11 @@ extern void kaiser_remove_mapping(unsign
  */
 extern void kaiser_init(void);
 
+static inline bool kaiser_active(void)
+{
+   extern int kaiser_enabled;
+   return kaiser_enabled;
+}
 #endif
 
 #endif /* __ASSEMBLY__ */
diff -puN include/linux/kaiser.h~kaiser-dynamic-check-func 
include/linux/kaiser.h
--- a/include/linux/kaiser.h~kaiser-dynamic-check-func  2017-11-08 
10:45:40.225681368 -0800
+++ b/include/linux/kaiser.h2017-11-08 10:45:40.229681368 -0800
@@ -25,5 +25,9 @@ static inline int kaiser_add_mapping(uns
return 0;
 }
 
+static inline bool kaiser_active(void)
+{
+   return 0;
+}
 #endif /* !CONFIG_KAISER */
 #endif /* _INCLUDE_KAISER_H */
_