Skip to contentSkip to conversation

ACPI IRQ proposal

RFC In review Bjorn Helgaas 5 participants 7 messages Mar 23, 2004 – Apr 22, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 ACPI IRQ proposal

I think the ACPI/platform interactions for IRQ setup are unnecessarily complex. Today we have:

- boot-time parsing of all the _PRTs (platform subsys_initcall calls acpi_pci_irq_init(), which calls either mp_parse_prt() or iosapic_parse_prt() based on some #ifdefs).

- pci_enable_device()-time IRQ enable (platform pcibios_enable_resources() calls acpi_pci_irq_enable(), which calls back to platform code, again based on some #ifdefs).

By defining a new platform interface, we should be able to get rid of the boot-time _PRT parsing and do everything cleanly at pci_enable_device()-time:

int /* Linux IRQ */
acpi_register_gsi(int gsi,
int polarity, /* active high or low */
int trigger) /* edge or level */

This is responsible for whatever APIC or IOSAPIC programming the platform needs, as well as allocating and returning a Linux IRQ.

By doing this, we get

- possibility of hot-plugging a PCI root bridge (w/ _PRT)
- removal of architecture #ifdefs from pci_irq.c and osl.c
- removal of some Linux IRQ junk from acpi/pci_irq.c

If there are still some broken drivers that don't call pci_enable_device(), we still have the option of putting a hook somewhere that just calls acpi_pci_irq_enable() for all PCI devices.

Sample patch below only cleans up ia64; i386 and x86_64 looks a little more complicated. Any comments?

 arch/ia64/kernel/acpi.c    |   36 +----------
 arch/ia64/kernel/iosapic.c |   55 ------------------
 arch/ia64/pci/pci.c        |   13 ----
 drivers/acpi/osl.c         |   23 ++++---
 drivers/acpi/pci_irq.c     |  136 ++++++++++++++++-----------------------------
 drivers/pci/pci.c          |    5 +
 drivers/serial/8250_acpi.c |   13 ----
 drivers/serial/8250_hcdp.c |    6 -
 include/asm-ia64/acpi.h    |    3 
 include/linux/acpi.h       |    3 
 10 files changed, 79 insertions(+), 214 deletions(-)

===== arch/ia64/kernel/acpi.c 1.64 vs edited =====

arch/ia64/kernel/acpi.c +6 -30
@@ -529,7 +529,6 @@
 	if (fadt->iapc_boot_arch & BAF_LEGACY_DEVICES)
 		acpi_legacy_devices = 1;
 
-	acpi_register_irq(fadt->sci_int, ACPI_ACTIVE_LOW, ACPI_LEVEL_SENSITIVE);
 	return 0;
 }
 
@@ -626,43 +625,20 @@
 	return 0;
 }
 
-/* deprecated in favor of acpi_gsi_to_irq */
 int
-acpi_irq_to_vector (u32 gsi)
+acpi_register_gsi (u32 gsi, int polarity, int trigger)
 {
-	if (has_8259 && gsi < 16)
-		return isa_irq_to_vector(gsi);
-
-	return gsi_to_vector(gsi);
-}
+	unsigned int irq;
 
