aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4030-drm-amdgpu-improve-MSI-X-handling-v3.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4030-drm-amdgpu-improve-MSI-X-handling-v3.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4030-drm-amdgpu-improve-MSI-X-handling-v3.patch60
1 files changed, 60 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4030-drm-amdgpu-improve-MSI-X-handling-v3.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4030-drm-amdgpu-improve-MSI-X-handling-v3.patch
new file mode 100644
index 00000000..b3c26754
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4030-drm-amdgpu-improve-MSI-X-handling-v3.patch
@@ -0,0 +1,60 @@
+From d5394a0c34d2b341f66d0249344c77eb2ff0bb7b Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexander.deucher@amd.com>
+Date: Thu, 3 Oct 2019 10:34:30 -0500
+Subject: [PATCH 4030/4256] drm/amdgpu: improve MSI-X handling (v3)
+
+Check the number of supported vectors and fall back to MSI if
+we return or error or 0 MSI-X vectors.
+
+v2: only allocate one vector. We can't currently use more than
+one anyway.
+
+v3: install the irq on vector 0.
+
+Tested-by: Tom St Denis <tom.stdenis@amd.com>
+Reviewed-by: Shaoyun liu <shaoyun.liu@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 17 +++++++++++++----
+ 1 file changed, 13 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+index 6feaf3db649a..22edda8ad261 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+@@ -242,11 +242,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);
++ int nvec = pci_msix_vec_count(adev->pdev);
++ unsigned int flags;
++
++ if (nvec <= 0) {
++ flags = PCI_IRQ_MSI;
++ } else {
++ flags = PCI_IRQ_MSI | PCI_IRQ_MSIX;
++ }
++ /* we only need one vector */
++ nvec = pci_alloc_irq_vectors(adev->pdev, 1, 1, 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");
+ }
+ }
+
+@@ -269,7 +277,8 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
+ INIT_WORK(&adev->irq.ih2_work, amdgpu_irq_handle_ih2);
+
+ adev->irq.installed = true;
+- r = drm_irq_install(adev->ddev, adev->ddev->pdev->irq);
++ /* Use vector 0 for MSI-X */
++ r = drm_irq_install(adev->ddev, pci_irq_vector(adev->pdev, 0));
+ if (r) {
+ adev->irq.installed = false;
+ if (!amdgpu_device_has_dc_support(adev))
+--
+2.17.1
+