All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 0/6] x86-tip: merge irqinit_32/64.c
@ 2009-03-29 20:15 Cyrill Gorcunov
  2009-03-29 20:15 ` [patch 1/6] x86: irqinit - order code snippets for easier merging Cyrill Gorcunov
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Cyrill Gorcunov @ 2009-03-29 20:15 UTC (permalink / raw)
  To: mingo, hpa, tglx; +Cc: linux-kernel, xemul, yhlu.kernel

Hi,

here is an attempt to merge irqinit_32/64 with minimum
changes by small steps.

Please review. Need serious testing and actually have
two problems in which I need help:

1) #include's verification and cleanup
2) APIC MCE assignments seems to be a bit
   not clear in general -- at moment I added
   preprocessor directives to not change current
   behaviour but in real there should be a review
   to check if we don't set vectors without handlers.
   Maybe I'm just screwed up -- too tired will check tomorrow :)

The patches are on top of -tip

|
| commit 71f60f2853b4ba53da35f51bc3e64ec6ad92ea90
| Merge: 305f38e f5b3ca6
| Author: Ingo Molnar <mingo@elte.hu>
| Date:   Sat Mar 28 13:13:08 2009 +0100
|
|    Merge branch 'x86/mce2'

Any comments are quite welcome. Thanks!

Cyrill

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

* [patch 1/6] x86: irqinit - order code snippets for easier merging
  2009-03-29 20:15 [patch 0/6] x86-tip: merge irqinit_32/64.c Cyrill Gorcunov
@ 2009-03-29 20:15 ` Cyrill Gorcunov
  2009-03-29 20:15 ` [patch 2/6] x86: irqinit - merge smp_intr_init Cyrill Gorcunov
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: Cyrill Gorcunov @ 2009-03-29 20:15 UTC (permalink / raw)
  To: mingo, hpa, tglx; +Cc: linux-kernel, xemul, yhlu.kernel, Cyrill Gorcunov

[-- Attachment #1: x86-irqinit-ordering --]
[-- Type: text/plain, Size: 3953 bytes --]

In attempt of easier further merging of this files I've
order init_ISA_irqs function and a few comments as well.
The notable change is that init_ISA_irqs is not static
function on x86-64 anymore -- we will use arch quirks later.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 arch/x86/kernel/irqinit_32.c |   27 +++++++++++++++++++-------
 arch/x86/kernel/irqinit_64.c |   44 +++++++++++++++++++++----------------------
 2 files changed, 42 insertions(+), 29 deletions(-)

Index: linux-2.6.git/arch/x86/kernel/irqinit_32.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/irqinit_32.c
+++ linux-2.6.git/arch/x86/kernel/irqinit_32.c
@@ -54,6 +54,10 @@ static struct irqaction fpu_irq = {
 	.name = "fpu",
 };
 
+/*
+ * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts:
+ * (these are usually mapped to vectors 0x30-0x3f)
+ */
 void __init init_ISA_irqs(void)
 {
 	int i;
@@ -63,9 +67,7 @@ void __init init_ISA_irqs(void)
 #endif
 	init_8259A(0);
 
-	/*
-	 * 16 old-style INTA-cycle interrupts:
-	 */
+	/* 16 old-style INTA-cycle interrupts */
 	for (i = 0; i < NR_IRQS_LEGACY; i++) {
 		struct irq_desc *desc = irq_to_desc(i);
 
@@ -74,11 +76,22 @@ void __init init_ISA_irqs(void)
 		desc->depth = 1;
 
 		set_irq_chip_and_handler_name(i, &i8259A_chip,
-					      handle_level_irq, "XT");
+					handle_level_irq, "XT");
 	}
 }
 
 /*
+ * The IO-APIC gives us many more interrupt sources. Most of these
+ * are unused but an SMP system is supposed to have enough memory ...
+ * sometimes (mostly wrt. hw bugs) we get corrupted vectors all
+ * across the spectrum, so we really want to be prepared to get all
+ * of these. Plus, more powerful systems might have more than 64
+ * IO-APIC registers.
+ *
+ * (these are usually mapped into the 0x30-0xff vector range)
+ */
+
+/*
  * IRQ2 is cascade interrupt to second interrupt controller
  */
 static struct irqaction irq2 = {
@@ -120,6 +133,9 @@ int vector_used_by_percpu_irq(unsigned i
 	return 0;
 }
 
+/* Overridden in paravirt.c */
+void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ")));
+
 static void __init smp_intr_init(void)
 {
 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_SMP)
@@ -177,9 +193,6 @@ static void __init apic_intr_init(void)
 #endif
 }
 
-/* Overridden in paravirt.c */
-void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ")));
-
 void __init native_init_IRQ(void)
 {
 	int i;
Index: linux-2.6.git/arch/x86/kernel/irqinit_64.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/irqinit_64.c
+++ linux-2.6.git/arch/x86/kernel/irqinit_64.c
@@ -27,6 +27,27 @@
  * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts:
  * (these are usually mapped to vectors 0x30-0x3f)
  */
+void __init init_ISA_irqs(void)
+{
+	int i;
+
+#ifdef CONFIG_X86_LOCAL_APIC
+	init_bsp_APIC();
+#endif
+	init_8259A(0);
+
+	/* 16 old-style INTA-cycle interrupts */
+	for (i = 0; i < NR_IRQS_LEGACY; i++) {
+		struct irq_desc *desc = irq_to_desc(i);
+
+		desc->status = IRQ_DISABLED;
+		desc->action = NULL;
+		desc->depth = 1;
+
+		set_irq_chip_and_handler_name(i, &i8259A_chip,
+					handle_level_irq, "XT");
+	}
+}
 
 /*
  * The IO-APIC gives us many more interrupt sources. Most of these
@@ -81,28 +102,7 @@ int vector_used_by_percpu_irq(unsigned i
 	return 0;
 }
 
-static void __init init_ISA_irqs(void)
-{
-	int i;
-
-	init_bsp_APIC();
-	init_8259A(0);
-
-	for (i = 0; i < NR_IRQS_LEGACY; i++) {
-		struct irq_desc *desc = irq_to_desc(i);
-
-		desc->status = IRQ_DISABLED;
-		desc->action = NULL;
-		desc->depth = 1;
-
-		/*
-		 * 16 old-style INTA-cycle interrupts:
-		 */
-		set_irq_chip_and_handler_name(i, &i8259A_chip,
-						      handle_level_irq, "XT");
-	}
-}
-
+/* Overridden in paravirt.c */
 void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ")));
 
 static void __init smp_intr_init(void)


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

* [patch 2/6] x86: irqinit - merge smp_intr_init
  2009-03-29 20:15 [patch 0/6] x86-tip: merge irqinit_32/64.c Cyrill Gorcunov
  2009-03-29 20:15 ` [patch 1/6] x86: irqinit - order code snippets for easier merging Cyrill Gorcunov
@ 2009-03-29 20:15 ` Cyrill Gorcunov
  2009-03-29 20:15 ` [patch 3/6] x86: irqinit - merge apic_intr_init Cyrill Gorcunov
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: Cyrill Gorcunov @ 2009-03-29 20:15 UTC (permalink / raw)
  To: mingo, hpa, tglx; +Cc: linux-kernel, xemul, yhlu.kernel, Cyrill Gorcunov

[-- Attachment #1: x86-irqinit-smp_intr_init --]
[-- Type: text/plain, Size: 1274 bytes --]

All x86-64 CPUs has a local APIC.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 arch/x86/kernel/irqinit_32.c |    2 +-
 arch/x86/kernel/irqinit_64.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.git/arch/x86/kernel/irqinit_32.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/irqinit_32.c
+++ linux-2.6.git/arch/x86/kernel/irqinit_32.c
@@ -158,7 +158,7 @@ static void __init smp_intr_init(void)
 	/* IPI for generic function call */
 	alloc_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt);
 
-	/* IPI for single call function */
+	/* IPI for generic single function call */
 	alloc_intr_gate(CALL_FUNCTION_SINGLE_VECTOR,
 				 call_function_single_interrupt);
 
