public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Eric W. Biederman" <ebiederm@xmission.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-pci@atrey.karlin.mff.cuni.cz, discuss@x86-64.org,
	Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	Andi Kleen <ak@suse.de>,
	Natalie Protasevich <Natalie.Protasevich@UNISYS.com>,
	Len Brown <len.brown@intel.com>,
	Kimball Murray <kimball.murray@gmail.com>,
	Brice Goglin <brice@myri.com>,
	Greg Lindahl <greg.lindahl@qlogic.com>,
	Dave Olson <olson@unixfolk.com>, Jeff Garzik <jeff@garzik.org>,
	Greg KH <gregkh@suse.de>, Grant Grundler <iod00d@hp.com>,
	"bibo,mao" <bibo.mao@intel.com>,
	Rajesh Shah <rajesh.shah@intel.com>, Mark Maule <maule@sgi.com>,
	Jesper Juhl <jesper.juhl@gmail.com>,
	Shaohua Li <shaohua.li@intel.com>,
	Matthew Wilcox <matthew@wil.cx>,
	"Michael S. Tsirkin" <mst@mellanox.co.il>,
	Ashok Raj <ashok.raj@intel.com>,
	Randy Dunlap <rdunlap@xenotime.net>Roland Dreier <rd>
Subject: [PATCH 21/25] x86_64 irq: Make the external irq handlers report their vector, not the irq number.
Date: Tue, 20 Jun 2006 16:28:34 -0600	[thread overview]
Message-ID: <11508425254020-git-send-email-ebiederm@xmission.com> (raw)
In-Reply-To: <11508425253581-git-send-email-ebiederm@xmission.com>

This is a small pessimization but it paves the way for making this information
per cpu.  Which allows the the maximum number of IRQS to become NR_CPUS*224.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 arch/x86_64/kernel/i8259.c   |   62 +++++++++++++++++-------------------------
 arch/x86_64/kernel/io_apic.c |    4 +--
 arch/x86_64/kernel/irq.c     |    7 +++--
 include/asm-x86_64/hw_irq.h  |    1 +
 4 files changed, 32 insertions(+), 42 deletions(-)

diff --git a/arch/x86_64/kernel/i8259.c b/arch/x86_64/kernel/i8259.c
index 4749954..c3e737a 100644
--- a/arch/x86_64/kernel/i8259.c
+++ b/arch/x86_64/kernel/i8259.c
@@ -44,19 +44,11 @@ #define BUILD_16_IRQS(x) \
 	BI(x,8) BI(x,9) BI(x,a) BI(x,b) \
 	BI(x,c) BI(x,d) BI(x,e) BI(x,f)
 
-#define BUILD_15_IRQS(x) \
-	BI(x,0) BI(x,1) BI(x,2) BI(x,3) \
-	BI(x,4) BI(x,5) BI(x,6) BI(x,7) \
-	BI(x,8) BI(x,9) BI(x,a) BI(x,b) \
-	BI(x,c) BI(x,d) BI(x,e)
-
 /*
  * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts:
  * (these are usually mapped to vectors 0x20-0x2f)
  */
-BUILD_16_IRQS(0x0)
 
-#ifdef CONFIG_X86_LOCAL_APIC
 /*
  * The IO-APIC gives us many more interrupt sources. Most of these 
  * are unused but an SMP system is supposed to have enough memory ...
@@ -67,19 +59,13 @@ #ifdef CONFIG_X86_LOCAL_APIC
  *
  * (these are usually mapped into the 0x30-0xff vector range)
  */
-		   BUILD_16_IRQS(0x1) BUILD_16_IRQS(0x2) BUILD_16_IRQS(0x3)
+				      BUILD_16_IRQS(0x2) BUILD_16_IRQS(0x3)
 BUILD_16_IRQS(0x4) BUILD_16_IRQS(0x5) BUILD_16_IRQS(0x6) BUILD_16_IRQS(0x7)
 BUILD_16_IRQS(0x8) BUILD_16_IRQS(0x9) BUILD_16_IRQS(0xa) BUILD_16_IRQS(0xb)
-BUILD_16_IRQS(0xc) BUILD_16_IRQS(0xd)
+BUILD_16_IRQS(0xc) BUILD_16_IRQS(0xd) BUILD_16_IRQS(0xe) BUILD_16_IRQS(0xf) 
 