-int
-acpi_gsi_to_irq (u32 gsi, unsigned int *irq)
-{
-	int vector;
-
-	if (has_8259 && gsi < 16)
-		*irq = isa_irq_to_vector(gsi);
-	else {
-		vector = gsi_to_vector(gsi);
-		if (vector == -1)
-			return -1;
-
-		*irq = vector;
-	}
-	return 0;
-}
-
-int
-acpi_register_irq (u32 gsi, u32 polarity, u32 trigger)
-{
 	if (has_8259 && gsi < 16)
 		return isa_irq_to_vector(gsi);
 
-	return iosapic_register_intr(gsi,
+	irq = iosapic_register_intr(gsi,
 			(polarity == ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
 			(trigger == ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
+	iosapic_enable_intr(irq);
+	return irq;
 }
-EXPORT_SYMBOL(acpi_register_irq);
+EXPORT_SYMBOL(acpi_register_gsi);
 
 #endif /* CONFIG_ACPI_BOOT */

===== arch/ia64/kernel/iosapic.c 1.36 vs edited =====

arch/ia64/kernel/iosapic.c +0 -55

58 lines not on this page · raw message

===== arch/ia64/pci/pci.c 1.44 vs edited =====

arch/ia64/pci/pci.c +0 -13
@@ -156,18 +156,6 @@
 	.write = pci_write,
 };
 
-static int __init
-pci_acpi_init (void)
-{
-	if (!acpi_pci_irq_init())
-		printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n");
-	else
-		printk(KERN_WARNING "PCI: Invalid ACPI-PCI IRQ routing table\n");
-	return 0;
-}
-
-subsys_initcall(pci_acpi_init);
-
 /* Called by ACPI when it finds a new root bus.  */
 
 static struct pci_controller * __devinit
@@ -440,7 +428,6 @@
 	if (ret < 0)
 		return ret;
 
-	printk(KERN_INFO "PCI: Found IRQ %d for device %s\n", dev->irq, pci_name(dev));
 	return acpi_pci_irq_enable(dev);
 }
 

===== drivers/acpi/osl.c 1.46 vs edited =====

drivers/acpi/osl.c +14 -9
@@ -36,6 +36,7 @@
 #include <linux/delay.h>
 #include <linux/workqueue.h>
 #include <linux/nmi.h>
+#include <linux/acpi.h>
 #include <acpi/acpi.h>
 #include <asm/io.h>
 #include <acpi/acpi_bus.h>
@@ -240,23 +241,24 @@
 }
 
 acpi_status
-acpi_os_install_interrupt_handler(u32 irq, OSD_HANDLER handler, void *context)
+acpi_os_install_interrupt_handler(u32 gsi, OSD_HANDLER handler, void *context)
 {
+	int irq;
+
 	/*
 	 * Ignore the irq from the core, and use the value in our copy of the
 	 * FADT. It may not be the same if an interrupt source override exists
 	 * for the SCI.
 	 */
-	irq = acpi_fadt.sci_int;
+	gsi = acpi_fadt.sci_int;
 
-#if defined(CONFIG_IA64) || defined(CONFIG_PCI_USE_VECTOR)
-	irq = acpi_irq_to_vector(irq);
+	irq = acpi_register_gsi(gsi, ACPI_ACTIVE_LOW, ACPI_LEVEL_SENSITIVE);
 	if (irq < 0) {
 		printk(KERN_ERR PREFIX "SCI (ACPI interrupt %d) not registered\n",
-		       acpi_fadt.sci_int);
+		       gsi);
 		return AE_OK;
 	}
-#endif
+
 	acpi_irq_handler = handler;
 	acpi_irq_context = context;
 	if (request_irq(irq, acpi_irq, SA_SHIRQ, "acpi", acpi_irq)) {
@@ -272,9 +274,12 @@
 acpi_os_remove_interrupt_handler(u32 irq, OSD_HANDLER handler)
 {
 	if (irq) {
-#if defined(CONFIG_IA64) || defined(CONFIG_PCI_USE_VECTOR)
-		irq = acpi_irq_to_vector(irq);
-#endif
+		/*
+		 * Probably should have something like
+		 * acpi_unregister_gsi() here so the platform can tear
+		 * down IOSAPIC setup for this GSI and deallocate the
+		 * associated Linux IRQ.
+		 */
 		free_irq(irq, acpi_irq);
 		acpi_irq_handler = NULL;
 		acpi_irq_irq = 0;

===== drivers/acpi/pci_irq.c 1.24 vs edited =====

drivers/acpi/pci_irq.c +50 -86

211 lines not on this page · raw message

===== drivers/pci/pci.c 1.63 vs edited =====

drivers/pci/pci.c +5 -0
@@ -363,6 +363,11 @@
 		pci_command &= ~PCI_COMMAND_MASTER;
 		pci_write_config_word(dev, PCI_COMMAND, pci_command);
 	}
+
+	/*
+	 * Probably should have a pcibios_disable_device() so the
+	 * architecture can undo any IRQ setup.
+	 */
 }
 
 /**

===== drivers/serial/8250_acpi.c 1.8 vs edited =====

drivers/serial/8250_acpi.c +3 -10
@@ -59,12 +59,8 @@
 				       struct acpi_resource_ext_irq *ext_irq)
 {
 	if (ext_irq->number_of_interrupts > 0) {
-#ifdef CONFIG_IA64
-		req->irq = acpi_register_irq(ext_irq->interrupts[0],
+		req->irq = acpi_register_gsi(ext_irq->interrupts[0],
 	                  ext_irq->active_high_low, ext_irq->edge_level);
-#else
-		req->irq = ext_irq->interrupts[0];
-#endif
 	}
 	return AE_OK;
 }
@@ -73,12 +69,8 @@
 				   struct acpi_resource_irq *irq)
 {
 	if (irq->number_of_interrupts > 0) {
-#ifdef CONFIG_IA64
-		req->irq = acpi_register_irq(irq->interrupts[0],
+		req->irq = acpi_register_gsi(irq->interrupts[0],
 	                  irq->active_high_low, irq->edge_level);
-#else
-		req->irq = irq->interrupts[0];
-#endif
 	}
 	return AE_OK;
 }
@@ -164,6 +156,7 @@
 
 	priv = acpi_driver_data(device);
 	unregister_serial(priv->line);
+	/* Probably should undo acpi_register_gsi() here */
 	if (priv->iomem_base)
 		iounmap(priv->iomem_base);
 	kfree(priv);

===== drivers/serial/8250_hcdp.c 1.3 vs edited =====

drivers/serial/8250_hcdp.c +0 -6
@@ -179,12 +179,6 @@
 			printk(KERN_WARNING"warning: No support for PCI serial console\n");
 			return;
 		}
-#ifdef CONFIG_IA64
-		port.irq = acpi_register_irq(gsi, ACPI_ACTIVE_HIGH,
-				ACPI_EDGE_SENSITIVE);
-#else
-		port.irq = gsi;
-#endif
 		port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF | UPF_RESOURCES;
 
 		/*

===== include/asm-ia64/acpi.h 1.15 vs edited =====

include/asm-ia64/acpi.h +0 -3
@@ -92,9 +92,6 @@
 
 const char *acpi_get_sysname (void);
 int acpi_request_vector (u32 int_type);
-int acpi_register_irq (u32 gsi, u32 polarity, u32 trigger);
-int acpi_irq_to_vector (u32 irq); /* deprecated in favor of acpi_gsi_to_irq */
-int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
 
 #ifdef CONFIG_ACPI_NUMA
 /* Proximity bitmap length; _PXM is at most 255 (8 bit)*/

===== include/linux/acpi.h 1.32 vs edited =====

include/linux/acpi.h +1 -2
@@ -424,7 +424,6 @@
 		acpi_handle		handle;
 		u32			index;
 	}			link;
-	u32			irq;
 };
 
 struct acpi_prt_list {
@@ -437,7 +436,7 @@
 struct pci_dev;
 
 int acpi_pci_irq_enable (struct pci_dev *dev);
-int acpi_pci_irq_init (void);
+int acpi_register_gsi (u32 gsi, int polarity, int trigger);
 
 struct acpi_pci_driver {
 	struct acpi_pci_driver *next;
#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Bjorn Helgaas

Bjorn> Any comments?

Wonderful!

	--david
#2 lore raw
In reply to Bjorn Helgaas

Hi, Bjorn.

I've tried your patch in tiger4, but it causes spurious acpi interrupts, and finally the IRQ is disabled by note_interrupt().

I guess the difference causing this problem is your patch enables the acpi interrupt on acpi_register_gsi() called by acpi_os_install_interrupt_handler(), but original acpi_os_install_interrupt_handler() calls acpi_irq_to_vector(), which does not enable the interrupt, instead.

I am not sure the reason, but probably the enabling timing is too early for the acpi interrupt.

Didn't you hit this problem?

Thanks,
Naoaki Maeda

------- Original code

#if defined(CONFIG_IA64) || defined(CONFIG_PCI_USE_VECTOR)
        irq = acpi_irq_to_vector(irq);
        if (irq < 0) {
                printk(KERN_ERR PREFIX "SCI (ACPI interrupt %d) not registered\n",
                       acpi_fadt.sci_int);
                return AE_OK;
        }
#endif
        acpi_irq_handler = handler;
        acpi_irq_context = context;
        if (request_irq(irq, acpi_irq, SA_SHIRQ, "acpi", acpi_irq)) {
                printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq);
                return AE_NOT_ACQUIRED;
        }
        acpi_irq_irq = irq;

--------

-------- Patched code

        irq = acpi_register_gsi(gsi, ACPI_ACTIVE_LOW, ACPI_LEVEL_SENSITIVE);
        if (irq < 0) {
                printk(KERN_ERR PREFIX "SCI (ACPI interrupt %d) not registered\n",
                       gsi);
                return AE_OK;
        }

        acpi_irq_handler = handler;
        acpi_irq_context = context;
        if (request_irq(irq, acpi_irq, SA_SHIRQ, "acpi", acpi_irq)) {
                printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq);
                return AE_NOT_ACQUIRED;
        }

