PCI: vmd: Free up IRQs on suspend path
authorScott Bauer <scott.bauer@intel.com>
Fri, 11 Aug 2017 20:54:32 +0000 (14:54 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 14 Aug 2017 17:56:46 +0000 (12:56 -0500)
Free up the IRQs we request on the suspend path and reallocate them on the
resume path.

Fixes this error:

  CPU 111 disable failed: CPU has 9 vectors assigned and there are only 0 available.
  Error taking CPU111 down: -34
  Non-boot CPUs are not disabled
  Enabling non-boot CPUs ...

Signed-off-by: Scott Bauer <scott.bauer@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Keith Busch <keith.busch@intel.com>
drivers/pci/host/vmd.c

index 7e967a8784b2c5bc1b9c227f8406e60a7222b921..4fe1756af010bf32ba486bf17ee5cd6dfcca1096 100644 (file)
@@ -763,6 +763,11 @@ static void vmd_remove(struct pci_dev *dev)
 static int vmd_suspend(struct device *dev)
 {
        struct pci_dev *pdev = to_pci_dev(dev);
+       struct vmd_dev *vmd = pci_get_drvdata(pdev);
+       int i;
+
+       for (i = 0; i < vmd->msix_count; i++)
+                devm_free_irq(dev, pci_irq_vector(pdev, i), &vmd->irqs[i]);
 
        pci_save_state(pdev);
        return 0;
@@ -771,6 +776,16 @@ static int vmd_suspend(struct device *dev)
 static int vmd_resume(struct device *dev)
 {
        struct pci_dev *pdev = to_pci_dev(dev);
+       struct vmd_dev *vmd = pci_get_drvdata(pdev);
+       int err, i;
+
+       for (i = 0; i < vmd->msix_count; i++) {
+               err = devm_request_irq(dev, pci_irq_vector(pdev, i),
+                                      vmd_irq, IRQF_NO_THREAD,
+                                      "vmd", &vmd->irqs[i]);
+               if (err)
+                       return err;
+       }
 
        pci_restore_state(pdev);
        return 0;