[PATCH 2/3] drm/amdgpu: release exclusive mode after hw_init if no kfd

Pixel Ding Pixel.Ding at amd.com
Thu Nov 2 03:16:09 UTC 2017


From: pding <Pixel.Ding at amd.com>

KFD device init requires exclusive mode. Driver can release
exclusive mode after hw_init if KFD is not enabled.

Signed-off-by: pding <Pixel.Ding at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c    | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 809e656..dc1d1af 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1716,6 +1716,9 @@ static int amdgpu_init(struct amdgpu_device *adev)
 		adev->ip_blocks[i].status.hw = true;
 	}
 
+	if (amdgpu_sriov_vf(adev) && !adev->kfd)
+		amdgpu_virt_release_full_gpu(adev, true);
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index acdb010..589b41f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -130,6 +130,7 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
 
 	dev->dev_private = (void *)adev;
 
+	amdgpu_amdkfd_device_probe(adev);
 	/* amdgpu_device_init should report only fatal error
 	 * like memory allocation failure or iomapping failure,
 	 * or memory manager initialization failure, it must
@@ -141,6 +142,7 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
 		adev->virt.caps &= ~AMDGPU_SRIOV_CAPS_RUNTIME;
 		adev->virt.ops = NULL;
 		amdgpu_device_fini(adev);
+		kfree(adev->kfd);
 		kfree(adev);
 		dev->dev_private = NULL;
 		/* Don't request EX mode too frequently which is attacking */
@@ -162,7 +164,6 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
 				"Error during ACPI methods call\n");
 	}
 
-	amdgpu_amdkfd_device_probe(adev);
 	amdgpu_amdkfd_device_init(adev);
 
 	if (amdgpu_device_is_px(dev)) {
@@ -174,7 +175,7 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
 		pm_runtime_put_autosuspend(dev->dev);
 	}
 
-	if (amdgpu_sriov_vf(adev))
+	if (amdgpu_sriov_vf(adev) && adev->kfd)
 		amdgpu_virt_release_full_gpu(adev, true);
 
 out:
-- 
2.9.5



More information about the amd-gfx mailing list