[1/2] drm/amdgpu: improve MSI-X handling

Submitted by Huang, Ray on Oct. 3, 2019, 3:07 p.m.

Details

Message ID MN2PR12MB3309565E84BD6930EF857992EC9F0@MN2PR12MB3309.namprd12.prod.outlook.com
State New
Headers show
Series "Series without cover letter" ( rev: 2 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Huang, Ray Oct. 3, 2019, 3:07 p.m.
Series are Reviewed-by: Huang Rui <ray.huang@amd.com>

-----Original Message-----
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex Deucher

Sent: Thursday, October 3, 2019 10:13 AM
To: amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>
Subject: [PATCH 1/2] drm/amdgpu: improve MSI-X handling

Check the number of supported vectors and fall back to MSI if we return or error or 0 MSI-X vectors.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

--
2.20.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
index 50771b2757dc..98aa28edba6a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
@@ -245,11 +245,19 @@  int amdgpu_irq_init(struct amdgpu_device *adev)
 	adev->irq.msi_enabled = false;
 
 	if (amdgpu_msi_ok(adev)) {
-		int nvec = pci_alloc_irq_vectors(adev->pdev, 1, pci_msix_vec_count(adev->pdev),
-					PCI_IRQ_MSI | PCI_IRQ_MSIX);
+		unsigned int flags;
+		int nvec = pci_msix_vec_count(adev->pdev);
+
+		if (nvec <= 0) {
+			flags = PCI_IRQ_MSI;
+			nvec = 1;
+		} else {
+			flags = PCI_IRQ_MSI | PCI_IRQ_MSIX;
+		}
+		nvec = pci_alloc_irq_vectors(adev->pdev, 1, nvec, flags);
 		if (nvec > 0) {
 			adev->irq.msi_enabled = true;
-			dev_dbg(adev->dev, "amdgpu: using MSI.\n");
+			dev_dbg(adev->dev, "amdgpu: using MSI/MSI-X.\n");
 		}
 	}