History

drm/radeon: add a GPU reset counter queryable by userspace

Userspace will be able to tell whether a GPU reset occured by comparing an old referece value of the counter with a new value.

Marek Olšák committed 11 years ago

Commit 72b90761 parent c6e7e4b5 files · +9 −1Browse files

Unified · Split

5 files
  1. drivers/gpu/drm/radeon/radeon.h +1 −0
  2. drivers/gpu/drm/radeon/radeon_device.c +2 −0
  3. drivers/gpu/drm/radeon/radeon_drv.c +2 −1
  4. drivers/gpu/drm/radeon/radeon_kms.c +3 −0
  5. include/uapi/drm/radeon_drm.h +1 −0
drivers/gpu/drm/radeon/radeon.h+1−0
@@ -2435,6 +2435,7 @@ struct radeon_device { · 2434 unmodified lines
24352435 atomic64_t vram_usage;
24362436 atomic64_t gtt_usage;
24372437 atomic64_t num_bytes_moved;
2438+ atomic_t gpu_reset_counter;
24382439 /* ACPI interface */
24392440 struct radeon_atif atif;
24402441 struct radeon_atcs atcs;
drivers/gpu/drm/radeon/radeon_device.c+2−0
@@ -1725,6 +1725,8 @@ int radeon_gpu_reset(struct radeon_device *rdev) · 1724 unmodified lines
17251725 return 0;
17261726 }
17271727
1728+ atomic_inc(&rdev->gpu_reset_counter);
1729+
17281730 radeon_save_bios_scratch_regs(rdev);
17291731 /* block TTM */
17301732 resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev);
drivers/gpu/drm/radeon/radeon_drv.c+2−1
@@ -90,9 +90,10 @@ · 89 unmodified lines
9090 * CS to GPU on >= r600
9191 * 2.41.0 - evergreen/cayman: Add SET_BASE/DRAW_INDIRECT command parsing support
9292 * 2.42.0 - Add VCE/VUI (Video Usability Information) support
93+ * 2.43.0 - RADEON_INFO_GPU_RESET_COUNTER
9394 */
9495 #define KMS_DRIVER_MAJOR 2
95−#define KMS_DRIVER_MINOR 42
96+#define KMS_DRIVER_MINOR 43
9697 #define KMS_DRIVER_PATCHLEVEL 0
9798 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
9899 int radeon_driver_unload_kms(struct drm_device *dev);
drivers/gpu/drm/radeon/radeon_kms.c+3−0
@@ -576,6 +576,9 @@ static int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file · 575 unmodified lines
576576 if (radeon_get_allowed_info_register(rdev, *value, value))
577577 return -EINVAL;
578578 break;
579+ case RADEON_INFO_GPU_RESET_COUNTER:
580+ *value = atomic_read(&rdev->gpu_reset_counter);
581+ break;
579582 default:
580583 DRM_DEBUG_KMS("Invalid request %d\n", info->request);
581584 return -EINVAL;
include/uapi/drm/radeon_drm.h+1−0
@@ -1038,6 +1038,7 @@ struct drm_radeon_cs { · 1037 unmodified lines
10381038 #define RADEON_INFO_CURRENT_GPU_SCLK 0x22
10391039 #define RADEON_INFO_CURRENT_GPU_MCLK 0x23
10401040 #define RADEON_INFO_READ_REG 0x24
1041+#define RADEON_INFO_GPU_RESET_COUNTER 0x25
10411042
10421043 struct drm_radeon_info {
10431044 uint32_t request;