--------

From: Bjorn Helgaas <[email protected]>
Subject: [RFC] ACPI IRQ proposal
Date: Tue, 23 Mar 2004 15:37:14 -0700

Quoted 35 lines

I think the ACPI/platform interactions for IRQ setup are unnecessarily complex. Today we have:

- boot-time parsing of all the _PRTs (platform subsys_initcall calls acpi_pci_irq_init(), which calls either mp_parse_prt() or iosapic_parse_prt() based on some #ifdefs).

- pci_enable_device()-time IRQ enable (platform pcibios_enable_resources() calls acpi_pci_irq_enable(), which calls back to platform code, again based on some #ifdefs).

By defining a new platform interface, we should be able to get rid of the boot-time _PRT parsing and do everything cleanly at pci_enable_device()-time:

int /* Linux IRQ */
acpi_register_gsi(int gsi,
int polarity, /* active high or low */
int trigger) /* edge or level */

This is responsible for whatever APIC or IOSAPIC programming the platform needs, as well as allocating and returning a Linux IRQ.

By doing this, we get

- possibility of hot-plugging a PCI root bridge (w/ _PRT)
- removal of architecture #ifdefs from pci_irq.c and osl.c
- removal of some Linux IRQ junk from acpi/pci_irq.c

If there are still some broken drivers that don't call pci_enable_device(), we still have the option of putting a hook somewhere that just calls acpi_pci_irq_enable() for all PCI devices.

Sample patch below only cleans up ia64; i386 and x86_64 looks a little more complicated. Any comments?

#3 lore raw

Hi Maeda-san, Bjorn,

Although the ACPI spec says that SCI is 'active-low, level' interrupt, there are many platforms that doesn't follow the rule (what I've seen are almost active-high, level). I think Maeda-san's case is just a wrong polarity.

Usually those platforms would describe the polarity and trigger of SCI in 'interrupt source override' record in the ACPI MADT table.

The polarity and trigger are programmed in iosapic when MADT parsing is done, so we don't want to force 'ACPI_ACTIVE_LOW, ACPI_LEVEL_SENSITIVE' when SCI is enabled.

So maybe acpi_register_gsi() would take only one argument (u32 gsi) and the acpi_register_gsi() by itself will derive polarity and trigger from override table or iosapic_intr_info[]?

From: MAEDA Naoaki <[email protected]>
Subject: Re: [RFC] ACPI IRQ proposal
Date: Fri, 26 Mar 2004 14:39:30 +0900 (JST)

Quoted 98 lines

Hi, Bjorn.

I've tried your patch in tiger4, but it causes spurious acpi interrupts, and finally the IRQ is disabled by note_interrupt().

I guess the difference causing this problem is your patch enables the acpi interrupt on acpi_register_gsi() called by acpi_os_install_interrupt_handler(), but original acpi_os_install_interrupt_handler() calls acpi_irq_to_vector(), which does not enable the interrupt, instead.

I am not sure the reason, but probably the enabling timing is too early for the acpi interrupt.

Didn't you hit this problem?

Thanks,
Naoaki Maeda

------- Original code

#if defined(CONFIG_IA64) || defined(CONFIG_PCI_USE_VECTOR)
        irq = acpi_irq_to_vector(irq);
        if (irq < 0) {
                printk(KERN_ERR PREFIX "SCI (ACPI interrupt %d) not registered\n",
                       acpi_fadt.sci_int);
                return AE_OK;
        }
#endif
        acpi_irq_handler = handler;
        acpi_irq_context = context;
        if (request_irq(irq, acpi_irq, SA_SHIRQ, "acpi", acpi_irq)) {
                printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq);
                return AE_NOT_ACQUIRED;
        }
        acpi_irq_irq = irq;

--------

-------- Patched code

        irq = acpi_register_gsi(gsi, ACPI_ACTIVE_LOW, ACPI_LEVEL_SENSITIVE);
        if (irq < 0) {
                printk(KERN_ERR PREFIX "SCI (ACPI interrupt %d) not registered\n",
                       gsi);
                return AE_OK;
        }

        acpi_irq_handler = handler;
        acpi_irq_context = context;
        if (request_irq(irq, acpi_irq, SA_SHIRQ, "acpi", acpi_irq)) {
                printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq);
                return AE_NOT_ACQUIRED;
        }

--------

From: Bjorn Helgaas <[email protected]>
Subject: [RFC] ACPI IRQ proposal
Date: Tue, 23 Mar 2004 15:37:14 -0700

Quoted 29 lines

I think the ACPI/platform interactions for IRQ setup are unnecessarily complex. Today we have:

- boot-time parsing of all the _PRTs (platform subsys_initcall calls acpi_pci_irq_init(), which calls either mp_parse_prt() or iosapic_parse_prt() based on some #ifdefs).

- pci_enable_device()-time IRQ enable (platform pcibios_enable_resources() calls acpi_pci_irq_enable(), which calls back to platform code, again based on some #ifdefs).

By defining a new platform interface, we should be able to get rid of the boot-time _PRT parsing and do everything cleanly at pci_enable_device()-time:

int /* Linux IRQ */
acpi_register_gsi(int gsi,
int polarity, /* active high or low */
int trigger) /* edge or level */

This is responsible for whatever APIC or IOSAPIC programming the platform needs, as well as allocating and returning a Linux IRQ.

By doing this, we get

- possibility of hot-plugging a PCI root bridge (w/ _PRT)
- removal of architecture #ifdefs from pci_irq.c and osl.c
- removal of some Linux IRQ junk from acpi/pci_irq.c

Quoted 6 lines

If there are still some broken drivers that don't call pci_enable_device(), we still have the option of putting a hook somewhere that just calls acpi_pci_irq_enable() for all PCI devices.

Sample patch below only cleans up ia64; i386 and x86_64 looks a little more complicated. Any comments?

-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 3 lines · Takayoshi Kochi

The polarity and trigger are programmed in iosapic when MADT parsing is done, so we don't want to force 'ACPI_ACTIVE_LOW, ACPI_LEVEL_SENSITIVE' when SCI is enabled.

Yup, I just completely threw out the MADT parsing, which was a mistake. Obviously we have to keep track of what's there. It's a shame it's currently all in architecture code, even though it should really be platform-independent.

Quoted 3 lines

So maybe acpi_register_gsi() would take only one argument (u32 gsi) and the acpi_register_gsi() by itself will derive polarity and trigger from override table or iosapic_intr_info[]?

But it doesn't seem right to me to for the arch code to have to keep track of the polarity/trigger stuff. Ideally I think ACPI should extract that from the PRT (as it does today) and from the static tables (as the arch code does today), then tell the arch code once via acpi_register_gsi().

But in the short term, I think I'll just leave the non-PRT stuff pretty much as it is today, and focus on cleaning up the PRT handling a bit.

#5 lore raw
In reply to Takayoshi Kochi

Hi, Kochi-san.

Thank you for your explanation of what may cause the problem. As you guessed, the SCI of my machine is active-high, level interrupt. I had to notice that the following kernel messages were printed.

tiger4 kernel: ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level) tiger4 kernel: register_intr: changing vector 39 from IO-SAPIC-edge to IO-SAPIC-level

In order to make sure that the spurious interrupts were caused by this problem, I have tried to simply change the 2nd argument of acpi_register_gsi() to ACPI_ACTIVE_HIGH, and then the spurious interrupts are gone.

Thanks,
Naoaki Maeda

From: Takayoshi Kochi <[email protected]>
Subject: [ACPI] Re: [RFC] ACPI IRQ proposal
Date: Fri, 26 Mar 2004 17:56:30 +0900 (JST)

Quoted 131 lines

Hi Maeda-san, Bjorn,

Although the ACPI spec says that SCI is 'active-low, level' interrupt, there are many platforms that doesn't follow the rule (what I've seen are almost active-high, level). I think Maeda-san's case is just a wrong polarity.

