drm/amd/powerplay: SCLK will have a big drop with low VDDC when PPlib was enabled.
Subsystems (2)
PATCH 1/1 drm/amd/powerplay: SCLK will have a big drop with low VDDC when PPlib was enabled.
From: Rex Zhu <[email protected]>
SMC uses CurrSclkPllRange structure to keep track of what range of PLL SCLK is sitting on. Driver overwrites this value to 0 because it's part of DPM table and driver doesn't program this. This change will set this field to 0xFF every time there's a init SMC table call.
--- drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +2 -1
@@ -2091,7 +2091,7 @@ static int polaris10_init_smc_table(struct pp_hwmgr *hwmgr)"Failed to populate Clock Stretcher Data Table!" , return result); } - + table->CurrSclkPllRange =0xff ; table->GraphicsVoltageChangeEnable =1 ; table->GraphicsThermThrottleEnable =1 ; table->GraphicsInterval =1 ;
@@ -2184,6 +2184,7 @@ static int polaris10_init_smc_table(struct pp_hwmgr *hwmgr)CONVERT_FROM_HOST_TO_SMC_UL (table->SmioMask1);CONVERT_FROM_HOST_TO_SMC_UL (table->SmioMask2);CONVERT_FROM_HOST_TO_SMC_UL (table->SclkStepSize); +CONVERT_FROM_HOST_TO_SMC_UL (table->CurrSclkPllRange);CONVERT_FROM_HOST_TO_SMC_US (table->TemperatureLimitHigh);CONVERT_FROM_HOST_TO_SMC_US (table->TemperatureLimitLow);CONVERT_FROM_HOST_TO_SMC_US (table->VoltageResponseTime);
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/powerplay: fix NULL point check error
From: Rex Zhu <[email protected]>
&& was used instead of ||
--- drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +3 -2
@@ -199,8 +199,9 @@ void phm_apply_dal_min_voltage_request(struct pp_hwmgr *hwmgr)enum PP_DAL_POWERLEVEL dal_power_level = hwmgr->dal_power_level;uint32_t req_vddc =0 , req_volt, i; -if (!table && !(dal_power_level >=PP_DAL_POWERLEVEL_ULTRALOW && - dal_power_level <=PP_DAL_POWERLEVEL_PERFORMANCE )) +if (!table || table-count <=0 + || dal_power_level <PP_DAL_POWERLEVEL_ULTRALOW + || dal_power_level >PP_DAL_POWERLEVEL_PERFORMANCE )return ;for (i =0 ; i < table->count; i++) {
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/powerplay: move asic unrelated function to hwmgr.c.
In reply to Alex DeucherFrom: Rex Zhu <[email protected]>
It's generic and used by multiple asics.
--- drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c | 37 +-------------------- drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 38 ++++++++++++++++++++++ .../gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | 36 -------------------- drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 2 +- 4 files changed, 40 insertions(+), 73 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c +1 -36
@@ -3573,46 +3573,11 @@ static int fiji_force_dpm_highest(struct pp_hwmgr *hwmgr)return 0 ; } -static void fiji_apply_dal_min_voltage_request (struct pp_hwmgr *hwmgr) -{ -struct phm_ppt_v1_information *table_info = - (struct phm_ppt_v1_information *)hwmgr->pptable; -struct phm_clock_voltage_dependency_table *table = - table_info->vddc_dep_on_dal_pwrl; -struct phm_ppt_v1_clock_voltage_dependency_table *vddc_table; -enum PP_DAL_POWERLEVEL dal_power_level = hwmgr->dal_power_level; -uint32_t req_vddc =0 , req_volt, i; - -if (!table && !(dal_power_level >=PP_DAL_POWERLEVEL_ULTRALOW && - dal_power_level <=PP_DAL_POWERLEVEL_PERFORMANCE )) -return ; - -for (i=0 ; i < table->count; i++) { -if (dal_power_level == table->entries[i].clk) { - req_vddc = table->entries[i].v; -break ; - } - } - - vddc_table = table_info->vdd_dep_on_sclk; -for (i=0 ; i < vddc_table->count; i++) { -if (req_vddc <= vddc_table->entries[i].vddc) { - req_volt = (((uint32_t )vddc_table->entries[i].vddc) *VOLTAGE_SCALE ) - <<VDDC_SHIFT ; -smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, - PPSMC_MSG_VddC_Request, req_volt); -return ; - } - } -printk (KERN_ERR "DAL requested level can not" -" found a available voltage in VDDC DPM Table \n" ); -} -static int fiji_upload_dpmlevel_enable_mask (struct pp_hwmgr *hwmgr) {struct fiji_hwmgr *data = (struct fiji_hwmgr *)(hwmgr->backend); -fiji_apply_dal_min_voltage_request (hwmgr); +phm_apply_dal_min_voltage_request (hwmgr);if (!data->sclk_dpm_key_disabled) {if (data->dpm_level_enable_mask.sclk_dpm_enable_mask)
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +38 -0
@@ -30,6 +30,9 @@#include "pppcielanes.h" #include "pp_debug.h" #include "ppatomctrl.h" +#include "ppsmc.h" + +#define VOLTAGE_SCALE 4extern int cz_hwmgr_init (struct pp_hwmgr *hwmgr);extern int tonga_hwmgr_init (struct pp_hwmgr *hwmgr);
@@ -566,3 +569,38 @@ uint32_t phm_get_lowest_enabled_level(struct pp_hwmgr *hwmgr, uint32_t mask)return level; } + +void phm_apply_dal_min_voltage_request (struct pp_hwmgr *hwmgr) +{ +struct phm_ppt_v1_information *table_info = + (struct phm_ppt_v1_information *)hwmgr->pptable; +struct phm_clock_voltage_dependency_table *table = + table_info->vddc_dep_on_dal_pwrl; +struct phm_ppt_v1_clock_voltage_dependency_table *vddc_table; +enum PP_DAL_POWERLEVEL dal_power_level = hwmgr->dal_power_level; +uint32_t req_vddc =0 , req_volt, i; + +if (!table || table->count <=0 + || dal_power_level <PP_DAL_POWERLEVEL_ULTRALOW + || dal_power_level >PP_DAL_POWERLEVEL_PERFORMANCE ) +return ; + +for (i =0 ; i < table->count; i++) { +if (dal_power_level == table->entries[i].clk) { + req_vddc = table->entries[i].v; +break ; + } + } + + vddc_table = table_info->vdd_dep_on_sclk; +for (i =0 ; i < vddc_table->count; i++) { +if (req_vddc <= vddc_table->entries[i].vddc) { + req_volt = (((uint32_t )vddc_table->entries[i].vddc) *VOLTAGE_SCALE ); +smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, + PPSMC_MSG_VddC_Request, req_volt); +return ; + } + } +printk (KERN_ERR "DAL requested level can not" +" found a available voltage in VDDC DPM Table \n" ); +}
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +0 -36
@@ -189,42 +189,6 @@ int phm_get_current_pcie_lane_number(struct pp_hwmgr *hwmgr)return decode_pcie_lane_width (link_width); } -void phm_apply_dal_min_voltage_request (struct pp_hwmgr *hwmgr) -{ -struct phm_ppt_v1_information *table_info = - (struct phm_ppt_v1_information *)hwmgr->pptable; -struct phm_clock_voltage_dependency_table *table = - table_info->vddc_dep_on_dal_pwrl; -struct phm_ppt_v1_clock_voltage_dependency_table *vddc_table; -enum PP_DAL_POWERLEVEL dal_power_level = hwmgr->dal_power_level; -uint32_t req_vddc =0 , req_volt, i; - -if (!table || table-count <=0 - || dal_power_level <PP_DAL_POWERLEVEL_ULTRALOW - || dal_power_level >PP_DAL_POWERLEVEL_PERFORMANCE ) -return ; - -for (i =0 ; i < table->count; i++) { -if (dal_power_level == table->entries[i].clk) { - req_vddc = table->entries[i].v; -break ; - } - } - - vddc_table = table_info->vdd_dep_on_sclk; -for (i =0 ; i < vddc_table->count; i++) { -if (req_vddc <= vddc_table->entries[i].vddc) { - req_volt = (((uint32_t )vddc_table->entries[i].vddc) *VOLTAGE_SCALE ) - <<VDDC_SHIFT ; -smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, - PPSMC_MSG_VddC_Request, req_volt); -return ; - } - } -printk (KERN_ERR "DAL requested level can not" -" found a available voltage in VDDC DPM Table \n" ); -} -/** * Enable voltage control *
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1 -1
@@ -673,7 +673,7 @@ extern int phm_get_sclk_for_voltage_evv(struct pp_hwmgr *hwmgr, phm_ppt_v1_voltaextern int phm_initializa_dynamic_state_adjustment_rule_settings (struct pp_hwmgr *hwmgr);extern int phm_hwmgr_backend_fini (struct pp_hwmgr *hwmgr);extern uint32_t phm_get_lowest_enabled_level (struct pp_hwmgr *hwmgr,uint32_t mask); - +extern void phm_apply_dal_min_voltage_request (struct pp_hwmgr *hwmgr);#define PHM_ENTIRE_REGISTER_MASK 0xFFFFFFFFU
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu: create fence slab once when amdgpu module init.
In reply to Alex DeucherFrom: Rex Zhu <[email protected]>
This avoids problems with multiple GPUs. For example, if the first GPU failed before amdgpu_fence_init() was called, amdgpu_fence_slab_ref is still 0 and it will get decremented in amdgpu_fence_driver_fini(). This will lead to a crash during init of the second GPU since amdgpu_fence_slab_ref is not 0.
v2: add functions for init/exit instead of
moving the variables into the driver.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 25 ++++++++++++++----------- 3 files changed, 20 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
@@ -602,6 +602,8 @@ int amdgpu_sync_wait(struct amdgpu_sync *sync);void amdgpu_sync_free (struct amdgpu_sync *sync);int amdgpu_sync_init (void );void amdgpu_sync_fini (void ); +int amdgpu_fence_slab_init (void ); +void amdgpu_fence_slab_fini (void );/* * GART structures, functions & helpers
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -1
@@ -565,9 +565,12 @@ static struct pci_driver amdgpu_kms_pci_driver = { .driver.pm = &amdgpu_pm_ops, }; + +static int __init amdgpu_init (void ) {amdgpu_sync_init (); +amdgpu_fence_slab_init ();if (vgacon_text_force ()) {DRM_ERROR ("VGACON disables amdgpu kernel modesetting.\n" );return -EINVAL ;
@@ -578,7 +581,6 @@ static int __init amdgpu_init(void) driver->driver_features |=DRIVER_MODESET ; driver->num_ioctls = amdgpu_max_kms_ioctl;amdgpu_register_atpx_handler (); -/* let modprobe override vga console setting */ return drm_pci_init (driver, pdriver); }
@@ -589,6 +591,7 @@ static void __exit amdgpu_exit(void)drm_pci_exit (driver, pdriver);amdgpu_unregister_atpx_handler ();amdgpu_sync_fini (); +amdgpu_fence_slab_fini (); }module_init (amdgpu_init);
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +14 -11
@@ -55,8 +55,21 @@ struct amdgpu_fence { };static struct kmem_cache *amdgpu_fence_slab; -static atomic_t amdgpu_fence_slab_ref =ATOMIC_INIT (0 ); +int amdgpu_fence_slab_init (void ) +{ + amdgpu_fence_slab =kmem_cache_create ( +"amdgpu_fence" ,sizeof (struct amdgpu_fence ),0 , +SLAB_HWCACHE_ALIGN ,NULL ); +if (!amdgpu_fence_slab) +return -ENOMEM ; +return 0 ; +} + +void amdgpu_fence_slab_fini (void ) +{ +kmem_cache_destroy (amdgpu_fence_slab); +}/* * Cast helper */
@@ -396,13 +409,6 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,*/ int amdgpu_fence_driver_init (struct amdgpu_device *adev) { -if (atomic_inc_return (&amdgpu_fence_slab_ref) ==1 ) { - amdgpu_fence_slab =kmem_cache_create ( -"amdgpu_fence" ,sizeof (struct amdgpu_fence ),0 , -SLAB_HWCACHE_ALIGN ,NULL ); -if (!amdgpu_fence_slab) -return -ENOMEM ; - }if (amdgpu_debugfs_fence_init (adev))dev_err (adev->dev,"fence debugfs file creation failed\n" );
@@ -441,9 +447,6 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev)kfree (ring->fence_drv.fences); ring->fence_drv.initialized = false; } - -if (atomic_dec_and_test (&amdgpu_fence_slab_ref)) -kmem_cache_destroy (amdgpu_fence_slab); }/**
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel