[SRU,Artful,1/1] PCI: vmd: Free up IRQs on suspend path

Message ID 7b6849c41763cc5f08dbd2e10cb630136e3b1bd8.1517242496.git.joseph.salisbury@canonical.com
State New
Headers show
Series
  • [SRU,Artful,1/1] PCI: vmd: Free up IRQs on suspend path
Related show

Commit Message

Joseph Salisbury Feb. 1, 2018, 6:32 p.m.
From: Scott Bauer <scott.bauer@intel.com>

BugLink: http://bugs.launchpad.net/bugs/1745508

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>
(cherry picked from commit e2b1820bd5d0962d6f271b0d47c3a0e38647df2f)
Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
---
 drivers/pci/host/vmd.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Colin King Feb. 1, 2018, 6:34 p.m. | #1
On 01/02/18 18:32, Joseph Salisbury wrote:
> From: Scott Bauer <scott.bauer@intel.com>
> 
> BugLink: http://bugs.launchpad.net/bugs/1745508
> 
> 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>
> (cherry picked from commit e2b1820bd5d0962d6f271b0d47c3a0e38647df2f)
> Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
> ---
>  drivers/pci/host/vmd.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/pci/host/vmd.c b/drivers/pci/host/vmd.c
> index 6088c30..cfc880b 100644
> --- a/drivers/pci/host/vmd.c
> +++ b/drivers/pci/host/vmd.c
> @@ -755,6 +755,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;
> @@ -763,6 +768,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;
> 

Clean upstream cherry pick, positive test results. Looks good to me.

Acked-by: Colin Ian King <colin.king@canonical.com>
Kleber Souza Feb. 6, 2018, 3:53 p.m. | #2
On 02/01/18 19:32, Joseph Salisbury wrote:
> From: Scott Bauer <scott.bauer@intel.com>
> 
> BugLink: http://bugs.launchpad.net/bugs/1745508
> 
> 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>
> (cherry picked from commit e2b1820bd5d0962d6f271b0d47c3a0e38647df2f)
> Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>

Clean cherry-pick, good test results and limited to a specific device.

Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>


> ---
>  drivers/pci/host/vmd.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/pci/host/vmd.c b/drivers/pci/host/vmd.c
> index 6088c30..cfc880b 100644
> --- a/drivers/pci/host/vmd.c
> +++ b/drivers/pci/host/vmd.c
> @@ -755,6 +755,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;
> @@ -763,6 +768,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;
>

Patch

diff --git a/drivers/pci/host/vmd.c b/drivers/pci/host/vmd.c
index 6088c30..cfc880b 100644
--- a/drivers/pci/host/vmd.c
+++ b/drivers/pci/host/vmd.c
@@ -755,6 +755,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;
@@ -763,6 +768,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;