drm/amdkfd: initialise kfd inside amdgpu_device_init
authorpding <Pixel.Ding@amd.com>
Mon, 6 Nov 2017 02:21:26 +0000 (10:21 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 4 Dec 2017 21:41:44 +0000 (16:41 -0500)
Also finalize kfd inside amdgpu_device_fini. kfd device_init needs
SRIOV exclusive accessing. Try to gather exclusive accessing to
reduce time consuming.

Signed-off-by: pding <Pixel.Ding@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c

index 84c8bbe..6636fa2 100644 (file)
@@ -1693,6 +1693,8 @@ static int amdgpu_early_init(struct amdgpu_device *adev)
        if (r)
                return r;
 
+       amdgpu_amdkfd_device_probe(adev);
+
        if (amdgpu_sriov_vf(adev)) {
                r = amdgpu_virt_request_full_gpu(adev, true);
                if (r)
@@ -1787,6 +1789,7 @@ static int amdgpu_init(struct amdgpu_device *adev)
                adev->ip_blocks[i].status.hw = true;
        }
 
+       amdgpu_amdkfd_device_init(adev);
        return 0;
 }
 
@@ -1854,6 +1857,7 @@ static int amdgpu_fini(struct amdgpu_device *adev)
 {
        int i, r;
 
+       amdgpu_amdkfd_device_fini(adev);
        /* need to disable SMC first */
        for (i = 0; i < adev->num_ip_blocks; i++) {
                if (!adev->ip_blocks[i].status.hw)
index f313eee..252d41d 100644 (file)
@@ -63,8 +63,6 @@ void amdgpu_driver_unload_kms(struct drm_device *dev)
                pm_runtime_forbid(dev->dev);
        }
 
-       amdgpu_amdkfd_device_fini(adev);
-
        amdgpu_acpi_fini(adev);
 
        amdgpu_device_fini(adev);
@@ -170,9 +168,6 @@ retry_init:
                                "Error during ACPI methods call\n");
        }
 
-       amdgpu_amdkfd_device_probe(adev);
-       amdgpu_amdkfd_device_init(adev);
-
        if (amdgpu_device_is_px(dev)) {
                pm_runtime_use_autosuspend(dev->dev);
                pm_runtime_set_autosuspend_delay(dev->dev, 5000);