public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] call _OSC support during root bridge discovery
@ 2008-10-29  5:48 Andrew Patterson
  2008-10-29  5:48 ` [PATCH 1/8] PCI, ACPI: include missing acpi.h file in pci-acpi.h Andrew Patterson
                   ` (7 more replies)
  0 siblings, 8 replies; 20+ messages in thread
From: Andrew Patterson @ 2008-10-29  5:48 UTC (permalink / raw)
  To: linux-pci, linux-acpi; +Cc: andrew.patterson, matthew

I recently reported a problem where a machine with close to a 100
PCIe root bridges was taking half an hour to just call _OSC.  The
root cause is the AER code calling:

        pcie_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT);

for each bridge.  The pcie_osc_support_set() function also iterates
over each bridge, so _OSC is called a quadratic number of times.

One solution to this problem would be to just move the call to
pcie_osc_support_set() to aer_service_init(), so _OSC support is only
called on each bridge once.

Matthew Wilcox came up with a better solution.  He says "Why should a
driver be calling pcie_osc_support_set() anyway?  This is something
the PCI core should be taking care of for it."

Matthew provided a patch for this solution that I massaged into the
following patch series.

It creates a new function (pci_acpi_osc_support()) which is called
from pci_root.c before we call any other methods on the device (as
recommended by the ACPI spec).  Since we know what capabilities the
system supports, individual modules do not now need to inform the core
of their support for various capabilities.

Some work that still needs to be done (provided by Matthew): 

o All the existing _OSC code should be moved from pci-acpi.c to
  pci_root.c.  I also think the acpi_osc_data should be made part of
  the acpi_pci_root struct, eliminating a separate allocation.

o We could also use an interface that iterates over all existing
  busses calling _OSC with new flags.  Shouldn't be hard, once it's
  integrated into pci_root.c.

o Further ahead, we don't actually check that the bits we asked for
  (in 'control') were actually granted to us.  The PCI firmware spec
  is quite explicit about interdependencies amongst the bits.

o We also need to re-evaluate _OSC when coming out of S4.

This patch series duplicates currently functionality while removing
our quadratic problem.  I believe that it can be applied now while the
above new functionality can be implemented some time in the future.

This patch series applies to the linux-next branch of pci-2.6 git
repository.  I expect it will also work with linux-next.

Matthew needs to sign-off patches 1-5.

Diff stats:

 drivers/acpi/pci_root.c            |   15 +++++++++++++++
 drivers/pci/msi.c                  |   31 +++++++++++-------------------
 drivers/pci/pci-acpi.c             |   37 +++++++++++++-----------------------
 drivers/pci/pci.c                  |    2 --
 drivers/pci/pci.h                  |    4 +---
 drivers/pci/pcie/aer/aerdrv_acpi.c |    1 -
 drivers/pci/pcie/aspm.c            |   22 ---------------------
 include/linux/pci-acpi.h           |   14 +++-----------
 include/linux/pci.h                |    5 +++++
 9 files changed, 48 insertions(+), 83 deletions(-)

Commits:

  - Include missing acpi.h file in pci-acpi.h.
  - Call _OSC support during root bridge discovery.
  - PCIe ASPM _OSC support capabilities called when root bridge added.
  - PCIe AER _OSC support capabilities called when root bridge added.
  - PCI MSI _OSC support capabilities called when root bridge added.
  - Added pci_msi_enabled which checks for pci=nomsi.
  - Check if MSI is enabled before adding _OSC support capability.
  - Remove obsolete _OSC capability support functions.

-- 
Andrew Patterson

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/8] PCI, ACPI: include missing acpi.h file in pci-acpi.h.
  2008-10-29  5:48 [PATCH 0/8] call _OSC support during root bridge discovery Andrew Patterson
@ 2008-10-29  5:48 ` Andrew Patterson
  2008-10-29  5:48 ` [PATCH 2/8] ACPI, PCI: call _OSC support during root bridge discovery Andrew Patterson
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 20+ messages in thread
From: Andrew Patterson @ 2008-10-29  5:48 UTC (permalink / raw)
  To: linux-pci, linux-acpi; +Cc: andrew.patterson, matthew

PCI, ACPI: include missing acpi.h file in pci-acpi.h.

The pci-acpi.h file will not compile without including linux/acpi.h.
---

 include/linux/pci-acpi.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)


diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 8837928..a9e4c34 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -8,6 +8,8 @@
 #ifndef _PCI_ACPI_H_
 #define _PCI_ACPI_H_
 
+#include <linux/acpi.h>
+
 #define OSC_QUERY_TYPE			0
 #define OSC_SUPPORT_TYPE 		1
 #define OSC_CONTROL_TYPE		2

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/8] ACPI, PCI: call _OSC support during root bridge discovery
  2008-10-29  5:48 [PATCH 0/8] call _OSC support during root bridge discovery Andrew Patterson
  2008-10-29  5:48 ` [PATCH 1/8] PCI, ACPI: include missing acpi.h file in pci-acpi.h Andrew Patterson
@ 2008-10-29  5:48 ` Andrew Patterson
  2008-10-29 14:30   ` Bjorn Helgaas
  2008-10-29  5:48 ` [PATCH 3/8] ACPI, PCI: PCIe ASPM _OSC support capabilities called when root bridge added Andrew Patterson
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Andrew Patterson @ 2008-10-29  5:48 UTC (permalink / raw)
  To: linux-pci, linux-acpi; +Cc: andrew.patterson, matthew

ACPI, PCI: call _OSC support during root bridge discovery

Added pci_acpi_isc_support() which is called when a PCI bridge is
added, so individual PCI root bridge drivers do not have to call _OSC
support for every root bridge in their probe functions.
---

 drivers/acpi/pci_root.c  |    6 ++++++
 drivers/pci/pci-acpi.c   |   24 +++++++++++++++++++-----
 include/linux/pci-acpi.h |    1 +
 3 files changed, 26 insertions(+), 5 deletions(-)


diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 1b8f67d..47df4a8 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -31,6 +31,7 @@
 #include <linux/spinlock.h>
 #include <linux/pm.h>
 #include <linux/pci.h>
+#include <linux/pci-acpi.h>
 #include <linux/acpi.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
@@ -210,6 +211,11 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
 
 	device->ops.bind = acpi_pci_bind;
 
+	pci_acpi_osc_support(device->handle,
+			     OSC_EXT_PCI_CONFIG_SUPPORT |
+			     OSC_PCI_SEGMENT_GROUPS_SUPPORT |
+			     0);
+
 	/* 
 	 * Segment
 	 * -------
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index dfe7c8e..f457387 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -139,28 +139,42 @@ static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data,
 	return status;
 }
 
-static acpi_status acpi_query_osc(acpi_handle handle,
-				  u32 level, void *context, void **retval)
+/*
+ * pci_acpi_osc_support: Invoke _OSC indicating support for the given feature
+ * @flags: Bitmask of flags to support
+ *
+ * See the ACPI spec for the definition of the flags
+ */
+int pci_acpi_osc_support(acpi_handle handle, u32 flags)
 {
+	u32 dummy;
 	acpi_status status;
-	struct acpi_osc_data *osc_data;
-	u32 flags = (unsigned long)context, dummy;
 	acpi_handle tmp;
+	struct acpi_osc_data *osc_data;
+	int rc = 0;
 
 	status = acpi_get_handle(handle, "_OSC", &tmp);
 	if (ACPI_FAILURE(status))
-		return AE_OK;
+		return -ENOTTY;
 
 	mutex_lock(&pci_acpi_lock);
 	osc_data = acpi_get_osc_data(handle);
 	if (!osc_data) {
 		printk(KERN_ERR "acpi osc data array is full\n");
+		rc = -ENOMEM;
 		goto out;
 	}
 
 	__acpi_query_osc(flags, osc_data, &dummy);
 out:
 	mutex_unlock(&pci_acpi_lock);
+	return rc;
+}
+
+static acpi_status acpi_query_osc(acpi_handle handle, u32 level,
+				  void *context, void **retval)
+{
+	pci_acpi_osc_support(handle, (unsigned long)context);
 	return AE_OK;
 }
 
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index a9e4c34..424f06f 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -51,6 +51,7 @@
 #ifdef CONFIG_ACPI
 extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags);
 extern acpi_status __pci_osc_support_set(u32 flags, const char *hid);