Index: linux-2.6.git/arch/x86/kernel/irqinit_64.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/irqinit_64.c
+++ linux-2.6.git/arch/x86/kernel/irqinit_64.c
@@ -107,7 +107,7 @@ void init_IRQ(void) __attribute__((weak,
 
 static void __init smp_intr_init(void)
 {
-#ifdef CONFIG_SMP
+#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_SMP)
 	/*
 	 * The reschedule interrupt is a CPU-to-CPU reschedule-helper
 	 * IPI, driven by wakeup.


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

* [patch 3/6] x86: irqinit - merge apic_intr_init
  2009-03-29 20:15 [patch 0/6] x86-tip: merge irqinit_32/64.c Cyrill Gorcunov
  2009-03-29 20:15 ` [patch 1/6] x86: irqinit - order code snippets for easier merging Cyrill Gorcunov
  2009-03-29 20:15 ` [patch 2/6] x86: irqinit - merge smp_intr_init Cyrill Gorcunov
@ 2009-03-29 20:15 ` Cyrill Gorcunov
  2009-03-29 20:15 ` [patch 4/6] x86: irqinit - merge native_init_IRQ Cyrill Gorcunov
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: Cyrill Gorcunov @ 2009-03-29 20:15 UTC (permalink / raw)
  To: mingo, hpa, tglx; +Cc: linux-kernel, xemul, yhlu.kernel, Cyrill Gorcunov

[-- Attachment #1: x86-irqinit-apic_intr_init --]
[-- Type: text/plain, Size: 2309 bytes --]

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 arch/x86/kernel/irqinit_32.c |    8 +++++++-
 arch/x86/kernel/irqinit_64.c |   18 ++++++++++++++----
 2 files changed, 21 insertions(+), 5 deletions(-)

Index: linux-2.6.git/arch/x86/kernel/irqinit_32.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/irqinit_32.c
+++ linux-2.6.git/arch/x86/kernel/irqinit_32.c
@@ -183,13 +183,19 @@ static void __init apic_intr_init(void)
 	alloc_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
 	alloc_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
 # ifdef CONFIG_PERF_COUNTERS
+	/* Performance monitoring interrupt */
 	alloc_intr_gate(LOCAL_PERF_VECTOR, perf_counter_interrupt);
 # endif
 
-# ifdef CONFIG_X86_MCE_P4THERMAL
+#if defined(CONFIG_X86_MCE_P4THERMAL) || defined(CONFIG_X86_64)
 	/* thermal monitor LVT interrupt */
 	alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
 # endif
+
+# ifdef CONFIG_X86_64
+	alloc_intr_gate(THRESHOLD_APIC_VECTOR, threshold_interrupt);
+# endif
+
 #endif
 }
 
Index: linux-2.6.git/arch/x86/kernel/irqinit_64.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/irqinit_64.c
+++ linux-2.6.git/arch/x86/kernel/irqinit_64.c
@@ -141,8 +141,7 @@ static void __init apic_intr_init(void)
 {
 	smp_intr_init();
 
-	alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
-	alloc_intr_gate(THRESHOLD_APIC_VECTOR, threshold_interrupt);
+#ifdef CONFIG_X86_LOCAL_APIC
 
 	/* self generated IPI for local APIC timer */
 	alloc_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt);
@@ -154,9 +153,20 @@ static void __init apic_intr_init(void)
 	alloc_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
 	alloc_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
 
-	/* Performance monitoring interrupt: */
-#ifdef CONFIG_PERF_COUNTERS
+# ifdef CONFIG_PERF_COUNTERS
+	/* Performance monitoring interrupt */
 	alloc_intr_gate(LOCAL_PERF_VECTOR, perf_counter_interrupt);
+# endif
+
+#if defined(CONFIG_X86_MCE_P4THERMAL) || defined(CONFIG_X86_64)
+	/* thermal monitor LVT interrupt */
+	alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
+# endif
+
+# ifdef CONFIG_X86_64
+	alloc_intr_gate(THRESHOLD_APIC_VECTOR, threshold_interrupt);
+# endif
+
 #endif
 }
 


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

* [patch 4/6] x86: irqinit - merge native_init_IRQ
  2009-03-29 20:15 [patch 0/6] x86-tip: merge irqinit_32/64.c Cyrill Gorcunov
                   ` (2 preceding siblings ...)
  2009-03-29 20:15 ` [patch 3/6] x86: irqinit - merge apic_intr_init Cyrill Gorcunov
@ 2009-03-29 20:15 ` Cyrill Gorcunov
  2009-04-01 14:53   ` Ingo Molnar
  2009-03-29 20:15 ` [patch 5/6] x86: irqinit - merge math_error_irq and headers Cyrill Gorcunov
  2009-03-29 20:15 ` [patch 6/6] x86: irqinit - merge irqinit_32/64.c into irqinit.c Cyrill Gorcunov
  5 siblings, 1 reply; 16+ messages in thread
From: Cyrill Gorcunov @ 2009-03-29 20:15 UTC (permalink / raw)
  To: mingo, hpa, tglx; +Cc: linux-kernel, xemul, yhlu.kernel, Cyrill Gorcunov

[-- Attachment #1: x86-irqinit-native_init_IRQ --]
[-- Type: text/plain, Size: 3023 bytes --]

For this purpose init_ISA_irqs is called indirectly
by x86_quirk_pre_intr_init.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 arch/x86/kernel/irqinit_32.c |    4 +++-
 arch/x86/kernel/irqinit_64.c |   22 +++++++++++++++++++++-
 arch/x86/kernel/setup.c      |    8 ++++++++
 3 files changed, 32 insertions(+), 2 deletions(-)

Index: linux-2.6.git/arch/x86/kernel/irqinit_32.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/irqinit_32.c
+++ linux-2.6.git/arch/x86/kernel/irqinit_32.c
@@ -215,7 +215,7 @@ void __init native_init_IRQ(void)
 	 */
 	for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) {
 		int vector = FIRST_EXTERNAL_VECTOR + i;
-		/* SYSCALL_VECTOR was reserved in trap_init. */
+		/* X86-32: SYSCALL_VECTOR was reserved in trap_init. */
 		if (!test_bit(vector, used_vectors))
 			set_intr_gate(vector, interrupt[i]);
 	}
@@ -229,6 +229,7 @@ void __init native_init_IRQ(void)
 	 */
 	x86_quirk_intr_init();
 
+#ifdef CONFIG_X86_32
 	/*
 	 * External FPU? Set up irq13 if so, for
 	 * original braindamaged IBM FERR coupling.
@@ -237,4 +238,5 @@ void __init native_init_IRQ(void)
 		setup_irq(FPU_IRQ, &fpu_irq);
 
 	irq_ctx_init(smp_processor_id());
+#endif
 }
Index: linux-2.6.git/arch/x86/kernel/irqinit_64.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/irqinit_64.c
+++ linux-2.6.git/arch/x86/kernel/irqinit_64.c
@@ -21,6 +21,7 @@
 #include <asm/pgtable.h>
 #include <asm/desc.h>
 #include <asm/apic.h>
+#include <asm/setup.h>
 #include <asm/i8259.h>
 
 /*
@@ -174,7 +175,8 @@ void __init native_init_IRQ(void)
 {
 	int i;
 
-	init_ISA_irqs();
+	/* Execute any quirks before the call gates are initialised: */
+	x86_quirk_pre_intr_init();
 
 	apic_intr_init();
 
@@ -185,10 +187,28 @@ void __init native_init_IRQ(void)
 	 */
 	for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) {
 		int vector = FIRST_EXTERNAL_VECTOR + i;
+		/* X86-32: SYSCALL_VECTOR was reserved in trap_init. */
 		if (!test_bit(vector, used_vectors))
 			set_intr_gate(vector, interrupt[i]);
 	}
 
 	if (!acpi_ioapic)
 		setup_irq(2, &irq2);
+
+	/*
+	 * Call quirks after call gates are initialised (usually add in
+	 * the architecture specific gates):
+	 */
+	x86_quirk_intr_init();
+
+#ifdef CONFIG_X86_32
+	/*
+	 * External FPU? Set up irq13 if so, for
+	 * original braindamaged IBM FERR coupling.
+	 */
+	if (boot_cpu_data.hard_math && !cpu_has_fpu)
+		setup_irq(FPU_IRQ, &fpu_irq);
+
+	irq_ctx_init(smp_processor_id());
+#endif
 }
Index: linux-2.6.git/arch/x86/kernel/setup.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/setup.c
+++ linux-2.6.git/arch/x86/kernel/setup.c
@@ -1087,3 +1087,11 @@ void __init x86_quirk_time_init(void)
 	setup_irq(0, &irq0);
 }
 #endif /* CONFIG_X86_32 */
+
+#ifdef CONFIG_X86_64
+void x86_quirk_pre_intr_init(void)
+{
+	init_ISA_irqs();
+}
+void x86_quirk_intr_init(void) { }
+#endif


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

* [patch 5/6] x86: irqinit - merge math_error_irq and headers
  2009-03-29 20:15 [patch 0/6] x86-tip: merge irqinit_32/64.c Cyrill Gorcunov
                   ` (3 preceding siblings ...)
  2009-03-29 20:15 ` [patch 4/6] x86: irqinit - merge native_init_IRQ Cyrill Gorcunov
@ 2009-03-29 20:15 ` Cyrill Gorcunov
  2009-03-29 20:15 ` [patch 6/6] x86: irqinit - merge irqinit_32/64.c into irqinit.c Cyrill Gorcunov
  5 siblings, 0 replies; 16+ messages in thread
From: Cyrill Gorcunov @ 2009-03-29 20:15 UTC (permalink / raw)
  To: mingo, hpa, tglx; +Cc: linux-kernel, xemul, yhlu.kernel, Cyrill Gorcunov

[-- Attachment #1: x86-irqinit-math_error_irq --]
[-- Type: text/plain, Size: 3377 bytes --]

Though the #include's are to be cleaned up.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 arch/x86/kernel/irqinit_32.c |    8 ++++++--
 arch/x86/kernel/irqinit_64.c |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 2 deletions(-)

Index: linux-2.6.git/arch/x86/kernel/irqinit_32.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/irqinit_32.c
+++ linux-2.6.git/arch/x86/kernel/irqinit_32.c
@@ -1,19 +1,23 @@
+#include <linux/linkage.h>
 #include <linux/errno.h>
 #include <linux/signal.h>
 #include <linux/sched.h>
 #include <linux/ioport.h>
 #include <linux/interrupt.h>
+#include <linux/timex.h>
 #include <linux/slab.h>
 #include <linux/random.h>
 #include <linux/init.h>
 #include <linux/kernel_stat.h>
 #include <linux/sysdev.h>
 #include <linux/bitops.h>
+#include <linux/acpi.h>
 #include <linux/io.h>
 #include <linux/delay.h>
 
 #include <asm/atomic.h>
 #include <asm/system.h>
+#include <asm/hw_irq.h>
 #include <asm/timer.h>
 #include <asm/pgtable.h>
 #include <asm/desc.h>
@@ -22,7 +26,7 @@
 #include <asm/i8259.h>
 #include <asm/traps.h>
 
-
+#ifdef CONFIG_X86_32
 /*
  * Note that on a 486, we don't want to do a SIGFPE on an irq13
  * as the irq is unreliable, and exception 16 works correctly
@@ -34,7 +38,6 @@
  * leads to races. IBM designers who came up with it should
  * be shot.
  */
-
 static irqreturn_t math_error_irq(int cpl, void *dev_id)
 {
 	outb(0, 0xF0);
@@ -53,6 +56,7 @@ static struct irqaction fpu_irq = {
 	.mask = CPU_MASK_NONE,
 	.name = "fpu",
 };
+#endif /* CONFIG_X86_32 */
 
 /*
  * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts:
Index: linux-2.6.git/arch/x86/kernel/irqinit_64.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/irqinit_64.c
+++ linux-2.6.git/arch/x86/kernel/irqinit_64.c
@@ -4,6 +4,7 @@
 #include <linux/sched.h>
 #include <linux/ioport.h>
 #include <linux/interrupt.h>
+#include <linux/kprobes.h>
 #include <linux/timex.h>
 #include <linux/slab.h>
 #include <linux/random.h>
@@ -18,11 +19,45 @@
 #include <asm/atomic.h>
 #include <asm/system.h>
 #include <asm/hw_irq.h>
+#include <asm/timer.h>
 #include <asm/pgtable.h>
 #include <asm/desc.h>
 #include <asm/apic.h>
 #include <asm/setup.h>
 #include <asm/i8259.h>
+#include <asm/traps.h>
+
+#ifdef CONFIG_X86_32
+/*
+ * Note that on a 486, we don't want to do a SIGFPE on an irq13
+ * as the irq is unreliable, and exception 16 works correctly
+ * (ie as explained in the intel literature). On a 386, you
+ * can't use exception 16 due to bad IBM design, so we have to
+ * rely on the less exact irq13.
+ *
+ * Careful.. Not only is IRQ13 unreliable, but it is also
+ * leads to races. IBM designers who came up with it should
+ * be shot.
+ */
+static irqreturn_t math_error_irq(int cpl, void *dev_id)
+{
+	outb(0, 0xF0);
+	if (ignore_fpu_irq || !boot_cpu_data.hard_math)
+		return IRQ_NONE;
+	math_error((void __user *)get_irq_regs()->ip);
+	return IRQ_HANDLED;
+}
+
+/*
+ * New motherboards sometimes make IRQ 13 be a PCI interrupt,
+ * so allow interrupt sharing.
+ */
+static struct irqaction fpu_irq = {
+	.handler = math_error_irq,
+	.mask = CPU_MASK_NONE,
+	.name = "fpu",
+};
+#endif /* CONFIG_X86_32 */
 
 /*
  * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts:


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

* [patch 6/6] x86: irqinit - merge irqinit_32/64.c into irqinit.c
  2009-03-29 20:15 [patch 0/6] x86-tip: merge irqinit_32/64.c Cyrill Gorcunov
                   ` (4 preceding siblings ...)
  2009-03-29 20:15 ` [patch 5/6] x86: irqinit - merge math_error_irq and headers Cyrill Gorcunov
@ 2009-03-29 20:15 ` Cyrill Gorcunov
  2009-04-01 15:01   ` Ingo Molnar
  5 siblings, 1 reply; 16+ messages in thread
From: Cyrill Gorcunov @ 2009-03-29 20:15 UTC (permalink / raw)
  To: mingo, hpa, tglx; +Cc: linux-kernel, xemul, yhlu.kernel, Cyrill Gorcunov

[-- Attachment #1: x86-irqinit-merge --]
[-- Type: text/plain, Size: 22102 bytes --]

So the files are merged there is still #include's
mess -- need serious cleanup.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 arch/x86/kernel/Makefile     |    2 
 arch/x86/kernel/irqinit.c    |  249 +++++++++++++++++++++++++++++++++++++++++++
 arch/x86/kernel/irqinit_32.c |  246 ------------------------------------------
 arch/x86/kernel/irqinit_64.c |  249 -------------------------------------------
 4 files changed, 250 insertions(+), 496 deletions(-)

Index: linux-2.6.git/arch/x86/kernel/Makefile
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/Makefile
+++ linux-2.6.git/arch/x86/kernel/Makefile
@@ -28,7 +28,7 @@ CFLAGS_paravirt.o	:= $(nostackp)
 obj-y			:= process_$(BITS).o signal.o entry_$(BITS).o
 obj-y			+= traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o
 obj-y			+= time_$(BITS).o ioport.o ldt.o dumpstack.o
-obj-y			+= setup.o i8259.o irqinit_$(BITS).o
+obj-y			+= setup.o i8259.o irqinit.o
 obj-$(CONFIG_X86_VISWS)	+= visws_quirks.o
 obj-$(CONFIG_X86_32)	+= probe_roms_32.o
 obj-$(CONFIG_X86_32)	+= sys_i386_32.o i386_ksyms_32.o
Index: linux-2.6.git/arch/x86/kernel/irqinit.c
===================================================================
--- /dev/null
+++ linux-2.6.git/arch/x86/kernel/irqinit.c
@@ -0,0 +1,249 @@
+#include <linux/linkage.h>
+#include <linux/errno.h>
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/ioport.h>
+#include <linux/interrupt.h>
+#include <linux/kprobes.h>
+#include <linux/timex.h>
+#include <linux/slab.h>
+#include <linux/random.h>
+#include <linux/init.h>
+#include <linux/kernel_stat.h>
+#include <linux/sysdev.h>
+#include <linux/bitops.h>
+#include <linux/acpi.h>
+#include <linux/io.h>
+#include <linux/delay.h>
+
+#include <asm/atomic.h>
+#include <asm/system.h>
+#include <asm/hw_irq.h>
+#include <asm/timer.h>
+#include <asm/pgtable.h>
+#include <asm/desc.h>
+#include <asm/apic.h>
+#include <asm/setup.h>
+#include <asm/i8259.h>
+#include <asm/traps.h>
+
+#ifdef CONFIG_X86_32
+/*
+ * Note that on a 486, we don't want to do a SIGFPE on an irq13
+ * as the irq is unreliable, and exception 16 works correctly
+ * (ie as explained in the intel literature). On a 386, you
+ * can't use exception 16 due to bad IBM design, so we have to
+ * rely on the less exact irq13.
+ *
+ * Careful.. Not only is IRQ13 unreliable, but it is also
+ * leads to races. IBM designers who came up with it should
+ * be shot.
+ */
+static irqreturn_t math_error_irq(int cpl, void *dev_id)
+{
+	outb(0, 0xF0);
+	if (ignore_fpu_irq || !boot_cpu_data.hard_math)
+		return IRQ_NONE;
+	math_error((void __user *)get_irq_regs()->ip);
+	return IRQ_HANDLED;
+}
+
+/*
+ * New motherboards sometimes make IRQ 13 be a PCI interrupt,
+ * so allow interrupt sharing.
+ */
+static struct irqaction fpu_irq = {
+	.handler = math_error_irq,
+	.mask = CPU_MASK_NONE,
+	.name = "fpu",
+};
+#endif /* CONFIG_X86_32 */
+
+/*
+ * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts:
+ * (these are usually mapped to vectors 0x30-0x3f)
+ */
+void __init init_ISA_irqs(void)
+{
+	int i;
+
+#ifdef CONFIG_X86_LOCAL_APIC
+	init_bsp_APIC();
+#endif
+	init_8259A(0);
+
+	/* 16 old-style INTA-cycle interrupts */
+	for (i = 0; i < NR_IRQS_LEGACY; i++) {
+		struct irq_desc *desc = irq_to_desc(i);
+
+		desc->status = IRQ_DISABLED;
+		desc->action = NULL;
+		desc->depth = 1;
+
+		set_irq_chip_and_handler_name(i, &i8259A_chip,
+					handle_level_irq, "XT");
+	}
+}
+
+/*
+ * The IO-APIC gives us many more interrupt sources. Most of these
+ * are unused but an SMP system is supposed to have enough memory ...
+ * sometimes (mostly wrt. hw bugs) we get corrupted vectors all
+ * across the spectrum, so we really want to be prepared to get all
+ * of these. Plus, more powerful systems might have more than 64
+ * IO-APIC registers.
+ *
+ * (these are usually mapped into the 0x30-0xff vector range)
+ */
+
+/*
+ * IRQ2 is cascade interrupt to second interrupt controller
+ */
+
+static struct irqaction irq2 = {
+	.handler = no_action,
+	.mask = CPU_MASK_NONE,
+	.name = "cascade",
+};
+DEFINE_PER_CPU(vector_irq_t, vector_irq) = {
+	[0 ... IRQ0_VECTOR - 1] = -1,
+	[IRQ0_VECTOR] = 0,
+	[IRQ1_VECTOR] = 1,
+	[IRQ2_VECTOR] = 2,
+	[IRQ3_VECTOR] = 3,
+	[IRQ4_VECTOR] = 4,
+	[IRQ5_VECTOR] = 5,
+	[IRQ6_VECTOR] = 6,
+	[IRQ7_VECTOR] = 7,
+	[IRQ8_VECTOR] = 8,
+	[IRQ9_VECTOR] = 9,
+	[IRQ10_VECTOR] = 10,
+	[IRQ11_VECTOR] = 11,
+	[IRQ12_VECTOR] = 12,
+	[IRQ13_VECTOR] = 13,
+	[IRQ14_VECTOR] = 14,
+	[IRQ15_VECTOR] = 15,
+	[IRQ15_VECTOR + 1 ... NR_VECTORS - 1] = -1
+};
+
+int vector_used_by_percpu_irq(unsigned int vector)
+{
+	int cpu;
+
+	for_each_online_cpu(cpu) {
+		if (per_cpu(vector_irq, cpu)[vector] != -1)
+			return 1;
+	}
+
+	return 0;
+}
+
+/* Overridden in paravirt.c */
+void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ")));
+
+static void __init smp_intr_init(void)
+{
+#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_SMP)
+	/*
+	 * The reschedule interrupt is a CPU-to-CPU reschedule-helper
+	 * IPI, driven by wakeup.
+	 */
+	alloc_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt);
+
+	/* IPIs for invalidation */
+	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+0, invalidate_interrupt0);
+	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+1, invalidate_interrupt1);
+	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+2, invalidate_interrupt2);
+	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+3, invalidate_interrupt3);
+	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+4, invalidate_interrupt4);
+	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+5, invalidate_interrupt5);
+	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+6, invalidate_interrupt6);
+	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+7, invalidate_interrupt7);
+
+	/* 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);
+#endif
+}
+
+static void __init apic_intr_init(void)
+{
+	smp_intr_init();
+
+#ifdef CONFIG_X86_LOCAL_APIC
+
+	/* self generated IPI for local APIC timer */
+	alloc_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt);
+
+	/* generic IPI for platform specific use */
+	alloc_intr_gate(GENERIC_INTERRUPT_VECTOR, generic_interrupt);
+
+	/* IPI vectors for APIC spurious and error interrupts */
+	alloc_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
+	alloc_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
+
+# ifdef CONFIG_PERF_COUNTERS
+	/* Performance monitoring interrupt */
+	alloc_intr_gate(LOCAL_PERF_VECTOR, perf_counter_interrupt);
+# endif
+
+#if defined(CONFIG_X86_MCE_P4THERMAL) || defined(CONFIG_X86_64)
+	/* thermal monitor LVT interrupt */
+	alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
+# endif
+
+# ifdef CONFIG_X86_64
+	alloc_intr_gate(THRESHOLD_APIC_VECTOR, threshold_interrupt);
+# endif
+
+#endif
+}
+
+void __init native_init_IRQ(void)
+{
+	int i;
+
+	/* Execute any quirks before the call gates are initialised: */
+	x86_quirk_pre_intr_init();
+
+	apic_intr_init();
+
+	/*
+	 * Cover the whole vector space, no vector can escape
+	 * us. (some of these will be overridden and become
+	 * 'special' SMP interrupts)
+	 */
+	for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) {
+		int vector = FIRST_EXTERNAL_VECTOR + i;
+		/* X86-32: SYSCALL_VECTOR was reserved in trap_init. */
+		if (!test_bit(vector, used_vectors))
+			set_intr_gate(vector, interrupt[i]);
+	}
+
+	if (!acpi_ioapic)
+		setup_irq(2, &irq2);
+
+	/*
+	 * Call quirks after call gates are initialised (usually add in
+	 * the architecture specific gates):
+	 */
+	x86_quirk_intr_init();
+
+#ifdef CONFIG_X86_32
+	/*
+	 * External FPU? Set up irq13 if so, for
+	 * original braindamaged IBM FERR coupling.
+	 */
+	if (boot_cpu_data.hard_math && !cpu_has_fpu)
+		setup_irq(FPU_IRQ, &fpu_irq);
+
+	irq_ctx_init(smp_processor_id());
+#endif
+}
Index: linux-2.6.git/arch/x86/kernel/irqinit_32.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/irqinit_32.c
+++ /dev/null
@@ -1,246 +0,0 @@
-#include <linux/linkage.h>
-#include <linux/errno.h>
-#include <linux/signal.h>
-#include <linux/sched.h>
-#include <linux/ioport.h>
-#include <linux/interrupt.h>
-#include <linux/timex.h>
-#include <linux/slab.h>
-#include <linux/random.h>
-#include <linux/init.h>
-#include <linux/kernel_stat.h>
-#include <linux/sysdev.h>
-#include <linux/bitops.h>
-#include <linux/acpi.h>
-#include <linux/io.h>
-#include <linux/delay.h>
-
-#include <asm/atomic.h>
-#include <asm/system.h>
-#include <asm/hw_irq.h>
-#include <asm/timer.h>
-#include <asm/pgtable.h>
-#include <asm/desc.h>
-#include <asm/apic.h>
-#include <asm/setup.h>
-#include <asm/i8259.h>
-#include <asm/traps.h>
-
-#ifdef CONFIG_X86_32
-/*
- * Note that on a 486, we don't want to do a SIGFPE on an irq13
- * as the irq is unreliable, and exception 16 works correctly
- * (ie as explained in the intel literature). On a 386, you
- * can't use exception 16 due to bad IBM design, so we have to
- * rely on the less exact irq13.
- *
- * Careful.. Not only is IRQ13 unreliable, but it is also
- * leads to races. IBM designers who came up with it should
- * be shot.
- */
-static irqreturn_t math_error_irq(int cpl, void *dev_id)
-{
-	outb(0, 0xF0);
-	if (ignore_fpu_irq || !boot_cpu_data.hard_math)
-		return IRQ_NONE;
-	math_error((void __user *)get_irq_regs()->ip);
-	return IRQ_HANDLED;
-}
-
-/*
- * New motherboards sometimes make IRQ 13 be a PCI interrupt,
- * so allow interrupt sharing.
- */
-static struct irqaction fpu_irq = {
-	.handler = math_error_irq,
-	.mask = CPU_MASK_NONE,
-	.name = "fpu",
-};
-#endif /* CONFIG_X86_32 */
-
-/*
- * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts:
- * (these are usually mapped to vectors 0x30-0x3f)
- */
-void __init init_ISA_irqs(void)
-{
-	int i;
-
-#ifdef CONFIG_X86_LOCAL_APIC
-	init_bsp_APIC();
-#endif
-	init_8259A(0);
-
-	/* 16 old-style INTA-cycle interrupts */
-	for (i = 0; i < NR_IRQS_LEGACY; i++) {
-		struct irq_desc *desc = irq_to_desc(i);
-
-		desc->status = IRQ_DISABLED;
-		desc->action = NULL;
-		desc->depth = 1;
-
-		set_irq_chip_and_handler_name(i, &i8259A_chip,
-					handle_level_irq, "XT");
-	}
-}
-
-/*
- * The IO-APIC gives us many more interrupt sources. Most of these
- * are unused but an SMP system is supposed to have enough memory ...
- * sometimes (mostly wrt. hw bugs) we get corrupted vectors all
- * across the spectrum, so we really want to be prepared to get all
- * of these. Plus, more powerful systems might have more than 64
- * IO-APIC registers.
- *
- * (these are usually mapped into the 0x30-0xff vector range)
- */
-
-/*
- * IRQ2 is cascade interrupt to second interrupt controller
- */
-static struct irqaction irq2 = {
-	.handler = no_action,
-	.mask = CPU_MASK_NONE,
-	.name = "cascade",
-};
-
-DEFINE_PER_CPU(vector_irq_t, vector_irq) = {
-	[0 ... IRQ0_VECTOR - 1] = -1,
-	[IRQ0_VECTOR] = 0,
-	[IRQ1_VECTOR] = 1,
-	[IRQ2_VECTOR] = 2,
-	[IRQ3_VECTOR] = 3,
-	[IRQ4_VECTOR] = 4,
-	[IRQ5_VECTOR] = 5,
-	[IRQ6_VECTOR] = 6,
-	[IRQ7_VECTOR] = 7,
-	[IRQ8_VECTOR] = 8,
-	[IRQ9_VECTOR] = 9,
-	[IRQ10_VECTOR] = 10,
-	[IRQ11_VECTOR] = 11,
-	[IRQ12_VECTOR] = 12,
-	[IRQ13_VECTOR] = 13,
-	[IRQ14_VECTOR] = 14,
-	[IRQ15_VECTOR] = 15,
-	[IRQ15_VECTOR + 1 ... NR_VECTORS - 1] = -1
-};
-
-int vector_used_by_percpu_irq(unsigned int vector)
-{
-	int cpu;
-
-	for_each_online_cpu(cpu) {
-		if (per_cpu(vector_irq, cpu)[vector] != -1)
-			return 1;
-	}
-
-	return 0;
-}
-
-/* Overridden in paravirt.c */
-void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ")));
-
-static void __init smp_intr_init(void)
-{
-#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_SMP)
-	/*
-	 * The reschedule interrupt is a CPU-to-CPU reschedule-helper
-	 * IPI, driven by wakeup.
-	 */
-	alloc_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt);
-
-	/* IPIs for invalidation */
-	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+0, invalidate_interrupt0);
-	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+1, invalidate_interrupt1);
-	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+2, invalidate_interrupt2);
-	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+3, invalidate_interrupt3);
-	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+4, invalidate_interrupt4);
-	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+5, invalidate_interrupt5);
-	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+6, invalidate_interrupt6);
-	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+7, invalidate_interrupt7);
-
-	/* 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);
-#endif
-}
-
-static void __init apic_intr_init(void)
-{
-	smp_intr_init();
-
-#ifdef CONFIG_X86_LOCAL_APIC
-	/* self generated IPI for local APIC timer */
-	alloc_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt);
-
-	/* generic IPI for platform specific use */
-	alloc_intr_gate(GENERIC_INTERRUPT_VECTOR, generic_interrupt);
-
-	/* IPI vectors for APIC spurious and error interrupts */
-	alloc_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
-	alloc_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
-# ifdef CONFIG_PERF_COUNTERS
-	/* Performance monitoring interrupt */
-	alloc_intr_gate(LOCAL_PERF_VECTOR, perf_counter_interrupt);
-# endif
-
-#if defined(CONFIG_X86_MCE_P4THERMAL) || defined(CONFIG_X86_64)
-	/* thermal monitor LVT interrupt */
-	alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
-# endif
-
-# ifdef CONFIG_X86_64
-	alloc_intr_gate(THRESHOLD_APIC_VECTOR, threshold_interrupt);
-# endif
-
-#endif
-}
-
-void __init native_init_IRQ(void)
-{
-	int i;
-
-	/* Execute any quirks before the call gates are initialised: */
-	x86_quirk_pre_intr_init();
-
-	apic_intr_init();
-
-	/*
-	 * Cover the whole vector space, no vector can escape
-	 * us. (some of these will be overridden and become
-	 * 'special' SMP interrupts)
-	 */
-	for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) {
-		int vector = FIRST_EXTERNAL_VECTOR + i;
-		/* X86-32: SYSCALL_VECTOR was reserved in trap_init. */
-		if (!test_bit(vector, used_vectors))
-			set_intr_gate(vector, interrupt[i]);
-	}
-
-	if (!acpi_ioapic)
-		setup_irq(2, &irq2);
-
-	/*
-	 * Call quirks after call gates are initialised (usually add in
-	 * the architecture specific gates):
-	 */
-	x86_quirk_intr_init();
-
-#ifdef CONFIG_X86_32
-	/*
-	 * External FPU? Set up irq13 if so, for
-	 * original braindamaged IBM FERR coupling.
-	 */
-	if (boot_cpu_data.hard_math && !cpu_has_fpu)
-		setup_irq(FPU_IRQ, &fpu_irq);
-
-	irq_ctx_init(smp_processor_id());
-#endif
-}
Index: linux-2.6.git/arch/x86/kernel/irqinit_64.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/irqinit_64.c
+++ /dev/null
@@ -1,249 +0,0 @@
-#include <linux/linkage.h>
-#include <linux/errno.h>
-#include <linux/signal.h>
-#include <linux/sched.h>
-#include <linux/ioport.h>
-#include <linux/interrupt.h>
-#include <linux/kprobes.h>
-#include <linux/timex.h>
-#include <linux/slab.h>
-#include <linux/random.h>
-#include <linux/init.h>
-#include <linux/kernel_stat.h>
-#include <linux/sysdev.h>
-#include <linux/bitops.h>
-#include <linux/acpi.h>
-#include <linux/io.h>
-#include <linux/delay.h>
-
-#include <asm/atomic.h>
-#include <asm/system.h>
-#include <asm/hw_irq.h>
-#include <asm/timer.h>
-#include <asm/pgtable.h>
-#include <asm/desc.h>
-#include <asm/apic.h>
-#include <asm/setup.h>
-#include <asm/i8259.h>
-#include <asm/traps.h>
-
-#ifdef CONFIG_X86_32
-/*
- * Note that on a 486, we don't want to do a SIGFPE on an irq13
- * as the irq is unreliable, and exception 16 works correctly
- * (ie as explained in the intel literature). On a 386, you
- * can't use exception 16 due to bad IBM design, so we have to
- * rely on the less exact irq13.
- *
- * Careful.. Not only is IRQ13 unreliable, but it is also
- * leads to races. IBM designers who came up with it should
- * be shot.
- */
-static irqreturn_t math_error_irq(int cpl, void *dev_id)
-{
-	outb(0, 0xF0);
-	if (ignore_fpu_irq || !boot_cpu_data.hard_math)
-		return IRQ_NONE;
-	math_error((void __user *)get_irq_regs()->ip);
-	return IRQ_HANDLED;
-}
-
-/*
- * New motherboards sometimes make IRQ 13 be a PCI interrupt,
- * so allow interrupt sharing.
- */
-static struct irqaction fpu_irq = {
-	.handler = math_error_irq,
-	.mask = CPU_MASK_NONE,
-	.name = "fpu",
-};
-#endif /* CONFIG_X86_32 */
-
-/*
- * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts:
- * (these are usually mapped to vectors 0x30-0x3f)
- */
-void __init init_ISA_irqs(void)
-{
-	int i;
-
-#ifdef CONFIG_X86_LOCAL_APIC
-	init_bsp_APIC();
-#endif
-	init_8259A(0);
-
-	/* 16 old-style INTA-cycle interrupts */
-	for (i = 0; i < NR_IRQS_LEGACY; i++) {
-		struct irq_desc *desc = irq_to_desc(i);
-
-		desc->status = IRQ_DISABLED;
-		desc->action = NULL;
-		desc->depth = 1;
-
-		set_irq_chip_and_handler_name(i, &i8259A_chip,
-					handle_level_irq, "XT");
-	}
-}
-
-/*
- * The IO-APIC gives us many more interrupt sources. Most of these
- * are unused but an SMP system is supposed to have enough memory ...
- * sometimes (mostly wrt. hw bugs) we get corrupted vectors all
- * across the spectrum, so we really want to be prepared to get all
- * of these. Plus, more powerful systems might have more than 64
- * IO-APIC registers.
- *
- * (these are usually mapped into the 0x30-0xff vector range)
- */
-
-/*
- * IRQ2 is cascade interrupt to second interrupt controller
- */
-
-static struct irqaction irq2 = {
-	.handler = no_action,
-	.mask = CPU_MASK_NONE,
-	.name = "cascade",
-};
-DEFINE_PER_CPU(vector_irq_t, vector_irq) = {
-	[0 ... IRQ0_VECTOR - 1] = -1,
-	[IRQ0_VECTOR] = 0,
-	[IRQ1_VECTOR] = 1,
-	[IRQ2_VECTOR] = 2,
-	[IRQ3_VECTOR] = 3,
-	[IRQ4_VECTOR] = 4,
-	[IRQ5_VECTOR] = 5,
-	[IRQ6_VECTOR] = 6,
-	[IRQ7_VECTOR] = 7,
-	[IRQ8_VECTOR] = 8,
-	[IRQ9_VECTOR] = 9,
-	[IRQ10_VECTOR] = 10,
-	[IRQ11_VECTOR] = 11,
-	[IRQ12_VECTOR] = 12,
-	[IRQ13_VECTOR] = 13,
-	[IRQ14_VECTOR] = 14,
-	[IRQ15_VECTOR] = 15,
-	[IRQ15_VECTOR + 1 ... NR_VECTORS - 1] = -1
-};
-
-int vector_used_by_percpu_irq(unsigned int vector)
-{
-	int cpu;
-
-	for_each_online_cpu(cpu) {
-		if (per_cpu(vector_irq, cpu)[vector] != -1)
-			return 1;
-	}
-
-	return 0;
-}
-
-/* Overridden in paravirt.c */
-void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ")));
-
-static void __init smp_intr_init(void)
-{
-#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_SMP)
-	/*
-	 * The reschedule interrupt is a CPU-to-CPU reschedule-helper
-	 * IPI, driven by wakeup.
-	 */
-	alloc_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt);
-
-	/* IPIs for invalidation */
-	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+0, invalidate_interrupt0);
-	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+1, invalidate_interrupt1);
-	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+2, invalidate_interrupt2);
-	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+3, invalidate_interrupt3);
-	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+4, invalidate_interrupt4);
-	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+5, invalidate_interrupt5);
-	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+6, invalidate_interrupt6);
-	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+7, invalidate_interrupt7);
-
-	/* 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);
-#endif
-}
-
-static void __init apic_intr_init(void)
-{
-	smp_intr_init();
-
-#ifdef CONFIG_X86_LOCAL_APIC
-
-	/* self generated IPI for local APIC timer */
-	alloc_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt);
-
-	/* generic IPI for platform specific use */
-	alloc_intr_gate(GENERIC_INTERRUPT_VECTOR, generic_interrupt);
-
-	/* IPI vectors for APIC spurious and error interrupts */
-	alloc_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
-	alloc_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
-
-# ifdef CONFIG_PERF_COUNTERS
-	/* Performance monitoring interrupt */
-	alloc_intr_gate(LOCAL_PERF_VECTOR, perf_counter_interrupt);
-# endif
-
-#if defined(CONFIG_X86_MCE_P4THERMAL) || defined(CONFIG_X86_64)
-	/* thermal monitor LVT interrupt */
-	alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
-# endif
-
-# ifdef CONFIG_X86_64
-	alloc_intr_gate(THRESHOLD_APIC_VECTOR, threshold_interrupt);
-# endif
-
-#endif
-}
-
-void __init native_init_IRQ(void)
-{
-	int i;
-
-	/* Execute any quirks before the call gates are initialised: */
-	x86_quirk_pre_intr_init();
-
-	apic_intr_init();
-
-	/*
-	 * Cover the whole vector space, no vector can escape
-	 * us. (some of these will be overridden and become
-	 * 'special' SMP interrupts)
-	 */
-	for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) {
-		int vector = FIRST_EXTERNAL_VECTOR + i;
-		/* X86-32: SYSCALL_VECTOR was reserved in trap_init. */
-		if (!test_bit(vector, used_vectors))
-			set_intr_gate(vector, interrupt[i]);
-	}
-
-	if (!acpi_ioapic)
-		setup_irq(2, &irq2);
-
-	/*
-	 * Call quirks after call gates are initialised (usually add in
-	 * the architecture specific gates):
-	 */
-	x86_quirk_intr_init();
-
-#ifdef CONFIG_X86_32
-	/*
-	 * External FPU? Set up irq13 if so, for
-	 * original braindamaged IBM FERR coupling.
-	 */
-	if (boot_cpu_data.hard_math && !cpu_has_fpu)
-		setup_irq(FPU_IRQ, &fpu_irq);
-
-	irq_ctx_init(smp_processor_id());
-#endif
-}


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

