From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754137AbdKXRZq (ORCPT ); Fri, 24 Nov 2017 12:25:46 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:40433 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754103AbdKXRZh (ORCPT ); Fri, 24 Nov 2017 12:25:37 -0500 X-Google-Smtp-Source: AGs4zMaXeLiO+uDvE7HF7T6qNIF2/OC/biY16VowdRWiCHqITC33RTPGaVCzD1/fjEVpJ8SqelPRBg== From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Dave Hansen , Andy Lutomirski , Thomas Gleixner , "H . Peter Anvin" , Peter Zijlstra , Borislav Petkov , Linus Torvalds Subject: [PATCH 40/43] x86/mm/kaiser: Add a function to check for KAISER being enabled Date: Fri, 24 Nov 2017 18:24:08 +0100 Message-Id: <20171124172411.19476-41-mingo@kernel.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171124172411.19476-1-mingo@kernel.org> References: <20171124172411.19476-1-mingo@kernel.org> 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 Signed-off-by: Thomas Gleixner Cc: Linus Torvalds Cc: Peter Zijlstra Cc: daniel.gruss@iaik.tugraz.at Cc: hughd@google.com Cc: keescook@google.com Cc: linux-mm@kvack.org Cc: luto@kernel.org Cc: michael.schwarz@iaik.tugraz.at Cc: moritz.lipp@iaik.tugraz.at Cc: richard.fellner@student.tugraz.at Link: https://lkml.kernel.org/r/20171123003518.B7D81B14@viggo.jf.intel.com Signed-off-by: Ingo Molnar --- arch/x86/include/asm/kaiser.h | 5 +++++ include/linux/kaiser.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/arch/x86/include/asm/kaiser.h b/arch/x86/include/asm/kaiser.h index 040cb096d29d..35f12a8a7071 100644 --- a/arch/x86/include/asm/kaiser.h +++ b/arch/x86/include/asm/kaiser.h @@ -56,6 +56,11 @@ extern void kaiser_remove_mapping(unsigned long start, unsigned long size); */ extern void kaiser_init(void); +static inline bool kaiser_active(void) +{ + extern int kaiser_enabled; + return kaiser_enabled; +} #endif #endif /* __ASSEMBLY__ */ diff --git a/include/linux/kaiser.h b/include/linux/kaiser.h index 77db4230a0dd..a3d28d00d555 100644 --- a/include/linux/kaiser.h +++ b/include/linux/kaiser.h @@ -28,5 +28,10 @@ static inline int kaiser_add_mapping(unsigned long addr, unsigned long size, static inline void kaiser_add_mapping_cpu_entry(int cpu) { } + +static inline bool kaiser_active(void) +{ + return 0; +} #endif /* !CONFIG_KAISER */ #endif /* _INCLUDE_KAISER_H */ -- 2.14.1