* [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing
@ 2009-02-06 23:59 Yinghai Lu
2009-02-07 0:00 ` [PATCH] x86/irq: optimizing nr_irqs Yinghai Lu
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Yinghai Lu @ 2009-02-06 23:59 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton
Cc: linux-kernel@vger.kernel.org
Impact: find right nr_irqs_gsi on some systems.
one system has gap between gsi.
[ 0.000000] ACPI: IOAPIC (id[0x04] address[0xfec00000] gsi_base[0])
[ 0.000000] IOAPIC[0]: apic_id 4, version 0, address 0xfec00000, GSI 0-23
[ 0.000000] ACPI: IOAPIC (id[0x05] address[0xfeafd000] gsi_base[48])
[ 0.000000] IOAPIC[1]: apic_id 5, version 0, address 0xfeafd000, GSI 48-54
[ 0.000000] ACPI: IOAPIC (id[0x06] address[0xfeafc000] gsi_base[56])
[ 0.000000] IOAPIC[2]: apic_id 6, version 0, address 0xfeafc000, GSI 56-62
...
[ 0.000000] nr_irqs_gsi: 38
so nr_irqs_gsi is not right. some irq for MSI will overwrite with io_apic.
need to get that with acpi_probe_gsi when acpi io_apic is used
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/include/asm/mpspec.h | 5 +++++
arch/x86/kernel/acpi/boot.c | 23 +++++++++++++++++++++++
arch/x86/kernel/io_apic.c | 20 +++++++++++++++-----
3 files changed, 43 insertions(+), 5 deletions(-)
Index: linux-2.6/arch/x86/include/asm/mpspec.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/mpspec.h
+++ linux-2.6/arch/x86/include/asm/mpspec.h
@@ -73,6 +73,7 @@ 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 acpi_probe_gsi(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);
@@ -83,6 +84,10 @@ mp_config_acpi_gsi(unsigned char number,
{
return 0;
}
+static inline int acpi_probe_gsi(void)
+{
+ return 0;
+}
#endif
#endif /* CONFIG_ACPI */
Index: linux-2.6/arch/x86/kernel/acpi/boot.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/acpi/boot.c
+++ linux-2.6/arch/x86/kernel/acpi/boot.c
@@ -944,6 +944,29 @@ void __init mp_register_ioapic(int id, u
nr_ioapics++;
}
+int __init acpi_probe_gsi(void)
+{
+ int idx;
+ int gsi;
+ int max_gsi = 0;
+
+ if (acpi_disabled)
+ return 0;
+
+ if (!acpi_ioapic)
+ return 0;
+
+ max_gsi = 0;
+ for (idx = 0; idx < nr_ioapics; idx++) {
+ gsi = mp_ioapic_routing[idx].gsi_end;
+
+ if (gsi > max_gsi)
+ max_gsi = gsi;
+ }
+
+ return max_gsi + 1;
+}
+
static void assign_to_mp_irq(struct mpc_intsrc *m,
struct mpc_intsrc *mp_irq)
{
Index: linux-2.6/arch/x86/kernel/io_apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/io_apic.c
+++ linux-2.6/arch/x86/kernel/io_apic.c
@@ -3810,14 +3810,24 @@ int __init io_apic_get_redir_entries (in
void __init probe_nr_irqs_gsi(void)
{
- int idx;
int nr = 0;
- for (idx = 0; idx < nr_ioapics; idx++)
- nr += io_apic_get_redir_entries(idx) + 1;
-
- if (nr > nr_irqs_gsi)
+ nr = acpi_probe_gsi();
+ if (nr > nr_irqs_gsi) {
nr_irqs_gsi = nr;
+ } else {
+ /* for acpi=off or acpi is not compiled in */
+ int idx;
+
+ nr = 0;
+ for (idx = 0; idx < nr_ioapics; idx++)
+ nr += io_apic_get_redir_entries(idx) + 1;
+
+ if (nr > nr_irqs_gsi)
+ nr_irqs_gsi = nr;
+ }
+
+ printk(KERN_DEBUG "nr_irqs_gsi: %d\n", nr_irqs_gsi);
}
#ifdef CONFIG_SPARSE_IRQ
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] x86/irq: optimizing nr_irqs
2009-02-06 23:59 [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing Yinghai Lu
@ 2009-02-07 0:00 ` Yinghai Lu
2009-02-08 9:44 ` [PATCH] x86/irq: optimizing nr_irqs -v2 Yinghai Lu
2009-02-07 3:35 ` [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing Len Brown
` (2 subsequent siblings)
3 siblings, 1 reply; 11+ messages in thread
From: Yinghai Lu @ 2009-02-07 0:00 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton
Cc: linux-kernel@vger.kernel.org
Impact: more depend on cards to be used
depend on nr_irq_gsi more, and have a ratio for MSI
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/io_apic.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
Index: linux-2.6/arch/x86/kernel/io_apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/io_apic.c
+++ linux-2.6/arch/x86/kernel/io_apic.c
@@ -3479,9 +3479,9 @@ int arch_setup_msi_irqs(struct pci_dev *
sub_handle = 0;
list_for_each_entry(msidesc, &dev->msi_list, list) {
irq = create_irq_nr(irq_want);
- irq_want++;
if (irq == 0)
return -1;
+ irq_want = irq + 1;
#ifdef CONFIG_INTR_REMAP
if (!intr_remapping_enabled)
goto no_ir;
@@ -3835,11 +3835,14 @@ int __init arch_probe_nr_irqs(void)
{
int nr;
- nr = ((8 * nr_cpu_ids) > (32 * nr_ioapics) ?
- (NR_VECTORS + (8 * nr_cpu_ids)) :
- (NR_VECTORS + (32 * nr_ioapics)));
-
- if (nr < nr_irqs && nr > nr_irqs_gsi)
+ nr = nr_irqs_gsi + 8 * nr_cpu_ids;
+#if defined(CONFIG_PCI_MSI) || defined(CONFIG_HT_IRQ)
+ /*
+ * for MSI and HT dyn irq
+ */
+ nr += nr_irqs_gsi * 16;
+#endif
+ if (nr < (NR_VECTORS * nr_cpu_ids))
nr_irqs = nr;
return 0;
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing
2009-02-06 23:59 [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing Yinghai Lu
2009-02-07 0:00 ` [PATCH] x86/irq: optimizing nr_irqs Yinghai Lu
@ 2009-02-07 3:35 ` Len Brown
2009-02-07 3:47 ` Yinghai Lu
2009-02-08 1:13 ` [PATCH] x86: use NR_IRQS_LEGACY to replace 16 Yinghai Lu
2009-02-09 8:13 ` [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing Ingo Molnar
3 siblings, 1 reply; 11+ messages in thread
From: Len Brown @ 2009-02-07 3:35 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton,
linux-kernel@vger.kernel.org, linux-acpi
> Impact: find right nr_irqs_gsi on some systems.
>
> one system has gap between gsi.
> [ 0.000000] ACPI: IOAPIC (id[0x04] address[0xfec00000] gsi_base[0])
> [ 0.000000] IOAPIC[0]: apic_id 4, version 0, address 0xfec00000, GSI 0-23
> [ 0.000000] ACPI: IOAPIC (id[0x05] address[0xfeafd000] gsi_base[48])
> [ 0.000000] IOAPIC[1]: apic_id 5, version 0, address 0xfeafd000, GSI 48-54
> [ 0.000000] ACPI: IOAPIC (id[0x06] address[0xfeafc000] gsi_base[56])
> [ 0.000000] IOAPIC[2]: apic_id 6, version 0, address 0xfeafc000, GSI 56-62
> ...
> [ 0.000000] nr_irqs_gsi: 38
I've never seen gaps in GSIs.
I've never seen IOAPICs with 7 redirection table entries.
This system looks quite broken even before the probe for nr_irqs_gsi.
Do you have more information on it?
thanks,
-Len
--
Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing
2009-02-07 3:35 ` [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing Len Brown
@ 2009-02-07 3:47 ` Yinghai Lu
2009-02-07 7:15 ` Len Brown
0 siblings, 1 reply; 11+ messages in thread
From: Yinghai Lu @ 2009-02-07 3:47 UTC (permalink / raw)
To: Len Brown, Ingo Molnar
Cc: Thomas Gleixner, H. Peter Anvin, Andrew Morton,
linux-kernel@vger.kernel.org, linux-acpi
Len Brown wrote:
>
>
>> Impact: find right nr_irqs_gsi on some systems.
>>
>> one system has gap between gsi.
>> [ 0.000000] ACPI: IOAPIC (id[0x04] address[0xfec00000] gsi_base[0])
>> [ 0.000000] IOAPIC[0]: apic_id 4, version 0, address 0xfec00000, GSI 0-23
>> [ 0.000000] ACPI: IOAPIC (id[0x05] address[0xfeafd000] gsi_base[48])
>> [ 0.000000] IOAPIC[1]: apic_id 5, version 0, address 0xfeafd000, GSI 48-54
>> [ 0.000000] ACPI: IOAPIC (id[0x06] address[0xfeafc000] gsi_base[56])
>> [ 0.000000] IOAPIC[2]: apic_id 6, version 0, address 0xfeafc000, GSI 56-62
>> ...
>> [ 0.000000] nr_irqs_gsi: 38
>
> I've never seen gaps in GSIs.
> I've never seen IOAPICs with 7 redirection table entries.
>
> This system looks quite broken even before the probe for nr_irqs_gsi.
> Do you have more information on it?
it is one AMD based system from Sun.
it has two hypertransport chains.
one: 8132 + ck804
one: io4
when 8 sockets are installed, will get
[ 0.000000] ACPI: IOAPIC (id[0x00] address[0xfec00000] gsi_base[0])
[ 0.000000] IOAPIC[0]: apic_id 0, version 0, address 0xfec00000, GSI 0-23
[ 0.000000] ACPI: IOAPIC (id[0x01] address[0xfdefd000] gsi_base[48])
[ 0.000000] IOAPIC[1]: apic_id 1, version 0, address 0xfdefd000, GSI 48-54
[ 0.000000] ACPI: IOAPIC (id[0x02] address[0xfdefc000] gsi_base[56])
[ 0.000000] IOAPIC[2]: apic_id 2, version 0, address 0xfdefc000, GSI 56-62
[ 0.000000] ACPI: IOAPIC (id[0x03] address[0xfeaff000] gsi_base[24])
[ 0.000000] IOAPIC[3]: apic_id 3, version 0, address 0xfeaff000, GSI 24-47
when 2 sockets are installed, only HT chains is used. will get
[ 0.000000] ACPI: IOAPIC (id[0x04] address[0xfec00000] gsi_base[0])
[ 0.000000] IOAPIC[0]: apic_id 4, version 0, address 0xfec00000, GSI 0-23
[ 0.000000] ACPI: IOAPIC (id[0x05] address[0xfeafd000] gsi_base[48])
[ 0.000000] IOAPIC[1]: apic_id 5, version 0, address 0xfeafd000, GSI 48-54
[ 0.000000] ACPI: IOAPIC (id[0x06] address[0xfeafc000] gsi_base[56])
[ 0.000000] IOAPIC[2]: apic_id 6, version 0, address 0xfeafc000, GSI 56-62
acpi madt ioapic-entries does include gsi_base field.
amd 8131: has 4 gsi
amd 8132: has 7 gsi, but only 3 can be used.
anyway that system is not broken, and it is quite solid.
this patch seems to be a 2.6.29 material.
YH
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing
2009-02-07 3:47 ` Yinghai Lu
@ 2009-02-07 7:15 ` Len Brown
0 siblings, 0 replies; 11+ messages in thread
From: Len Brown @ 2009-02-07 7:15 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton,
linux-kernel@vger.kernel.org, linux-acpi
> >> Impact: find right nr_irqs_gsi on some systems.
> >>
> >> one system has gap between gsi.
> >> [ 0.000000] ACPI: IOAPIC (id[0x04] address[0xfec00000] gsi_base[0])
> >> [ 0.000000] IOAPIC[0]: apic_id 4, version 0, address 0xfec00000, GSI 0-23
> >> [ 0.000000] ACPI: IOAPIC (id[0x05] address[0xfeafd000] gsi_base[48])
> >> [ 0.000000] IOAPIC[1]: apic_id 5, version 0, address 0xfeafd000, GSI 48-54
> >> [ 0.000000] ACPI: IOAPIC (id[0x06] address[0xfeafc000] gsi_base[56])
> >> [ 0.000000] IOAPIC[2]: apic_id 6, version 0, address 0xfeafc000, GSI 56-62
> >> ...
> >> [ 0.000000] nr_irqs_gsi: 38
> >
> > I've never seen gaps in GSIs.
> > I've never seen IOAPICs with 7 redirection table entries.
> >
> > This system looks quite broken even before the probe for nr_irqs_gsi.
> > Do you have more information on it?
>
> it is one AMD based system from Sun.
> it has two hypertransport chains.
> one: 8132 + ck804
> one: io4
>
> when 8 sockets are installed, will get
> [ 0.000000] ACPI: IOAPIC (id[0x00] address[0xfec00000] gsi_base[0])
> [ 0.000000] IOAPIC[0]: apic_id 0, version 0, address 0xfec00000, GSI 0-23
> [ 0.000000] ACPI: IOAPIC (id[0x01] address[0xfdefd000] gsi_base[48])
> [ 0.000000] IOAPIC[1]: apic_id 1, version 0, address 0xfdefd000, GSI 48-54
> [ 0.000000] ACPI: IOAPIC (id[0x02] address[0xfdefc000] gsi_base[56])
> [ 0.000000] IOAPIC[2]: apic_id 2, version 0, address 0xfdefc000, GSI 56-62
> [ 0.000000] ACPI: IOAPIC (id[0x03] address[0xfeaff000] gsi_base[24])
> [ 0.000000] IOAPIC[3]: apic_id 3, version 0, address 0xfeaff000, GSI 24-47
>
>
> when 2 sockets are installed, only HT chains is used. will get
> [ 0.000000] ACPI: IOAPIC (id[0x04] address[0xfec00000] gsi_base[0])
> [ 0.000000] IOAPIC[0]: apic_id 4, version 0, address 0xfec00000, GSI 0-23
> [ 0.000000] ACPI: IOAPIC (id[0x05] address[0xfeafd000] gsi_base[48])
> [ 0.000000] IOAPIC[1]: apic_id 5, version 0, address 0xfeafd000, GSI 48-54
> [ 0.000000] ACPI: IOAPIC (id[0x06] address[0xfeafc000] gsi_base[56])
> [ 0.000000] IOAPIC[2]: apic_id 6, version 0, address 0xfeafc000, GSI 56-62
>
> acpi madt ioapic-entries does include gsi_base field.
>
> amd 8131: has 4 gsi
> amd 8132: has 7 gsi, but only 3 can be used.
>
> anyway that system is not broken, and it is quite solid.
I don't know if it violates the ACPI spec to have gaps in the GSI's,
but it does violate my expectations when I read the spec -- so i guess
that "unexpected" or "unconventional" may be a better word than "broken".
At the same time, "unexpected" and "unconventional" BIOS implementations
cause things like "broken" OS -- thus the need for your patch:-)
> this patch seems to be a 2.6.29 material.
I agree.
thanks,
Len Brown, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] x86: use NR_IRQS_LEGACY to replace 16
2009-02-06 23:59 [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing Yinghai Lu
2009-02-07 0:00 ` [PATCH] x86/irq: optimizing nr_irqs Yinghai Lu
2009-02-07 3:35 ` [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing Len Brown
@ 2009-02-08 1:13 ` Yinghai Lu
2009-02-09 8:14 ` Ingo Molnar
2009-02-09 8:13 ` [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing Ingo Molnar
3 siblings, 1 reply; 11+ messages in thread
From: Yinghai Lu @ 2009-02-08 1:13 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton
Cc: linux-kernel@vger.kernel.org
Impact: cleanup
also could kill platform_legacy_irq
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/include/asm/hw_irq.h | 4 +---
arch/x86/kernel/io_apic.c | 8 ++++----
2 files changed, 5 insertions(+), 7 deletions(-)
Index: linux-2.6/arch/x86/include/asm/hw_irq.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/hw_irq.h
+++ linux-2.6/arch/x86/include/asm/hw_irq.h
@@ -25,8 +25,6 @@
#include <asm/irq.h>
#include <asm/sections.h>
-#define platform_legacy_irq(irq) ((irq) < 16)
-
/* Interrupt handlers registered during init_IRQ */
extern void apic_timer_interrupt(void);
extern void error_interrupt(void);
@@ -60,7 +58,7 @@ extern void make_8259A_irq(unsigned int
extern void init_8259A(int aeoi);
/* IOAPIC */
-#define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs))
+#define IO_APIC_IRQ(x) (((x) >= NR_IRQS_LEGACY) || ((1<<(x)) & io_apic_irqs))
extern unsigned long io_apic_irqs;
extern void init_VISWS_APIC_irqs(void);
Index: linux-2.6/arch/x86/kernel/io_apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/io_apic.c
+++ linux-2.6/arch/x86/kernel/io_apic.c
@@ -3168,6 +3168,7 @@ static int __init ioapic_init_sysfs(void
device_initcall(ioapic_init_sysfs);
+static int nr_irqs_gsi = NR_IRQS_LEGACY;
/*
* Dynamic irq allocate and deallocation
*/
@@ -3182,11 +3183,11 @@ unsigned int create_irq_nr(unsigned int
struct irq_desc *desc_new = NULL;
irq = 0;
+ if (irq_want < nr_irqs_gsi)
+ irq_want = nr_irqs_gsi;
+
spin_lock_irqsave(&vector_lock, flags);
for (new = irq_want; new < nr_irqs; new++) {
- if (platform_legacy_irq(new))
- continue;
-
desc_new = irq_to_desc_alloc_cpu(new, cpu);
if (!desc_new) {
printk(KERN_INFO "can not get irq_desc for %d\n", new);
@@ -3211,7 +3212,6 @@ unsigned int create_irq_nr(unsigned int
return irq;
}
-static int nr_irqs_gsi = NR_IRQS_LEGACY;
int create_irq(void)
{
unsigned int irq_want;
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] x86/irq: optimizing nr_irqs -v2
2009-02-07 0:00 ` [PATCH] x86/irq: optimizing nr_irqs Yinghai Lu
@ 2009-02-08 9:44 ` Yinghai Lu
2009-02-09 8:14 ` Ingo Molnar
0 siblings, 1 reply; 11+ messages in thread
From: Yinghai Lu @ 2009-02-08 9:44 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton
Cc: linux-kernel@vger.kernel.org
Impact: more depend on cards to be used
depend on nr_irq_gsi more, and have a ratio for MSI
v2: make nr_irqs shoule less than NR_VECTORS * nr_cpu_ids
aka if only one cpu, we only can support nr_irqs = NR_VECTORS
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/io_apic.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
Index: linux-2.6/arch/x86/kernel/io_apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/io_apic.c
+++ linux-2.6/arch/x86/kernel/io_apic.c
@@ -3482,9 +3482,9 @@ int arch_setup_msi_irqs(struct pci_dev *
sub_handle = 0;
list_for_each_entry(msidesc, &dev->msi_list, list) {
irq = create_irq_nr(irq_want);
- irq_want++;
if (irq == 0)
return -1;
+ irq_want = irq + 1;
#ifdef CONFIG_INTR_REMAP
if (!intr_remapping_enabled)
goto no_ir;
@@ -3838,11 +3838,17 @@ int __init arch_probe_nr_irqs(void)
{
int nr;
- nr = ((8 * nr_cpu_ids) > (32 * nr_ioapics) ?
- (NR_VECTORS + (8 * nr_cpu_ids)) :
- (NR_VECTORS + (32 * nr_ioapics)));
+ if (nr_irqs > (NR_VECTORS * nr_cpu_ids))
+ nr_irqs = NR_VECTORS * nr_cpu_ids;
- if (nr < nr_irqs && nr > nr_irqs_gsi)
+ nr = nr_irqs_gsi + 8 * nr_cpu_ids;
+#if defined(CONFIG_PCI_MSI) || defined(CONFIG_HT_IRQ)
+ /*
+ * for MSI and HT dyn irq
+ */
+ nr += nr_irqs_gsi * 16;
+#endif
+ if (nr < nr_irqs)
nr_irqs = nr;
return 0;
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing
2009-02-06 23:59 [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing Yinghai Lu
` (2 preceding siblings ...)
2009-02-08 1:13 ` [PATCH] x86: use NR_IRQS_LEGACY to replace 16 Yinghai Lu
@ 2009-02-09 8:13 ` Ingo Molnar
2009-02-09 9:03 ` [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing v3 Yinghai Lu
3 siblings, 1 reply; 11+ messages in thread
From: Ingo Molnar @ 2009-02-09 8:13 UTC (permalink / raw)
To: Yinghai Lu
Cc: Thomas Gleixner, H. Peter Anvin, Andrew Morton,
linux-kernel@vger.kernel.org
* Yinghai Lu <yinghai@kernel.org> wrote:
>
> Impact: find right nr_irqs_gsi on some systems.
>
> one system has gap between gsi.
> [ 0.000000] ACPI: IOAPIC (id[0x04] address[0xfec00000] gsi_base[0])
> [ 0.000000] IOAPIC[0]: apic_id 4, version 0, address 0xfec00000, GSI 0-23
> [ 0.000000] ACPI: IOAPIC (id[0x05] address[0xfeafd000] gsi_base[48])
> [ 0.000000] IOAPIC[1]: apic_id 5, version 0, address 0xfeafd000, GSI 48-54
> [ 0.000000] ACPI: IOAPIC (id[0x06] address[0xfeafc000] gsi_base[56])
> [ 0.000000] IOAPIC[2]: apic_id 6, version 0, address 0xfeafc000, GSI 56-62
> ...
> [ 0.000000] nr_irqs_gsi: 38
>
> so nr_irqs_gsi is not right. some irq for MSI will overwrite with io_apic.
>
> need to get that with acpi_probe_gsi when acpi io_apic is used
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>
> ---
> arch/x86/include/asm/mpspec.h | 5 +++++
> arch/x86/kernel/acpi/boot.c | 23 +++++++++++++++++++++++
> arch/x86/kernel/io_apic.c | 20 +++++++++++++++-----
> 3 files changed, 43 insertions(+), 5 deletions(-)
Applied to tip/x86/apic, thanks Yinghai!
Could you please send one against linus/master too please? (there's conflicts)
Ingo
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] x86/irq: optimizing nr_irqs -v2
2009-02-08 9:44 ` [PATCH] x86/irq: optimizing nr_irqs -v2 Yinghai Lu
@ 2009-02-09 8:14 ` Ingo Molnar
0 siblings, 0 replies; 11+ messages in thread
From: Ingo Molnar @ 2009-02-09 8:14 UTC (permalink / raw)
To: Yinghai Lu
Cc: Thomas Gleixner, H. Peter Anvin, Andrew Morton,
linux-kernel@vger.kernel.org
* Yinghai Lu <yinghai@kernel.org> wrote:
>
> Impact: more depend on cards to be used
>
> depend on nr_irq_gsi more, and have a ratio for MSI
>
> v2: make nr_irqs shoule less than NR_VECTORS * nr_cpu_ids
> aka if only one cpu, we only can support nr_irqs = NR_VECTORS
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>
> ---
> arch/x86/kernel/io_apic.c | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
Applied to tip/x86/apic, thanks Yinghai!
Ingo
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] x86: use NR_IRQS_LEGACY to replace 16
2009-02-08 1:13 ` [PATCH] x86: use NR_IRQS_LEGACY to replace 16 Yinghai Lu
@ 2009-02-09 8:14 ` Ingo Molnar
0 siblings, 0 replies; 11+ messages in thread
From: Ingo Molnar @ 2009-02-09 8:14 UTC (permalink / raw)
To: Yinghai Lu
Cc: Thomas Gleixner, H. Peter Anvin, Andrew Morton,
linux-kernel@vger.kernel.org
* Yinghai Lu <yinghai@kernel.org> wrote:
>
> Impact: cleanup
>
> also could kill platform_legacy_irq
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>
> ---
> arch/x86/include/asm/hw_irq.h | 4 +---
> arch/x86/kernel/io_apic.c | 8 ++++----
> 2 files changed, 5 insertions(+), 7 deletions(-)
Applied to tip/x86/apic, thanks Yinghai!
Ingo
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing v3
2009-02-09 8:13 ` [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing Ingo Molnar
@ 2009-02-09 9:03 ` Yinghai Lu
0 siblings, 0 replies; 11+ messages in thread
From: Yinghai Lu @ 2009-02-09 9:03 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton,
Len Brown
Cc: linux-kernel@vger.kernel.org
Impact: find right nr_irqs_gsi on some systems.
one system has gap between gsi.
[ 0.000000] ACPI: IOAPIC (id[0x04] address[0xfec00000] gsi_base[0])
[ 0.000000] IOAPIC[0]: apic_id 4, version 0, address 0xfec00000, GSI 0-23
[ 0.000000] ACPI: IOAPIC (id[0x05] address[0xfeafd000] gsi_base[48])
[ 0.000000] IOAPIC[1]: apic_id 5, version 0, address 0xfeafd000, GSI 48-54
[ 0.000000] ACPI: IOAPIC (id[0x06] address[0xfeafc000] gsi_base[56])
[ 0.000000] IOAPIC[2]: apic_id 6, version 0, address 0xfeafc000, GSI 56-62
...
[ 0.000000] nr_irqs_gsi: 38
so nr_irqs_gsi is not right. some irq for MSI will overwrite with io_apic.
need to get that with acpi_probe_gsi when acpi io_apic is used
v2: Ingo pointed out inline acpi_probe_gsi() should be with !CONFIG_ACPI
v3: against current upstream for 2.6.29, because it is 2.6.29 material
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/include/asm/mpspec.h | 6 ++++++
arch/x86/kernel/acpi/boot.c | 23 +++++++++++++++++++++++
arch/x86/kernel/io_apic.c | 20 +++++++++++++++-----
3 files changed, 44 insertions(+), 5 deletions(-)
Index: linux-2.6/arch/x86/include/asm/mpspec.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/mpspec.h
+++ linux-2.6/arch/x86/include/asm/mpspec.h
@@ -60,6 +60,7 @@ 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 acpi_probe_gsi(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);
@@ -71,6 +72,11 @@ mp_config_acpi_gsi(unsigned char number,
return 0;
}
#endif
+#else /* !CONFIG_ACPI */
+static inline int acpi_probe_gsi(void)
+{
+ return 0;
+}
#endif /* CONFIG_ACPI */
#define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_APICS)
Index: linux-2.6/arch/x86/kernel/io_apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/io_apic.c
+++ linux-2.6/arch/x86/kernel/io_apic.c
@@ -3841,14 +3841,24 @@ int __init io_apic_get_redir_entries (in
void __init probe_nr_irqs_gsi(void)
{
- int idx;
int nr = 0;
- for (idx = 0; idx < nr_ioapics; idx++)
- nr += io_apic_get_redir_entries(idx) + 1;
-
- if (nr > nr_irqs_gsi)
+ nr = acpi_probe_gsi();
+ if (nr > nr_irqs_gsi) {
nr_irqs_gsi = nr;
+ } else {
+ /* for acpi=off or acpi is not compiled in */
+ int idx;
+
+ nr = 0;
+ for (idx = 0; idx < nr_ioapics; idx++)
+ nr += io_apic_get_redir_entries(idx) + 1;
+
+ if (nr > nr_irqs_gsi)
+ nr_irqs_gsi = nr;
+ }
+
+ printk(KERN_DEBUG "nr_irqs_gsi: %d\n", nr_irqs_gsi);
}
/* --------------------------------------------------------------------------
Index: linux-2.6/arch/x86/kernel/acpi/boot.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/acpi/boot.c
+++ linux-2.6/arch/x86/kernel/acpi/boot.c
@@ -973,6 +973,29 @@ void __init mp_register_ioapic(int id, u
nr_ioapics++;
}
+int __init acpi_probe_gsi(void)
+{
+ int idx;
+ int gsi;
+ int max_gsi = 0;
+
+ if (acpi_disabled)
+ return 0;
+
+ if (!acpi_ioapic)
+ return 0;
+
+ max_gsi = 0;
+ for (idx = 0; idx < nr_ioapics; idx++) {
+ gsi = mp_ioapic_routing[idx].gsi_end;
+
+ if (gsi > max_gsi)
+ max_gsi = gsi;
+ }
+
+ return max_gsi + 1;
+}
+
static void assign_to_mp_irq(struct mp_config_intsrc *m,
struct mp_config_intsrc *mp_irq)
{
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2009-02-09 9:05 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-06 23:59 [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing Yinghai Lu
2009-02-07 0:00 ` [PATCH] x86/irq: optimizing nr_irqs Yinghai Lu
2009-02-08 9:44 ` [PATCH] x86/irq: optimizing nr_irqs -v2 Yinghai Lu
2009-02-09 8:14 ` Ingo Molnar
2009-02-07 3:35 ` [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing Len Brown
2009-02-07 3:47 ` Yinghai Lu
2009-02-07 7:15 ` Len Brown
2009-02-08 1:13 ` [PATCH] x86: use NR_IRQS_LEGACY to replace 16 Yinghai Lu
2009-02-09 8:14 ` Ingo Molnar
2009-02-09 8:13 ` [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing Ingo Molnar
2009-02-09 9:03 ` [PATCH] x86: find nr_irqs_gsi with mp_ioapic_routing v3 Yinghai Lu
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.