* Re: [patch 4/6] x86: irqinit - merge native_init_IRQ
  2009-03-29 20:15 ` [patch 4/6] x86: irqinit - merge native_init_IRQ Cyrill Gorcunov
@ 2009-04-01 14:53   ` Ingo Molnar
  2009-04-01 15:01     ` Cyrill Gorcunov
  2009-04-01 16:16     ` Cyrill Gorcunov
  0 siblings, 2 replies; 16+ messages in thread
From: Ingo Molnar @ 2009-04-01 14:53 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: hpa, tglx, linux-kernel, xemul, yhlu.kernel


* Cyrill Gorcunov <gorcunov@openvz.org> wrote:

> For this purpose init_ISA_irqs is called indirectly
> by x86_quirk_pre_intr_init.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
> ---
>  arch/x86/kernel/irqinit_32.c |    4 +++-
>  arch/x86/kernel/irqinit_64.c |   22 +++++++++++++++++++++-
>  arch/x86/kernel/setup.c      |    8 ++++++++
>  3 files changed, 32 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6.git/arch/x86/kernel/irqinit_32.c
> ===================================================================
> --- linux-2.6.git.orig/arch/x86/kernel/irqinit_32.c
> +++ linux-2.6.git/arch/x86/kernel/irqinit_32.c
> @@ -215,7 +215,7 @@ void __init native_init_IRQ(void)
>  	 */
>  	for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) {
>  		int vector = FIRST_EXTERNAL_VECTOR + i;
> -		/* SYSCALL_VECTOR was reserved in trap_init. */
> +		/* X86-32: SYSCALL_VECTOR was reserved in trap_init. */
>  		if (!test_bit(vector, used_vectors))
>  			set_intr_gate(vector, interrupt[i]);
>  	}
> @@ -229,6 +229,7 @@ void __init native_init_IRQ(void)
>  	 */
>  	x86_quirk_intr_init();
>  
> +#ifdef CONFIG_X86_32
>  	/*
>  	 * External FPU? Set up irq13 if so, for
>  	 * original braindamaged IBM FERR coupling.
> @@ -237,4 +238,5 @@ void __init native_init_IRQ(void)
>  		setup_irq(FPU_IRQ, &fpu_irq);
>  
>  	irq_ctx_init(smp_processor_id());
> +#endif
>  }
> Index: linux-2.6.git/arch/x86/kernel/irqinit_64.c
> ===================================================================
> --- linux-2.6.git.orig/arch/x86/kernel/irqinit_64.c
> +++ linux-2.6.git/arch/x86/kernel/irqinit_64.c
> @@ -21,6 +21,7 @@
>  #include <asm/pgtable.h>
>  #include <asm/desc.h>
>  #include <asm/apic.h>
> +#include <asm/setup.h>
>  #include <asm/i8259.h>
>  
>  /*
> @@ -174,7 +175,8 @@ void __init native_init_IRQ(void)
>  {
>  	int i;
>  
> -	init_ISA_irqs();
> +	/* Execute any quirks before the call gates are initialised: */
> +	x86_quirk_pre_intr_init();
>  
>  	apic_intr_init();
>  
> @@ -185,10 +187,28 @@ void __init native_init_IRQ(void)
>  	 */
>  	for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) {
>  		int vector = FIRST_EXTERNAL_VECTOR + i;
> +		/* X86-32: SYSCALL_VECTOR was reserved in trap_init. */
>  		if (!test_bit(vector, used_vectors))
>  			set_intr_gate(vector, interrupt[i]);
>  	}
>  
>  	if (!acpi_ioapic)
>  		setup_irq(2, &irq2);
> +
> +	/*
> +	 * Call quirks after call gates are initialised (usually add in
> +	 * the architecture specific gates):
> +	 */
> +	x86_quirk_intr_init();
> +
> +#ifdef CONFIG_X86_32
> +	/*
> +	 * External FPU? Set up irq13 if so, for
> +	 * original braindamaged IBM FERR coupling.
> +	 */
> +	if (boot_cpu_data.hard_math && !cpu_has_fpu)
> +		setup_irq(FPU_IRQ, &fpu_irq);
> +
> +	irq_ctx_init(smp_processor_id());
> +#endif
>  }
> Index: linux-2.6.git/arch/x86/kernel/setup.c
> ===================================================================
> --- linux-2.6.git.orig/arch/x86/kernel/setup.c
> +++ linux-2.6.git/arch/x86/kernel/setup.c
> @@ -1087,3 +1087,11 @@ void __init x86_quirk_time_init(void)
>  	setup_irq(0, &irq0);
>  }
>  #endif /* CONFIG_X86_32 */
> +
> +#ifdef CONFIG_X86_64
> +void x86_quirk_pre_intr_init(void)
> +{
> +	init_ISA_irqs();
> +}
> +void x86_quirk_intr_init(void) { }
> +#endif