-#ifdef CONFIG_PCI_MSI
-	BUILD_15_IRQS(0xe)
-#endif
-
-#endif
 
 #undef BUILD_16_IRQS
-#undef BUILD_15_IRQS
 #undef BI
 
 
@@ -92,31 +78,15 @@ #define IRQLIST_16(x) \
 	IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \
 	IRQ(x,c), IRQ(x,d), IRQ(x,e), IRQ(x,f)
 
-#define IRQLIST_15(x) \
-	IRQ(x,0), IRQ(x,1), IRQ(x,2), IRQ(x,3), \
-	IRQ(x,4), IRQ(x,5), IRQ(x,6), IRQ(x,7), \
-	IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \
-	IRQ(x,c), IRQ(x,d), IRQ(x,e)
-
 void (*interrupt[NR_IRQS])(void) = {
-	IRQLIST_16(0x0),
-
-#ifdef CONFIG_X86_IO_APIC
-			 IRQLIST_16(0x1), IRQLIST_16(0x2), IRQLIST_16(0x3),
+					  IRQLIST_16(0x2), IRQLIST_16(0x3),
 	IRQLIST_16(0x4), IRQLIST_16(0x5), IRQLIST_16(0x6), IRQLIST_16(0x7),
 	IRQLIST_16(0x8), IRQLIST_16(0x9), IRQLIST_16(0xa), IRQLIST_16(0xb),
-	IRQLIST_16(0xc), IRQLIST_16(0xd)
-
-#ifdef CONFIG_PCI_MSI
-	, IRQLIST_15(0xe)
-#endif
-
-#endif
+	IRQLIST_16(0xc), IRQLIST_16(0xd), IRQLIST_16(0xe), IRQLIST_16(0xf)
 };
 
 #undef IRQ
 #undef IRQLIST_16
-#undef IRQLIST_14
 
 /*
  * This is the 'legacy' 8259A Programmable Interrupt Controller,
@@ -424,6 +394,26 @@ device_initcall(i8259A_init_sysfs);
  */
 
 static struct irqaction irq2 = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL};
+int vector_irq[NR_VECTORS] __read_mostly = {
+	[0 ... FIRST_EXTERNAL_VECTOR - 1] = -1,
+	[FIRST_EXTERNAL_VECTOR + 0] = 0,
+	[FIRST_EXTERNAL_VECTOR + 1] = 1,
+	[FIRST_EXTERNAL_VECTOR + 2] = 2,
+	[FIRST_EXTERNAL_VECTOR + 3] = 3,
+	[FIRST_EXTERNAL_VECTOR + 4] = 4,
+	[FIRST_EXTERNAL_VECTOR + 5] = 5,
+	[FIRST_EXTERNAL_VECTOR + 6] = 6,
+	[FIRST_EXTERNAL_VECTOR + 7] = 7,
+	[FIRST_EXTERNAL_VECTOR + 8] = 8,
+	[FIRST_EXTERNAL_VECTOR + 9] = 9,
+	[FIRST_EXTERNAL_VECTOR + 10] = 10,
+	[FIRST_EXTERNAL_VECTOR + 11] = 11,
+	[FIRST_EXTERNAL_VECTOR + 12] = 12,
+	[FIRST_EXTERNAL_VECTOR + 13] = 13,
+	[FIRST_EXTERNAL_VECTOR + 14] = 14,
+	[FIRST_EXTERNAL_VECTOR + 15] = 15,
+	[FIRST_EXTERNAL_VECTOR + 16 ... NR_VECTORS - 1] = -1
+};
 
 void __init init_ISA_irqs (void)
 {
@@ -523,8 +513,6 @@ void __init init_IRQ(void)
 	 */
 	for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) {
 		int vector = FIRST_EXTERNAL_VECTOR + i;
-		if (i >= NR_IRQS)
-			break;
 		if (vector != IA32_SYSCALL_VECTOR)
 			set_intr_gate(vector, interrupt[i]);
 	}
@@ -534,7 +522,7 @@ #ifdef CONFIG_SMP
 	 * IRQ0 must be given a fixed assignment and initialized,
 	 * because it's used before the IO-APIC is set up.
 	 */
