All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>, Peter Anvin <hpa@zytor.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@alien8.de>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: [patch V2 39/44] x86/idt: Move APIC gate initialization to tables
Date: Fri, 25 Aug 2017 23:47:27 +0200	[thread overview]
Message-ID: <20170825214943.310420253@linutronix.de> (raw)
In-Reply-To: 20170825214648.264521964@linutronix.de

[-- Attachment #1: x86-idt--Move-apic-gate-initialization-to-tables.patch --]
[-- Type: text/plain, Size: 5160 bytes --]

Replace the APIC/SMP vector gate initialization with the table based
mechanism.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/include/asm/desc.h |    1 
 arch/x86/kernel/idt.c       |   48 ++++++++++++++++++++++++++++++
 arch/x86/kernel/irqinit.c   |   69 --------------------------------------------
 3 files changed, 50 insertions(+), 68 deletions(-)

--- a/arch/x86/include/asm/desc.h
+++ b/arch/x86/include/asm/desc.h
@@ -507,6 +507,7 @@ static inline void load_current_idt(void
 extern void idt_setup_early_handler(void);
 extern void idt_setup_early_traps(void);
 extern void idt_setup_traps(void);
+extern void idt_setup_apic_and_irq_gates(void);
 
 #ifdef CONFIG_X86_64
 extern void idt_setup_early_pf(void);
--- a/arch/x86/kernel/idt.c
+++ b/arch/x86/kernel/idt.c
@@ -103,6 +103,46 @@ static const __initdata struct idt_data
 #endif
 };
 
+/*
+ * The APIC and SMP idt entries
+ */
+static const __initdata struct idt_data apic_idts[] = {
+#ifdef CONFIG_SMP
+	INTG(RESCHEDULE_VECTOR,		reschedule_interrupt),
+	INTG(CALL_FUNCTION_VECTOR,	call_function_interrupt),
+	INTG(CALL_FUNCTION_SINGLE_VECTOR, call_function_single_interrupt),
+	INTG(IRQ_MOVE_CLEANUP_VECTOR,	irq_move_cleanup_interrupt),
+	INTG(REBOOT_VECTOR,		reboot_interrupt),
+#endif
+
+#ifdef CONFIG_X86_THERMAL_VECTOR
+	INTG(THERMAL_APIC_VECTOR,	thermal_interrupt),
+#endif
+
+#ifdef CONFIG_X86_MCE_THRESHOLD
+	INTG(THRESHOLD_APIC_VECTOR,	threshold_interrupt),
+#endif
+
+#ifdef CONFIG_X86_MCE_AMD
+	INTG(DEFERRED_ERROR_VECTOR,	deferred_error_interrupt),
+#endif
+
+#ifdef CONFIG_X86_LOCAL_APIC
+	INTG(LOCAL_TIMER_VECTOR,	apic_timer_interrupt),
+	INTG(X86_PLATFORM_IPI_VECTOR,	x86_platform_ipi),
+# ifdef CONFIG_HAVE_KVM
+	INTG(POSTED_INTR_VECTOR,	kvm_posted_intr_ipi),
+	INTG(POSTED_INTR_WAKEUP_VECTOR, kvm_posted_intr_wakeup_ipi),
+	INTG(POSTED_INTR_NESTED_VECTOR, kvm_posted_intr_nested_ipi),
+# endif
+# ifdef CONFIG_IRQ_WORK
+	INTG(IRQ_WORK_VECTOR,		irq_work_interrupt),
+# endif
+	INTG(SPURIOUS_APIC_VECTOR,	spurious_interrupt),
+	INTG(ERROR_APIC_VECTOR,		error_interrupt),
+#endif
+};
+
 #ifdef CONFIG_X86_64
 /*
  * Early traps running on the DEFAULT_STACK because the other interrupt
@@ -241,6 +281,14 @@ void __init idt_setup_debugidt_traps(voi
 #endif
 
 /**
+ * idt_setup_apic_and_irq_gates - Setup APIC/SMP and normal interrupt gates
+ */
+void __init idt_setup_apic_and_irq_gates(void)
+{
+	idt_setup_from_table(idt_table, apic_idts, ARRAY_SIZE(apic_idts));
+}
+
+/**
  * idt_setup_early_handler - Initializes the idt table with early handlers
  */
 void __init idt_setup_early_handler(void)
--- a/arch/x86/kernel/irqinit.c
+++ b/arch/x86/kernel/irqinit.c
@@ -87,73 +87,6 @@ void __init init_IRQ(void)
 	x86_init.irqs.intr_init();
 }
 