Hm, wouldnt it be cleaner to add it as a new quirk function vector 
in struct x86_quirks? See arch/x86/include/asm/setup.h.

	Ingo

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

* Re: [patch 6/6] x86: irqinit - merge irqinit_32/64.c into irqinit.c
  2009-03-29 20:15 ` [patch 6/6] x86: irqinit - merge irqinit_32/64.c into irqinit.c Cyrill Gorcunov
@ 2009-04-01 15:01   ` Ingo Molnar
  2009-04-01 15:05     ` Cyrill Gorcunov
  0 siblings, 1 reply; 16+ messages in thread
From: Ingo Molnar @ 2009-04-01 15:01 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: hpa, tglx, linux-kernel, xemul, yhlu.kernel


* Cyrill Gorcunov <gorcunov@openvz.org> wrote:

> So the files are merged there is still #include's
> mess -- need serious cleanup.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
> ---
>  arch/x86/kernel/Makefile     |    2 
>  arch/x86/kernel/irqinit.c    |  249 +++++++++++++++++++++++++++++++++++++++++++
>  arch/x86/kernel/irqinit_32.c |  246 ------------------------------------------
>  arch/x86/kernel/irqinit_64.c |  249 -------------------------------------------
>  4 files changed, 250 insertions(+), 496 deletions(-)

ok, this looks pretty well done.

If you could do the x86_quirk cleanup on top of this i guess we 
could try it. (no need to redo the unification with the quirk thing, 
that will break this patch.)

	Ingo

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

* Re: [patch 4/6] x86: irqinit - merge native_init_IRQ
  2009-04-01 14:53   ` Ingo Molnar