+int pci_acpi_osc_support(acpi_handle handle, u32 flags);
 static inline acpi_status pci_osc_support_set(u32 flags)
 {
 	return __pci_osc_support_set(flags, PCI_ROOT_HID_STRING);

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 3/8] ACPI, PCI: PCIe ASPM _OSC support capabilities called when root bridge added
  2008-10-29  5:48 [PATCH 0/8] call _OSC support during root bridge discovery Andrew Patterson
  2008-10-29  5:48 ` [PATCH 1/8] PCI, ACPI: include missing acpi.h file in pci-acpi.h Andrew Patterson
  2008-10-29  5:48 ` [PATCH 2/8] ACPI, PCI: call _OSC support during root bridge discovery Andrew Patterson
@ 2008-10-29  5:48 ` Andrew Patterson
  2008-10-29  6:06   ` Kenji Kaneshige
  2008-10-29  5:48 ` [PATCH 4/8] ACPI, PCI: PCIe AER " Andrew Patterson
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Andrew Patterson @ 2008-10-29  5:48 UTC (permalink / raw)
  To: linux-pci, linux-acpi; +Cc: andrew.patterson, matthew

ACPI, PCI: PCIe ASPM _OSC support capabilities called when root bridge added

The _OSC capabilities OSC_ACTIVE_STATE_PWR_SUPPORT and
OSC_CLOCK_PWR_CAPABILITY_SUPPORT are set when the root bridge is added
with pci_acpi_osc_support(), so we no longer need to do it in the
ASPM driver.
---

 drivers/acpi/pci_root.c |    4 ++++
 drivers/pci/pcie/aspm.c |   22 ----------------------
 2 files changed, 4 insertions(+), 22 deletions(-)


diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 47df4a8..4d60629 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -214,6 +214,10 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
 	pci_acpi_osc_support(device->handle,
 			     OSC_EXT_PCI_CONFIG_SUPPORT |
 			     OSC_PCI_SEGMENT_GROUPS_SUPPORT |
+#ifdef CONFIG_PCIEASPM
+			     OSC_ACTIVE_STATE_PWR_SUPPORT |
+			     OSC_CLOCK_PWR_CAPABILITY_SUPPORT |
+#endif
 			     0);
 
 	/* 
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 8f63f4c..2c87883 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -833,25 +833,3 @@ void pcie_no_aspm(void)
 	if (!aspm_force)
 		aspm_disabled = 1;
 }
-
-#ifdef CONFIG_ACPI
-#include <acpi/acpi_bus.h>
-#include <linux/pci-acpi.h>
-static void pcie_aspm_platform_init(void)
-{
-	pcie_osc_support_set(OSC_ACTIVE_STATE_PWR_SUPPORT|
-		OSC_CLOCK_PWR_CAPABILITY_SUPPORT);
-}
-#else
-static inline void pcie_aspm_platform_init(void) { }
-#endif
-
-static int __init pcie_aspm_init(void)
-{
-	if (aspm_disabled)
-		return 0;
-	pcie_aspm_platform_init();
-	return 0;
-}
-
-fs_initcall(pcie_aspm_init);

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 4/8] ACPI, PCI: PCIe AER _OSC support capabilities called when root bridge added
  2008-10-29  5:48 [PATCH 0/8] call _OSC support during root bridge discovery Andrew Patterson
                   ` (2 preceding siblings ...)
  2008-10-29  5:48 ` [PATCH 3/8] ACPI, PCI: PCIe ASPM _OSC support capabilities called when root bridge added Andrew Patterson
@ 2008-10-29  5:48 ` Andrew Patterson
  2008-10-29  5:48 ` [PATCH 5/8] ACPI, PCI: PCI MSI " Andrew Patterson
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 20+ messages in thread
From: Andrew Patterson @ 2008-10-29  5:48 UTC (permalink / raw)
  To: linux-pci, linux-acpi; +Cc: andrew.patterson, matthew

ACPI, PCI: PCIe AER _OSC support capabilities called when root bridge added

The _OSC capability OSC_EXT_PCI_CONFIG_SUPPORT is set when the root
bridge is added with pci_acpi_osc_support(), so we no longer need to do
it in the PCIe AER driver.
---

 drivers/pci/pcie/aer/aerdrv_acpi.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)


diff --git a/drivers/pci/pcie/aer/aerdrv_acpi.c b/drivers/pci/pcie/aer/aerdrv_acpi.c
index 6dd7b13..ebce26c 100644
--- a/drivers/pci/pcie/aer/aerdrv_acpi.c
+++ b/drivers/pci/pcie/aer/aerdrv_acpi.c
@@ -38,7 +38,6 @@ int aer_osc_setup(struct pcie_device *pciedev)
 
 	handle = acpi_find_root_bridge_handle(pdev);
 	if (handle) {
-		pcie_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT);
 		status = pci_osc_control_set(handle,
 					OSC_PCI_EXPRESS_AER_CONTROL |
 					OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 5/8] ACPI, PCI: PCI MSI _OSC support capabilities called when root bridge added
  2008-10-29  5:48 [PATCH 0/8] call _OSC support during root bridge discovery Andrew Patterson
                   ` (3 preceding siblings ...)
  2008-10-29  5:48 ` [PATCH 4/8] ACPI, PCI: PCIe AER " Andrew Patterson
@ 2008-10-29  5:48 ` Andrew Patterson
  2008-10-29  5:48 ` [PATCH 6/8] PCI: added pci_msi_enabled which checks for pci=nomsi Andrew Patterson
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 20+ messages in thread
From: Andrew Patterson @ 2008-10-29  5:48 UTC (permalink / raw)
  To: linux-pci, linux-acpi; +Cc: andrew.patterson, matthew

ACPI, PCI: PCI MSI _OSC support capabilities called when root bridge added

The _OSC capabilityy OSC_MSI_SUPPORT is set when the root
bridge is added with pci_acpi_osc_support(), so we no longer
need to do it in the PCI MSI driver.
---

 drivers/acpi/pci_root.c |    3 +++
 drivers/pci/msi.c       |   21 ---------------------
 drivers/pci/pci.c       |    2 --
 drivers/pci/pci.h       |    2 --
 4 files changed, 3 insertions(+), 25 deletions(-)


diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 4d60629..75a59ea 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -214,6 +214,9 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
 	pci_acpi_osc_support(device->handle,
 			     OSC_EXT_PCI_CONFIG_SUPPORT |
 			     OSC_PCI_SEGMENT_GROUPS_SUPPORT |
+#ifdef CONFIG_PCI_MSI
+			     OSC_MSI_SUPPORT |
+#endif
 #ifdef CONFIG_PCIEASPM
 			     OSC_ACTIVE_STATE_PWR_SUPPORT |
 			     OSC_CLOCK_PWR_CAPABILITY_SUPPORT |
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 74801f7..d281201 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -759,24 +759,3 @@ void pci_msi_init_pci_dev(struct pci_dev *dev)
 {
 	INIT_LIST_HEAD(&dev->msi_list);
 }
-
-#ifdef CONFIG_ACPI
-#include <linux/acpi.h>
-#include <linux/pci-acpi.h>
-static void __devinit msi_acpi_init(void)
-{
-	if (acpi_pci_disabled)
-		return;
-	pci_osc_support_set(OSC_MSI_SUPPORT);
-	pcie_osc_support_set(OSC_MSI_SUPPORT);
-}
-#else
-static inline void msi_acpi_init(void) { }
-#endif /* CONFIG_ACPI */
-
-void __devinit msi_init(void)
-{
-	if (!pci_msi_enable)
-		return;
-	msi_acpi_init();
-}
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 533aeb5..d77e477 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2032,8 +2032,6 @@ static int __devinit pci_init(void)
 		pci_fixup_device(pci_fixup_final, dev);
 	}
 
-	msi_init();
-
 	return 0;
 }
 
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 9de87e9..b205ab8 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -98,11 +98,9 @@ extern unsigned int pci_pm_d3_delay;
 #ifdef CONFIG_PCI_MSI
 void pci_no_msi(void);
 extern void pci_msi_init_pci_dev(struct pci_dev *dev);
-extern void __devinit msi_init(void);
 #else
 static inline void pci_no_msi(void) { }
 static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { }
-static inline void msi_init(void) { }
 #endif
 
 #ifdef CONFIG_PCIEAER


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 6/8] PCI: added pci_msi_enabled which checks for pci=nomsi
  2008-10-29  5:48 [PATCH 0/8] call _OSC support during root bridge discovery Andrew Patterson
                   ` (4 preceding siblings ...)
  2008-10-29  5:48 ` [PATCH 5/8] ACPI, PCI: PCI MSI " Andrew Patterson
@ 2008-10-29  5:48 ` Andrew Patterson
  2008-10-29 14:33   ` Bjorn Helgaas
  2008-10-29  5:48 ` [PATCH 7/8] PCI: check if MSI is enabled before adding _OSC support capability Andrew Patterson
  2008-10-29  5:48 ` [PATCH 8/8] PCI, ACPI: remove obsolete _OSC capability support functions Andrew Patterson
  7 siblings, 1 reply; 20+ messages in thread
From: Andrew Patterson @ 2008-10-29  5:48 UTC (permalink / raw)
  To: linux-pci, linux-acpi; +Cc: andrew.patterson, matthew

PCI: added pci_msi_enabled which checks for pci=nomsi

The pci_msi_enabled() function is used to check whether pci=nomsi
is set on the kernel command-line.

Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
---

 drivers/pci/msi.c   |   12 ++++++++++++
 include/linux/pci.h |    5 +++++
 2 files changed, 17 insertions(+), 0 deletions(-)


diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index d281201..0e8dae1 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -755,6 +755,18 @@ void pci_no_msi(void)
 	pci_msi_enable = 0;
 }
 
+/**
+ * pci_msi_enabled - is MSI enabled?
+ *
+ * Returns true if MSI has not been disabled by the command-line option
+ * pci=nomsi.
+ **/
+int pci_msi_enabled(void)
+{
+	return pci_msi_enable;
+}
+EXPORT_SYMBOL(pci_msi_enabled);
+
 void pci_msi_init_pci_dev(struct pci_dev *dev)
 {
 	INIT_LIST_HEAD(&dev->msi_list);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 752def8..8d0513e 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -767,6 +767,10 @@ static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev)
 
 static inline void pci_restore_msi_state(struct pci_dev *dev)
 { }
+static inline int pci_msi_enabled(void)
+{
+	return 0;
+}
 #else
 extern int pci_enable_msi(struct pci_dev *dev);
 extern void pci_msi_shutdown(struct pci_dev *dev);
@@ -777,6 +781,7 @@ extern void pci_msix_shutdown(struct pci_dev *dev);
 extern void pci_disable_msix(struct pci_dev *dev);
 extern void msi_remove_pci_irq_vectors(struct pci_dev *dev);
 extern void pci_restore_msi_state(struct pci_dev *dev);
+extern int pci_msi_enabled(void);
 #endif
 
 #ifdef CONFIG_HT_IRQ

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 7/8] PCI: check if MSI is enabled before adding _OSC support capability
  2008-10-29  5:48 [PATCH 0/8] call _OSC support during root bridge discovery Andrew Patterson
                   ` (5 preceding siblings ...)
  2008-10-29  5:48 ` [PATCH 6/8] PCI: added pci_msi_enabled which checks for pci=nomsi Andrew Patterson
@ 2008-10-29  5:48 ` Andrew Patterson
  2008-10-29  6:19   ` Kenji Kaneshige
  2008-10-29 14:33   ` Bjorn Helgaas
  2008-10-29  5:48 ` [PATCH 8/8] PCI, ACPI: remove obsolete _OSC capability support functions Andrew Patterson
  7 siblings, 2 replies; 20+ messages in thread
From: Andrew Patterson @ 2008-10-29  5:48 UTC (permalink / raw)
  To: linux-pci, linux-acpi; +Cc: andrew.patterson, matthew

PCI: check if MSI is enabled before adding _OSC support capability

Ensure that pci=nomsi is not set before adding the _OSC support capability
OSC_MSI_SUPPORT to the root bridge.

Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
---

 drivers/acpi/pci_root.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)


diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 75a59ea..32afd02 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -194,6 +194,7 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
 	unsigned long long value = 0;
 	acpi_handle handle = NULL;
 	struct acpi_device *child;
+	u32 flags;
 
 
 	if (!device)
@@ -211,17 +212,18 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
 
 	device->ops.bind = acpi_pci_bind;
 
-	pci_acpi_osc_support(device->handle,
-			     OSC_EXT_PCI_CONFIG_SUPPORT |
-			     OSC_PCI_SEGMENT_GROUPS_SUPPORT |
-#ifdef CONFIG_PCI_MSI
-			     OSC_MSI_SUPPORT |
-#endif
+	flags = (OSC_EXT_PCI_CONFIG_SUPPORT |
+		 OSC_PCI_SEGMENT_GROUPS_SUPPORT |
 #ifdef CONFIG_PCIEASPM
-			     OSC_ACTIVE_STATE_PWR_SUPPORT |
-			     OSC_CLOCK_PWR_CAPABILITY_SUPPORT |
+		 OSC_ACTIVE_STATE_PWR_SUPPORT |
+		 OSC_CLOCK_PWR_CAPABILITY_SUPPORT |
+#endif
+		 0);
+#ifdef CONFIG_PCI_MSI
+	if (pci_msi_enabled())
+		flags |= OSC_MSI_SUPPORT;
 #endif
-			     0);
+	pci_acpi_osc_support(device->handle, flags);
 
 	/* 
 	 * Segment

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 8/8] PCI, ACPI: remove obsolete _OSC capability support functions
  2008-10-29  5:48 [PATCH 0/8] call _OSC support during root bridge discovery Andrew Patterson
                   ` (6 preceding siblings ...)
  2008-10-29  5:48 ` [PATCH 7/8] PCI: check if MSI is enabled before adding _OSC support capability Andrew Patterson
@ 2008-10-29  5:48 ` Andrew Patterson
  7 siblings, 0 replies; 20+ messages in thread
From: Andrew Patterson @ 2008-10-29  5:48 UTC (permalink / raw)
  To: linux-pci, linux-acpi; +Cc: andrew.patterson, matthew

PCI, ACPI: remove obsolete _OSC capability support functions

The acpi_query_osc, __pci_osc_support_set, pci_osc_support_set, and
pcie_osc_support_set functions have been obsoleted in favor of setting
these capabilities during root bridge discovery with pci_acpi_osc_support.
There are no longer any callers of these functions, so they are removed.

Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
---

 drivers/pci/pci-acpi.c   |   25 -------------------------
 include/linux/pci-acpi.h |   11 -----------
 2 files changed, 0 insertions(+), 36 deletions(-)


diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index f457387..128ce7d 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -171,31 +171,6 @@ out:
 	return rc;
 }
 
-static acpi_status acpi_query_osc(acpi_handle handle, u32 level,
-				  void *context, void **retval)
-{
-	pci_acpi_osc_support(handle, (unsigned long)context);
-	return AE_OK;
-}
-
-/**
- * __pci_osc_support_set - register OS support to Firmware
- * @flags: OS support bits
- * @hid: hardware ID
- *
- * Update OS support fields and doing a _OSC Query to obtain an update
- * from Firmware on supported control bits.
- **/
-acpi_status __pci_osc_support_set(u32 flags, const char *hid)
-{
-	if (!(flags & OSC_SUPPORT_MASKS))
-		return AE_TYPE;
-
-	acpi_get_devices(hid, acpi_query_osc,
-			 (void *)(unsigned long)flags, NULL);
-	return AE_OK;
-}
-
 /**
  * pci_osc_control_set - commit requested control to Firmware
  * @handle: acpi_handle for the target ACPI object
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 424f06f..871e096 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -50,16 +50,7 @@
 
 #ifdef CONFIG_ACPI
 extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags);
-extern acpi_status __pci_osc_support_set(u32 flags, const char *hid);
 int pci_acpi_osc_support(acpi_handle handle, u32 flags);
-static inline acpi_status pci_osc_support_set(u32 flags)
-{
-	return __pci_osc_support_set(flags, PCI_ROOT_HID_STRING);
-}
-static inline acpi_status pcie_osc_support_set(u32 flags)
-{
-	return __pci_osc_support_set(flags, PCI_EXPRESS_ROOT_HID_STRING);
-}
 static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
 {
 	/* Find root host bridge */
@@ -76,8 +67,6 @@ typedef u32 		acpi_status;
 #endif    
 static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
 {return AE_ERROR;}
-static inline acpi_status pci_osc_support_set(u32 flags) {return AE_ERROR;} 
-static inline acpi_status pcie_osc_support_set(u32 flags) {return AE_ERROR;}
 static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
 { return NULL; }
 #endif


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 3/8] ACPI, PCI: PCIe ASPM _OSC support capabilities called when root bridge added
  2008-10-29  5:48 ` [PATCH 3/8] ACPI, PCI: PCIe ASPM _OSC support capabilities called when root bridge added Andrew Patterson
@ 2008-10-29  6:06   ` Kenji Kaneshige
  2008-10-29 16:19     ` Andrew Patterson
  2008-10-29 22:57     ` Andrew Patterson
  0 siblings, 2 replies; 20+ messages in thread
From: Kenji Kaneshige @ 2008-10-29  6:06 UTC (permalink / raw)
  To: Andrew Patterson; +Cc: linux-pci, linux-acpi, matthew

Andrew Patterson wrote:
> ACPI, PCI: PCIe ASPM _OSC support capabilities called when root bridge added
> 
> The _OSC capabilities OSC_ACTIVE_STATE_PWR_SUPPORT and
> OSC_CLOCK_PWR_CAPABILITY_SUPPORT are set when the root bridge is added
> with pci_acpi_osc_support(), so we no longer need to do it in the
> ASPM driver.
> ---
> 
>  drivers/acpi/pci_root.c |    4 ++++
>  drivers/pci/pcie/aspm.c |   22 ----------------------
>  2 files changed, 4 insertions(+), 22 deletions(-)
> 
> 
> diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
> index 47df4a8..4d60629 100644
> --- a/drivers/acpi/pci_root.c
> +++ b/drivers/acpi/pci_root.c
> @@ -214,6 +214,10 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
>  	pci_acpi_osc_support(device->handle,
>  			     OSC_EXT_PCI_CONFIG_SUPPORT |
>  			     OSC_PCI_SEGMENT_GROUPS_SUPPORT |
> +#ifdef CONFIG_PCIEASPM
> +			     OSC_ACTIVE_STATE_PWR_SUPPORT |
> +			     OSC_CLOCK_PWR_CAPABILITY_SUPPORT |
> +#endif

Don't we need to check 'aspm_disabled'?

Thanks,
Kenji Kaneshige




>  			     0);
>  
>  	/* 
> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
> index 8f63f4c..2c87883 100644
> --- a/drivers/pci/pcie/aspm.c
> +++ b/drivers/pci/pcie/aspm.c
> @@ -833,25 +833,3 @@ void pcie_no_aspm(void)
>  	if (!aspm_force)
>  		aspm_disabled = 1;
>  }
> -
> -#ifdef CONFIG_ACPI
> -#include <acpi/acpi_bus.h>
> -#include <linux/pci-acpi.h>
> -static void pcie_aspm_platform_init(void)
> -{
> -	pcie_osc_support_set(OSC_ACTIVE_STATE_PWR_SUPPORT|
> -		OSC_CLOCK_PWR_CAPABILITY_SUPPORT);
> -}
> -#else
> -static inline void pcie_aspm_platform_init(void) { }
> -#endif
> -
> -static int __init pcie_aspm_init(void)
> -{
> -	if (aspm_disabled)
> -		return 0;
> -	pcie_aspm_platform_init();
> -	return 0;
> -}
> -
> -fs_initcall(pcie_aspm_init);
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 7/8] PCI: check if MSI is enabled before adding _OSC support capability
  2008-10-29  5:48 ` [PATCH 7/8] PCI: check if MSI is enabled before adding _OSC support capability Andrew Patterson
@ 2008-10-29  6:19   ` Kenji Kaneshige
  2008-10-30  4:51     ` Andrew Patterson
  2008-10-29 14:33   ` Bjorn Helgaas
  1 sibling, 1 reply; 20+ messages in thread
From: Kenji Kaneshige @ 2008-10-29  6:19 UTC (permalink / raw)
  To: Andrew Patterson; +Cc: linux-pci, linux-acpi, matthew

Andrew Patterson wrote:
> PCI: check if MSI is enabled before adding _OSC support capability
> 
> Ensure that pci=nomsi is not set before adding the _OSC support capability
> OSC_MSI_SUPPORT to the root bridge.
> 
> Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
> ---
> 
>  drivers/acpi/pci_root.c |   20 +++++++++++---------
>  1 files changed, 11 insertions(+), 9 deletions(-)
> 
> 
> diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
> index 75a59ea..32afd02 100644
> --- a/drivers/acpi/pci_root.c
> +++ b/drivers/acpi/pci_root.c
> @@ -194,6 +194,7 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
>  	unsigned long long value = 0;
>  	acpi_handle handle = NULL;
>  	struct acpi_device *child;
> +	u32 flags;
>  
>  
>  	if (!device)
> @@ -211,17 +212,18 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
>  
>  	device->ops.bind = acpi_pci_bind;
>  
> -	pci_acpi_osc_support(device->handle,
> -			     OSC_EXT_PCI_CONFIG_SUPPORT |
> -			     OSC_PCI_SEGMENT_GROUPS_SUPPORT |
> -#ifdef CONFIG_PCI_MSI
> -			     OSC_MSI_SUPPORT |
> -#endif
> +	flags = (OSC_EXT_PCI_CONFIG_SUPPORT |
> +		 OSC_PCI_SEGMENT_GROUPS_SUPPORT |
>  #ifdef CONFIG_PCIEASPM
> -			     OSC_ACTIVE_STATE_PWR_SUPPORT |
> -			     OSC_CLOCK_PWR_CAPABILITY_SUPPORT |
> +		 OSC_ACTIVE_STATE_PWR_SUPPORT |
> +		 OSC_CLOCK_PWR_CAPABILITY_SUPPORT |
> +#endif
> +		 0);
> +#ifdef CONFIG_PCI_MSI
> +	if (pci_msi_enabled())
> +		flags |= OSC_MSI_SUPPORT;
>  #endif
> -			     0);
> +	pci_acpi_osc_support(device->handle, flags);
>  
>  	/* 
>  	 * Segment

I think the 'pci_msi_enable' variable can be changed after
acpi_pci_root_add() is called by quirk_disable_all_msi()
(in driver/pci/quirk.c).

Thanks,
Kenji Kaneshige

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/8] ACPI, PCI: call _OSC support during root bridge discovery
  2008-10-29  5:48 ` [PATCH 2/8] ACPI, PCI: call _OSC support during root bridge discovery Andrew Patterson
@ 2008-10-29 14:30   ` Bjorn Helgaas
  2008-10-29 20:28     ` Andrew Patterson
  0 siblings, 1 reply; 20+ messages in thread
From: Bjorn Helgaas @ 2008-10-29 14:30 UTC (permalink / raw)
  To: Andrew Patterson; +Cc: linux-pci, linux-acpi, matthew

On Tuesday 28 October 2008 11:48:26 pm Andrew Patterson wrote:
> ACPI, PCI: call _OSC support during root bridge discovery
> 
> Added pci_acpi_isc_support() which is called when a PCI bridge is

s/_isc_/_osc_/

> added, so individual PCI root bridge drivers do not have to call _OSC
> support for every root bridge in their probe functions.
> ---
> 
>  drivers/acpi/pci_root.c  |    6 ++++++
>  drivers/pci/pci-acpi.c   |   24 +++++++++++++++++++-----
>  include/linux/pci-acpi.h |    1 +
>  3 files changed, 26 insertions(+), 5 deletions(-)
> 
> 
> diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
> index 1b8f67d..47df4a8 100644
> --- a/drivers/acpi/pci_root.c
> +++ b/drivers/acpi/pci_root.c
> @@ -31,6 +31,7 @@
>  #include <linux/spinlock.h>
>  #include <linux/pm.h>
>  #include <linux/pci.h>
> +#include <linux/pci-acpi.h>
>  #include <linux/acpi.h>
>  #include <acpi/acpi_bus.h>
>  #include <acpi/acpi_drivers.h>
> @@ -210,6 +211,11 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
>  
>  	device->ops.bind = acpi_pci_bind;
>  
> +	pci_acpi_osc_support(device->handle,
> +			     OSC_EXT_PCI_CONFIG_SUPPORT |
> +			     OSC_PCI_SEGMENT_GROUPS_SUPPORT |
> +			     0);
> +
>  	/* 
>  	 * Segment
>  	 * -------
> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> index dfe7c8e..f457387 100644
> --- a/drivers/pci/pci-acpi.c
> +++ b/drivers/pci/pci-acpi.c
> @@ -139,28 +139,42 @@ static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data,
>  	return status;
>  }
>  
> -static acpi_status acpi_query_osc(acpi_handle handle,
> -				  u32 level, void *context, void **retval)
> +/*
> + * pci_acpi_osc_support: Invoke _OSC indicating support for the given feature
> + * @flags: Bitmask of flags to support
> + *
> + * See the ACPI spec for the definition of the flags
> + */
> +int pci_acpi_osc_support(acpi_handle handle, u32 flags)
>  {
> +	u32 dummy;
>  	acpi_status status;
> -	struct acpi_osc_data *osc_data;
> -	u32 flags = (unsigned long)context, dummy;
>  	acpi_handle tmp;
> +	struct acpi_osc_data *osc_data;
> +	int rc = 0;
>  
>  	status = acpi_get_handle(handle, "_OSC", &tmp);
>  	if (ACPI_FAILURE(status))
> -		return AE_OK;
> +		return -ENOTTY;
>  
>  	mutex_lock(&pci_acpi_lock);
>  	osc_data = acpi_get_osc_data(handle);
>  	if (!osc_data) {
>  		printk(KERN_ERR "acpi osc data array is full\n");

I know you didn't change this printk, but since you're here,
can you clean this up?  I propose removing this printk altogether,
then checking the return from pci_acpi_osc_support() and using
dev_warn (with the flags and return value) if it fails.

> +		rc = -ENOMEM;
>  		goto out;
>  	}
>  
>  	__acpi_query_osc(flags, osc_data, &dummy);
>  out:
>  	mutex_unlock(&pci_acpi_lock);
> +	return rc;
> +}
> +
> +static acpi_status acpi_query_osc(acpi_handle handle, u32 level,
> +				  void *context, void **retval)
> +{
> +	pci_acpi_osc_support(handle, (unsigned long)context);
>  	return AE_OK;
>  }
>  
> diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
> index a9e4c34..424f06f 100644
> --- a/include/linux/pci-acpi.h
> +++ b/include/linux/pci-acpi.h
> @@ -51,6 +51,7 @@
>  #ifdef CONFIG_ACPI
>  extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags);
>  extern acpi_status __pci_osc_support_set(u32 flags, const char *hid);
> +int pci_acpi_osc_support(acpi_handle handle, u32 flags);
>  static inline acpi_status pci_osc_support_set(u32 flags)
>  {
>  	return __pci_osc_support_set(flags, PCI_ROOT_HID_STRING);
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 6/8] PCI: added pci_msi_enabled which checks for pci=nomsi
  2008-10-29  5:48 ` [PATCH 6/8] PCI: added pci_msi_enabled which checks for pci=nomsi Andrew Patterson
@ 2008-10-29 14:33   ` Bjorn Helgaas
  2008-10-29 21:36     ` Andrew Patterson
  0 siblings, 1 reply; 20+ messages in thread
From: Bjorn Helgaas @ 2008-10-29 14:33 UTC (permalink / raw)
  To: Andrew Patterson; +Cc: linux-pci, linux-acpi, matthew

On Tuesday 28 October 2008 11:48:46 pm Andrew Patterson wrote:
> PCI: added pci_msi_enabled which checks for pci=nomsi
> 
> The pci_msi_enabled() function is used to check whether pci=nomsi
> is set on the kernel command-line.
> 
> Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
> ---
> 
>  drivers/pci/msi.c   |   12 ++++++++++++
>  include/linux/pci.h |    5 +++++
>  2 files changed, 17 insertions(+), 0 deletions(-)
> 
> 
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index d281201..0e8dae1 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -755,6 +755,18 @@ void pci_no_msi(void)
>  	pci_msi_enable = 0;
>  }
>  
> +/**
> + * pci_msi_enabled - is MSI enabled?
> + *
> + * Returns true if MSI has not been disabled by the command-line option
> + * pci=nomsi.
> + **/
> +int pci_msi_enabled(void)
> +{
> +	return pci_msi_enable;
> +}
> +EXPORT_SYMBOL(pci_msi_enabled);
> +
>  void pci_msi_init_pci_dev(struct pci_dev *dev)
>  {
>  	INIT_LIST_HEAD(&dev->msi_list);
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 752def8..8d0513e 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -767,6 +767,10 @@ static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev)
>  
>  static inline void pci_restore_msi_state(struct pci_dev *dev)
>  { }
> +static inline int pci_msi_enabled(void)
> +{
> +	return 0;
> +}
>  #else
>  extern int pci_enable_msi(struct pci_dev *dev);
>  extern void pci_msi_shutdown(struct pci_dev *dev);
> @@ -777,6 +781,7 @@ extern void pci_msix_shutdown(struct pci_dev *dev);
>  extern void pci_disable_msix(struct pci_dev *dev);
>  extern void msi_remove_pci_irq_vectors(struct pci_dev *dev);
>  extern void pci_restore_msi_state(struct pci_dev *dev);
> +extern int pci_msi_enabled(void);
>  #endif
>  
>  #ifdef CONFIG_HT_IRQ

I don't think it's worth splitting out this patch.  You might
as well just add pci_msi_enabled() in the same patch where you
add a use of it.

Bjorn

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 7/8] PCI: check if MSI is enabled before adding _OSC support capability
  2008-10-29  5:48 ` [PATCH 7/8] PCI: check if MSI is enabled before adding _OSC support capability Andrew Patterson
  2008-10-29  6:19   ` Kenji Kaneshige
@ 2008-10-29 14:33   ` Bjorn Helgaas
  2008-10-29 21:57     ` Andrew Patterson
  1 sibling, 1 reply; 20+ messages in thread
From: Bjorn Helgaas @ 2008-10-29 14:33 UTC (permalink / raw)
  To: Andrew Patterson; +Cc: linux-pci, linux-acpi, matthew

On Tuesday 28 October 2008 11:48:51 pm Andrew Patterson wrote:
> PCI: check if MSI is enabled before adding _OSC support capability
> 
> Ensure that pci=nomsi is not set before adding the _OSC support capability
> OSC_MSI_SUPPORT to the root bridge.
> 
> Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
> ---
> 
>  drivers/acpi/pci_root.c |   20 +++++++++++---------
>  1 files changed, 11 insertions(+), 9 deletions(-)
> 
> 
> diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
> index 75a59ea..32afd02 100644
> --- a/drivers/acpi/pci_root.c
> +++ b/drivers/acpi/pci_root.c
> @@ -194,6 +194,7 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
>  	unsigned long long value = 0;
>  	acpi_handle handle = NULL;
>  	struct acpi_device *child;
> +	u32 flags;
>  
>  
>  	if (!device)
> @@ -211,17 +212,18 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
>  
>  	device->ops.bind = acpi_pci_bind;
>  
> -	pci_acpi_osc_support(device->handle,
> -			     OSC_EXT_PCI_CONFIG_SUPPORT |
> -			     OSC_PCI_SEGMENT_GROUPS_SUPPORT |
> -#ifdef CONFIG_PCI_MSI
> -			     OSC_MSI_SUPPORT |
> -#endif
> +	flags = (OSC_EXT_PCI_CONFIG_SUPPORT |
> +		 OSC_PCI_SEGMENT_GROUPS_SUPPORT |
>  #ifdef CONFIG_PCIEASPM
> -			     OSC_ACTIVE_STATE_PWR_SUPPORT |
> -			     OSC_CLOCK_PWR_CAPABILITY_SUPPORT |
> +		 OSC_ACTIVE_STATE_PWR_SUPPORT |
> +		 OSC_CLOCK_PWR_CAPABILITY_SUPPORT |
> +#endif
> +		 0);
> +#ifdef CONFIG_PCI_MSI
> +	if (pci_msi_enabled())
> +		flags |= OSC_MSI_SUPPORT;
>  #endif
> -			     0);
> +	pci_acpi_osc_support(device->handle, flags);

I think this should be folded into patch 5/8.  Otherwise, bisection
won't work across this series because at patch 5, we always add
OSC_MSI_SUPPORT, regardless of "pci=nomsi".

If you introduce "flags" in patch 2/8, the rest of the patches will
be clearer (and it will facilitate a useful dev_warn() when
pci_acpi_osc_support() fails).

You don't need the "#ifdef CONFIG_PCI_MSI" here, do you?

Bjorn

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 3/8] ACPI, PCI: PCIe ASPM _OSC support capabilities called when root bridge added
  2008-10-29  6:06   ` Kenji Kaneshige