Usually those platforms would describe the polarity and trigger of SCI in 'interrupt source override' record in the ACPI MADT table.

The polarity and trigger are programmed in iosapic when MADT parsing is done, so we don't want to force 'ACPI_ACTIVE_LOW, ACPI_LEVEL_SENSITIVE' when SCI is enabled.

So maybe acpi_register_gsi() would take only one argument (u32 gsi) and the acpi_register_gsi() by itself will derive polarity and trigger from override table or iosapic_intr_info[]?

From: MAEDA Naoaki <[email protected]>
Subject: Re: [RFC] ACPI IRQ proposal
Date: Fri, 26 Mar 2004 14:39:30 +0900 (JST)

Quoted 90 lines

Hi, Bjorn.

I've tried your patch in tiger4, but it causes spurious acpi interrupts, and finally the IRQ is disabled by note_interrupt().

I guess the difference causing this problem is your patch enables the acpi interrupt on acpi_register_gsi() called by acpi_os_install_interrupt_handler(), but original acpi_os_install_interrupt_handler() calls acpi_irq_to_vector(), which does not enable the interrupt, instead.

I am not sure the reason, but probably the enabling timing is too early for the acpi interrupt.

Didn't you hit this problem?

Thanks,
Naoaki Maeda

------- Original code

#if defined(CONFIG_IA64) || defined(CONFIG_PCI_USE_VECTOR)
        irq = acpi_irq_to_vector(irq);
        if (irq < 0) {
                printk(KERN_ERR PREFIX "SCI (ACPI interrupt %d) not registered\n",
                       acpi_fadt.sci_int);
                return AE_OK;
        }
#endif
        acpi_irq_handler = handler;
        acpi_irq_context = context;
        if (request_irq(irq, acpi_irq, SA_SHIRQ, "acpi", acpi_irq)) {
                printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq);
                return AE_NOT_ACQUIRED;
        }
        acpi_irq_irq = irq;

--------

-------- Patched code

        irq = acpi_register_gsi(gsi, ACPI_ACTIVE_LOW, ACPI_LEVEL_SENSITIVE);
        if (irq < 0) {
                printk(KERN_ERR PREFIX "SCI (ACPI interrupt %d) not registered\n",
                       gsi);
                return AE_OK;
        }

        acpi_irq_handler = handler;
        acpi_irq_context = context;
        if (request_irq(irq, acpi_irq, SA_SHIRQ, "acpi", acpi_irq)) {
                printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq);
                return AE_NOT_ACQUIRED;
        }