@ 2009-04-01 15:01     ` Cyrill Gorcunov
  2009-04-01 16:16     ` Cyrill Gorcunov
  1 sibling, 0 replies; 16+ messages in thread
From: Cyrill Gorcunov @ 2009-04-01 15:01 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: hpa, tglx, linux-kernel, xemul, yhlu.kernel

[Ingo Molnar - Wed, Apr 01, 2009 at 04:53:28PM +0200]
...
| 
| > Index: linux-2.6.git/arch/x86/kernel/setup.c
| > ===================================================================
| > --- linux-2.6.git.orig/arch/x86/kernel/setup.c
| > +++ linux-2.6.git/arch/x86/kernel/setup.c
| > @@ -1087,3 +1087,11 @@ void __init x86_quirk_time_init(void)
| >  	setup_irq(0, &irq0);
| >  }
| >  #endif /* CONFIG_X86_32 */
| > +
| > +#ifdef CONFIG_X86_64
| > +void x86_quirk_pre_intr_init(void)
| > +{
| > +	init_ISA_irqs();
| > +}
| > +void x86_quirk_intr_init(void) { }
| > +#endif
| 
| Hm, wouldnt it be cleaner to add it as a new quirk function vector 
| in struct x86_quirks? See arch/x86/include/asm/setup.h.
| 
| 	Ingo
| 

