From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Henderson Subject: [PATCH 2/6] x86: Move arch_has_random* inside CONFIG_ARCH_RANDOM Date: Mon, 28 Oct 2019 22:05:55 +0100 Message-ID: <20191028210559.8289-3-rth@twiddle.net> References: <20191028210559.8289-1-rth@twiddle.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20191028210559.8289-1-rth@twiddle.net> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: linux-arch@vger.kernel.org Cc: linux-s390@vger.kernel.org, x86@kernel.org, Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org List-Id: linux-arch.vger.kernel.org These functions are declared generically without CONFIG_ARCH_RANDOM. The only reason this compiles for x86 is that we currently have a mix of inline functions are preprocessor defines. Signed-off-by: Richard Henderson --- Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" --- arch/x86/include/asm/archrandom.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/archrandom.h b/arch/x86/include/asm/archrandom.h index af45e1452f09..5904d7d9e703 100644 --- a/arch/x86/include/asm/archrandom.h +++ b/arch/x86/include/asm/archrandom.h @@ -73,10 +73,6 @@ static inline bool rdseed_int(unsigned int *v) return ok; } -/* Conditional execution based on CPU type */ -#define arch_has_random() static_cpu_has(X86_FEATURE_RDRAND) -#define arch_has_random_seed() static_cpu_has(X86_FEATURE_RDSEED) - /* * These are the generic interfaces; they must not be declared if the * stubs in are to be invoked, @@ -84,6 +80,10 @@ static inline bool rdseed_int(unsigned int *v) */ #ifdef CONFIG_ARCH_RANDOM +/* Conditional execution based on CPU type */ +#define arch_has_random() static_cpu_has(X86_FEATURE_RDRAND) +#define arch_has_random_seed() static_cpu_has(X86_FEATURE_RDSEED) + static inline bool arch_get_random_long(unsigned long *v) { return arch_has_random() ? rdrand_long(v) : false; -- 2.17.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f67.google.com ([209.85.221.67]:46929 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389536AbfJ1VGI (ORCPT ); Mon, 28 Oct 2019 17:06:08 -0400 Received: by mail-wr1-f67.google.com with SMTP id n15so11347849wrw.13 for ; Mon, 28 Oct 2019 14:06:05 -0700 (PDT) From: Richard Henderson Subject: [PATCH 2/6] x86: Move arch_has_random* inside CONFIG_ARCH_RANDOM Date: Mon, 28 Oct 2019 22:05:55 +0100 Message-ID: <20191028210559.8289-3-rth@twiddle.net> In-Reply-To: <20191028210559.8289-1-rth@twiddle.net> References: <20191028210559.8289-1-rth@twiddle.net> Sender: linux-arch-owner@vger.kernel.org List-ID: To: linux-arch@vger.kernel.org Cc: x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" Message-ID: <20191028210555.YRAcGPl0xs6KDUUPPvqfwrnGdA0gr1f8tHfduCUD3Yc@z> These functions are declared generically without CONFIG_ARCH_RANDOM. The only reason this compiles for x86 is that we currently have a mix of inline functions are preprocessor defines. Signed-off-by: Richard Henderson --- Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" --- arch/x86/include/asm/archrandom.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/archrandom.h b/arch/x86/include/asm/archrandom.h index af45e1452f09..5904d7d9e703 100644 --- a/arch/x86/include/asm/archrandom.h +++ b/arch/x86/include/asm/archrandom.h @@ -73,10 +73,6 @@ static inline bool rdseed_int(unsigned int *v) return ok; } -/* Conditional execution based on CPU type */ -#define arch_has_random() static_cpu_has(X86_FEATURE_RDRAND) -#define arch_has_random_seed() static_cpu_has(X86_FEATURE_RDSEED) - /* * These are the generic interfaces; they must not be declared if the * stubs in are to be invoked, @@ -84,6 +80,10 @@ static inline bool rdseed_int(unsigned int *v) */ #ifdef CONFIG_ARCH_RANDOM +/* Conditional execution based on CPU type */ +#define arch_has_random() static_cpu_has(X86_FEATURE_RDRAND) +#define arch_has_random_seed() static_cpu_has(X86_FEATURE_RDSEED) + static inline bool arch_get_random_long(unsigned long *v) { return arch_has_random() ? rdrand_long(v) : false; -- 2.17.1