@ 2008-10-29 16:19     ` Andrew Patterson
  2008-10-29 22:57     ` Andrew Patterson
  1 sibling, 0 replies; 20+ messages in thread
From: Andrew Patterson @ 2008-10-29 16:19 UTC (permalink / raw)
  To: Kenji Kaneshige; +Cc: linux-pci, linux-acpi, matthew

On Wed, 2008-10-29 at 15:06 +0900, Kenji Kaneshige wrote:
> Andrew Patterson wrote:
> > ACPI, PCI: PCIe ASPM _OSC support capabilities called when root bridge added
> > 
> > The _OSC capabilities OSC_ACTIVE_STATE_PWR_SUPPORT and
> > OSC_CLOCK_PWR_CAPABILITY_SUPPORT are set when the root bridge is added
> > with pci_acpi_osc_support(), so we no longer need to do it in the
> > ASPM driver.
> > ---
> > 
> >  drivers/acpi/pci_root.c |    4 ++++
> >  drivers/pci/pcie/aspm.c |   22 ----------------------
> >  2 files changed, 4 insertions(+), 22 deletions(-)
> > 
> > 
> > diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
> > index 47df4a8..4d60629 100644
> > --- a/drivers/acpi/pci_root.c
> > +++ b/drivers/acpi/pci_root.c
> > @@ -214,6 +214,10 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
> >  	pci_acpi_osc_support(device->handle,
> >  			     OSC_EXT_PCI_CONFIG_SUPPORT |
> >  			     OSC_PCI_SEGMENT_GROUPS_SUPPORT |
> > +#ifdef CONFIG_PCIEASPM
> > +			     OSC_ACTIVE_STATE_PWR_SUPPORT |
> > +			     OSC_CLOCK_PWR_CAPABILITY_SUPPORT |
> > +#endif
> 
> Don't we need to check 'aspm_disabled'?

I'll fix this.

Andrew

> 
> Thanks,
> Kenji Kaneshige
> 
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/8] ACPI, PCI: call _OSC support during root bridge discovery
  2008-10-29 14:30   ` Bjorn Helgaas
@ 2008-10-29 20:28     ` Andrew Patterson
  0 siblings, 0 replies; 20+ messages in thread
From: Andrew Patterson @ 2008-10-29 20:28 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, linux-acpi, matthew

On Wed, 2008-10-29 at 08:30 -0600, Bjorn Helgaas wrote:
> On Tuesday 28 October 2008 11:48:26 pm Andrew Patterson wrote:
> > ACPI, PCI: call _OSC support during root bridge discovery
> > 
> > Added pci_acpi_isc_support() which is called when a PCI bridge is
> 
> s/_isc_/_osc_/

Fixed.

> 
> > added, so individual PCI root bridge drivers do not have to call _OSC
> > support for every root bridge in their probe functions.
> > ---
> > 
> >  drivers/acpi/pci_root.c  |    6 ++++++
> >  drivers/pci/pci-acpi.c   |   24 +++++++++++++++++++-----
> >  include/linux/pci-acpi.h |    1 +
> >  3 files changed, 26 insertions(+), 5 deletions(-)
> > 
> > 
> > diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
> > index 1b8f67d..47df4a8 100644
> > --- a/drivers/acpi/pci_root.c
> > +++ b/drivers/acpi/pci_root.c
> > @@ -31,6 +31,7 @@
> >  #include <linux/spinlock.h>
> >  #include <linux/pm.h>
> >  #include <linux/pci.h>
> > +#include <linux/pci-acpi.h>
> >  #include <linux/acpi.h>
> >  #include <acpi/acpi_bus.h>
> >  #include <acpi/acpi_drivers.h>
> > @@ -210,6 +211,11 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
> >  
> >  	device->ops.bind = acpi_pci_bind;
> >  
> > +	pci_acpi_osc_support(device->handle,
> > +			     OSC_EXT_PCI_CONFIG_SUPPORT |
> > +			     OSC_PCI_SEGMENT_GROUPS_SUPPORT |
> > +			     0);
> > +
> >  	/* 
> >  	 * Segment
> >  	 * -------
> > diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> > index dfe7c8e..f457387 100644
> > --- a/drivers/pci/pci-acpi.c
> > +++ b/drivers/pci/pci-acpi.c
> > @@ -139,28 +139,42 @@ static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data,
> >  	return status;
> >  }
> >  
> > -static acpi_status acpi_query_osc(acpi_handle handle,
> > -				  u32 level, void *context, void **retval)
> > +/*
> > + * pci_acpi_osc_support: Invoke _OSC indicating support for the given feature
> > + * @flags: Bitmask of flags to support
> > + *
> > + * See the ACPI spec for the definition of the flags
> > + */
> > +int pci_acpi_osc_support(acpi_handle handle, u32 flags)
> >  {
> > +	u32 dummy;
> >  	acpi_status status;
> > -	struct acpi_osc_data *osc_data;
> > -	u32 flags = (unsigned long)context, dummy;
> >  	acpi_handle tmp;
> > +	struct acpi_osc_data *osc_data;
> > +	int rc = 0;
> >  
> >  	status = acpi_get_handle(handle, "_OSC", &tmp);
> >  	if (ACPI_FAILURE(status))
> > -		return AE_OK;
> > +		return -ENOTTY;
> >  
> >  	mutex_lock(&pci_acpi_lock);
> >  	osc_data = acpi_get_osc_data(handle);
> >  	if (!osc_data) {
> >  		printk(KERN_ERR "acpi osc data array is full\n");
> 
> I know you didn't change this printk, but since you're here,
> can you clean this up?  I propose removing this printk altogether,
> then checking the return from pci_acpi_osc_support() and using
> dev_warn (with the flags and return value) if it fails.
> 

One problem we would have with this change is that there are a lot of
platforms that don't implement _OSC, so we would get a lot of spew when
calling pci_acpi_osc_support on those systems (returning -ENOTTY).
Matthew is talking about moving this allocation into the acpi_pci_root
struct, so this issue should become moot at that point.

> > +		rc = -ENOMEM;
> >  		goto out;
> >  	}
> >  

Andrew



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 6/8] PCI: added pci_msi_enabled which checks for pci=nomsi
  2008-10-29 14:33   ` Bjorn Helgaas
@ 2008-10-29 21:36     ` Andrew Patterson
  0 siblings, 0 replies; 20+ messages in thread