Will take a look, thanks!

        Cyrill

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

* Re: [patch 6/6] x86: irqinit - merge irqinit_32/64.c into irqinit.c
  2009-04-01 15:01   ` Ingo Molnar
@ 2009-04-01 15:05     ` Cyrill Gorcunov
  0 siblings, 0 replies; 16+ messages in thread
From: Cyrill Gorcunov @ 2009-04-01 15:05 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: hpa, tglx, linux-kernel, xemul, yhlu.kernel

[Ingo Molnar - Wed, Apr 01, 2009 at 05:01:01PM +0200]
| 
| * Cyrill Gorcunov <gorcunov@openvz.org> wrote:
| 
| > So the files are merged there is still #include's
| > mess -- need serious cleanup.
| > 
| > Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
| > ---
| >  arch/x86/kernel/Makefile     |    2 
| >  arch/x86/kernel/irqinit.c    |  249 +++++++++++++++++++++++++++++++++++++++++++
| >  arch/x86/kernel/irqinit_32.c |  246 ------------------------------------------
| >  arch/x86/kernel/irqinit_64.c |  249 -------------------------------------------
| >  4 files changed, 250 insertions(+), 496 deletions(-)
| 
| ok, this looks pretty well done.
| 
| If you could do the x86_quirk cleanup on top of this i guess we 
| could try it. (no need to redo the unification with the quirk thing, 
| that will break this patch.)
| 
| 	Ingo
| 

ok, will do the quirk cleanup on top of.

        Cyrill

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

* Re: [patch 4/6] x86: irqinit - merge native_init_IRQ
  2009-04-01 14:53   ` Ingo Molnar
  2009-04-01 15:01     ` Cyrill Gorcunov
@ 2009-04-01 16:16     ` Cyrill Gorcunov
  2009-04-01 16:22       ` Ingo Molnar
  1 sibling, 1 reply; 16+ messages in thread
From: Cyrill Gorcunov @ 2009-04-01 16:16 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: hpa, tglx, linux-kernel, xemul, yhlu.kernel

[Ingo Molnar - Wed, Apr 01, 2009 at 04:53:28PM +0200]
...
| > Index: linux-2.6.git/arch/x86/kernel/setup.c
| > ===================================================================
| > --- linux-2.6.git.orig/arch/x86/kernel/setup.c
| > +++ linux-2.6.git/arch/x86/kernel/setup.c
| > @@ -1087,3 +1087,11 @@ void __init x86_quirk_time_init(void)
| >  	setup_irq(0, &irq0);
| >  }
| >  #endif /* CONFIG_X86_32 */
| > +
| > +#ifdef CONFIG_X86_64
| > +void x86_quirk_pre_intr_init(void)
| > +{
| > +	init_ISA_irqs();
| > +}
| > +void x86_quirk_intr_init(void) { }
| > +#endif
| 
| Hm, wouldnt it be cleaner to add it as a new quirk function vector 
| in struct x86_quirks? See arch/x86/include/asm/setup.h.
| 
| 	Ingo
| 

I just remember -- I thought about that and since x86_quirk_pre_intr_init
described as external BUT implemented for x86-32 only I needed
to indroduce new x86-64 versions for this (and since I know
that there no need to do anything else except calling init_ISA_irqs
I desided to have separate wrapper for that).

And btw x86-32 already has init_ISA_irqs call and quirks
are used in x86-32 mode only so for 64bit it will be just
a not needed check. Which means - I could just use original
x86_quirk_pre_intr_init function which  will call all I need.

Or you meant something else?

        Cyrill

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

* Re: [patch 4/6] x86: irqinit - merge native_init_IRQ
  2009-04-01 16:16     ` Cyrill Gorcunov
@ 2009-04-01 16:22       ` Ingo Molnar
  2009-04-01 16:40         ` Cyrill Gorcunov
  0 siblings, 1 reply; 16+ messages in thread
From: Ingo Molnar @ 2009-04-01 16:22 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: hpa, tglx, linux-kernel, xemul, yhlu.kernel


* Cyrill Gorcunov <gorcunov@gmail.com> wrote:

> [Ingo Molnar - Wed, Apr 01, 2009 at 04:53:28PM +0200]
> ...
> | > Index: linux-2.6.git/arch/x86/kernel/setup.c
> | > ===================================================================
> | > --- linux-2.6.git.orig/arch/x86/kernel/setup.c
> | > +++ linux-2.6.git/arch/x86/kernel/setup.c
> | > @@ -1087,3 +1087,11 @@ void __init x86_quirk_time_init(void)
> | >  	setup_irq(0, &irq0);
> | >  }
> | >  #endif /* CONFIG_X86_32 */
> | > +
> | > +#ifdef CONFIG_X86_64
> | > +void x86_quirk_pre_intr_init(void)
> | > +{
> | > +	init_ISA_irqs();
> | > +}
> | > +void x86_quirk_intr_init(void) { }
> | > +#endif
> | 
> | Hm, wouldnt it be cleaner to add it as a new quirk function vector 
> | in struct x86_quirks? See arch/x86/include/asm/setup.h.
> | 
> | 	Ingo
> | 
> 
> I just remember -- I thought about that and since 
> x86_quirk_pre_intr_init described as external BUT implemented for 
> x86-32 only I needed to indroduce new x86-64 versions for this 
> (and since I know that there no need to do anything else except 
> calling init_ISA_irqs I desided to have separate wrapper for 
> that).
> 
> And btw x86-32 already has init_ISA_irqs call and quirks are used 
> in x86-32 mode only so for 64bit it will be just a not needed 
> check. Which means - I could just use original 
> x86_quirk_pre_intr_init function which will call all I need.
> 
> Or you meant something else?

The typical solution there is to make the entry NULL in the 64-bit 
case. All the quirk handlers are conditional like this:

arch/x86/kernel/mpparse.c:      if (x86_quirks->mpc_apic_id)
arch/x86/kernel/mpparse.c:              apicid = x86_quirks->mpc_apic_id(m);

or am i missing something?

	Ingo

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

* Re: [patch 4/6] x86: irqinit - merge native_init_IRQ
  2009-04-01 16:22       ` Ingo Molnar
@ 2009-04-01 16:40         ` Cyrill Gorcunov
  2009-04-01 17:22           ` Cyrill Gorcunov
  0 siblings, 1 reply; 16+ messages in thread
From: Cyrill Gorcunov @ 2009-04-01 16:40 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: hpa, tglx, linux-kernel, xemul, yhlu.kernel

[Ingo Molnar - Wed, Apr 01, 2009 at 06:22:50PM +0200]
...
| > I just remember -- I thought about that and since 
| > x86_quirk_pre_intr_init described as external BUT implemented for 
| > x86-32 only I needed to indroduce new x86-64 versions for this 
| > (and since I know that there no need to do anything else except 
| > calling init_ISA_irqs I desided to have separate wrapper for 
| > that).
| > 
| > And btw x86-32 already has init_ISA_irqs call and quirks are used 
| > in x86-32 mode only so for 64bit it will be just a not needed 
| > check. Which means - I could just use original 
| > x86_quirk_pre_intr_init function which will call all I need.
| > 
| > Or you meant something else?
| 
| The typical solution there is to make the entry NULL in the 64-bit 
| case. All the quirk handlers are conditional like this:
| 
| arch/x86/kernel/mpparse.c:      if (x86_quirks->mpc_apic_id)
| arch/x86/kernel/mpparse.c:              apicid = x86_quirks->mpc_apic_id(m);
| 
| or am i missing something?
| 
| 	Ingo
| 

The problem is that 

	x86_quirk_pre_intr_init
	x86_quirk_intr_init
	...

are guarded by CONFIG_X86_32. So I thought
to call x86_quirk_pre_intr_init which is implemented
as following

void __init x86_quirk_pre_intr_init(void)
{
	if (x86_quirks->arch_pre_intr_init) {
		if (x86_quirks->arch_pre_intr_init())
			return;
	}
	init_ISA_irqs();
}

