]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
drm/amdgpu: Do error injection even vram reserve fails
authorxinhui pan <xinhui.pan@amd.com>
Fri, 14 Jun 2019 08:06:10 +0000 (16:06 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 20 Jun 2019 16:32:10 +0000 (11:32 -0500)
As long as the address is mapped with vram, we can do an error
injection.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c

index 7efc4e07665d0b8963cdf0bd56fbb68400cdc453..614116c7036ae71f3289c62fc0e3aaff71e8dfe5 100644 (file)
@@ -333,12 +333,13 @@ static ssize_t amdgpu_ras_debugfs_ctrl_write(struct file *f, const char __user *
        case 2:
                ret = amdgpu_ras_reserve_vram(adev,
                                data.inject.address, PAGE_SIZE, &bo);
-               /* This address might be used already on failure. In fact we can
-                * perform an injection in such case.
-                */
-               if (ret)
-                       break;
-               data.inject.address = amdgpu_bo_gpu_offset(bo);
+               if (ret) {
+                       /* address was offset, now it is absolute.*/
+                       data.inject.address += adev->gmc.vram_start;
+                       if (data.inject.address > adev->gmc.vram_end)
+                               break;
+               } else
+                       data.inject.address = amdgpu_bo_gpu_offset(bo);
                ret = amdgpu_ras_error_inject(adev, &data.inject);
                amdgpu_ras_release_vram(adev, &bo);
                break;