drm/amdgpu: add cgs interface for enter/exit rlc safe mode.
authorRex Zhu <Rex.Zhu@amd.com>
Wed, 21 Dec 2016 12:30:58 +0000 (20:30 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 27 Jan 2017 16:12:46 +0000 (11:12 -0500)
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>
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
drivers/gpu/drm/amd/include/cgs_common.h

index d0e87102e1b913e6f44bbf811f42832030acf9bb..a5df1ef306d9dc65c6cbad7a256192a249566483 100644 (file)
@@ -763,6 +763,23 @@ static uint16_t amdgpu_get_firmware_version(struct cgs_device *cgs_device,
        return fw_version;
 }
 
+static int amdgpu_cgs_enter_safe_mode(struct cgs_device *cgs_device,
+                                       bool en)
+{
+       CGS_FUNC_ADEV;
+
+       if (adev->gfx.rlc.funcs->enter_safe_mode == NULL ||
+               adev->gfx.rlc.funcs->exit_safe_mode == NULL)
+               return 0;
+
+       if (en)
+               adev->gfx.rlc.funcs->enter_safe_mode(adev);
+       else
+               adev->gfx.rlc.funcs->exit_safe_mode(adev);
+
+       return 0;
+}
+
 static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
                                        enum cgs_ucode_id type,
                                        struct cgs_firmware_info *info)
@@ -1243,6 +1260,7 @@ static const struct cgs_ops amdgpu_cgs_ops = {
        .call_acpi_method = amdgpu_cgs_call_acpi_method,
        .query_system_info = amdgpu_cgs_query_system_info,
        .is_virtualization_enabled = amdgpu_cgs_is_virtualization_enabled,
+       .enter_safe_mode = amdgpu_cgs_enter_safe_mode,
 };
 
 static const struct cgs_os_ops amdgpu_cgs_os_ops = {
index e4a1697ec1d31f4d04e5995c2975c4f2ef9fb745..1d26ae768147a05204e5872a6641ab5577d9d2b6 100644 (file)
@@ -622,6 +622,8 @@ typedef int (*cgs_query_system_info)(struct cgs_device *cgs_device,
 
 typedef int (*cgs_is_virtualization_enabled_t)(void *cgs_device);
 
+typedef int (*cgs_enter_safe_mode)(struct cgs_device *cgs_device, bool en);
+
 struct cgs_ops {
        /* memory management calls (similar to KFD interface) */
        cgs_gpu_mem_info_t gpu_mem_info;
@@ -674,6 +676,7 @@ struct cgs_ops {
        /* get system info */
        cgs_query_system_info query_system_info;
        cgs_is_virtualization_enabled_t is_virtualization_enabled;
+       cgs_enter_safe_mode enter_safe_mode;
 };
 
 struct cgs_os_ops; /* To be define in OS-specific CGS header */
@@ -779,4 +782,8 @@ struct cgs_device
 
 #define cgs_is_virtualization_enabled(cgs_device) \
                CGS_CALL(is_virtualization_enabled, cgs_device)
+
+#define cgs_enter_safe_mode(cgs_device, en) \
+               CGS_CALL(enter_safe_mode, cgs_device, en)
+
 #endif /* _CGS_COMMON_H */