Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: add powercontainment module parameter

This patch makes powercontainment feature configurable. Currently, the
powercontainment is not very stable, so add a module parameter to
enable/disable it via user mode.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Huang Rui and committed by
Alex Deucher
6bb6b297 c5f74f78

+24 -9
+1
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 85 85 extern int amdgpu_sched_jobs; 86 86 extern int amdgpu_sched_hw_submission; 87 87 extern int amdgpu_powerplay; 88 + extern int amdgpu_powercontainment; 88 89 extern unsigned amdgpu_pcie_gen_cap; 89 90 extern unsigned amdgpu_pcie_lane_cap; 90 91
+4
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
··· 82 82 int amdgpu_sched_jobs = 32; 83 83 int amdgpu_sched_hw_submission = 2; 84 84 int amdgpu_powerplay = -1; 85 + int amdgpu_powercontainment = 1; 85 86 unsigned amdgpu_pcie_gen_cap = 0; 86 87 unsigned amdgpu_pcie_lane_cap = 0; 87 88 ··· 161 160 #ifdef CONFIG_DRM_AMD_POWERPLAY 162 161 MODULE_PARM_DESC(powerplay, "Powerplay component (1 = enable, 0 = disable, -1 = auto (default))"); 163 162 module_param_named(powerplay, amdgpu_powerplay, int, 0444); 163 + 164 + MODULE_PARM_DESC(powercontainment, "Power Containment (1 = enable (default), 0 = disable)"); 165 + module_param_named(powercontainment, amdgpu_powercontainment, int, 0444); 164 166 #endif 165 167 166 168 MODULE_PARM_DESC(pcie_gen_cap, "PCIE Gen Caps (0: autodetect (default))");
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
··· 52 52 pp_init->chip_family = adev->family; 53 53 pp_init->chip_id = adev->asic_type; 54 54 pp_init->device = amdgpu_cgs_create_device(adev); 55 + pp_init->powercontainment_enabled = amdgpu_powercontainment; 55 56 56 57 ret = amd_powerplay_init(pp_init, amd_pp); 57 58 kfree(pp_init);
+8 -7
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_powertune.c
··· 73 73 74 74 if (!tmp) { 75 75 phm_cap_set(hwmgr->platform_descriptor.platformCaps, 76 - PHM_PlatformCaps_PowerContainment); 77 - 78 - phm_cap_set(hwmgr->platform_descriptor.platformCaps, 79 76 PHM_PlatformCaps_CAC); 80 77 81 78 fiji_hwmgr->fast_watermark_threshold = 100; 82 79 83 - tmp = 1; 84 - fiji_hwmgr->enable_dte_feature = tmp ? false : true; 85 - fiji_hwmgr->enable_tdc_limit_feature = tmp ? true : false; 86 - fiji_hwmgr->enable_pkg_pwr_tracking_feature = tmp ? true : false; 80 + if (hwmgr->powercontainment_enabled) { 81 + phm_cap_set(hwmgr->platform_descriptor.platformCaps, 82 + PHM_PlatformCaps_PowerContainment); 83 + tmp = 1; 84 + fiji_hwmgr->enable_dte_feature = tmp ? false : true; 85 + fiji_hwmgr->enable_tdc_limit_feature = tmp ? true : false; 86 + fiji_hwmgr->enable_pkg_pwr_tracking_feature = tmp ? true : false; 87 + } 87 88 } 88 89 } 89 90
+1
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
··· 58 58 hwmgr->hw_revision = pp_init->rev_id; 59 59 hwmgr->usec_timeout = AMD_MAX_USEC_TIMEOUT; 60 60 hwmgr->power_source = PP_PowerSource_AC; 61 + hwmgr->powercontainment_enabled = pp_init->powercontainment_enabled; 61 62 62 63 switch (hwmgr->chip_family) { 63 64 case AMD_FAMILY_CZ:
+7 -2
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c
··· 2606 2606 phm_cap_unset(hwmgr->platform_descriptor.platformCaps, 2607 2607 PHM_PlatformCaps_TCPRamping); 2608 2608 2609 - phm_cap_set(hwmgr->platform_descriptor.platformCaps, 2610 - PHM_PlatformCaps_PowerContainment); 2609 + if (hwmgr->powercontainment_enabled) 2610 + phm_cap_set(hwmgr->platform_descriptor.platformCaps, 2611 + PHM_PlatformCaps_PowerContainment); 2612 + else 2613 + phm_cap_unset(hwmgr->platform_descriptor.platformCaps, 2614 + PHM_PlatformCaps_PowerContainment); 2615 + 2611 2616 phm_cap_set(hwmgr->platform_descriptor.platformCaps, 2612 2617 PHM_PlatformCaps_CAC); 2613 2618
+1
drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h
··· 132 132 uint32_t chip_family; 133 133 uint32_t chip_id; 134 134 uint32_t rev_id; 135 + bool powercontainment_enabled; 135 136 }; 136 137 enum amd_pp_display_config_type{ 137 138 AMD_PP_DisplayConfigType_None = 0,
+1
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
··· 609 609 uint32_t num_ps; 610 610 struct pp_thermal_controller_info thermal_controller; 611 611 bool fan_ctrl_is_in_default_mode; 612 + bool powercontainment_enabled; 612 613 uint32_t fan_ctrl_default_mode; 613 614 uint32_t tmin; 614 615 struct phm_microcode_version_info microcode_version_info;