diff options
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 23 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/include/cgs_common.h | 8 |
2 files changed, 31 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c index 383204e911a4..a7afe553e0a1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | |||
| @@ -42,6 +42,28 @@ struct amdgpu_cgs_device { | |||
| 42 | struct amdgpu_device *adev = \ | 42 | struct amdgpu_device *adev = \ |
| 43 | ((struct amdgpu_cgs_device *)cgs_device)->adev | 43 | ((struct amdgpu_cgs_device *)cgs_device)->adev |
| 44 | 44 | ||
| 45 | static void *amdgpu_cgs_register_pp_handle(struct cgs_device *cgs_device, | ||
| 46 | int (*call_back_func)(struct amd_pp_init *, void **)) | ||
| 47 | { | ||
| 48 | CGS_FUNC_ADEV; | ||
| 49 | struct amd_pp_init pp_init; | ||
| 50 | struct amd_powerplay *amd_pp; | ||
| 51 | |||
| 52 | if (call_back_func == NULL) | ||
| 53 | return NULL; | ||
| 54 | |||
| 55 | amd_pp = &(adev->powerplay); | ||
| 56 | pp_init.chip_family = adev->family; | ||
| 57 | pp_init.chip_id = adev->asic_type; | ||
| 58 | pp_init.pm_en = (amdgpu_dpm != 0 && !amdgpu_sriov_vf(adev)) ? true : false; | ||
| 59 | pp_init.feature_mask = amdgpu_pp_feature_mask; | ||
| 60 | pp_init.device = cgs_device; | ||
| 61 | if (call_back_func(&pp_init, &(amd_pp->pp_handle))) | ||
| 62 | return NULL; | ||
| 63 | |||
| 64 | return adev->powerplay.pp_handle; | ||
| 65 | } | ||
| 66 | |||
| 45 | static int amdgpu_cgs_alloc_gpu_mem(struct cgs_device *cgs_device, | 67 | static int amdgpu_cgs_alloc_gpu_mem(struct cgs_device *cgs_device, |
| 46 | enum cgs_gpu_mem_type type, | 68 | enum cgs_gpu_mem_type type, |
| 47 | uint64_t size, uint64_t align, | 69 | uint64_t size, uint64_t align, |
| @@ -1179,6 +1201,7 @@ static const struct cgs_ops amdgpu_cgs_ops = { | |||
| 1179 | .is_virtualization_enabled = amdgpu_cgs_is_virtualization_enabled, | 1201 | .is_virtualization_enabled = amdgpu_cgs_is_virtualization_enabled, |
| 1180 | .enter_safe_mode = amdgpu_cgs_enter_safe_mode, | 1202 | .enter_safe_mode = amdgpu_cgs_enter_safe_mode, |
| 1181 | .lock_grbm_idx = amdgpu_cgs_lock_grbm_idx, | 1203 | .lock_grbm_idx = amdgpu_cgs_lock_grbm_idx, |
| 1204 | .register_pp_handle = amdgpu_cgs_register_pp_handle, | ||
| 1182 | }; | 1205 | }; |
| 1183 | 1206 | ||
| 1184 | static const struct cgs_os_ops amdgpu_cgs_os_ops = { | 1207 | static const struct cgs_os_ops amdgpu_cgs_os_ops = { |
diff --git a/drivers/gpu/drm/amd/include/cgs_common.h b/drivers/gpu/drm/amd/include/cgs_common.h index 030b14649c4e..675988d56392 100644 --- a/drivers/gpu/drm/amd/include/cgs_common.h +++ b/drivers/gpu/drm/amd/include/cgs_common.h | |||
| @@ -423,6 +423,10 @@ typedef int (*cgs_enter_safe_mode)(struct cgs_device *cgs_device, bool en); | |||
| 423 | 423 | ||
| 424 | typedef void (*cgs_lock_grbm_idx)(struct cgs_device *cgs_device, bool lock); | 424 | typedef void (*cgs_lock_grbm_idx)(struct cgs_device *cgs_device, bool lock); |
| 425 | 425 | ||
| 426 | struct amd_pp_init; | ||
| 427 | typedef void* (*cgs_register_pp_handle)(struct cgs_device *cgs_device, | ||
| 428 | int (*call_back_func)(struct amd_pp_init *, void **)); | ||
| 429 | |||
| 426 | struct cgs_ops { | 430 | struct cgs_ops { |
| 427 | /* memory management calls (similar to KFD interface) */ | 431 | /* memory management calls (similar to KFD interface) */ |
| 428 | cgs_alloc_gpu_mem_t alloc_gpu_mem; | 432 | cgs_alloc_gpu_mem_t alloc_gpu_mem; |
| @@ -459,6 +463,7 @@ struct cgs_ops { | |||
| 459 | cgs_is_virtualization_enabled_t is_virtualization_enabled; | 463 | cgs_is_virtualization_enabled_t is_virtualization_enabled; |
| 460 | cgs_enter_safe_mode enter_safe_mode; | 464 | cgs_enter_safe_mode enter_safe_mode; |
| 461 | cgs_lock_grbm_idx lock_grbm_idx; | 465 | cgs_lock_grbm_idx lock_grbm_idx; |
| 466 | cgs_register_pp_handle register_pp_handle; | ||
| 462 | }; | 467 | }; |
| 463 | 468 | ||
| 464 | struct cgs_os_ops; /* To be define in OS-specific CGS header */ | 469 | struct cgs_os_ops; /* To be define in OS-specific CGS header */ |
| @@ -537,4 +542,7 @@ struct cgs_device | |||
| 537 | 542 | ||
| 538 | #define cgs_lock_grbm_idx(cgs_device, lock) \ | 543 | #define cgs_lock_grbm_idx(cgs_device, lock) \ |
| 539 | CGS_CALL(lock_grbm_idx, cgs_device, lock) | 544 | CGS_CALL(lock_grbm_idx, cgs_device, lock) |
| 545 | #define cgs_register_pp_handle(cgs_device, call_back_func) \ | ||
| 546 | CGS_CALL(register_pp_handle, cgs_device, call_back_func) | ||
| 547 | |||
| 540 | #endif /* _CGS_COMMON_H */ | 548 | #endif /* _CGS_COMMON_H */ |