--------

From: Bjorn Helgaas <[email protected]>
Subject: [RFC] ACPI IRQ proposal
Date: Tue, 23 Mar 2004 15:37:14 -0700

Quoted 33 lines

I think the ACPI/platform interactions for IRQ setup are unnecessarily complex. Today we have:

- boot-time parsing of all the _PRTs (platform subsys_initcall calls acpi_pci_irq_init(), which calls either mp_parse_prt() or iosapic_parse_prt() based on some #ifdefs).

- pci_enable_device()-time IRQ enable (platform pcibios_enable_resources() calls acpi_pci_irq_enable(), which calls back to platform code, again based on some #ifdefs).

By defining a new platform interface, we should be able to get rid of the boot-time _PRT parsing and do everything cleanly at pci_enable_device()-time:

int /* Linux IRQ */
acpi_register_gsi(int gsi,
int polarity, /* active high or low */
int trigger) /* edge or level */

This is responsible for whatever APIC or IOSAPIC programming the platform needs, as well as allocating and returning a Linux IRQ.

By doing this, we get

- possibility of hot-plugging a PCI root bridge (w/ _PRT)
- removal of architecture #ifdefs from pci_irq.c and osl.c
- removal of some Linux IRQ junk from acpi/pci_irq.c

If there are still some broken drivers that don't call pci_enable_device(), we still have the option of putting a hook somewhere that just calls acpi_pci_irq_enable() for all PCI devices.

Quoted 8 lines
Quoted 2 lines

Sample patch below only cleans up ia64; i386 and x86_64 looks a little more complicated. Any comments?

-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Acpi-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/acpi-devel

#6 lore raw
In reply to Bjorn Helgaas

Hi Bjorn,

It will be possible that iosapic_register_intr() runs on multiple CPUs in parallel when your patch is applied. But I think current iosapic_register_int()
doesn't take care of this. If iosapic_register_intr() is called for one gsi on
multiple CPUs in parallel, two or more vectors might be assigned to one gsi. A following patch is a sample patch to fix this issue. (This patch is not
tested yet.)

Thanks,
Kenji Kaneshige

---

 linux-2.6.6-rc1-kanesige/arch/ia64/kernel/iosapic.c |    5 +++++
 1 files changed, 5 insertions(+)

diff -puN arch/ia64/kernel/iosapic.c~lock_iosapic_register_intr arch/ia64/kernel/iosapic.c
--- linux-2.6.6-rc1/arch/ia64/kernel/iosapic.c~lock_iosapic_register_intr

2004-04-21 14:58:25.229102461 +0900

+++ linux-2.6.6-rc1-kanesige/arch/ia64/kernel/iosapic.c 2004-04-21
15:44:04.719878795 +0900
@@ -499,9 +499,12 @@ int
iosapic_register_intr (unsigned int gsi,
unsigned long polarity, unsigned long trigger)
{
+ unsigned long flags;
int vector;
unsigned int dest = (ia64_getreg(_IA64_REG_CR_LID) >> 16) & 0xffff;

+ spin_lock_irqsave(&iosapic_lock, flags);
+
vector = gsi_to_vector(gsi);
if (vector < 0)
vector = assign_irq_vector(AUTO_ASSIGN);
@@ -509,6 +512,8 @@ iosapic_register_intr (unsigned int gsi,
register_intr(gsi, vector, IOSAPIC_LOWEST_PRIORITY,
polarity, trigger);

+ spin_unlock_irqrestore(&iosapic_lock, flags);
+
printk(KERN_INFO "GSI 0x%x(%s,%s) -> CPU 0x%04x vector %d\n",
gsi, (polarity = IOSAPIC_POL_HIGH ? "high" : "low"), (trigger = IOSAPIC_EDGE ? "edge" : "level"), dest, vector);

_