diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2016-12-21 07:30:58 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-01-27 11:12:46 -0500 |
commit | e8a95b274d2f1a46dda12fa8e0cd2806df791701 (patch) | |
tree | 4410ac99b649074eff3d2a57e42b88dba9b13611 /drivers/gpu | |
parent | 919db4c199127781cef99b7ea0b74e3a9572ea32 (diff) |
drm/amdgpu: add cgs interface for enter/exit rlc safe mode.
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 18 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/include/cgs_common.h | 7 |
2 files changed, 25 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c index d0e87102e1b9..a5df1ef306d9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | |||
@@ -763,6 +763,23 @@ static uint16_t amdgpu_get_firmware_version(struct cgs_device *cgs_device, | |||
763 | return fw_version; | 763 | return fw_version; |
764 | } | 764 | } |
765 | 765 | ||
766 | static int amdgpu_cgs_enter_safe_mode(struct cgs_device *cgs_device, | ||
767 | bool en) | ||
768 | { | ||
769 | CGS_FUNC_ADEV; | ||
770 | |||
771 | if (adev->gfx.rlc.funcs->enter_safe_mode == NULL || | ||
772 | adev->gfx.rlc.funcs->exit_safe_mode == NULL) | ||
773 | return 0; | ||
774 | |||
775 | if (en) | ||
776 | adev->gfx.rlc.funcs->enter_safe_mode(adev); | ||
777 | else | ||
778 | adev->gfx.rlc.funcs->exit_safe_mode(adev); | ||
779 | |||
780 | return 0; | ||
781 | } | ||
782 | |||
766 | static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device, | 783 | static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device, |
767 | enum cgs_ucode_id type, | 784 | enum cgs_ucode_id type, |
768 | struct cgs_firmware_info *info) | 785 | struct cgs_firmware_info *info) |
@@ -1243,6 +1260,7 @@ static const struct cgs_ops amdgpu_cgs_ops = { | |||
1243 | .call_acpi_method = amdgpu_cgs_call_acpi_method, | 1260 | .call_acpi_method = amdgpu_cgs_call_acpi_method, |
1244 | .query_system_info = amdgpu_cgs_query_system_info, | 1261 | .query_system_info = amdgpu_cgs_query_system_info, |
1245 | .is_virtualization_enabled = amdgpu_cgs_is_virtualization_enabled, | 1262 | .is_virtualization_enabled = amdgpu_cgs_is_virtualization_enabled, |
1263 | .enter_safe_mode = amdgpu_cgs_enter_safe_mode, | ||
1246 | }; | 1264 | }; |
1247 | 1265 | ||
1248 | static const struct cgs_os_ops amdgpu_cgs_os_ops = { | 1266 | 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 e4a1697ec1d3..1d26ae768147 100644 --- a/drivers/gpu/drm/amd/include/cgs_common.h +++ b/drivers/gpu/drm/amd/include/cgs_common.h | |||
@@ -622,6 +622,8 @@ typedef int (*cgs_query_system_info)(struct cgs_device *cgs_device, | |||
622 | 622 | ||
623 | typedef int (*cgs_is_virtualization_enabled_t)(void *cgs_device); | 623 | typedef int (*cgs_is_virtualization_enabled_t)(void *cgs_device); |
624 | 624 | ||
625 | typedef int (*cgs_enter_safe_mode)(struct cgs_device *cgs_device, bool en); | ||
626 | |||
625 | struct cgs_ops { | 627 | struct cgs_ops { |
626 | /* memory management calls (similar to KFD interface) */ | 628 | /* memory management calls (similar to KFD interface) */ |
627 | cgs_gpu_mem_info_t gpu_mem_info; | 629 | cgs_gpu_mem_info_t gpu_mem_info; |
@@ -674,6 +676,7 @@ struct cgs_ops { | |||
674 | /* get system info */ | 676 | /* get system info */ |
675 | cgs_query_system_info query_system_info; | 677 | cgs_query_system_info query_system_info; |
676 | cgs_is_virtualization_enabled_t is_virtualization_enabled; | 678 | cgs_is_virtualization_enabled_t is_virtualization_enabled; |
679 | cgs_enter_safe_mode enter_safe_mode; | ||
677 | }; | 680 | }; |
678 | 681 | ||
679 | struct cgs_os_ops; /* To be define in OS-specific CGS header */ | 682 | struct cgs_os_ops; /* To be define in OS-specific CGS header */ |
@@ -779,4 +782,8 @@ struct cgs_device | |||
779 | 782 | ||
780 | #define cgs_is_virtualization_enabled(cgs_device) \ | 783 | #define cgs_is_virtualization_enabled(cgs_device) \ |
781 | CGS_CALL(is_virtualization_enabled, cgs_device) | 784 | CGS_CALL(is_virtualization_enabled, cgs_device) |
785 | |||
786 | #define cgs_enter_safe_mode(cgs_device, en) \ | ||
787 | CGS_CALL(enter_safe_mode, cgs_device, en) | ||
788 | |||
782 | #endif /* _CGS_COMMON_H */ | 789 | #endif /* _CGS_COMMON_H */ |