Skip to contentSkip to conversation

x86: probe nr_irqs even only mptable is used

PATCH Applied Yinghai Lu 2 participants 4 messages Aug 19, 2008

Subsystems (2)
lore
Share & tools
lore

Yinghai Lu

author
#0 lore raw

PATCH 1/1 x86: probe nr_irqs even only mptable is used

for !CONFIG_HAVE_SPARSE_IRQ

---
 arch/x86/kernel/acpi/boot.c |   25 -------------------------
 arch/x86/kernel/io_apic.c   |   43 ++++++++++++++++++++++++++++++-------------
 arch/x86/kernel/setup.c     |    6 +++---
 include/asm-x86/io_apic.h   |    7 +++++++
 include/asm-x86/mpspec.h    |    1 -
 5 files changed, 40 insertions(+), 42 deletions(-)
arch/x86/kernel/acpi/boot.c +0 -25
Index: linux-2.6/arch/x86/kernel/acpi/boot.c
===================================================================
@@ -961,29 +961,6 @@ void __init mp_register_ioapic(int id, u
 	nr_ioapics++;
 }
 
-int get_nr_irqs_via_madt(void)
-{
-	int idx;
-	int nr = 0;
-
-	for (idx = 0; idx < nr_ioapics; idx++) {
-		if (mp_ioapic_routing[idx].gsi_end > nr)
-			nr = mp_ioapic_routing[idx].gsi_end;
-	}
-
-	nr++;
-
-	/* double it for hotplug and msi and nmi */
-	nr <<= 1;
-
-	/* something wrong ? */
-	if (nr < 32)
-		nr = 32;
-
-	return nr;
-
-}
-
 static void assign_to_mp_irq(struct mp_config_intsrc *m,
 				    struct mp_config_intsrc *mp_irq)
 {
@@ -1282,8 +1259,6 @@ static int __init acpi_parse_madt_ioapic
 	}
 
 
-	nr_irqs = get_nr_irqs_via_madt();
-
 	count =
 	    acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE, acpi_parse_int_src_ovr,
 				  nr_irqs);
arch/x86/kernel/io_apic.c +30 -13

55 lines not on this page · raw message

arch/x86/kernel/setup.c +3 -3
Index: linux-2.6/arch/x86/kernel/setup.c
===================================================================
@@ -873,15 +873,15 @@ void __init setup_arch(char **cmdline_p)
 	prefill_possible_map();
 
 #ifdef CONFIG_X86_64
-	/* need to wait for nr_cpu_ids settle down */
-	if (nr_irqs == NR_IRQS)
-		nr_irqs = 32 * nr_cpu_ids + 224;
 	init_cpu_to_node();
 #endif
 
 	init_apic_mappings();
 	ioapic_init_mappings();
 
+	/* need to wait for io_apic is mapped */
+	nr_irqs = probe_nr_irqs();
+
 	kvm_guest_init();
 
 	res_kernel[0] = &code_resource;
include/asm-x86/mpspec.h +0 -1
Index: linux-2.6/include/asm-x86/mpspec.h
===================================================================
@@ -59,7 +59,6 @@ extern void mp_override_legacy_irq(u8 bu
 				   u32 gsi);
 extern void mp_config_acpi_legacy_irqs(void);
 extern int mp_register_gsi(u32 gsi, int edge_level, int active_high_low);
-extern int get_nr_irqs_via_madt(void);
 #ifdef CONFIG_X86_IO_APIC
 extern int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
 				u32 gsi, int triggering, int polarity);
include/asm-x86/io_apic.h +7 -0
Index: linux-2.6/include/asm-x86/io_apic.h
===================================================================
@@ -197,10 +197,17 @@ extern void restore_IO_APIC_setup(void);
 extern void reinit_intr_remapped_IO_APIC(int);
 #endif
 
+extern int probe_nr_irqs(void);
+
 #else  /* !CONFIG_X86_IO_APIC */
 #define io_apic_assign_pci_irqs 0
 static const int timer_through_8259 = 0;
 static inline void ioapic_init_mappings(void) { }
+
+static inline int probe_nr_irqs(void)
+{
+	return NR_IRQS;
+}
 #endif
 
 #endif /* ASM_X86__IO_APIC_H */
Applied
#1 lore raw
Quoted 1 line · Yinghai Lu

for !CONFIG_HAVE_SPARSE_IRQ

applied to tip/irq/sparseirq, thanks.

This should fix MAXSMP+!SPARSEIRQ bootups and memory footprint, right?

Ingo

author
#2 lore raw
Quoted 9 lines · Ingo Molnar
Quoted 1 line · Yinghai Lu

for !CONFIG_HAVE_SPARSE_IRQ

applied to tip/irq/sparseirq, thanks.

This should fix MAXSMP+!SPARSEIRQ bootups and memory footprint, right?

Yes

YH

#3 lore raw

PATCH 1/1 sparse irqs: UP build fix

In reply to Ingo Molnar
Quoted 2 lines

From 8ed1307017efa10960e4ad1650b931eb70d6434c Mon Sep 17 00:00:00 2001

From: Ingo Molnar <[email protected]>
Date: Tue, 19 Aug 2008 04:27:17 +0200
Subject: [PATCH] sparse irqs: UP build fix

fix:

In file included from arch/x86/kernel/early-quirks.c:18:
include/asm/io_apic.h: In function 'probe_nr_irqs':
include/asm/io_apic.h:209: error: 'NR_IRQS' undeclared (first use in this function) include/asm/io_apic.h:209: error: (Each undeclared identifier is reported only once include/asm/io_apic.h:209: error: for each function it appears in.)

---
 include/asm-x86/io_apic.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/asm-x86/io_apic.h +1 -0
index 92a8308..d35cbd7 100644
@@ -4,6 +4,7 @@
 #include <linux/types.h>
 #include <asm/mpspec.h>
 #include <asm/apicdef.h>
+#include <asm/irq_vectors.h>
 
 /*
  * Intel IO-APIC support for SMP and UP systems.