]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
drm/amdgpu: add VRAM lost query
authorChristian König <christian.koenig@amd.com>
Mon, 9 Oct 2017 15:53:06 +0000 (17:53 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 19 Oct 2017 19:27:05 +0000 (15:27 -0400)
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>
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
include/uapi/drm/amdgpu_drm.h

index ff1a416a66c91c4666a532f1e536c3fe8197aa0f..6f0b26dae3b0009ee127929186ef43d140b87bcb 100644 (file)
@@ -763,6 +763,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
                }
                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;
index d0a3ea69eab6e98f01279abcc44d55298f24ff4f..ff0181829f3db6dfb4323bf4032875ad04516d2e 100644 (file)
@@ -657,6 +657,7 @@ struct drm_amdgpu_cs_chunk_data {
        #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