-static void __init smp_intr_init(void)
-{
-#ifdef CONFIG_SMP
-	/*
-	 * The reschedule interrupt is a CPU-to-CPU reschedule-helper
-	 * IPI, driven by wakeup.
-	 */
-	alloc_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt);
-
-	/* IPI for generic function call */
-	alloc_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt);
-
-	/* IPI for generic single function call */
-	alloc_intr_gate(CALL_FUNCTION_SINGLE_VECTOR,
-			call_function_single_interrupt);
-
-	/* Low priority IPI to cleanup after moving an irq */
-	set_intr_gate(IRQ_MOVE_CLEANUP_VECTOR, irq_move_cleanup_interrupt);
-	set_bit(IRQ_MOVE_CLEANUP_VECTOR, used_vectors);
-
-	/* IPI used for rebooting/stopping */
-	alloc_intr_gate(REBOOT_VECTOR, reboot_interrupt);
-#endif /* CONFIG_SMP */
-}
-
-static void __init apic_intr_init(void)
-{
-	smp_intr_init();
-
-#ifdef CONFIG_X86_THERMAL_VECTOR
-	alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
-#endif
-#ifdef CONFIG_X86_MCE_THRESHOLD
-	alloc_intr_gate(THRESHOLD_APIC_VECTOR, threshold_interrupt);
-#endif
-
-#ifdef CONFIG_X86_MCE_AMD
-	alloc_intr_gate(DEFERRED_ERROR_VECTOR, deferred_error_interrupt);
-#endif
-
-#ifdef CONFIG_X86_LOCAL_APIC
-	/* self generated IPI for local APIC timer */
-	alloc_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt);
-
-	/* IPI for X86 platform specific use */
-	alloc_intr_gate(X86_PLATFORM_IPI_VECTOR, x86_platform_ipi);
-#ifdef CONFIG_HAVE_KVM
-	/* IPI for KVM to deliver posted interrupt */
-	alloc_intr_gate(POSTED_INTR_VECTOR, kvm_posted_intr_ipi);
-	/* IPI for KVM to deliver interrupt to wake up tasks */
-	alloc_intr_gate(POSTED_INTR_WAKEUP_VECTOR, kvm_posted_intr_wakeup_ipi);
-	/* IPI for KVM to deliver nested posted interrupt */
-	alloc_intr_gate(POSTED_INTR_NESTED_VECTOR, kvm_posted_intr_nested_ipi);
-#endif
-
-	/* IPI vectors for APIC spurious and error interrupts */
-	alloc_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
-	alloc_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
-
-	/* IRQ work interrupts: */
-# ifdef CONFIG_IRQ_WORK
-	alloc_intr_gate(IRQ_WORK_VECTOR, irq_work_interrupt);
-# endif
-
-#endif
-}
-
 void __init native_init_IRQ(void)
 {
 	int i;
@@ -161,7 +94,7 @@ void __init native_init_IRQ(void)
 	/* Execute any quirks before the call gates are initialised: */
 	x86_init.irqs.pre_vector_init();
 
-	apic_intr_init();
+	idt_setup_apic_and_irq_gates();
 
 	/*
 	 * Cover the whole vector space, no vector can escape

  parent reply	other threads:[~2017-08-25 21:58 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-25 21:46 [patch V2 00/44] x86: Cleanup IDT code Thomas Gleixner
2017-08-25 21:46 ` [patch V2 01/44] x86/irq: Remove vector_used_by_percpu_irq() Thomas Gleixner
2017-08-25 21:46 ` [patch V2 02/44] x86/irq: Unexport used_vectors Thomas Gleixner
2017-08-25 21:46 ` [patch V2 03/44] x86/irq: Get rid of the first_system_vector bogisity Thomas Gleixner
2017-08-25 21:46 ` [patch V2 04/44] x86/irq: Remove duplicated used_vectors definition Thomas Gleixner
2017-08-25 21:46 ` [patch V2 05/44] x86/boot: Move EISA setup to a proper place Thomas Gleixner
2017-08-25 21:46 ` [patch V2 06/44] x86/tracing: Introduce a static key for exception tracing Thomas Gleixner
2017-08-25 21:46 ` [patch V2 07/44] x86/traps: Simplify pagefault tracing logic Thomas Gleixner
2017-08-25 21:46 ` [patch V2 08/44] x86/apic: Remove the duplicated tracing version of local_timer_interrupt Thomas Gleixner
2017-08-25 21:46 ` [patch V2 09/44] x86/apic: Use this_cpu_ptr in local_timer_interrupt Thomas Gleixner
2017-08-25 21:46 ` [patch V2 10/44] x86/irq: Get rid of duplicated trace_x86_platform_ipi() code Thomas Gleixner
2017-08-25 21:46 ` [patch V2 11/44] x86/apic: Remove the duplicated tracing versions of interrupts Thomas Gleixner
2017-08-25 21:47 ` [patch V2 12/44] x86/irqwork: Get rid of duplicated tracing interrupt code Thomas Gleixner
2017-08-25 21:47 ` [patch V2 13/44] x86/mce: Remove " Thomas Gleixner
2017-08-25 21:47 ` [patch V2 14/44] x86/smp: Remove pointless duplicated " Thomas Gleixner
2017-08-25 21:47 ` [patch V2 15/44] x86/smp: Use static key for reschedule interrupt tracing Thomas Gleixner
2017-08-25 21:47 ` [patch V2 16/44] x86/idt: Remove tracing idt completely Thomas Gleixner
2017-08-25 21:47 ` [patch V2 17/44] x86/idt: Cleanup the i386 low level entry macros Thomas Gleixner
2017-08-25 21:47 ` [patch V2 18/44] x86/tracing: Disentangle pagefault and resched IPI tracing key Thomas Gleixner
2017-08-25 21:47 ` [patch V2 19/44] x86/ipi: Make platform IPI depend on APIC Thomas Gleixner
2017-08-25 21:47 ` [patch V2 20/44] x86/irq_work: Make it " Thomas Gleixner
2017-08-25 21:47 ` [patch V2 21/44] x86/tracing: Build tracepoints only when they are used Thomas Gleixner
2017-08-25 21:47 ` [patch V2 22/44] x86/idt: Unify gate_struct handling for 32/64bit Thomas Gleixner
2017-08-25 21:47 ` [patch V2 23/44] x86/percpu: Use static initializer for GDT entry Thomas Gleixner
2017-08-25 21:47 ` [patch V2 24/44] x86/fpu: Use bitfield accessors for desc_struct Thomas Gleixner
2017-08-25 21:47 ` [patch V2 25/44] x86: Replace access to desc_struct:a/b fields Thomas Gleixner
2017-08-26  2:16   ` Boris Ostrovsky
2017-08-25 21:47 ` [patch V2 26/44] x86/gdt: Use bitfields for initialization Thomas Gleixner
2017-08-25 21:47 ` [patch V2 27/44] x86/ldttss: Cleanup 32bit descriptors Thomas Gleixner
2017-08-25 21:47 ` [patch V2 28/44] x86/idt: Create file for IDT related code Thomas Gleixner
2017-08-25 21:47 ` [patch V2 29/44] x86/idt: Move 32bit idt_descr to C code Thomas Gleixner
2017-08-25 21:47 ` [patch V2 30/44] x86/idt: Remove unused set_trap_gate() Thomas Gleixner
2017-08-25 21:47 ` [patch V2 31/44] x86/idt: Consolidate IDT invalidation Thomas Gleixner
2017-08-25 21:47 ` [patch V2 32/44] x86/idt: Move early IDT handler setup to IDT code Thomas Gleixner
2017-08-25 21:47 ` [patch V2 33/44] x86/idt: Move early IDT setup out of 32bit asm Thomas Gleixner
2017-08-25 21:47 ` [patch V2 34/44] x86/idt: Prepare for table based init Thomas Gleixner
2017-08-25 21:47 ` [patch V2 35/44] x86/idt: Switch early trap init to IDT tables Thomas Gleixner
2017-08-26  2:24   ` Boris Ostrovsky
2017-08-26  8:16     ` Thomas Gleixner
2017-08-26 10:59       ` Juergen Gross
2017-08-26 13:05         ` Thomas Gleixner
2017-08-26 15:07           ` Boris Ostrovsky
2017-08-25 21:47 ` [patch V2 36/44] x86/idt: Move debug stack init to table based Thomas Gleixner
2017-08-25 21:47 ` [patch V2 37/44] x86/idt: Move ist stack based traps to table init Thomas Gleixner
2017-08-25 21:47 ` [patch V2 38/44] x86/idt: Move regular trap init to tables Thomas Gleixner
2017-08-25 21:47 ` Thomas Gleixner [this message]
2017-08-25 21:47 ` [patch V2 40/44] x86/idt: Move interrupt gate initialization to IDT code Thomas Gleixner
2017-08-25 21:47 ` [patch V2 41/44] x86/idt: Remove unused functions/inlines Thomas Gleixner
2017-08-25 21:47 ` [patch V2 42/44] x86/idt: Deinline setup functions Thomas Gleixner
2017-08-25 21:47 ` [patch V2 43/44] x86/idt: Simplify alloc_intr_gate Thomas Gleixner
2017-08-25 21:47 ` [patch V2 44/44] x86/idt: Hide set_intr_gate() Thomas Gleixner

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=20170825214943.310420253@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.