-	set_intr_gate(FIRST_DEVICE_VECTOR, interrupt[0]);
+	vector_irq[FIRST_DEVICE_VECTOR] = 0;
 
 	/*
 	 * The reschedule interrupt is a CPU-to-CPU reschedule-helper
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index 1a63a0e..3ff5606 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -850,6 +850,7 @@ next:
 	}
 
 	vector = current_vector;
+	vector_irq[vector] = irq;
 	IO_APIC_VECTOR(irq) = vector;
 
 	return vector;
@@ -884,7 +885,6 @@ static void ioapic_register_intr(int irq
 	else
 		set_irq_chip_and_handler(irq, &ioapic_chip,
 					 handle_edge_irq);
-	set_intr_gate(vector, interrupt[irq]);
 }
 
 static void __init setup_IO_APIC_irqs(void)
@@ -1727,7 +1727,6 @@ static inline void check_timer(void)
 	 */
 	disable_8259A_irq(0);
 	vector = assign_irq_vector(0);
-	set_intr_gate(vector, interrupt[0]);
 
 	/*
 	 * Subtle, code in do_timer_interrupt() expects an AEOI
@@ -1988,7 +1987,6 @@ int create_irq(void)
 	spin_unlock_irqrestore(&vector_lock, flags);
 
 	if (irq >= 0) {
-		set_intr_gate(vector, interrupt[irq]);
 		dynamic_irq_init(irq);
 	}
 	return irq;
diff --git a/arch/x86_64/kernel/irq.c b/arch/x86_64/kernel/irq.c
index c2d27d3..dd8d79a 100644
--- a/arch/x86_64/kernel/irq.c
+++ b/arch/x86_64/kernel/irq.c
@@ -93,12 +93,15 @@ #endif
 asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
 {	
 	/* high bit used in ret_from_ code  */
-	unsigned irq = ~regs->orig_rax;
+	unsigned vector = ~regs->orig_rax;
+	unsigned irq;
 
 	exit_idle();
 	irq_enter();
 
-	generic_handle_irq(irq, regs);
+	irq = vector_irq[vector];
+	if (likely(irq < NR_IRQS))
+		generic_handle_irq(irq, regs);
 
 	irq_exit();
 
diff --git a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h
index 1a8dc18..9f6a0bf 100644
--- a/include/asm-x86_64/hw_irq.h
+++ b/include/asm-x86_64/hw_irq.h
@@ -74,6 +74,7 @@ #define FIRST_SYSTEM_VECTOR	0xef   /* du
 
 #ifndef __ASSEMBLY__
 extern u8 irq_vector[NR_IRQ_VECTORS];
