Userspace will be able to tell whether a GPU reset occured by comparing an old referece value of the counter with a new value.
Unified · Split
| @@ -2435,6 +2435,7 @@ struct radeon_device { · 2434 unmodified lines | |||
| 2435 | atomic64_t vram_usage; | 2435 | atomic64_t vram_usage; |
| 2436 | atomic64_t gtt_usage; | 2436 | atomic64_t gtt_usage; |
| 2437 | atomic64_t num_bytes_moved; | 2437 | atomic64_t num_bytes_moved; |
| 2438 | atomic_t gpu_reset_counter; | ||
| 2438 | /* ACPI interface */ | 2439 | /* ACPI interface */ |
| 2439 | struct radeon_atif atif; | 2440 | struct radeon_atif atif; |
| 2440 | struct radeon_atcs atcs; | 2441 | struct radeon_atcs atcs; |
| @@ -1725,6 +1725,8 @@ int radeon_gpu_reset(struct radeon_device *rdev) · 1724 unmodified lines | |||
| 1725 | return 0; | 1725 | return 0; |
| 1726 | } | 1726 | } |
| 1727 | 1727 | ||
| 1728 | atomic_inc(&rdev->gpu_reset_counter); | ||
| 1729 | |||
| 1728 | radeon_save_bios_scratch_regs(rdev); | 1730 | radeon_save_bios_scratch_regs(rdev); |
| 1729 | /* block TTM */ | 1731 | /* block TTM */ |
| 1730 | resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev); | 1732 | resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev); |
| @@ -90,9 +90,10 @@ · 89 unmodified lines | |||
| 90 | * CS to GPU on >= r600 | 90 | * CS to GPU on >= r600 |
| 91 | * 2.41.0 - evergreen/cayman: Add SET_BASE/DRAW_INDIRECT command parsing support | 91 | * 2.41.0 - evergreen/cayman: Add SET_BASE/DRAW_INDIRECT command parsing support |
| 92 | * 2.42.0 - Add VCE/VUI (Video Usability Information) support | 92 | * 2.42.0 - Add VCE/VUI (Video Usability Information) support |
| 93 | * 2.43.0 - RADEON_INFO_GPU_RESET_COUNTER | ||
| 93 | */ | 94 | */ |
| 94 | #define KMS_DRIVER_MAJOR 2 | 95 | #define KMS_DRIVER_MAJOR 2 |
| 95 | #define KMS_DRIVER_MINOR 42 | 96 | #define KMS_DRIVER_MINOR 43 |
| 96 | #define KMS_DRIVER_PATCHLEVEL 0 | 97 | #define KMS_DRIVER_PATCHLEVEL 0 |
| 97 | int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); | 98 | int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); |
| 98 | int radeon_driver_unload_kms(struct drm_device *dev); | 99 | int radeon_driver_unload_kms(struct drm_device *dev); |
| @@ -576,6 +576,9 @@ static int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file · 575 unmodified lines | |||
| 576 | if (radeon_get_allowed_info_register(rdev, *value, value)) | 576 | if (radeon_get_allowed_info_register(rdev, *value, value)) |
| 577 | return -EINVAL; | 577 | return -EINVAL; |
| 578 | break; | 578 | break; |
| 579 | case RADEON_INFO_GPU_RESET_COUNTER: | ||
| 580 | *value = atomic_read(&rdev->gpu_reset_counter); | ||
| 581 | break; | ||
| 579 | default: | 582 | default: |
| 580 | DRM_DEBUG_KMS("Invalid request %d\n", info->request); | 583 | DRM_DEBUG_KMS("Invalid request %d\n", info->request); |
| 581 | return -EINVAL; | 584 | return -EINVAL; |
| @@ -1038,6 +1038,7 @@ struct drm_radeon_cs { · 1037 unmodified lines | |||
| 1038 | #define RADEON_INFO_CURRENT_GPU_SCLK 0x22 | 1038 | #define RADEON_INFO_CURRENT_GPU_SCLK 0x22 |
| 1039 | #define RADEON_INFO_CURRENT_GPU_MCLK 0x23 | 1039 | #define RADEON_INFO_CURRENT_GPU_MCLK 0x23 |
| 1040 | #define RADEON_INFO_READ_REG 0x24 | 1040 | #define RADEON_INFO_READ_REG 0x24 |
| 1041 | #define RADEON_INFO_GPU_RESET_COUNTER 0x25 | ||
| 1041 | 1042 | ||
| 1042 | struct drm_radeon_info { | 1043 | struct drm_radeon_info { |
| 1043 | uint32_t request; | 1044 | uint32_t request; |