From: Andrew Patterson @ 2008-10-29 21:36 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, linux-acpi, matthew

On Wed, 2008-10-29 at 08:33 -0600, Bjorn Helgaas wrote:
> On Tuesday 28 October 2008 11:48:46 pm Andrew Patterson wrote:
> > PCI: added pci_msi_enabled which checks for pci=nomsi
> > 
> > The pci_msi_enabled() function is used to check whether pci=nomsi
> > is set on the kernel command-line.
> > 
> > Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
> > ---
> > 
> >  drivers/pci/msi.c   |   12 ++++++++++++
> >  include/linux/pci.h |    5 +++++
> >  2 files changed, 17 insertions(+), 0 deletions(-)
> > 
> > 
> > diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> > index d281201..0e8dae1 100644
> > --- a/drivers/pci/msi.c
> > +++ b/drivers/pci/msi.c
> > @@ -755,6 +755,18 @@ void pci_no_msi(void)
> >  	pci_msi_enable = 0;
> >  }
> >  
> > +/**
> > + * pci_msi_enabled - is MSI enabled?
> > + *
> > + * Returns true if MSI has not been disabled by the command-line option
> > + * pci=nomsi.
> > + **/
> > +int pci_msi_enabled(void)
> > +{
> > +	return pci_msi_enable;
> > +}
> > +EXPORT_SYMBOL(pci_msi_enabled);
> > +
> >  void pci_msi_init_pci_dev(struct pci_dev *dev)
> >  {
> >  	INIT_LIST_HEAD(&dev->msi_list);
> > diff --git a/include/linux/pci.h b/include/linux/pci.h
> > index 752def8..8d0513e 100644
> > --- a/include/linux/pci.h
> > +++ b/include/linux/pci.h
> > @@ -767,6 +767,10 @@ static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev)
> >  
> >  static inline void pci_restore_msi_state(struct pci_dev *dev)
> >  { }
> > +static inline int pci_msi_enabled(void)
> > +{
> > +	return 0;
> > +}
> >  #else
> >  extern int pci_enable_msi(struct pci_dev *dev);
> >  extern void pci_msi_shutdown(struct pci_dev *dev);
> > @@ -777,6 +781,7 @@ extern void pci_msix_shutdown(struct pci_dev *dev);
> >  extern void pci_disable_msix(struct pci_dev *dev);
> >  extern void msi_remove_pci_irq_vectors(struct pci_dev *dev);
> >  extern void pci_restore_msi_state(struct pci_dev *dev);
> > +extern int pci_msi_enabled(void);
> >  #endif
> >  
> >  #ifdef CONFIG_HT_IRQ
> 
> I don't think it's worth splitting out this patch.  You might
> as well just add pci_msi_enabled() in the same patch where you
> add a use of it.
> 

Done.

Andrew

> Bjorn
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 7/8] PCI: check if MSI is enabled before adding _OSC support capability
  2008-10-29 14:33   ` Bjorn Helgaas
@ 2008-10-29 21:57     ` Andrew Patterson
  0 siblings, 0 replies; 20+ messages in thread
From: Andrew Patterson @ 2008-10-29 21:57 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, linux-acpi, matthew

On Wed, 2008-10-29 at 08:33 -0600, Bjorn Helgaas wrote:
> On Tuesday 28 October 2008 11:48:51 pm Andrew Patterson wrote:
> > PCI: check if MSI is enabled before adding _OSC support capability
> > 
> > Ensure that pci=nomsi is not set before adding the _OSC support capability
> > OSC_MSI_SUPPORT to the root bridge.
> > 
> > Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
> > ---
> > 
> >  drivers/acpi/pci_root.c |   20 +++++++++++---------
> >  1 files changed, 11 insertions(+), 9 deletions(-)
> > 
> > 
> > diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
> > index 75a59ea..32afd02 100644
> > --- a/drivers/acpi/pci_root.c
> > +++ b/drivers/acpi/pci_root.c
> > @@ -194,6 +194,7 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
> >  	unsigned long long value = 0;
> >  	acpi_handle handle = NULL;
> >  	struct acpi_device *child;
> > +	u32 flags;
> >  
> >  
> >  	if (!device)
> > @@ -211,17 +212,18 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
> >  
> >  	device->ops.bind = acpi_pci_bind;
> >  
> > -	pci_acpi_osc_support(device->handle,
> > -			     OSC_EXT_PCI_CONFIG_SUPPORT |
> > -			     OSC_PCI_SEGMENT_GROUPS_SUPPORT |
> > -#ifdef CONFIG_PCI_MSI
> > -			     OSC_MSI_SUPPORT |
> > -#endif
> > +	flags = (OSC_EXT_PCI_CONFIG_SUPPORT |
> > +		 OSC_PCI_SEGMENT_GROUPS_SUPPORT |
> >  #ifdef CONFIG_PCIEASPM
> > -			     OSC_ACTIVE_STATE_PWR_SUPPORT |
> > -			     OSC_CLOCK_PWR_CAPABILITY_SUPPORT |
> > +		 OSC_ACTIVE_STATE_PWR_SUPPORT |
> > +		 OSC_CLOCK_PWR_CAPABILITY_SUPPORT |
> > +#endif
> > +		 0);
> > +#ifdef CONFIG_PCI_MSI
> > +	if (pci_msi_enabled())
> > +		flags |= OSC_MSI_SUPPORT;
> >  #endif
> > -			     0);
> > +	pci_acpi_osc_support(device->handle, flags);
> 
> I think this should be folded into patch 5/8.  Otherwise, bisection
> won't work across this series because at patch 5, we always add
> OSC_MSI_SUPPORT, regardless of "pci=nomsi".
> 

