All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiang Liu <jiang.liu@linux.intel.com>
To: Borislav Petkov <bp@alien8.de>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org
Cc: Jiang Liu <jiang.liu@linux.intel.com>,
	lkml <linux-kernel@vger.kernel.org>,
	linux-pci@vger.kernel.org
Subject: [PATCH] x86, irq: Keep IRQ assignment for PCI devices during suspend/hibernation
Date: Wed, 30 Jul 2014 17:37:13 +0800	[thread overview]
Message-ID: <1406713034-3387-1-git-send-email-jiang.liu@linux.intel.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1407282255120.23352@nanos>

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);
 }
 
-- 
1.7.10.4


  parent reply	other threads:[~2014-07-30  9:34 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20140728175326.GA7100@pd.tnic>
2014-07-28 20:59 ` rc7 + tip/master suspend fun Rafael J. Wysocki
2014-07-28 21:02   ` Thomas Gleixner
2014-07-28 22:02     ` Rafael J. Wysocki
2014-07-29  2:17     ` Jiang Liu
2014-07-30  9:37     ` Jiang Liu [this message]
2014-07-30 17:58       ` [PATCH] x86, irq: Keep IRQ assignment for PCI devices during suspend/hibernation Borislav Petkov
2014-07-31  0:33         ` Jiang Liu
2014-07-31 10:39           ` Borislav Petkov
2014-07-31 14:41             ` Jiang Liu
2014-07-31 14:41               ` Jiang Liu
2014-07-31 15:21               ` Borislav Petkov
2014-07-31 15:21                 ` Borislav Petkov
2014-07-31 16:36             ` Jiang Liu
2014-07-31 16:56               ` Borislav Petkov
2014-08-01 10:56                 ` [PATCH] x86, irq: Keep IRQ assignment for PCI devices during suspend/hibernation, bisected Borislav Petkov
2014-08-01 12:27                   ` Jiang Liu
2014-08-01 14:39                     ` Borislav Petkov
2014-08-01 16:11                       ` Borislav Petkov
2014-08-01 22:14                         ` Jörg Rödel
2014-08-01 22:50                           ` Borislav Petkov
2014-08-02  2:25                             ` [PATCH] iommu/amd: Implement syscore_ops.shutdown() Jiang Liu
2014-08-02  2:25                               ` Jiang Liu
2014-08-04 10:12                               ` Borislav Petkov
2014-08-04 10:12                                 ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1406713034-3387-1-git-send-email-jiang.liu@linux.intel.com \
    --to=jiang.liu@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rjw@rjwysocki.net \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.