-- it will call init_ISA_irqs for us. But as I said
it's bound by CONFIG_X86_32. So we could remove this
limitation and use these function on x86-64 as well
and don't call for x86_quirks->arch_pre_intr_init.

The only reason I didn't do that -- we test
if x86_quirks->arch_pre_intr_init is defined for
nothing -- it's always NULL on x86-64.

Another reason for that -- irqinit_32.c calls for
x86_quirk_pre_intr_init and using the same name
for x86-64 will make code a bit cleaner I believe.

Maybe I better post a patch for review -- it'll
say more then me with my english :) ?

        Cyrill

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

* Re: [patch 4/6] x86: irqinit - merge native_init_IRQ
  2009-04-01 16:40         ` Cyrill Gorcunov
@ 2009-04-01 17:22           ` Cyrill Gorcunov
  2009-04-01 18:56             ` Cyrill Gorcunov
  0 siblings, 1 reply; 16+ messages in thread
From: Cyrill Gorcunov @ 2009-04-01 17:22 UTC (permalink / raw)
  To: Ingo Molnar, hpa, tglx, linux-kernel, xemul, yhlu.kernel

Ingo,

here is what I meant. The x86_quirk_pre_intr_init
and x86_quirk_intr_init do all we need. The only
paid off -- is that on x86-64 the functions
will check for x86_quirks->arch_intr_init and
x86_quirks->arch_pre_intr_init which are always
NULL for x86-64 (at least for now). If that is
acceptable -- then apply the patch below for
testing please. Othrewise we could eliminate
useless check by #ifdef (which would not be
that much differ from what I've posted initially
in patch series :)

        Cyrill
---

x86: irqinit - merge native_init_IRQ

For this purpose on X86-64 init_ISA_irqs is called
indirectly via x86_quirk_pre_intr_init (ie the same
way as X86-32 do).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 arch/x86/kernel/irqinit_32.c |    4 +++-
 arch/x86/kernel/irqinit_64.c |   22 +++++++++++++++++++++-
 arch/x86/kernel/setup.c      |    2 +-
 3 files changed, 25 insertions(+), 3 deletions(-)

Index: linux-2.6.git/arch/x86/kernel/irqinit_32.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/irqinit_32.c
+++ linux-2.6.git/arch/x86/kernel/irqinit_32.c
@@ -215,7 +215,7 @@ void __init native_init_IRQ(void)
 	 */
 	for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) {
 		int vector = FIRST_EXTERNAL_VECTOR + i;
-		/* SYSCALL_VECTOR was reserved in trap_init. */
+		/* X86-32: SYSCALL_VECTOR was reserved in trap_init. */
 		if (!test_bit(vector, used_vectors))
 			set_intr_gate(vector, interrupt[i]);
 	}
@@ -229,6 +229,7 @@ void __init native_init_IRQ(void)
 	 */
 	x86_quirk_intr_init();
 
+#ifdef CONFIG_X86_32
 	/*
 	 * External FPU? Set up irq13 if so, for
 	 * original braindamaged IBM FERR coupling.
@@ -237,4 +238,5 @@ void __init native_init_IRQ(void)
 		setup_irq(FPU_IRQ, &fpu_irq);
 
 	irq_ctx_init(smp_processor_id());
+#endif
 }
Index: linux-2.6.git/arch/x86/kernel/irqinit_64.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/irqinit_64.c
+++ linux-2.6.git/arch/x86/kernel/irqinit_64.c
@@ -21,6 +21,7 @@
 #include <asm/pgtable.h>
 #include <asm/desc.h>
 #include <asm/apic.h>
+#include <asm/setup.h>
 #include <asm/i8259.h>
 
 /*
@@ -174,7 +175,8 @@ void __init native_init_IRQ(void)
 {
 	int i;
 
-	init_ISA_irqs();
+	/* Execute any quirks before the call gates are initialised: */
+	x86_quirk_pre_intr_init();
 
 	apic_intr_init();
 
@@ -185,10 +187,28 @@ void __init native_init_IRQ(void)
 	 */
 	for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) {
 		int vector = FIRST_EXTERNAL_VECTOR + i;
+		/* X86-32: SYSCALL_VECTOR was reserved in trap_init. */
 		if (!test_bit(vector, used_vectors))
 			set_intr_gate(vector, interrupt[i]);
 	}
 
 	if (!acpi_ioapic)
 		setup_irq(2, &irq2);
+
+	/*
+	 * Call quirks after call gates are initialised (usually add in
+	 * the architecture specific gates):
+	 */
+	x86_quirk_intr_init();
+
+#ifdef CONFIG_X86_32
+	/*
+	 * External FPU? Set up irq13 if so, for
+	 * original braindamaged IBM FERR coupling.
+	 */
+	if (boot_cpu_data.hard_math && !cpu_has_fpu)
+		setup_irq(FPU_IRQ, &fpu_irq);
+
+	irq_ctx_init(smp_processor_id());
+#endif
 }
Index: linux-2.6.git/arch/x86/kernel/setup.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/setup.c
+++ linux-2.6.git/arch/x86/kernel/setup.c
@@ -995,7 +995,6 @@ void __init setup_arch(char **cmdline_p)
 #endif
 }
 
-#ifdef CONFIG_X86_32
 
 /**
  * x86_quirk_pre_intr_init - initialisation prior to setting up interrupt vectors
@@ -1032,6 +1031,7 @@ void __init x86_quirk_intr_init(void)
 	}
 }
 
+#ifdef CONFIG_X86_32
 /**
  * x86_quirk_trap_init - initialise system specific traps
  *

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

* Re: [patch 4/6] x86: irqinit - merge native_init_IRQ
  2009-04-01 17:22           ` Cyrill Gorcunov
@ 2009-04-01 18:56             ` Cyrill Gorcunov
  0 siblings, 0 replies; 16+ messages in thread
From: Cyrill Gorcunov @ 2009-04-01 18:56 UTC (permalink / raw)
  To: Ingo Molnar, hpa, tglx, linux-kernel, xemul, yhlu.kernel

[Cyrill Gorcunov - Wed, Apr 01, 2009 at 09:22:08PM +0400]
| Ingo,
| 
| here is what I meant. The x86_quirk_pre_intr_init
| and x86_quirk_intr_init do all we need. The only
| paid off -- is that on x86-64 the functions
| will check for x86_quirks->arch_intr_init and
| x86_quirks->arch_pre_intr_init which are always
| NULL for x86-64 (at least for now). If that is
| acceptable -- then apply the patch below for
| testing please. Othrewise we could eliminate
| useless check by #ifdef (which would not be
| that much differ from what I've posted initially
| in patch series :)
| 
|         Cyrill
| ---
| 
| x86: irqinit - merge native_init_IRQ
| 
| For this purpose on X86-64 init_ISA_irqs is called
| indirectly via x86_quirk_pre_intr_init (ie the same
| way as X86-32 do).
| 
| Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
| ---
|  arch/x86/kernel/irqinit_32.c |    4 +++-
|  arch/x86/kernel/irqinit_64.c |   22 +++++++++++++++++++++-
|  arch/x86/kernel/setup.c      |    2 +-
|  3 files changed, 25 insertions(+), 3 deletions(-)
| 
...

Ingo,

here are the reasons I found to vote for _this_ implementation
(ie using x86_quirk_intr_init and x86_quirk_pre_intr_init
 for both x86-32 and x86-64 platforms instead of direct function
 pointers)

1) Both are called on x86-32 as a former.
2) For x86-32 among the init_ISA_irqs call
   the quirk itself is needed (VISWS code)

        Cyrill

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

end of thread, other threads:[~2009-04-01 18:55 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-29 20:15 [patch 0/6] x86-tip: merge irqinit_32/64.c Cyrill Gorcunov
2009-03-29 20:15 ` [patch 1/6] x86: irqinit - order code snippets for easier merging Cyrill Gorcunov
2009-03-29 20:15 ` [patch 2/6] x86: irqinit - merge smp_intr_init Cyrill Gorcunov
2009-03-29 20:15 ` [patch 3/6] x86: irqinit - merge apic_intr_init Cyrill Gorcunov
2009-03-29 20:15 ` [patch 4/6] x86: irqinit - merge native_init_IRQ Cyrill Gorcunov
2009-04-01 14:53   ` Ingo Molnar
2009-04-01 15:01     ` Cyrill Gorcunov
2009-04-01 16:16     ` Cyrill Gorcunov
2009-04-01 16:22       ` Ingo Molnar
2009-04-01 16:40         ` Cyrill Gorcunov
2009-04-01 17:22           ` Cyrill Gorcunov
2009-04-01 18:56             ` Cyrill Gorcunov
2009-03-29 20:15 ` [patch 5/6] x86: irqinit - merge math_error_irq and headers Cyrill Gorcunov
2009-03-29 20:15 ` [patch 6/6] x86: irqinit - merge irqinit_32/64.c into irqinit.c Cyrill Gorcunov
2009-04-01 15:01   ` Ingo Molnar
2009-04-01 15:05     ` Cyrill Gorcunov

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.