linux/drivers/gpu/drm/amd/pm/inc
Lang Yu 6ff7fddbd1 drm/amdgpu: add support for SMU debug option
SMU firmware expects the driver maintains error context
and doesn't interact with SMU any more when SMU errors
occurred. That will aid in debugging SMU firmware issues.

Add SMU debug option support for this request, it can be
enabled or disabled via amdgpu_smu_debug debugfs file.
Use a 32-bit mask to indicate corresponding debug modes.
Currently, only one mode(HALT_ON_ERROR) is supported.
When enabled, it brings hardware to a kind of halt state
so that no one can touch it any more in the envent of SMU
errors.

The dirver interacts with SMU via sending messages. And
threre are three ways to sending messages to SMU in current
implementation. Handle them respectively as following:

1, smu_cmn_send_smc_msg_with_param() for normal timeout cases

  Halt on any error.

2, smu_cmn_send_msg_without_waiting()/smu_cmn_wait_for_response()
for longer timeout cases

  Halt on errors apart from ETIME. Otherwise this way won't work.
  Let the user handle ETIME error in such a case.

3, smu_cmn_send_msg_without_waiting() for no waiting cases

  Halt on errors apart from ETIME. Otherwise second way won't work.

== Command Guide ==

1, enable HALT_ON_ERROR mode

 # echo 0x1 > /sys/kernel/debug/dri/0/amdgpu_smu_debug

2, disable HALT_ON_ERROR mode

 # echo 0x0 > /sys/kernel/debug/dri/0/amdgpu_smu_debug

v5:
 - Use bit mask to allow more debug features.(Evan)
 - Use WRAN() instead of BUG().(Evan)

v4:
 - Set to halt state instead of a simple hang.(Christian)

v3:
 - Use debugfs_create_bool().(Christian)
 - Put variable into smu_context struct.
 - Don't resend command when timeout.

v2:
 - Resend command when timeout.(Lijo)
 - Use debugfs file instead of module parameter.

Signed-off-by: Lang Yu <lang.yu@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2021-12-13 16:33:16 -05:00
..
vega12
aldebaran_ppsmc.h drm/amd/pm: Support board calibration on aldebaran 2021-07-23 10:07:59 -04:00
amd_powerplay.h
amdgpu_dpm.h drm/amd/pm: avoid duplicate powergate/ungate setting 2021-11-22 14:45:02 -05:00
amdgpu_pm.h drm/amd/pm: do not use drm middle layer for debugfs 2021-02-18 16:43:09 -05:00
amdgpu_smu.h drm/amdgpu: add support for SMU debug option 2021-12-13 16:33:16 -05:00
arcturus_ppsmc.h drm/amd/pm: Add LightSBR SMU MSG support 2021-03-23 23:25:43 -04:00
cz_ppsmc.h
fiji_ppsmc.h
hardwaremanager.h
hwmgr.h drm/amd/pm: drop the unnecessary intermediate percent-based transition 2021-08-16 15:35:56 -04:00
polaris10_pwrvirus.h
power_state.h
pp_debug.h
pp_endian.h
pp_thermal.h drm/amd/pm/inc/pp_thermal: Mark 'SMU7Thermal{WithDelay}Policy' as __maybe_unused 2020-12-01 16:04:44 -05:00
ppinterrupt.h
rv_ppsmc.h drm/amdgpu/powerplay/smu10: add support for gpu busy query (v2) 2021-03-23 23:27:50 -04:00
smu7_common.h
smu7_discrete.h
smu7_fusion.h
smu7_ppsmc.h drm/amd/pm: correct Polaris DIDT configurations 2020-10-27 11:59:16 -04:00
smu7.h
smu8_fusion.h
smu8.h
smu9_driver_if.h
smu9.h
smu10_driver_if.h
smu10.h drm/amd/pm: update smu10.h WORKLOAD_PPLIB setting for raven 2020-12-08 23:06:15 -05:00
smu11_driver_if_arcturus.h
smu11_driver_if_cyan_skillfish.h drm/amdgpu: update SMU driver interface for cyan skilfish(v3) 2021-09-16 09:56:23 -04:00
smu11_driver_if_navi10.h drm/amd/pm: bump Navi1x driver if version and related data structures V2 2021-03-02 14:05:18 -05:00
smu11_driver_if_sienna_cichlid.h drm/amd/pm: bump DRIVER_IF_VERSION for Sienna Cichlid 2021-07-08 17:47:28 -04:00
smu11_driver_if_vangogh.h drm/amd/pm: update the driver interface header for vangogh 2021-04-15 16:32:19 -04:00
smu11_driver_if.h
smu12_driver_if.h
smu13_driver_if_aldebaran.h drm/amd/pm: Update smu driver interface for aldebaran 2021-11-22 14:45:03 -05:00
smu13_driver_if_yellow_carp.h drm/admgpu/pm: add smu v13 driver interface header for yellow carp (v3) 2021-06-04 16:03:09 -04:00
smu71_discrete.h
smu71.h
smu72_discrete.h
smu72.h
smu73_discrete.h
smu73.h
smu74_discrete.h drm/amd/pm: correct VR shared rail info 2020-10-27 11:58:57 -04:00
smu74.h
smu75_discrete.h
smu75.h
smu_11_0_cdr_table.h
smu_types.h drm/amdgpu: add manual sclk/vddc setting support for cyan skilfish(v3) 2021-09-16 09:56:23 -04:00
smu_ucode_xfer_cz.h
smu_ucode_xfer_vi.h
smu_v11_0_7_ppsmc.h drm/amd/pm: new SMC message for 2nd usb2.0 port workaround 2020-12-10 16:41:49 -05:00
smu_v11_0_7_pptable.h
smu_v11_0_ppsmc.h
smu_v11_0_pptable.h
smu_v11_0.h amdgpu/pm: (v2) add limit_type to (pptable_funcs)->set_power_limit signature 2021-10-13 14:14:54 -04:00
smu_v11_5_pmfw.h drm/amd/pm: update the swSMU headers for vangogh 2020-11-13 00:12:51 -05:00
smu_v11_5_ppsmc.h drm/amd/pm: update the smu v11.5 smc header for vangogh 2021-02-09 15:29:15 -05:00
smu_v11_8_pmfw.h drm/amdgpu: add smu_v11_8_pmfw header for cyan_skilfish 2021-07-23 10:08:01 -04:00
smu_v11_8_ppsmc.h drm/amdgpu: update SMU PPSMC for cyan skilfish 2021-09-16 09:56:23 -04:00
smu_v12_0_ppsmc.h
smu_v12_0.h drm/amd/pm: add the callback to get the bootup values for renoir 2021-04-15 16:32:44 -04:00
smu_v13_0_1_pmfw.h drm/amd/pm: update smu v13.0.1 firmware header 2021-08-05 21:17:59 -04:00
smu_v13_0_1_ppsmc.h drm/amdgpu/pm: drop pp_power_profile_mode support for yellow carp 2021-11-03 12:22:07 -04:00
smu_v13_0_pptable.h drm/amd/swsmu: add aldebaran smu13 ip support (v3) 2021-03-23 22:54:24 -04:00
smu_v13_0.h drm/amd/pm: Update smu driver interface for aldebaran 2021-11-22 14:45:03 -05:00
smumgr.h drm/amd/pm: perform SMC reset on suspend/hibernation 2020-10-30 01:00:43 -04:00
tonga_ppsmc.h
vega10_ppsmc.h
vega12_ppsmc.h
vega20_ppsmc.h