From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754851AbdKJTdS (ORCPT ); Fri, 10 Nov 2017 14:33:18 -0500 Received: from mga02.intel.com ([134.134.136.20]:42993 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754600AbdKJTcO (ORCPT ); Fri, 10 Nov 2017 14:32:14 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,375,1505804400"; d="scan'208";a="3586353" Subject: [PATCH 26/30] x86, kaiser: add a function to check for KAISER being enabled To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, dave.hansen@linux.intel.com, moritz.lipp@iaik.tugraz.at, daniel.gruss@iaik.tugraz.at, michael.schwarz@iaik.tugraz.at, richard.fellner@student.tugraz.at, luto@kernel.org, torvalds@linux-foundation.org, keescook@google.com, hughd@google.com, x86@kernel.org From: Dave Hansen Date: Fri, 10 Nov 2017 11:31:55 -0800 References: <20171110193058.BECA7D88@viggo.jf.intel.com> In-Reply-To: <20171110193058.BECA7D88@viggo.jf.intel.com> Message-Id: <20171110193155.D088AF1D@viggo.jf.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: x86@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.h 2017-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 */ _