[PATCH 14/18] drm/amdgpu: Fix amdgpu reload failure under SRIOV

Yu, Xiangliang Xiangliang.Yu at amd.com
Mon Sep 18 09:10:49 UTC 2017


NAK, Tonga has no this problem, please keep the patch into internal branch for temporally.


-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf Of Monk Liu
Sent: Monday, September 18, 2017 2:12 PM
To: amd-gfx at lists.freedesktop.org
Cc: Chen, Horace <Horace.Chen at amd.com>; Liu, Monk <Monk.Liu at amd.com>
Subject: [PATCH 14/18] drm/amdgpu: Fix amdgpu reload failure under SRIOV

From: Horace Chen <horace.chen at amd.com>

Kernel will set the PCI power state to UNKNOWN after unloading, Since SRIOV has faked PCI config space so the UNKNOWN state will be kept forever.

In driver reload if the power state is UNKNOWN then enabling msi will fail.

forcely set it to D0 for SRIOV to fix this kernel flawness.

Change-Id: I6a72d5fc9b653b21c3c98167515a511c5edeb91c
Signed-off-by: Horace Chen <horace.chen at amd.com>
Signed-off-by: Monk Liu <Monk.Liu at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
index 914c5bf..345406a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
@@ -229,7 +229,15 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
 	adev->irq.msi_enabled = false;
 
 	if (amdgpu_msi_ok(adev)) {
-		int ret = pci_enable_msi(adev->pdev);
+		int ret;
+		if (amdgpu_sriov_vf(adev) &&
+		    adev->pdev->current_state == PCI_UNKNOWN){
+			/* If pci power state is unknown on the SRIOV platform,
+			 * it may be set in the remove device. We need to forcely
+			 * set it to D0 to enable the msi*/
+			adev->pdev->current_state = PCI_D0;
+		}
+		ret = pci_enable_msi(adev->pdev);
 		if (!ret) {
 			adev->irq.msi_enabled = true;
 			dev_info(adev->dev, "amdgpu: using MSI.\n");
--
2.7.4

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


More information about the amd-gfx mailing list