]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/amdgpu: add set/get mca debug mode operations
authorTao Zhou <tao.zhou1@amd.com>
Thu, 12 Oct 2023 03:22:07 +0000 (11:22 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 20 Oct 2023 19:11:28 +0000 (15:11 -0400)
Record the debug mode status in RAS.

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h

index eb81efacefe2a93f76e76a272435341d670b1d39..3c83a2b8fb2c3689f2c12ca4ea4e8afe28d205ed 100644 (file)
@@ -3311,6 +3311,27 @@ int amdgpu_ras_reset_gpu(struct amdgpu_device *adev)
        return 0;
 }
 
+void amdgpu_ras_set_mca_debug_mode(struct amdgpu_device *adev, bool enable)
+{
+       struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
+
+       if (con)
+               con->is_mca_debug_mode = enable;
+}
+
+bool amdgpu_ras_get_mca_debug_mode(struct amdgpu_device *adev)
+{
+       struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
+       const struct amdgpu_mca_smu_funcs *mca_funcs = adev->mca.mca_funcs;
+
+       if (!con)
+               return false;
+
+       if (mca_funcs && mca_funcs->mca_set_debug_mode)
+               return con->is_mca_debug_mode;
+       else
+               return true;
+}
 
 /* Register each ip ras block into amdgpu ras */
 int amdgpu_ras_register_ras_block(struct amdgpu_device *adev,
index 3f9ac0ab67e672cfbda9a159bb1c1a5fc4ea5408..2fdfef62ee27b493b3eda63fb3ceb8be39f02b32 100644 (file)
@@ -434,6 +434,8 @@ struct amdgpu_ras {
 
        /* Indicates smu whether need update bad channel info */
        bool update_channel_flag;
+       /* Record status of smu mca debug mode */
+       bool is_mca_debug_mode;
 
        /* Record special requirements of gpu reset caller */
        uint32_t  gpu_reset_flags;
@@ -768,6 +770,9 @@ struct amdgpu_ras* amdgpu_ras_get_context(struct amdgpu_device *adev);
 
 int amdgpu_ras_set_context(struct amdgpu_device *adev, struct amdgpu_ras *ras_con);
 
+void amdgpu_ras_set_mca_debug_mode(struct amdgpu_device *adev, bool enable);
+bool amdgpu_ras_get_mca_debug_mode(struct amdgpu_device *adev);
+
 int amdgpu_ras_register_ras_block(struct amdgpu_device *adev,
                                struct amdgpu_ras_block_object *ras_block_obj);
 void amdgpu_ras_interrupt_fatal_error_handler(struct amdgpu_device *adev);