Skip to contentSkip to conversation

drm/amdgpu: add VRAM lost query

PATCH In review Christian König 2 participants 2 messages Oct 9, 2017 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: add VRAM lost query

From: Christian König <[email protected]>

Allows userspace to figure out if VRAM was lost.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 +++
 include/uapi/drm/amdgpu_drm.h           | 1 +
 2 files changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3 -0
index 0fc36b2..49cc496 100644
@@ -762,6 +762,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;
include/uapi/drm/amdgpu_drm.h +1 -0
index 3bf41a6..de0a2ac 100644
@@ -632,6 +632,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
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1507564426-8374-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 5 lines · Christian König

From: Christian König <[email protected]>

Allows userspace to figure out if VRAM was lost.

Yes, I think we can use this in Mesa. We'll need to actually code this up, but for now this patch is:

Quoted 32 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 +++
  include/uapi/drm/amdgpu_drm.h           | 1 +
  2 files changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3 -0
index 0fc36b2..49cc496 100644
@@ -762,6 +762,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;
include/uapi/drm/amdgpu_drm.h +1 -0
index 3bf41a6..de0a2ac 100644
@@ -632,6 +632,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
Signature · 6 lines
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx