drm/amdkfd: handle svm migrate init error
authorPhilip Yang <Philip.Yang@amd.com>
Fri, 17 Sep 2021 18:32:14 +0000 (14:32 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 23 Sep 2021 20:34:49 +0000 (16:34 -0400)
If svm migration init failed to create pgmap for device memory, set
pgmap type to 0 to disable device SVM support capability.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c

index dab290a..165e0eb 100644 (file)
@@ -894,6 +894,9 @@ int svm_migrate_init(struct amdgpu_device *adev)
        r = devm_memremap_pages(adev->dev, pgmap);
        if (IS_ERR(r)) {
                pr_err("failed to register HMM device memory\n");
+
+               /* Disable SVM support capability */
+               pgmap->type = 0;
                devm_release_mem_region(adev->dev, res->start,
                                        res->end - res->start + 1);
                return PTR_ERR(r);