aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-08-19 23:50:52 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-16 10:52:58 -0400
commit9d6a4d0823b3b8e29156f5e698b5a68687afad32 (patch)
treeb3a06b8392f8b451625ad64ad7d51b60456fb388 /arch/x86
parent8f09cd20a24c5f13c571bc73ddcd47be0af3b70f (diff)
x86: probe nr_irqs even only mptable is used
for !CONFIG_HAVE_SPARSE_IRQ 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.) v2: fix by Ingo Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/acpi/boot.c25
-rw-r--r--arch/x86/kernel/io_apic.c43
-rw-r--r--arch/x86/kernel/setup.c6
3 files changed, 33 insertions, 41 deletions
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 3e9d163fd92f..5fef4fece4a5 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -957,29 +957,6 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
957 nr_ioapics++; 957 nr_ioapics++;
958} 958}
959 959
960int get_nr_irqs_via_madt(void)
961{
962 int idx;
963 int nr = 0;
964
965 for (idx = 0; idx < nr_ioapics; idx++) {
966 if (mp_ioapic_routing[idx].gsi_end > nr)
967 nr = mp_ioapic_routing[idx].gsi_end;
968 }
969
970 nr++;
971
972 /* double it for hotplug and msi and nmi */
973 nr <<= 1;
974
975 /* something wrong ? */
976 if (nr < 32)
977 nr = 32;
978
979 return nr;
980
981}
982
983static void assign_to_mp_irq(struct mp_config_intsrc *m, 960static void assign_to_mp_irq(struct mp_config_intsrc *m,
984 struct mp_config_intsrc *mp_irq) 961 struct mp_config_intsrc *mp_irq)
985{ 962{
@@ -1278,8 +1255,6 @@ static int __init acpi_parse_madt_ioapic_entries(void)
1278 } 1255 }
1279 1256
1280 1257
1281 nr_irqs = get_nr_irqs_via_madt();
1282
1283 count = 1258 count =
1284 acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE, acpi_parse_int_src_ovr, 1259 acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE, acpi_parse_int_src_ovr,
1285 nr_irqs); 1260 nr_irqs);
diff --git a/arch/x86/kernel/io_apic.c b/arch/x86/kernel/io_apic.c
index f853b667fa5c..f7e80262cbbb 100644
--- a/arch/x86/kernel/io_apic.c
+++ b/arch/x86/kernel/io_apic.c
@@ -3596,6 +3596,36 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
3596} 3596}
3597#endif /* CONFIG_HT_IRQ */ 3597#endif /* CONFIG_HT_IRQ */
3598 3598
3599int __init io_apic_get_redir_entries (int ioapic)
3600{
3601 union IO_APIC_reg_01 reg_01;
3602 unsigned long flags;
3603
3604 spin_lock_irqsave(&ioapic_lock, flags);
3605 reg_01.raw = io_apic_read(ioapic, 1);
3606 spin_unlock_irqrestore(&ioapic_lock, flags);
3607
3608 return reg_01.bits.entries;
3609}
3610
3611int __init probe_nr_irqs(void)
3612{
3613 int idx;
3614 int nr = 0;
3615
3616 for (idx = 0; idx < nr_ioapics; idx++)
3617 nr += io_apic_get_redir_entries(idx);
3618
3619 /* double it for hotplug and msi and nmi */
3620 nr <<= 1;
3621
3622 /* something wrong ? */
3623 if (nr < 32)
3624 nr = 32;
3625
3626 return nr;
3627}
3628
3599/* -------------------------------------------------------------------------- 3629/* --------------------------------------------------------------------------
3600 ACPI-based IOAPIC Configuration 3630 ACPI-based IOAPIC Configuration
3601 -------------------------------------------------------------------------- */ 3631 -------------------------------------------------------------------------- */
@@ -3690,19 +3720,6 @@ int __init io_apic_get_version(int ioapic)
3690} 3720}
3691#endif 3721#endif
3692 3722
3693int __init io_apic_get_redir_entries (int ioapic)
3694{
3695 union IO_APIC_reg_01 reg_01;
3696 unsigned long flags;
3697
3698 spin_lock_irqsave(&ioapic_lock, flags);
3699 reg_01.raw = io_apic_read(ioapic, 1);
3700 spin_unlock_irqrestore(&ioapic_lock, flags);
3701
3702 return reg_01.bits.entries;
3703}
3704
3705
3706int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int polarity) 3723int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int polarity)
3707{ 3724{
3708 if (!IO_APIC_IRQ(irq)) { 3725 if (!IO_APIC_IRQ(irq)) {
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index d90c659b70e9..61335306696a 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1069,15 +1069,15 @@ void __init setup_arch(char **cmdline_p)
1069 prefill_possible_map(); 1069 prefill_possible_map();
1070 1070
1071#ifdef CONFIG_X86_64 1071#ifdef CONFIG_X86_64
1072 /* need to wait for nr_cpu_ids settle down */
1073 if (nr_irqs == NR_IRQS)
1074 nr_irqs = 32 * nr_cpu_ids + 224;
1075 init_cpu_to_node(); 1072 init_cpu_to_node();
1076#endif 1073#endif
1077 1074
1078 init_apic_mappings(); 1075 init_apic_mappings();
1079 ioapic_init_mappings(); 1076 ioapic_init_mappings();
1080 1077
1078 /* need to wait for io_apic is mapped */
1079 nr_irqs = probe_nr_irqs();
1080
1081 kvm_guest_init(); 1081 kvm_guest_init();
1082 1082
1083 e820_reserve_resources(); 1083 e820_reserve_resources();