+extern int vector_irq[NR_VECTORS];
 #define IO_APIC_VECTOR(irq)	(irq_vector[irq])
 
 /*
-- 
1.4.0.gc07e

  reply	other threads:[~2006-06-20 22:28 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-20 22:24 [PATCH 0/25] Decouple IRQ issues (MSI, i386, x86_64, ia64) Eric W. Biederman
2006-06-20 22:28 ` [PATCH 1/25] irq: Convert the move_irq flag from a 32bit word to a single bit Eric W. Biederman
2006-06-20 22:28   ` [PATCH 2/25] irq: Add moved_masked_irq Eric W. Biederman
2006-06-20 22:28     ` [PATCH 3/25] x86_64 irq: Reenable migrating irqs to other cpus Eric W. Biederman
2006-06-20 22:28       ` [PATCH 4/25] msi: Simplify msi enable and disable Eric W. Biederman
2006-06-20 22:28         ` [PATCH 5/25] msi: Make the msi boolean tests return either 0 or 1 Eric W. Biederman
2006-06-20 22:28           ` [PATCH 6/25] msi: Implement helper functions read_msi_msg and write_msi_msg Eric W. Biederman
2006-06-20 22:28             ` [PATCH 7/25] msi: Refactor the msi_ops Eric W. Biederman
2006-06-20 22:28               ` [PATCH 8/25] msi: Simplify the msi irq limit policy Eric W. Biederman
2006-06-20 22:28                 ` [PATCH 9/25] irq: Add a dynamic irq creation API Eric W. Biederman
2006-06-20 22:28                   ` [PATCH 10/25] ia64 irq: Dynamic irq support Eric W. Biederman
2006-06-20 22:28                     ` [PATCH 11/25] i386 " Eric W. Biederman
2006-06-20 22:28                       ` [PATCH 12/25] x86_64 " Eric W. Biederman
2006-06-20 22:28                         ` [PATCH 13/25] msi: Make the msi code irq based and not vector based Eric W. Biederman
2006-06-20 22:28                           ` [PATCH 14/25] x86_64 irq: Move msi message composition into io_apic.c Eric W. Biederman
2006-06-20 22:28                             ` [PATCH 15/25] i386 " Eric W. Biederman
2006-06-20 22:28                               ` [PATCH 16/25] msi: Only build msi-apic.c on ia64 Eric W. Biederman
2006-06-20 22:28                                 ` [PATCH 17/25] x86_64 irq: Remove the msi assumption that irq == vector Eric W. Biederman
2006-06-20 22:28                                   ` [PATCH 18/25] i386 " Eric W. Biederman
2006-06-20 22:28                                     ` [PATCH 19/25] irq: Remove msi hacks Eric W. Biederman
2006-06-20 22:28                                       ` [PATCH 20/25] irq: Generalize the check for HARDIRQ_BITS Eric W. Biederman
2006-06-20 22:28                                         ` Eric W. Biederman [this message]
2006-06-20 22:28                                           ` [PATCH 22/25] x86_64 irq: make vector_irq per cpu Eric W. Biederman
2006-06-20 22:28                                             ` [PATCH 23/25] x86_64 irq: Kill gsi_irq_sharing Eric W. Biederman
2006-06-20 22:28                                               ` [PATCH 24/25] x86_64 irq: Kill irq compression Eric W. Biederman
2006-06-20 22:28                                                 ` [PATCH 25/25] irq: Document what an IRQ is Eric W. Biederman
2006-06-21  1:50                       ` [PATCH 11/25] i386 irq: Dynamic irq support Rajesh Shah
2006-06-21  2:21                         ` Eric W. Biederman
2006-06-21  2:27                           ` Rajesh Shah
2006-06-21 14:07                             ` Eric W. Biederman
2006-06-20 23:56                   ` [PATCH 9/25] irq: Add a dynamic irq creation API Benjamin Herrenschmidt
2006-06-21  1:01                     ` Eric W. Biederman
2006-06-21  1:33                       ` Benjamin Herrenschmidt
2006-06-21  1:41                         ` Jeff Garzik
2006-06-21  1:36                       ` Matthew Wilcox
2006-06-21  1:28                 ` [PATCH 8/25] msi: Simplify the msi irq limit policy Rajesh Shah
2006-06-21  2:46                 ` Roland Dreier
2006-06-21  3:48                   ` Eric W. Biederman
2006-06-21  1:18               ` [PATCH 7/25] msi: Refactor the msi_ops Rajesh Shah
2006-06-21  1:04             ` [PATCH 6/25] msi: Implement helper functions read_msi_msg and write_msi_msg Rajesh Shah
2006-06-21  1:43               ` Eric W. Biederman
2006-06-20 22:45           ` [PATCH 5/25] msi: Make the msi boolean tests return either 0 or 1 Jeff Garzik
2006-06-21  0:44         ` [PATCH 4/25] msi: Simplify msi enable and disable Rajesh Shah
2006-06-21  1:19           ` Eric W. Biederman
2006-06-21  0:30 ` [PATCH 0/25] Decouple IRQ issues (MSI, i386, x86_64, ia64) Rajesh Shah
2006-06-21  1:07   ` Eric W. Biederman
2006-06-21 14:10   ` [PATCH] Decouple IRQ issues (fix i386 compile issues) Eric W. Biederman
2006-06-21 10:24 ` [PATCH 0/25] Decouple IRQ issues (MSI, i386, x86_64, ia64) Ingo Molnar
2006-06-21 16:25   ` Greg KH
2006-06-22  3:55     ` Eric W. Biederman

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=11508425254020-git-send-email-ebiederm@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=Natalie.Protasevich@UNISYS.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=ashok.raj@intel.com \
    --cc=bibo.mao@intel.com \
    --cc=brice@myri.com \
    --cc=discuss@x86-64.org \
    --cc=greg.lindahl@qlogic.com \
    --cc=gregkh@suse.de \
    --cc=iod00d@hp.com \
    --cc=jeff@garzik.org \
    --cc=jesper.juhl@gmail.com \
    --cc=kimball.murray@gmail.com \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    --cc=matthew@wil.cx \
    --cc=maule@sgi.com \
    --cc=mingo@elte.hu \
    --cc=mst@mellanox.co.il \
    --cc=olson@unixfolk.com \
    --cc=rajesh.shah@intel.com \
    --cc=rdunlap@xenotime.net \
    --cc=shaohua.li@intel.com \
    --cc=tglx@linutronix.de \
    /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