mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: x86@kernel.org, Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>, "H . Peter Anvin" <hpa@zytor.com>
Cc: "Jason A . Donenfeld" <Jason@zx2c4.com>,
	linux-crypto@vger.kernel.org,
	Masahiro Yamada <masahiroy@kernel.org>,
	Anton Ivanov <anton.ivanov@cambridgegreys.com>,
	Jeff Dike <jdike@addtoit.com>,
	Richard Weinberger <richard@nod.at>,
	linux-kernel@vger.kernel.org, linux-um@lists.infradead.org
Subject: [PATCH 1/2] x86: check CONFIG options instead of __arch_um__
Date: Tue, 21 Apr 2020 16:39:46 +0900	[thread overview]
Message-ID: <20200421073947.586662-1-masahiroy@kernel.org> (raw)

If the intention is to check i386/x86_64 excluding UML, we can use
CONFIG options instead.

There are only some users of __arch_um__. This commit replaces them,
then removes the __arch_um__ definition.

The original reason for checking __i386__ / __x86_64__ was perhaps
because lib/raid6/algos.c is built not only for the kernel but also
for the user-space test program.

However, lib/raid6/test/Makefile passes -DCONFIG_X86, -DCONFIG_X86_32,
and -DCONFIG_X86_64 for this case. So, I do not see a good reason to
not use CONFIG options here.

What is confusing is, CONFIG_X86_{32,64} is defined not only in
arch/x86/Kconfig, but also in arch/x86/um/Kconfig. To exlucde UML,
we need to check CONFIG_X86 too.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: H. Peter Anvin (Intel) <hpa@zytor.com>
---

 arch/um/Makefile  | 2 +-
 kernel/signal.c   | 2 +-
 lib/raid6/algos.c | 6 ++++--
 lib/raid6/x86.h   | 2 +-
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/um/Makefile b/arch/um/Makefile
index d2daa206872d..064fbed7a4e9 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -62,7 +62,7 @@ KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/um
 #
 # These apply to USER_CFLAGS to.
 
-KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ \
+KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) \
 	$(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap	\
 	-Dlongjmp=kernel_longjmp -Dsetjmp=kernel_setjmp \
 	-Din6addr_loopback=kernel_in6addr_loopback \
diff --git a/kernel/signal.c b/kernel/signal.c
index 713104884414..1af3ad707b02 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1246,7 +1246,7 @@ static void print_fatal_signal(int signr)
 	struct pt_regs *regs = signal_pt_regs();
 	pr_info("potentially unexpected fatal signal %d.\n", signr);
 
-#if defined(__i386__) && !defined(__arch_um__)
+#if defined(CONFIG_X86) && defined(CONFIG_X86_32)
 	pr_info("code at %08lx: ", regs->ip);
 	{
 		int i;
diff --git a/lib/raid6/algos.c b/lib/raid6/algos.c
index 6d5e5000fdd7..978fa19efbbf 100644
--- a/lib/raid6/algos.c
+++ b/lib/raid6/algos.c
@@ -29,7 +29,8 @@ struct raid6_calls raid6_call;
 EXPORT_SYMBOL_GPL(raid6_call);
 
 const struct raid6_calls * const raid6_algos[] = {
-#if defined(__i386__) && !defined(__arch_um__)
+#ifdef CONFIG_X86
+#if defined(CONFIG_X86_32)
 #ifdef CONFIG_AS_AVX512
 	&raid6_avx512x2,
 	&raid6_avx512x1,
@@ -43,7 +44,7 @@ const struct raid6_calls * const raid6_algos[] = {
 	&raid6_mmxx2,
 	&raid6_mmxx1,
 #endif
-#if defined(__x86_64__) && !defined(__arch_um__)
+#if defined(CONFIG_X86_64)
 #ifdef CONFIG_AS_AVX512
 	&raid6_avx512x4,
 	&raid6_avx512x2,
@@ -56,6 +57,7 @@ const struct raid6_calls * const raid6_algos[] = {
 	&raid6_sse2x2,
 	&raid6_sse2x1,
 #endif
+#endif /* CONFIG_X86 */
 #ifdef CONFIG_ALTIVEC
 	&raid6_vpermxor8,
 	&raid6_vpermxor4,
diff --git a/lib/raid6/x86.h b/lib/raid6/x86.h
index 9a6ff37115e7..0436b32f7709 100644
--- a/lib/raid6/x86.h
+++ b/lib/raid6/x86.h
@@ -14,7 +14,7 @@
 #ifndef LINUX_RAID_RAID6X86_H
 #define LINUX_RAID_RAID6X86_H
 
-#if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__)
+#ifdef CONFIG_X86
 
 #ifdef __KERNEL__ /* Real code */
 
-- 
2.25.1


             reply	other threads:[~2020-04-21  7:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21  7:39 Masahiro Yamada [this message]
2020-04-21  7:39 ` [PATCH 2/2] raid6/algos.c: refactor raid6_algos array for x86 Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200421073947.586662-1-masahiroy@kernel.org \
    --to=masahiroy@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jdike@addtoit.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=mingo@kernel.org \
    --cc=richard@nod.at \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®