Skip to contentSkip to conversation

Disable ACPI PCI link device if no PCI device uses it - takes 2

PATCH In review Shaohua Li 2 participants 2 messages Jul 26, 2005 – Jul 28, 2005 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

Shaohua Li

author
#0 lore raw

PATCH 1/1 Disable ACPI PCI link device if no PCI device uses it - takes 2

Hi,
Looks like people agree device drivers should call free_irq/pci_disable_irq at suspend time per the OLS report. This patch tries to disable pci link device if no PCI device is using it, which is one goal of pci driver calls pci_disable_irq. This patch also warns users if some drivers don't call pci_disable_irq at suspend time. Next step we will implement acpi_unregister_gsi for x86/x86_64, so we can automically mask ioapic/pic if no device is using them. And in the same way, alarm users if driver doesn't call free_irq at suspend time. Greg, is the PCI part ok for you? It just has very small changes in PCI part.

Thanks,
Shaohua

---

 linux-2.6.13-rc3-root/arch/i386/pci/acpi.c        |    1 
 linux-2.6.13-rc3-root/arch/i386/pci/common.c      |    6 +
 linux-2.6.13-rc3-root/arch/i386/pci/irq.c         |    1 
 linux-2.6.13-rc3-root/arch/i386/pci/pci.h         |    1 
 linux-2.6.13-rc3-root/drivers/acpi/pci_irq.c      |   85 ++++++++++++------
 linux-2.6.13-rc3-root/drivers/acpi/pci_link.c     |  101 ++++++++++++++++++----
 linux-2.6.13-rc3-root/include/acpi/acpi_drivers.h |    3 
 linux-2.6.13-rc3-root/include/linux/acpi.h        |    4 
 8 files changed, 155 insertions(+), 47 deletions(-)
arch/i386/pci/acpi.c renamed from arch/i386/pci/acpi.c~suspend_resume_irq +1 -0
diff -puN arch/i386/pci/acpi.c~suspend_resume_irq arch/i386/pci/acpi.c
@@ -30,6 +30,7 @@ static int __init pci_acpi_init(void)
 	acpi_irq_penalty_init();
 	pcibios_scanned++;
 	pcibios_enable_irq = acpi_pci_irq_enable;
+	pcibios_disable_irq = acpi_pci_irq_disable;
 
 	if (pci_routeirq) {
 		/*
arch/i386/pci/common.c renamed from arch/i386/pci/common.c~suspend_resume_irq +6 -0
diff -puN arch/i386/pci/common.c~suspend_resume_irq arch/i386/pci/common.c
@@ -254,3 +254,9 @@ int pcibios_enable_device(struct pci_dev
 
 	return pcibios_enable_irq(dev);
 }
+
+void pcibios_disable_device (struct pci_dev *dev)
+{
+	if (pcibios_disable_irq)
+		pcibios_disable_irq(dev);
+}
arch/i386/pci/irq.c renamed from arch/i386/pci/irq.c~suspend_resume_irq +1 -0
diff -puN arch/i386/pci/irq.c~suspend_resume_irq arch/i386/pci/irq.c
@@ -56,6 +56,7 @@ struct irq_router_handler {
 };
 
 int (*pcibios_enable_irq)(struct pci_dev *dev) = NULL;
+void (*pcibios_disable_irq)(struct pci_dev *dev) = NULL;
 
 /*
  *  Check passed address for the PCI IRQ Routing Table signature
arch/i386/pci/pci.h renamed from arch/i386/pci/pci.h~suspend_resume_irq +1 -0
diff -puN arch/i386/pci/pci.h~suspend_resume_irq arch/i386/pci/pci.h
@@ -73,3 +73,4 @@ extern int pcibios_scanned;
 extern spinlock_t pci_config_lock;
 
 extern int (*pcibios_enable_irq)(struct pci_dev *dev);
+extern void (*pcibios_disable_irq)(struct pci_dev *dev);
drivers/acpi/pci_irq.c renamed from drivers/acpi/pci_irq.c~suspend_resume_irq +59 -26

153 lines not on this page · raw message

drivers/acpi/pci_link.c renamed from drivers/acpi/pci_link.c~suspend_resume_irq +85 -16

209 lines not on this page · raw message

include/acpi/acpi_drivers.h renamed from include/acpi/acpi_drivers.h~suspend_resume_irq +2 -1
diff -puN include/acpi/acpi_drivers.h~suspend_resume_irq include/acpi/acpi_drivers.h
@@ -56,8 +56,9 @@
 /* ACPI PCI Interrupt Link (pci_link.c) */
 
 int acpi_irq_penalty_init (void);
-int acpi_pci_link_get_irq (acpi_handle handle, int index, int *edge_level,
+int acpi_pci_link_allocate_irq (acpi_handle handle, int index, int *edge_level,
 	int *active_high_low, char **name);
+int acpi_pci_link_free_irq(acpi_handle handle);
 
 /* ACPI PCI Interrupt Routing (pci_irq.c) */
 
include/linux/acpi.h renamed from include/linux/acpi.h~suspend_resume_irq +0 -4
diff -puN include/linux/acpi.h~suspend_resume_irq include/linux/acpi.h
@@ -453,9 +453,7 @@ int acpi_gsi_to_irq (u32 gsi, unsigned i
  * If this matches the last registration, any IRQ resources for gsi
  * are freed.
  */
-#ifdef CONFIG_ACPI_DEALLOCATE_IRQ
 void acpi_unregister_gsi (u32 gsi);
-#endif
 
 #ifdef CONFIG_ACPI_PCI
 
@@ -480,9 +478,7 @@ struct pci_dev;
 int acpi_pci_irq_enable (struct pci_dev *dev);
 void acpi_penalize_isa_irq(int irq, int active);
 
-#ifdef CONFIG_ACPI_DEALLOCATE_IRQ
 void acpi_pci_irq_disable (struct pci_dev *dev);
-#endif
 
 struct acpi_pci_driver {
 	struct acpi_pci_driver *next;

_

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

A message that is not in the archive (sent off-list or not yet received): 1122364343.7106.3.camel-ECwVeV2eNyQD0+JXs3kMbRL4W9x8LtSr@public.gmane.org

#2 lore raw
Quoted 11 lines · Shaohua Li

Hi,
Looks like people agree device drivers should call free_irq/pci_disable_irq at suspend time per the OLS report. This patch tries to disable pci link device if no PCI device is using it, which is one goal of pci driver calls pci_disable_irq. This patch also warns users if some drivers don't call pci_disable_irq at suspend time. Next step we will implement acpi_unregister_gsi for x86/x86_64, so we can automically mask ioapic/pic if no device is using them. And in the same way, alarm users if driver doesn't call free_irq at suspend time. Greg, is the PCI part ok for you? It just has very small changes in PCI part.

Looks ok to me.

thanks,

greg k-h

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf