call _OSC support during root bridge discovery
cover call _OSC support during root bridge discovery
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.
Signature · 1 line
Andrew Patterson
PATCH 1/8 PCI, ACPI: include missing acpi.h file in pci-acpi.h.
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(-)
include/linux/pci-acpi.h +2 -0
@@ -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
PATCH 2/8 ACPI, PCI: call _OSC support during root bridge discovery
In reply to Andrew PattersonACPI, 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(-)
drivers/acpi/pci_root.c +6 -0
@@ -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 * -------
drivers/pci/pci-acpi.c +19 -5
@@ -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 ; }
include/linux/pci-acpi.h +1 -0
@@ -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 );
Re: [PATCH 2/8] ACPI, PCI: call _OSC support during root bridge discovery
Quoted 3 lines · Andrew Patterson
ACPI, PCI: call
_OSCsupport during root bridge discoveryAdded
pci_acpi_isc_support()which is called when a PCI bridge is
s/_isc_/_osc_/
Quoted 59 lines
added, so individual PCI root bridge drivers do not have to call
_OSCsupport 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(-)drivers/acpi/pci_root.c +6
-0@@ -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 * ------- drivers/pci/pci-acpi.c +10
-4@@ -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 ;
drivers/pci/pci-acpi.c static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data, · line 163
Quoted 10 lines
drivers/pci/pci-acpi.c +1
-1status =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.
Quoted 35 lines
drivers/pci/pci-acpi.c +8
-0+ 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 ; }include/linux/pci-acpi.h +1
-1@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/8] ACPI, PCI: call _OSC support during root bridge discovery
Quoted 6 lines · Bjorn Helgaas
Quoted 3 lines · Andrew Patterson
ACPI, PCI: call
_OSCsupport during root bridge discoveryAdded
pci_acpi_isc_support()which is called when a PCI bridge iss/_isc_/_osc_/
Fixed.
Quoted 66 lines
Quoted 66 lines
added, so individual PCI root bridge drivers do not have to call
_OSCsupport 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(-)drivers/acpi/pci_root.c +6
-0@@ -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 * ------- drivers/pci/pci-acpi.c +11
-5@@ -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 ;
Quoted 10 lines
drivers/pci/pci-acpi.c static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data, · line 163
Quoted 4 lines
drivers/pci/pci-acpi.c +0
-0mutex_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 usingdev_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.
Quoted 4 lines
drivers/pci/pci-acpi.c static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data, · line 167
Quoted 4 lines
drivers/pci/pci-acpi.c +1
-0+ rc = -ENOMEM ; goto out; }
Andrew
PATCH 3/8 ACPI, PCI: PCIe ASPM _OSC support capabilities called when root bridge added
In reply to Andrew PattersonACPI, 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(-)
drivers/acpi/pci_root.c +4 -0
@@ -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 | +#endif0 );/*
drivers/pci/pcie/aspm.c +0 -22
@@ -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);
Re: [PATCH 3/8] ACPI, PCI: PCIe ASPM _OSC support capabilities called when root bridge added
Quoted 18 lines · Andrew Patterson
ACPI, PCI: PCIe ASPM
_OSCsupport capabilities called when root bridge addedThe
_OSCcapabilitiesOSC_ACTIVE_STATE_PWR_SUPPORTandOSC_CLOCK_PWR_CAPABILITY_SUPPORTare set when the root bridge is added withpci_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(-)drivers/acpi/pci_root.c +0
-0
drivers/acpi/pci_root.c static int __devinit acpi_pci_root_add(struct acpi_device *device) · line 220
Quoted 7 lines
drivers/acpi/pci_root.c +4
-0@@ -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
Quoted 40 lines
drivers/acpi/pci_root.c +0
-00);/* drivers/pci/pcie/aspm.c +0
-23@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/8] ACPI, PCI: PCIe ASPM _OSC support capabilities called when root bridge added
Quoted 14 lines · Kenji Kaneshige
Quoted 13 lines · Andrew Patterson
ACPI, PCI: PCIe ASPM
_OSCsupport capabilities called when root bridge addedThe
_OSCcapabilitiesOSC_ACTIVE_STATE_PWR_SUPPORTandOSC_CLOCK_PWR_CAPABILITY_SUPPORTare set when the root bridge is added withpci_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(-)
Quoted 14 lines
drivers/acpi/pci_root.c static int __devinit acpi_pci_root_add(struct acpi_device *device) · line 220
Quoted 12 lines
drivers/acpi/pci_root.c +4
-0@@ -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
Quoted 5 lines
Thanks,
Kenji Kaneshige
Re: [PATCH 3/8] ACPI, PCI: PCIe ASPM _OSC support capabilities called when root bridge added
In reply to Kenji KaneshigeQuoted 14 lines · Kenji Kaneshige
Quoted 13 lines · Andrew Patterson
ACPI, PCI: PCIe ASPM
_OSCsupport capabilities called when root bridge addedThe
_OSCcapabilitiesOSC_ACTIVE_STATE_PWR_SUPPORTandOSC_CLOCK_PWR_CAPABILITY_SUPPORTare set when the root bridge is added withpci_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(-)
Quoted 14 lines
drivers/acpi/pci_root.c static int __devinit acpi_pci_root_add(struct acpi_device *device) · line 220
Quoted 12 lines
drivers/acpi/pci_root.c +4
-0@@ -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
Quoted 5 lines
Thanks,
Kenji Kaneshige
PATCH 4/8 ACPI, PCI: PCIe AER _OSC support capabilities called when root bridge added
In reply to Andrew PattersonACPI, 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(-)
drivers/pci/pcie/aer/aerdrv_acpi.c +0 -1
@@ -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 );
PATCH 5/8 ACPI, PCI: PCI MSI _OSC support capabilities called when root bridge added
In reply to Andrew PattersonACPI, 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(-)
drivers/acpi/pci_root.c +3 -0
@@ -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 |
drivers/pci/msi.c +0 -21
@@ -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 (); -}
drivers/pci/pci.c +0 -2
@@ -2032,8 +2032,6 @@ static int __devinit pci_init(void)pci_fixup_device (pci_fixup_final, dev); } -msi_init (); -return 0 ; }
drivers/pci/pci.h +0 -2
@@ -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
PATCH 6/8 PCI: added pci_msi_enabled which checks for pci=nomsi
In reply to Andrew PattersonPCI: 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.
---
drivers/pci/msi.c | 12 ++++++++++++ include/linux/pci.h | 5 +++++ 2 files changed, 17 insertions(+), 0 deletions(-)
drivers/pci/msi.c +12 -0
@@ -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);
include/linux/pci.h +5 -0
@@ -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
Re: [PATCH 6/8] PCI: added pci_msi_enabled which checks for pci=nomsi
Quoted 52 lines · Andrew Patterson
PCI: added
pci_msi_enabledwhich checks for pci=nomsiThe
pci_msi_enabled()function is used to check whether pci=nomsi is set on the kernel command-line.Signed-off-by Andrew Patterson <[email protected]>---
drivers/pci/msi.c | 12 ++++++++++++ include/linux/pci.h | 5 +++++ 2 files changed, 17 insertions(+), 0 deletions(-)drivers/pci/msi.c +12
-0@@ -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);include/linux/pci.h +4
-0@@ -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);
include/linux/pci.h extern void pci_msix_shutdown(struct pci_dev *dev); · line 787
Quoted 7 lines
include/linux/pci.h +1
-0@@ -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
Re: [PATCH 6/8] PCI: added pci_msi_enabled which checks for pci=nomsi
Quoted 59 lines · Bjorn Helgaas
Quoted 58 lines · Andrew Patterson
PCI: added
pci_msi_enabledwhich checks for pci=nomsiThe
pci_msi_enabled()function is used to check whether pci=nomsi is set on the kernel command-line.Signed-off-by Andrew Patterson <[email protected]>---
drivers/pci/msi.c | 12 ++++++++++++ include/linux/pci.h | 5 +++++ 2 files changed, 17 insertions(+), 0 deletions(-)drivers/pci/msi.c +12
-0@@ -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);include/linux/pci.h +5
-0@@ -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
Quoted 6 lines
include/linux/pci.h extern void pci_msix_shutdown(struct pci_dev *dev); · line 787
Quoted 1 line
include/linux/pci.h +0
-0#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
Quoted 2 lines
Bjorn
PATCH 7/8 PCI: check if MSI is enabled before adding _OSC support capability
In reply to Andrew PattersonPCI: 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.
---
drivers/acpi/pci_root.c | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-)
drivers/acpi/pci_root.c +11 -9
@@ -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
Re: [PATCH 7/8] PCI: check if MSI is enabled before adding _OSC support capability
Quoted 42 lines · Andrew Patterson
PCI: check if MSI is enabled before adding
_OSCsupport capabilityEnsure that pci=nomsi is not set before adding the
_OSCsupport capabilityOSC_MSI_SUPPORTto the root bridge.Signed-off-by Andrew Patterson <[email protected]>---
drivers/acpi/pci_root.c | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-)drivers/acpi/pci_root.c +6
-8@@ -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
drivers/acpi/pci_root.c static int __devinit acpi_pci_root_add(struct acpi_device *device) · line 229
Quoted 10 lines
drivers/acpi/pci_root.c +5
-1+ 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
Re: [PATCH 7/8] PCI: check if MSI is enabled before adding _OSC support capability
Quoted 51 lines · Kenji Kaneshige
Quoted 50 lines · Andrew Patterson
PCI: check if MSI is enabled before adding
_OSCsupport capabilityEnsure that pci=nomsi is not set before adding the
_OSCsupport capabilityOSC_MSI_SUPPORTto the root bridge.Signed-off-by Andrew Patterson <[email protected]>---
drivers/acpi/pci_root.c | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-)drivers/acpi/pci_root.c +11
-9@@ -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);
Quoted 6 lines
drivers/acpi/pci_root.c static int __devinit acpi_pci_root_add(struct acpi_device *device) · line 229
Quoted 2 lines
drivers/acpi/pci_root.c +0
-0/* * Segment I think the '
pci_msi_enable' variable can be changed afteracpi_pci_root_add()is called byquirk_disable_all_msi()(indriver/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
Quoted 3 lines
Thanks,
Kenji Kaneshige
Re: [PATCH 7/8] PCI: check if MSI is enabled before adding _OSC support capability
In reply to Andrew PattersonQuoted 39 lines · Andrew Patterson
PCI: check if MSI is enabled before adding
_OSCsupport capabilityEnsure that pci=nomsi is not set before adding the
_OSCsupport capabilityOSC_MSI_SUPPORTto the root bridge.Signed-off-by Andrew Patterson <[email protected]>---
drivers/acpi/pci_root.c | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-)drivers/acpi/pci_root.c +3
-8@@ -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 |
drivers/acpi/pci_root.c static int __devinit acpi_pci_root_add(struct acpi_device *device) · line 226
Quoted 10 lines
drivers/acpi/pci_root.c +8
-1+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
Re: [PATCH 7/8] PCI: check if MSI is enabled before adding _OSC support capability
Quoted 46 lines · Bjorn Helgaas
Quoted 45 lines · Andrew Patterson
PCI: check if MSI is enabled before adding
_OSCsupport capabilityEnsure that pci=nomsi is not set before adding the
_OSCsupport capabilityOSC_MSI_SUPPORTto the root bridge.Signed-off-by Andrew Patterson <[email protected]>---
drivers/acpi/pci_root.c | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-)drivers/acpi/pci_root.c +9
-8@@ -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 ())
Quoted 9 lines
drivers/acpi/pci_root.c static int __devinit acpi_pci_root_add(struct acpi_device *device) · line 226
Quoted 4 lines
drivers/acpi/pci_root.c +2
-1+ 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.
Quoted 3 lines
If you introduce "flags" in patch 2/8, the rest of the patches will be clearer (and it will facilitate a useful
dev_warn()whenpci_acpi_osc_support()fails).
Done.
Quoted 2 lines
You don't need the "#ifdef
CONFIG_PCI_MSI" here, do you?
No, Removed.
Quoted 3 lines
Bjorn
Andrew
PATCH 8/8 PCI, ACPI: remove obsolete _OSC capability support functions
In reply to Andrew PattersonPCI, 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.
---
drivers/pci/pci-acpi.c | 25 ------------------------- include/linux/pci-acpi.h | 11 ----------- 2 files changed, 0 insertions(+), 36 deletions(-)
drivers/pci/pci-acpi.c +0 -25
@@ -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
include/linux/pci-acpi.h +0 -11
@@ -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