drm/amdgpu: add the sensor value of VCN activity
Subsystems (3)
PATCH v2 1/7 drm/amdgpu: add the sensor value of VCN activity
This will add the sensor value of VCN activity for some ASICs.
--- .../gpu/drm/amd/include/kgd_pp_interface.h | 1 + drivers/gpu/drm/amd/pm/amdgpu_pm.c | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -0
@@ -150,6 +150,7 @@ enum amd_pp_sensors {AMDGPU_PP_SENSOR_VCN_POWER_STATE ,AMDGPU_PP_SENSOR_PEAK_PSTATE_SCLK ,AMDGPU_PP_SENSOR_PEAK_PSTATE_MCLK , + AMDGPU_PP_SENSOR_VCN_LOAD, }; enum amd_pp_task {
drivers/gpu/drm/amd/pm/amdgpu_pm.c +37 -0
@@ -1581,6 +1581,30 @@ static ssize_t amdgpu_get_mem_busy_percent(struct device *dev,return sysfs_emit (buf,"%d\n" , value); } +/** +* DOC: vcn_busy_percent +* +* The amdgpu driver provides a sysfs API for reading how busy the VCN +* is as a percentage. The file vcn_busy_percent is used for this. +* The SMU firmware computes a percentage of load based on the +* aggregate activity level in the IP cores. +*/ +static ssize_t amdgpu_get_vcn_busy_percent (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev =drm_to_adev (ddev); +unsigned int value; +int r; + + r =amdgpu_hwmon_get_sensor_generic (adev,AMDGPU_PP_SENSOR_VCN_LOAD , &value); +if (r) +return r; + +return sysfs_emit (buf,"%d\n" , value); +} +/** * DOC: pcie_bw *
@@ -2121,6 +2145,7 @@ static struct amdgpu_device_attr amdgpu_device_attrs[] = {AMDGPU_DEVICE_ATTR_RW (pp_od_clk_voltage,ATTR_FLAG_BASIC ),AMDGPU_DEVICE_ATTR_RO (gpu_busy_percent,ATTR_FLAG_BASIC |ATTR_FLAG_ONEVF ),AMDGPU_DEVICE_ATTR_RO (mem_busy_percent,ATTR_FLAG_BASIC |ATTR_FLAG_ONEVF ), +AMDGPU_DEVICE_ATTR_RO (vcn_busy_percent,ATTR_FLAG_BASIC |ATTR_FLAG_ONEVF ),AMDGPU_DEVICE_ATTR_RO (pcie_bw,ATTR_FLAG_BASIC ),AMDGPU_DEVICE_ATTR_RW (pp_features,ATTR_FLAG_BASIC |ATTR_FLAG_ONEVF ), AMDGPU_DEVICE_ATTR_RO(unique_id, ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
@@ -2170,6 +2195,15 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ }else if (DEVICE_ATTR_IS (mem_busy_percent)) {if (adev->flags &AMD_IS_APU || gc_ver ==IP_VERSION (9 ,0 ,1 )) *states =ATTR_STATE_UNSUPPORTED ; + }else if (DEVICE_ATTR_IS (vcn_busy_percent)) { +if (!(gc_ver ==IP_VERSION (10 ,3 ,1 ) || + gc_ver ==IP_VERSION (10 ,3 ,3 ) || + gc_ver ==IP_VERSION (10 ,3 ,6 ) || + gc_ver ==IP_VERSION (10 ,3 ,7 ) || + gc_ver ==IP_VERSION (11 ,0 ,1 ) || + gc_ver ==IP_VERSION (11 ,0 ,4 ) || + gc_ver ==IP_VERSION (11 ,5 ,0 ))) + *states =ATTR_STATE_UNSUPPORTED ; }else if (DEVICE_ATTR_IS (pcie_bw)) {/* PCIe Perf counters won't work on APU nodes */ if (adev->flags &AMD_IS_APU )
@@ -4365,6 +4399,9 @@ static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *a/* MEM Load */ if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_MEM_LOAD , (void *)&value, &size))seq_printf (m,"MEM Load: %u %%\n" , value); +/* VCN Load */ +if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_VCN_LOAD , (void *)&value, &size)) +seq_printf (m,"VCN Load: %u %%\n" , value);seq_printf (m,"\n" );
Signature · 1 line
2.34.1
PATCH v2 2/7 drm/amdgpu: add VCN sensor value for SMU 13.0.4
This will add VCN sensor value for SMU 13.0.4.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c +7 -1
@@ -318,7 +318,7 @@ static int smu_v13_0_4_get_smu_metrics_data(struct smu_context *smu, *value = metrics->GfxActivity /100 ;break ;case METRICS_AVERAGE_VCNACTIVITY : - *value = metrics->UvdActivity; + *value = metrics->UvdActivity /100 ;break ;case METRICS_AVERAGE_SOCKETPOWER : *value = (metrics->AverageSocketPower <<8 ) /1000 ;
@@ -572,6 +572,12 @@ static int smu_v13_0_4_read_sensor(struct smu_context *smu, (uint32_t *)data); *size =4 ;break ; +case AMDGPU_PP_SENSOR_VCN_LOAD : + ret =smu_v13_0_4_get_smu_metrics_data (smu, +METRICS_AVERAGE_VCNACTIVITY , + (uint32_t *)data); + *size =4 ; +break ;case AMDGPU_PP_SENSOR_GPU_AVG_POWER : ret = smu_v13_0_4_get_smu_metrics_data(smu, METRICS_AVERAGE_SOCKETPOWER,
Signature · 1 line
2.34.1
PATCH v2 3/7 drm/admgpu: add vclk and dclk sysfs node for some ASICs
In reply to Xiaojian DuThis will add vclk and dclk sysfs node for some ASICs.
--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +12 -0
@@ -2235,9 +2235,15 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ *states =ATTR_STATE_UNSUPPORTED ; }else if (DEVICE_ATTR_IS (pp_dpm_vclk)) {if (!(gc_ver ==IP_VERSION (10 ,3 ,1 ) || + gc_ver ==IP_VERSION (10 ,3 ,3 ) || + gc_ver ==IP_VERSION (10 ,3 ,6 ) || + gc_ver ==IP_VERSION (10 ,3 ,7 ) || gc_ver ==IP_VERSION (10 ,3 ,0 ) || gc_ver ==IP_VERSION (10 ,1 ,2 ) || gc_ver ==IP_VERSION (11 ,0 ,0 ) || + gc_ver ==IP_VERSION (11 ,0 ,1 ) || + gc_ver ==IP_VERSION (11 ,0 ,4 ) || + gc_ver ==IP_VERSION (11 ,5 ,0 ) || gc_ver ==IP_VERSION (11 ,0 ,2 ) || gc_ver ==IP_VERSION (11 ,0 ,3 ) || gc_ver ==IP_VERSION (9 ,4 ,3 )))
@@ -2250,9 +2256,15 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ *states =ATTR_STATE_UNSUPPORTED ; }else if (DEVICE_ATTR_IS (pp_dpm_dclk)) {if (!(gc_ver ==IP_VERSION (10 ,3 ,1 ) || + gc_ver ==IP_VERSION (10 ,3 ,3 ) || + gc_ver ==IP_VERSION (10 ,3 ,6 ) || + gc_ver ==IP_VERSION (10 ,3 ,7 ) || gc_ver ==IP_VERSION (10 ,3 ,0 ) || gc_ver ==IP_VERSION (10 ,1 ,2 ) || gc_ver ==IP_VERSION (11 ,0 ,0 ) || + gc_ver ==IP_VERSION (11 ,0 ,1 ) || + gc_ver ==IP_VERSION (11 ,0 ,4 ) || + gc_ver ==IP_VERSION (11 ,5 ,0 ) || gc_ver ==IP_VERSION (11 ,0 ,2 ) || gc_ver ==IP_VERSION (11 ,0 ,3 ) || gc_ver ==IP_VERSION (9 ,4 ,3 )))
Signature · 1 line
2.34.1
PATCH v2 4/7 drm/amdgpu: add VCN sensor value for Vangogh
In reply to Xiaojian DuThis will drm/amdgpu: add VCN sensor value for Vangogh.
--- drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +7 -1
@@ -301,7 +301,7 @@ static int vangogh_get_legacy_smu_metrics_data(struct smu_context *smu, *value = metrics->GfxActivity /100 ;break ;case METRICS_AVERAGE_VCNACTIVITY : - *value = metrics->UvdActivity; + *value = metrics->UvdActivity /100 ;break ;case METRICS_AVERAGE_SOCKETPOWER : *value = (metrics->CurrentSocketPower << 8) /
@@ -1507,6 +1507,12 @@ static int vangogh_read_sensor(struct smu_context *smu, (uint32_t *)data); *size =4 ;break ; +case AMDGPU_PP_SENSOR_VCN_LOAD : + ret =vangogh_common_get_smu_metrics_data (smu, +METRICS_AVERAGE_VCNACTIVITY , + (uint32_t *)data); + *size =4 ; +break ;case AMDGPU_PP_SENSOR_GPU_AVG_POWER : ret = vangogh_common_get_smu_metrics_data(smu, METRICS_AVERAGE_SOCKETPOWER,
Signature · 1 line
2.34.1
PATCH v2 5/7 drm/amdgpu: add VCN sensor value for yellow carp
In reply to Xiaojian DuThis will add VCN sensor value for yellow carp.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +7 -1
@@ -363,7 +363,7 @@ static int yellow_carp_get_smu_metrics_data(struct smu_context *smu, *value = metrics->GfxActivity /100 ;break ;case METRICS_AVERAGE_VCNACTIVITY : - *value = metrics->UvdActivity; + *value = metrics->UvdActivity /100 ;break ;case METRICS_CURR_SOCKETPOWER : *value = (metrics->CurrentSocketPower <<8 ) /1000 ;
@@ -423,6 +423,12 @@ static int yellow_carp_read_sensor(struct smu_context *smu, (uint32_t *)data); *size =4 ;break ; +case AMDGPU_PP_SENSOR_VCN_LOAD : + ret =yellow_carp_get_smu_metrics_data (smu, +METRICS_AVERAGE_VCNACTIVITY , + (uint32_t *)data); + *size =4 ; +break ;case AMDGPU_PP_SENSOR_GPU_INPUT_POWER : ret = yellow_carp_get_smu_metrics_data(smu, METRICS_CURR_SOCKETPOWER,
Signature · 1 line
2.34.1
PATCH v2 6/7 drm/amdgpu: add VCN sensor value for SMU 13.0.5
In reply to Xiaojian DuThis will add VCN sensor value for SMU 13.0.5.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c +7 -1
@@ -286,7 +286,7 @@ static int smu_v13_0_5_get_smu_metrics_data(struct smu_context *smu, *value = metrics->GfxActivity /100 ;break ;case METRICS_AVERAGE_VCNACTIVITY : - *value = metrics->UvdActivity; + *value = metrics->UvdActivity /100 ;break ;case METRICS_CURR_SOCKETPOWER : *value = (metrics->CurrentSocketPower <<8 ) /1000 ;
@@ -332,6 +332,12 @@ static int smu_v13_0_5_read_sensor(struct smu_context *smu, (uint32_t *)data); *size =4 ;break ; +case AMDGPU_PP_SENSOR_VCN_LOAD : + ret =smu_v13_0_5_get_smu_metrics_data (smu, +METRICS_AVERAGE_VCNACTIVITY , + (uint32_t *)data); + *size =4 ; +break ;case AMDGPU_PP_SENSOR_GPU_INPUT_POWER : ret = smu_v13_0_5_get_smu_metrics_data(smu, METRICS_CURR_SOCKETPOWER,
Signature · 1 line
2.34.1
PATCH v2 7/7 drm/amdgpu: add VCN sensor value for SMU 14.0.0
In reply to Xiaojian DuThis will add VCN sensor value for SMU 14.0.0.
--- drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c +6 -0
@@ -352,6 +352,12 @@ static int smu_v14_0_0_read_sensor(struct smu_context *smu, (uint32_t *)data); *size =4 ;break ; +case AMDGPU_PP_SENSOR_VCN_LOAD : + ret =smu_v14_0_0_get_smu_metrics_data (smu, +METRICS_AVERAGE_VCNACTIVITY , + (uint32_t *)data); + *size =4 ; +break ;case AMDGPU_PP_SENSOR_GPU_AVG_POWER : ret = smu_v14_0_0_get_smu_metrics_data(smu, METRICS_AVERAGE_SOCKETPOWER,
Signature · 1 line
2.34.1
Re: [PATCH v2 7/7] drm/amdgpu: add VCN sensor value for SMU 14.0.0
Series is:
Quoted 28 lines · Xiaojian Du
This will add VCN sensor value for SMU 14.0.0.
Signed-off-by Xiaojian Du <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c +6
-1@@ -352,6 +352,12 @@ static int smu_v14_0_0_read_sensor(struct smu_context *smu, (uint32_t *)data); *size =4 ;break ; +case AMDGPU_PP_SENSOR_VCN_LOAD : + ret =smu_v14_0_0_get_smu_metrics_data (smu, +METRICS_AVERAGE_VCNACTIVITY , + (uint32_t *)data); + *size =4 ; +break ;case AMDGPU_PP_SENSOR_GPU_AVG_POWER : ret = smu_v14_0_0_get_smu_metrics_data(smu, METRICS_AVERAGE_SOCKETPOWER, --2.34.1