public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/apic: Replace the redundant macros with an empty stub
@ 2018-01-17  7:37 Dou Liyang
  2018-02-13 16:59 ` [tip:x86/apic] x86/apic: Simplify init_bsp_APIC() usage tip-bot for Dou Liyang
  0 siblings, 1 reply; 2+ messages in thread
From: Dou Liyang @ 2018-01-17  7:37 UTC (permalink / raw)
  To: linux-kernel, x86; +Cc: tglx, mingo, hpa, ville.syrjala, mroos, Dou Liyang

The X86_LOCAL_APIC is depended on CONFIG X86_64, that means if
CONFIG_X86_64=y, the X86_LOCAL_APIC must be y too.

So, using

  if defined(CONFIG_X86_64) || defined(CONFIG_X86_LOCAL_APIC)

... is redundant.

Remove the redundant macros and add an empty stub instead. also add some
comments for init_bsp_APIC().

Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
---
 arch/x86/include/asm/apic.h | 1 +
 arch/x86/kernel/irqinit.c   | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index 98722773391d..6e1990d69865 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -183,6 +183,7 @@ static inline void disable_local_APIC(void) { }
 # define setup_boot_APIC_clock x86_init_noop
 # define setup_secondary_APIC_clock x86_init_noop
 static inline void lapic_update_tsc_freq(void) { }
+static inline void init_bsp_APIC(void) { }
 static inline void apic_intr_mode_init(void) { }
 static inline void lapic_assign_system_vectors(void) { }
 static inline void lapic_assign_legacy_vector(unsigned int i, bool r) { }
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c
index a539410c4ea9..a0e41397558e 100644
--- a/arch/x86/kernel/irqinit.c
+++ b/arch/x86/kernel/irqinit.c
@@ -61,9 +61,14 @@ void __init init_ISA_irqs(void)
 	struct irq_chip *chip = legacy_pic->chip;
 	int i;
 
-#if defined(CONFIG_X86_64) || defined(CONFIG_X86_LOCAL_APIC)
+	/*
+	 * Try to setup the through-local-APIC virtual wire mode earlier.
+	 *
+	 * In some 32bit UP machines whose APIC has been disabled by BIOS
+	 * and re-enabled by "lapic", it hangs at boot time without this.
+	 */
 	init_bsp_APIC();
-#endif
+
 	legacy_pic->init(0);
 
 	for (i = 0; i < nr_legacy_irqs(); i++)
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip:x86/apic] x86/apic: Simplify init_bsp_APIC() usage
  2018-01-17  7:37 [PATCH] x86/apic: Replace the redundant macros with an empty stub Dou Liyang
@ 2018-02-13 16:59 ` tip-bot for Dou Liyang
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Dou Liyang @ 2018-02-13 16:59 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, torvalds, linux-kernel, peterz, tglx, douly.fnst, hpa

Commit-ID:  ccf5355d05cd891522267f04b2723002e7f061de
Gitweb:     https://git.kernel.org/tip/ccf5355d05cd891522267f04b2723002e7f061de
Author:     Dou Liyang <douly.fnst@cn.fujitsu.com>
AuthorDate: Wed, 17 Jan 2018 15:37:48 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 13 Feb 2018 17:30:38 +0100

x86/apic: Simplify init_bsp_APIC() usage

Since CONFIG_X86_64 selects CONFIG_X86_LOCAL_APIC, the following
condition:

  #if defined(CONFIG_X86_64) || defined(CONFIG_X86_LOCAL_APIC)

is equivalent to:

  #if defined(CONFIG_X86_LOCAL_APIC)

... and we can eliminate that #ifdef by providing an empty
init_bsp_APIC() stub in the !CONFIG_X86_LOCAL_APIC case.

Also add some comments to explain why we call init_bsp_APIC().

Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: mroos@linux.ee
Cc: ville.syrjala@linux.intel.com
Link: http://lkml.kernel.org/r/20180117073748.23905-1-douly.fnst@cn.fujitsu.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/apic.h | 1 +
 arch/x86/kernel/irqinit.c   | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index 9872277..6e1990d 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -183,6 +183,7 @@ static inline void disable_local_APIC(void) { }
 # define setup_boot_APIC_clock x86_init_noop
 # define setup_secondary_APIC_clock x86_init_noop
 static inline void lapic_update_tsc_freq(void) { }
+static inline void init_bsp_APIC(void) { }
 static inline void apic_intr_mode_init(void) { }
 static inline void lapic_assign_system_vectors(void) { }
 static inline void lapic_assign_legacy_vector(unsigned int i, bool r) { }
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c
index a539410..772196c 100644
--- a/arch/x86/kernel/irqinit.c
+++ b/arch/x86/kernel/irqinit.c
@@ -61,9 +61,14 @@ void __init init_ISA_irqs(void)
 	struct irq_chip *chip = legacy_pic->chip;
 	int i;
 
-#if defined(CONFIG_X86_64) || defined(CONFIG_X86_LOCAL_APIC)
+	/*
+	 * Try to set up the through-local-APIC virtual wire mode earlier.
+	 *
+	 * On some 32-bit UP machines, whose APIC has been disabled by BIOS
+	 * and then got re-enabled by "lapic", it hangs at boot time without this.
+	 */
 	init_bsp_APIC();
-#endif
+
 	legacy_pic->init(0);
 
 	for (i = 0; i < nr_legacy_irqs(); i++)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-13 16:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-17  7:37 [PATCH] x86/apic: Replace the redundant macros with an empty stub Dou Liyang
2018-02-13 16:59 ` [tip:x86/apic] x86/apic: Simplify init_bsp_APIC() usage tip-bot for Dou Liyang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox