drm/amd: add AMDGPU_DEBUG_HIBERNATION_THAW_RESUME_GPU debug mask
Subsystems (2)
PATCH 1/1 drm/amd: add AMDGPU_DEBUG_HIBERNATION_THAW_RESUME_GPU debug mask
Kernel parameter no_console_suspend is required to capture all hibernation kernel log via serial console. But when the parameter is set, GPU will be resumed in thaw stage. This causes many issues on alinux3 kernel.
Fix: add new debug mask AMDGPU_DEBUG_HIBERNATION_THAW_RESUME_GPU to replace the check of console_suspend_enabled in thaw() callback.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -3
@@ -33,7 +33,6 @@#include <drm/drm_vblank.h> #include <linux/cc_platform.h> -#include <linux/console.h> #include <linux/dynamic_debug.h> #include <linux/module.h> #include <linux/mmu_notifier.h>
@@ -146,7 +145,8 @@ enum AMDGPU_DEBUG_MASK {AMDGPU_DEBUG_SMU_POOL =BIT (7 ),AMDGPU_DEBUG_VM_USERPTR =BIT (8 ),AMDGPU_DEBUG_DISABLE_RAS_CE_LOG =BIT (9 ), - AMDGPU_DEBUG_ENABLE_CE_CS = BIT(10) +AMDGPU_DEBUG_ENABLE_CE_CS =BIT (10 ), + AMDGPU_DEBUG_HIBERNATION_THAW_RESUME_GPU = BIT(11), };unsigned int amdgpu_vram_limit =UINT_MAX ;
@@ -2707,7 +2707,7 @@ static int amdgpu_pmops_thaw(struct device *dev)struct drm_device *drm_dev =dev_get_drvdata (dev);/* do not resume device if it's normal hibernation */ -if (console_suspend_enabled && +if (!(amdgpu_debug_mask &AMDGPU_DEBUG_HIBERNATION_THAW_RESUME_GPU ) && !pm_hibernate_is_recovering () && !pm_hibernation_mode_is_suspend ())return 0 ;
Signature · 1 line
2.43.0
Quoted 26 lines · Samuel Zhang
Kernel parameter
no_console_suspendis required to capture all hibernation kernel log via serial console. But when the parameter is set, GPU will be resumed in thaw stage. This causes many issues on alinux3 kernel.Fix: add new debug mask
AMDGPU_DEBUG_HIBERNATION_THAW_RESUME_GPUto replace the check ofconsole_suspend_enabledinthaw()callback.Signed-off-by Samuel Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-1@@ -33,7 +33,6 @@#include <drm/drm_vblank.h> #include <linux/cc_platform.h> -#include <linux/console.h> #include <linux/dynamic_debug.h> #include <linux/module.h> #include <linux/mmu_notifier.h>
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c enum AMDGPU_DEBUG_MASK { · line 149
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2
-1@@ -146,7 +145,8 @@ enum AMDGPU_DEBUG_MASK {AMDGPU_DEBUG_SMU_POOL =BIT (7 ),AMDGPU_DEBUG_VM_USERPTR =BIT (8 ),AMDGPU_DEBUG_DISABLE_RAS_CE_LOG =BIT (9 ), -AMDGPU_DEBUG_ENABLE_CE_CS =BIT (10 ) +AMDGPU_DEBUG_ENABLE_CE_CS =BIT (10 ), + AMDGPU_DEBUG_HIBERNATION_THAW_RESUME_GPU = BIT(11),
You should add a line to amdgpu_init_debug_options() as well for this change.
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_thaw(struct device *dev) · line 2710
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-1};unsigned int amdgpu_vram_limit =UINT_MAX ;@@ -2707,7 +2707,7 @@ static int amdgpu_pmops_thaw(struct device *dev)struct drm_device *drm_dev =dev_get_drvdata (dev);/* do not resume device if it's normal hibernation */ - if (console_suspend_enabled && + if (!(amdgpu_debug_mask & AMDGPU_DEBUG_HIBERNATION_THAW_RESUME_GPU) &&
We don't seem to use this code pattern elsewhere for amdgpu_debug_mask to look for a bit where it's needed.
Rather assign a variable in amdgpu_init_debug_options() and look at that variable.
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0!pm_hibernate_is_recovering() && !pm_hibernation_mode_is_suspend())return 0 ;