Done.

> If you introduce "flags" in patch 2/8, the rest of the patches will
> be clearer (and it will facilitate a useful dev_warn() when
> pci_acpi_osc_support() fails).

Done.

> 
> You don't need the "#ifdef CONFIG_PCI_MSI" here, do you?

No, Removed.

> 
> Bjorn
> 

Andrew

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 3/8] ACPI, PCI: PCIe ASPM _OSC support capabilities called when root bridge added
  2008-10-29  6:06   ` Kenji Kaneshige
  2008-10-29 16:19     ` Andrew Patterson
@ 2008-10-29 22:57     ` Andrew Patterson
  1 sibling, 0 replies; 20+ messages in thread
From: Andrew Patterson @ 2008-10-29 22:57 UTC (permalink / raw)
  To: Kenji Kaneshige; +Cc: linux-pci, linux-acpi, matthew

On Wed, 2008-10-29 at 15:06 +0900, Kenji Kaneshige wrote:
> Andrew Patterson wrote:
> > ACPI, PCI: PCIe ASPM _OSC support capabilities called when root bridge added
> > 
> > The _OSC capabilities OSC_ACTIVE_STATE_PWR_SUPPORT and
> > OSC_CLOCK_PWR_CAPABILITY_SUPPORT are set when the root bridge is added
> > with pci_acpi_osc_support(), so we no longer need to do it in the
> > ASPM driver.
> > ---
> > 
> >  drivers/acpi/pci_root.c |    4 ++++
> >  drivers/pci/pcie/aspm.c |   22 ----------------------
> >  2 files changed, 4 insertions(+), 22 deletions(-)
> > 
> > 
> > diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
> > index 47df4a8..4d60629 100644
> > --- a/drivers/acpi/pci_root.c
> > +++ b/drivers/acpi/pci_root.c
> > @@ -214,6 +214,10 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
> >  	pci_acpi_osc_support(device->handle,
> >  			     OSC_EXT_PCI_CONFIG_SUPPORT |
> >  			     OSC_PCI_SEGMENT_GROUPS_SUPPORT |
> > +#ifdef CONFIG_PCIEASPM
> > +			     OSC_ACTIVE_STATE_PWR_SUPPORT |
> > +			     OSC_CLOCK_PWR_CAPABILITY_SUPPORT |
> > +#endif
> 
> Don't we need to check 'aspm_disabled'?

Added the function pcie_aspm_enabled, which is checked before adding the
ASPM capabilities to the flags.  Which also means I can remove the
#ifdef CONFIG_PCIEASPM.

Andrew

> 
> Thanks,
> Kenji Kaneshige
> 
> 


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 7/8] PCI: check if MSI is enabled before adding _OSC support capability
  2008-10-29  6:19   ` Kenji Kaneshige
@ 2008-10-30  4:51     ` Andrew Patterson
  0 siblings, 0 replies; 20+ messages in thread
From: Andrew Patterson @ 2008-10-30  4:51 UTC (permalink / raw)
  To: Kenji Kaneshige; +Cc: linux-pci, linux-acpi, matthew

On Wed, 2008-10-29 at 15:19 +0900, Kenji Kaneshige wrote:
> Andrew Patterson wrote:
> > PCI: check if MSI is enabled before adding _OSC support capability
> > 
> > Ensure that pci=nomsi is not set before adding the _OSC support capability
> > OSC_MSI_SUPPORT to the root bridge.
> > 
> > Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
> > ---
> > 
> >  drivers/acpi/pci_root.c |   20 +++++++++++---------
> >  1 files changed, 11 insertions(+), 9 deletions(-)
> > 
> > 
> > diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
> > index 75a59ea..32afd02 100644
> > --- a/drivers/acpi/pci_root.c
> > +++ b/drivers/acpi/pci_root.c
> > @@ -194,6 +194,7 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
> >  	unsigned long long value = 0;
> >  	acpi_handle handle = NULL;
> >  	struct acpi_device *child;
> > +	u32 flags;
> >  
> >  
> >  	if (!device)
> > @@ -211,17 +212,18 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
> >  
> >  	device->ops.bind = acpi_pci_bind;
> >  
> > -	pci_acpi_osc_support(device->handle,
> > -			     OSC_EXT_PCI_CONFIG_SUPPORT |
> > -			     OSC_PCI_SEGMENT_GROUPS_SUPPORT |
> > -#ifdef CONFIG_PCI_MSI
> > -			     OSC_MSI_SUPPORT |
> > -#endif
> > +	flags = (OSC_EXT_PCI_CONFIG_SUPPORT |
> > +		 OSC_PCI_SEGMENT_GROUPS_SUPPORT |
> >  #ifdef CONFIG_PCIEASPM
> > -			     OSC_ACTIVE_STATE_PWR_SUPPORT |
> > -			     OSC_CLOCK_PWR_CAPABILITY_SUPPORT |
> > +		 OSC_ACTIVE_STATE_PWR_SUPPORT |
> > +		 OSC_CLOCK_PWR_CAPABILITY_SUPPORT |
> > +#endif
> > +		 0);
> > +#ifdef CONFIG_PCI_MSI
> > +	if (pci_msi_enabled())
> > +		flags |= OSC_MSI_SUPPORT;
> >  #endif
> > -			     0);
> > +	pci_acpi_osc_support(device->handle, flags);
> >  
> >  	/* 
> >  	 * Segment
> 
> I think the 'pci_msi_enable' variable can be changed after
> acpi_pci_root_add() is called by quirk_disable_all_msi()
> (in driver/pci/quirk.c).

I am not sure what to do about this one.  I think the correct thing to
do is use Matthew's as yet unwritten root bridge iterator function to
remove the OSC_MSI_SUPPORT flag for all root bridges. I suspect that it
will not hurt to have this flag set given that we disable the use of all
MSI.

Andrew

> Thanks,
> Kenji Kaneshige
> 



^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2008-10-30  4:51 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-29  5:48 [PATCH 0/8] call _OSC support during root bridge discovery Andrew Patterson
2008-10-29  5:48 ` [PATCH 1/8] PCI, ACPI: include missing acpi.h file in pci-acpi.h Andrew Patterson
2008-10-29  5:48 ` [PATCH 2/8] ACPI, PCI: call _OSC support during root bridge discovery Andrew Patterson
2008-10-29 14:30   ` Bjorn Helgaas
2008-10-29 20:28     ` Andrew Patterson
2008-10-29  5:48 ` [PATCH 3/8] ACPI, PCI: PCIe ASPM _OSC support capabilities called when root bridge added Andrew Patterson
2008-10-29  6:06   ` Kenji Kaneshige
2008-10-29 16:19     ` Andrew Patterson
2008-10-29 22:57     ` Andrew Patterson
2008-10-29  5:48 ` [PATCH 4/8] ACPI, PCI: PCIe AER " Andrew Patterson
2008-10-29  5:48 ` [PATCH 5/8] ACPI, PCI: PCI MSI " Andrew Patterson
2008-10-29  5:48 ` [PATCH 6/8] PCI: added pci_msi_enabled which checks for pci=nomsi Andrew Patterson
2008-10-29 14:33   ` Bjorn Helgaas
2008-10-29 21:36     ` Andrew Patterson
2008-10-29  5:48 ` [PATCH 7/8] PCI: check if MSI is enabled before adding _OSC support capability Andrew Patterson
2008-10-29  6:19   ` Kenji Kaneshige
2008-10-30  4:51     ` Andrew Patterson
2008-10-29 14:33   ` Bjorn Helgaas
2008-10-29 21:57     ` Andrew Patterson
2008-10-29  5:48 ` [PATCH 8/8] PCI, ACPI: remove obsolete _OSC capability support functions Andrew Patterson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox