aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Quan <evan.quan@amd.com>2017-07-04 03:37:09 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-07-14 11:06:25 -0400
commit209ee27e9ba35c53e18284c7bb5ac2ba6a2fcd22 (patch)
tree54e36db0bff8f22b415df719d07110088653fb1b
parentc62a59d0c8117f709f1e7a9fc8ccc1aae1db3f2c (diff)
drm/amd/powerplay: added grbm_idx_mutex lock/unlock to cgs v2
- v2: rename param 'en' as 'lock' Signed-off-by: Evan Quan <evan.quan@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c12
-rw-r--r--drivers/gpu/drm/amd/include/cgs_common.h5
2 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
index 9b589402b58d..a99e0bca6812 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
@@ -614,6 +614,17 @@ static int amdgpu_cgs_enter_safe_mode(struct cgs_device *cgs_device,
614 return 0; 614 return 0;
615} 615}
616 616
617static void amdgpu_cgs_lock_grbm_idx(struct cgs_device *cgs_device,
618 bool lock)
619{
620 CGS_FUNC_ADEV;
621
622 if (lock)
623 mutex_lock(&adev->grbm_idx_mutex);
624 else
625 mutex_unlock(&adev->grbm_idx_mutex);
626}
627
617static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device, 628static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
618 enum cgs_ucode_id type, 629 enum cgs_ucode_id type,
619 struct cgs_firmware_info *info) 630 struct cgs_firmware_info *info)
@@ -1127,6 +1138,7 @@ static const struct cgs_ops amdgpu_cgs_ops = {
1127 .query_system_info = amdgpu_cgs_query_system_info, 1138 .query_system_info = amdgpu_cgs_query_system_info,
1128 .is_virtualization_enabled = amdgpu_cgs_is_virtualization_enabled, 1139 .is_virtualization_enabled = amdgpu_cgs_is_virtualization_enabled,
1129 .enter_safe_mode = amdgpu_cgs_enter_safe_mode, 1140 .enter_safe_mode = amdgpu_cgs_enter_safe_mode,
1141 .lock_grbm_idx = amdgpu_cgs_lock_grbm_idx,
1130}; 1142};
1131 1143
1132static const struct cgs_os_ops amdgpu_cgs_os_ops = { 1144static 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 b46d12df8df0..0214f63f52fc 100644
--- a/drivers/gpu/drm/amd/include/cgs_common.h
+++ b/drivers/gpu/drm/amd/include/cgs_common.h
@@ -407,6 +407,8 @@ typedef int (*cgs_is_virtualization_enabled_t)(void *cgs_device);
407 407
408typedef int (*cgs_enter_safe_mode)(struct cgs_device *cgs_device, bool en); 408typedef int (*cgs_enter_safe_mode)(struct cgs_device *cgs_device, bool en);
409 409
410typedef void (*cgs_lock_grbm_idx)(struct cgs_device *cgs_device, bool lock);
411
410struct cgs_ops { 412struct cgs_ops {
411 /* memory management calls (similar to KFD interface) */ 413 /* memory management calls (similar to KFD interface) */
412 cgs_alloc_gpu_mem_t alloc_gpu_mem; 414 cgs_alloc_gpu_mem_t alloc_gpu_mem;
@@ -442,6 +444,7 @@ struct cgs_ops {
442 cgs_query_system_info query_system_info; 444 cgs_query_system_info query_system_info;
443 cgs_is_virtualization_enabled_t is_virtualization_enabled; 445 cgs_is_virtualization_enabled_t is_virtualization_enabled;
444 cgs_enter_safe_mode enter_safe_mode; 446 cgs_enter_safe_mode enter_safe_mode;
447 cgs_lock_grbm_idx lock_grbm_idx;
445}; 448};
446 449
447struct cgs_os_ops; /* To be define in OS-specific CGS header */ 450struct cgs_os_ops; /* To be define in OS-specific CGS header */
@@ -518,4 +521,6 @@ struct cgs_device
518#define cgs_enter_safe_mode(cgs_device, en) \ 521#define cgs_enter_safe_mode(cgs_device, en) \
519 CGS_CALL(enter_safe_mode, cgs_device, en) 522 CGS_CALL(enter_safe_mode, cgs_device, en)
520 523
524#define cgs_lock_grbm_idx(cgs_device, lock) \
525 CGS_CALL(lock_grbm_idx, cgs_device, lock)
521#endif /* _CGS_COMMON_H */ 526#endif /* _CGS_COMMON_H */