diff mbox

x86, irq: Keep IRQ assignment for PCI devices during suspend/hibernation

Message ID 1406713034-3387-1-git-send-email-jiang.liu@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jiang Liu July 30, 2014, 9:37 a.m. UTC
Function pci_disable_device() may be called for PCI devices during
suspend/hibernation, which in turn may release IRQ assigned to PCI
interrupt. Later when pci_enable_device() is called during resume,
a different IRQ may be assigned and thus break the driver.
So keep IRQ assignment for PCI devices during suspend/hibernation.
We check pci_dev.dev.power.is_prepared to detect that pci_disable_device()
and pci_enable_device() is called during suspend/hibernation.

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
Hi Borislav,
	I can't reproduce the issue with my test machine. So could you
please help to test this patch?
Regards!
Gerry
---
 arch/x86/pci/common.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Borislav Petkov July 30, 2014, 5:58 p.m. UTC | #1
On Wed, Jul 30, 2014 at 05:37:13PM +0800, Jiang Liu wrote:
> Function pci_disable_device() may be called for PCI devices during
> suspend/hibernation, which in turn may release IRQ assigned to PCI
> interrupt. Later when pci_enable_device() is called during resume,
> a different IRQ may be assigned and thus break the driver.
> So keep IRQ assignment for PCI devices during suspend/hibernation.
> We check pci_dev.dev.power.is_prepared to detect that pci_disable_device()
> and pci_enable_device() is called during suspend/hibernation.
> 
> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
> ---
> Hi Borislav,
> 	I can't reproduce the issue with my test machine. So could you
> please help to test this patch?
> Regards!
> Gerry
> ---
>  arch/x86/pci/common.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
> index 059a76c29739..417de4c92e8f 100644
> --- a/arch/x86/pci/common.c
> +++ b/arch/x86/pci/common.c
> @@ -662,14 +662,15 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
>  	if ((err = pci_enable_resources(dev, mask)) < 0)
>  		return err;
>  
> -	if (!pci_dev_msi_enabled(dev))
> +	if (!pci_dev_msi_enabled(dev) && !dev->dev.pm.is_prepared)
>  		return pcibios_enable_irq(dev);
>  	return 0;
>  }
>  
>  void pcibios_disable_device (struct pci_dev *dev)
>  {
> -	if (!pci_dev_msi_enabled(dev) && pcibios_disable_irq)
> +	if (!pci_dev_msi_enabled(dev) && pcibios_disable_irq &&
> +	    !dev->dev.pm.is_prepared)
>  		pcibios_disable_irq(dev);

Did you even build-test this patch?

arch/x86/pci/common.c: In function ‘pcibios_enable_device’:
arch/x86/pci/common.c:665:44: error: ‘struct device’ has no member named ‘pm’
  if (!pci_dev_msi_enabled(dev) && !dev->dev.pm.is_prepared)
                                            ^
arch/x86/pci/common.c: In function ‘pcibios_disable_device’:
arch/x86/pci/common.c:673:15: error: ‘struct device’ has no member named ‘pm’
      !dev->dev.pm.is_prepared)
               ^
make[1]: *** [arch/x86/pci/common.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [arch/x86/pci] Error 2
make: *** Waiting for unfinished jobs....



My tree is rc7 + tip/master from Sunday.
diff mbox

Patch

diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 059a76c29739..417de4c92e8f 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -662,14 +662,15 @@  int pcibios_enable_device(struct pci_dev *dev, int mask)
 	if ((err = pci_enable_resources(dev, mask)) < 0)
 		return err;
 
-	if (!pci_dev_msi_enabled(dev))
+	if (!pci_dev_msi_enabled(dev) && !dev->dev.pm.is_prepared)
 		return pcibios_enable_irq(dev);
 	return 0;
 }
 
 void pcibios_disable_device (struct pci_dev *dev)
 {
-	if (!pci_dev_msi_enabled(dev) && pcibios_disable_irq)
+	if (!pci_dev_msi_enabled(dev) && pcibios_disable_irq &&
+	    !dev->dev.pm.is_prepared)
 		pcibios_disable_irq(dev);
 }