Allows userspace to figure out if VRAM was lost.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
                }
                return copy_to_user(out, &ui32, min(size, 4u)) ? -EFAULT : 0;
        }
+       case AMDGPU_INFO_VRAM_LOST_COUNTER:
+               ui32 = atomic_read(&adev->vram_lost_counter);
+               return copy_to_user(out, &ui32, min(size, 4u)) ? -EFAULT : 0;
        default:
                DRM_DEBUG_KMS("Invalid request %d\n", info->query);
                return -EINVAL;
 
        #define AMDGPU_INFO_SENSOR_VDDGFX               0x7
 /* Number of VRAM page faults on CPU access. */
 #define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS   0x1E
+#define AMDGPU_INFO_VRAM_LOST_COUNTER          0x1F
 
 #define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0
 #define AMDGPU_INFO_MMR_SE_INDEX_MASK  0xff