drm/amdgpu: add bitmask controll for power related sysfs interfaces
Subsystems (3)
PATCH 1/8 drm/amdgpu: add bitmask controll for power related sysfs interfaces
Via this, the logic for adding/dropping the support for some specific sysfs interface can be greatly simplified.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 ++ drivers/gpu/drm/amd/pm/amdgpu_pm.c | 115 +++++++++++++++------ drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h | 37 +++++++ drivers/gpu/drm/amd/pm/inc/amdgpu_pm.h | 16 +-- 4 files changed, 141 insertions(+), 36 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +9 -0
@@ -3639,6 +3639,15 @@ int amdgpu_device_init(struct amdgpu_device *adev,ratelimit_state_init (&adev->throttling_logging_rs, (60 -1 ) *HZ ,1 );ratelimit_set_flags (&adev->throttling_logging_rs,RATELIMIT_MSG_ON_RELEASE ); +/* +* At default, all sysfs interfaces are claimed to be supported. +* And every sysfs interface is readable and writable. However, +* each ASIC can have its own setting by overriding these. +*/ + adev->pm.sysfs_if_supported =AMD_SYSFS_IF_BITMASK_ALL_SUPPORTED ; +for (i =0 ; i <AMD_MAX_NUMBER_OF_SYSFS_IF_SUPPORTED ; i++) + adev->pm.sysfs_if_attr_mode[i] =S_IRUGO |S_IWUGO ; +/* Registers mapping */ /* TODO: block userspace mapping of io register */ if (adev->asic_type >=CHIP_BONAIRE ) {
drivers/gpu/drm/amd/pm/amdgpu_pm.c +86 -29
129 lines not on this page · raw message
drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +37 -0
@@ -312,6 +312,39 @@ struct config_table_settinguint16_t fclk_average_tau; }; +/* Bitmasks for controlling which Sysfs interface to support */ +#define AMD_SYSFS_IF_POWER_DPM_STATE_BIT 0U +#define AMD_SYSFS_IF_POWER_DPM_FORCE_PERFORMANCE_LEVEL_BIT 1U +#define AMD_SYSFS_IF_PP_NUM_STATES_BIT 2U +#define AMD_SYSFS_IF_PP_CUR_STATE_BIT 3U +#define AMD_SYSFS_IF_PP_FORCE_STATE_BIT 4U +#define AMD_SYSFS_IF_PP_TABLE_BIT 5U +#define AMD_SYSFS_IF_PP_DPM_SCLK_BIT 6U +#define AMD_SYSFS_IF_PP_DPM_MCLK_BIT 7U +#define AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT 8U +#define AMD_SYSFS_IF_PP_DPM_FCLK_BIT 9U +#define AMD_SYSFS_IF_PP_DPM_VCLK_BIT 10U +#define AMD_SYSFS_IF_PP_DPM_DCLK_BIT 11U +#define AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT 12U +#define AMD_SYSFS_IF_PP_DPM_PCIE_BIT 13U +#define AMD_SYSFS_IF_PP_SCLK_OD_BIT 14U +#define AMD_SYSFS_IF_PP_MCLK_OD_BIT 15U +#define AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT 16U +#define AMD_SYSFS_IF_PP_OD_CLK_VOLTAGE_BIT 17U +#define AMD_SYSFS_IF_GPU_BUSY_PERCENT_BIT 18U +#define AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT 19U +#define AMD_SYSFS_IF_PCIE_BW_BIT 20U +#define AMD_SYSFS_IF_PP_FEATURES_BIT 21U +#define AMD_SYSFS_IF_UNIQUE_ID_BIT 22U +#define AMD_SYSFS_IF_THERMAL_THROTTLING_LOGGING_BIT 23U +#define AMD_SYSFS_IF_GPU_METRICS_BIT 24U +#define AMD_SYSFS_IF_SMARTSHIFT_APU_POWER_BIT 25U +#define AMD_SYSFS_IF_SMARTSHIFT_DGPU_POWER_BIT 26U +#define AMD_SYSFS_IF_SMARTSHIFT_BIAS_BIT 27U +#define AMD_MAX_NUMBER_OF_SYSFS_IF_SUPPORTED 64U +#define AMD_SYSFS_IF_BITMASK (if_bit) (1ULL << (if_bit)) +#define AMD_SYSFS_IF_BITMASK_ALL_SUPPORTED ULLONG_MAX +struct amdgpu_pm {struct mutex mutex;u32 current_sclk;
@@ -364,6 +397,10 @@ struct amdgpu_pm {struct config_table_setting config_table;/* runtime mode */ enum amdgpu_runpm_mode rpm_mode; + +/* bitmasks for clarifying which sysfs interfaces supported */ +uint64_t sysfs_if_supported; +umode_t sysfs_if_attr_mode[AMD_MAX_NUMBER_OF_SYSFS_IF_SUPPORTED ]; }; int amdgpu_dpm_read_sensor(struct amdgpu_device *adev, enum amd_pp_sensors sensor,
drivers/gpu/drm/amd/pm/inc/amdgpu_pm.h +9 -7
@@ -46,6 +46,7 @@ enum amdgpu_device_attr_states {struct amdgpu_device_attr {struct device_attribute dev_attr; +uint64_t if_bit;enum amdgpu_device_attr_flags flags;int (*attr_update)(struct amdgpu_device *adev,struct amdgpu_device_attr *attr,uint32_t mask,enum amdgpu_device_attr_states *states);
@@ -60,24 +61,25 @@ struct amdgpu_device_attr_entry {#define to_amdgpu_device_attr (_dev_attr) \ container_of(_dev_attr, struct amdgpu_device_attr, dev_attr) -#define __AMDGPU_DEVICE_ATTR (_name, _mode, _show, _store, _flags, ...) \ +#define __AMDGPU_DEVICE_ATTR (_name, _mode, _show, _store, _bit, _flags, ...) \ { .dev_attr = __ATTR(_name, _mode, _show, _store), \ + .if_bit = _bit, \ .flags = _flags, \ ##__VA_ARGS__, } -#define AMDGPU_DEVICE_ATTR (_name, _mode, _flags, ...) \ +#define AMDGPU_DEVICE_ATTR (_name, _mode, _bit, _flags, ...) \ __AMDGPU_DEVICE_ATTR(_name, _mode, \ amdgpu_get_##_name, amdgpu_set_##_name, \ - _flags, ##__VA_ARGS__) + _bit, _flags, ##__VA_ARGS__) -#define AMDGPU_DEVICE_ATTR_RW (_name, _flags, ...) \ +#define AMDGPU_DEVICE_ATTR_RW (_name, _bit, _flags, ...) \ AMDGPU_DEVICE_ATTR(_name, S_IRUGO | S_IWUSR, \ - _flags, ##__VA_ARGS__) + _bit, _flags, ##__VA_ARGS__) -#define AMDGPU_DEVICE_ATTR_RO (_name, _flags, ...) \ +#define AMDGPU_DEVICE_ATTR_RO (_name, _bit, _flags, ...) \ __AMDGPU_DEVICE_ATTR(_name, S_IRUGO, \ amdgpu_get_##_name, NULL, \ - _flags, ##__VA_ARGS__) + _bit, _flags, ##__VA_ARGS__)int amdgpu_pm_sysfs_init (struct amdgpu_device *adev);int amdgpu_pm_virt_sysfs_init (struct amdgpu_device *adev);
Signature · 1 line
2.34.1
PATCH 2/8 drm/amd/pm: refine the checks for sysfs interfaces support
Make the code more clean and readable with no real logics change.
--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 200 ++++++++++++++--------------- 1 file changed, 98 insertions(+), 102 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +98 -102
@@ -2006,9 +2006,6 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ uint32_t mask, enum amdgpu_device_attr_states *states) { struct device_attribute *dev_attr = &attr->dev_attr; -uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; -uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; -const char *attr_name = dev_attr->attr.name;if (!(attr->flags & mask) || !(AMD_SYSFS_IF_BITMASK (attr->if_bit) & adev->pm.sysfs_if_supported)) {
@@ -2016,112 +2013,14 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_return 0 ; } -#define DEVICE_ATTR_IS (_name) (!strcmp(attr_name, #_name)) - -if (DEVICE_ATTR_IS (pp_dpm_socclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 ) || - gc_ver ==IP_VERSION (9 ,4 ,1 ) || - gc_ver ==IP_VERSION (9 ,4 ,2 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_fclk)) { -if (mp1_ver <IP_VERSION (10 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_od_clk_voltage)) { - *states =ATTR_STATE_UNSUPPORTED ; -if (amdgpu_dpm_is_overdrive_supported (adev)) - *states =ATTR_STATE_SUPPORTED ; - }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 (pcie_bw)) { -/* PCIe Perf counters won't work on APU nodes */ -if (adev->flags &AMD_IS_APU ) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (unique_id)) { -switch (gc_ver) { -case IP_VERSION (9 ,0 ,1 ): -case IP_VERSION (9 ,4 ,0 ): -case IP_VERSION (9 ,4 ,1 ): -case IP_VERSION (9 ,4 ,2 ): -case IP_VERSION (10 ,3 ,0 ): -case IP_VERSION (11 ,0 ,0 ): - *states =ATTR_STATE_SUPPORTED ; -break ; -default : - *states =ATTR_STATE_UNSUPPORTED ; - } - }else if (DEVICE_ATTR_IS (pp_features)) { -if (adev->flags &AMD_IS_APU || gc_ver <IP_VERSION (9 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (gpu_metrics)) { -if (gc_ver <IP_VERSION (9 ,1 ,0 )) - *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 ,0 ) || - gc_ver ==IP_VERSION (10 ,1 ,2 ) || - gc_ver ==IP_VERSION (11 ,0 ,0 ) || - gc_ver ==IP_VERSION (11 ,0 ,2 ))) - *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 ,0 ) || - gc_ver ==IP_VERSION (10 ,1 ,2 ) || - gc_ver ==IP_VERSION (11 ,0 ,0 ) || - gc_ver ==IP_VERSION (11 ,0 ,2 ))) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_power_profile_mode)) { -if (amdgpu_dpm_get_power_profile_mode (adev,NULL ) == -EOPNOTSUPP ) - *states =ATTR_STATE_UNSUPPORTED ; -else if (gc_ver ==IP_VERSION (10 ,3 ,0 ) &&amdgpu_sriov_vf (adev)) - *states =ATTR_STATE_UNSUPPORTED ; - } - -switch (gc_ver) { -case IP_VERSION (9 ,4 ,1 ): -case IP_VERSION (9 ,4 ,2 ): -/* the Mi series card does not support standalone mclk/socclk/fclk level setting */ -if (DEVICE_ATTR_IS (pp_dpm_mclk) || -DEVICE_ATTR_IS (pp_dpm_socclk) || -DEVICE_ATTR_IS (pp_dpm_fclk)) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } -break ; -case IP_VERSION (10 ,3 ,0 ): -if (DEVICE_ATTR_IS (power_dpm_force_performance_level) && -amdgpu_sriov_vf (adev)) { - dev_attr->attr.mode &= ~0222 ; - dev_attr->store =NULL ; - } -break ; -default : -break ; - } - -if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) { -/* SMU MP1 does not support dcefclk level setting */ -if (gc_ver >=IP_VERSION (10 ,0 ,0 )) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } - } - -/* setting should not be allowed from VF if not in one VF mode */ -if (amdgpu_sriov_vf (adev) && !amdgpu_sriov_is_pp_one_vf (adev)) { +if (!(adev->pm.sysfs_if_attr_mode[attr->if_bit] &S_IWUGO )) { dev_attr->attr.mode &= ~S_IWUGO ; dev_attr->store =NULL ; } -#undef DEVICE_ATTR_IS -return 0 ; } -static int amdgpu_device_attr_create (struct amdgpu_device *adev,struct amdgpu_device_attr *attr,uint32_t mask,struct list_head *attr_list)
@@ -3411,6 +3310,101 @@ static const struct attribute_group *hwmon_groups[] = {NULL }; +static void amdgpu_sysfs_if_support_check (struct amdgpu_device *adev) +{ +uint64_t *sysfs_if_supported = &adev->pm.sysfs_if_supported; +umode_t *sysfs_if_attr_mode = adev->pm.sysfs_if_attr_mode; +uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; +uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; +int i; + +/* All but those specific ASICs support these */ + *sysfs_if_supported &= ~BIT_ULL (AMD_SYSFS_IF_UNIQUE_ID_BIT ); + *sysfs_if_supported &= ~(BIT_ULL (AMD_SYSFS_IF_PP_DPM_VCLK_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCLK_BIT )); + +if (gc_ver <IP_VERSION (9 ,1 ,0 )) { + *sysfs_if_supported &= ~BIT_ULL (AMD_SYSFS_IF_GPU_METRICS_BIT ); + +if (gc_ver ==IP_VERSION (9 ,0 ,1 )) { + *sysfs_if_supported &= ~BIT_ULL (AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT ); + *sysfs_if_supported |=BIT_ULL (AMD_SYSFS_IF_UNIQUE_ID_BIT ); + } + +if (gc_ver <IP_VERSION (9 ,0 ,0 )) + *sysfs_if_supported &= ~(BIT_ULL (AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_FEATURES_BIT )); + }else { +switch (gc_ver) { +case IP_VERSION (9 ,4 ,0 ): + *sysfs_if_supported |=BIT_ULL (AMD_SYSFS_IF_UNIQUE_ID_BIT ); +break ; +case IP_VERSION (9 ,4 ,1 ): +case IP_VERSION (9 ,4 ,2 ): + *sysfs_if_supported &= ~BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT ); + *sysfs_if_supported |=BIT_ULL (AMD_SYSFS_IF_UNIQUE_ID_BIT ); +/* the Mi series card does not support standalone mclk/socclk/fclk level setting */ + sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_MCLK_BIT ] &= ~S_IWUGO ; + sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT ] &= ~S_IWUGO ; + sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_FCLK_BIT ] &= ~S_IWUGO ; +break ; +case IP_VERSION (10 ,1 ,2 ): + *sysfs_if_supported |=BIT_ULL (AMD_SYSFS_IF_PP_DPM_VCLK_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCLK_BIT ); +break ; +case IP_VERSION (10 ,3 ,0 ): + *sysfs_if_supported |=BIT_ULL (AMD_SYSFS_IF_UNIQUE_ID_BIT ); + *sysfs_if_supported |=BIT_ULL (AMD_SYSFS_IF_PP_DPM_VCLK_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCLK_BIT ); +if (amdgpu_sriov_vf (adev)) { + *sysfs_if_supported &= ~BIT_ULL (AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT ); + sysfs_if_attr_mode[AMD_SYSFS_IF_POWER_DPM_FORCE_PERFORMANCE_LEVEL_BIT ] &= ~S_IWUGO ; + } +break ; +case IP_VERSION (10 ,3 ,1 ): + *sysfs_if_supported |=BIT_ULL (AMD_SYSFS_IF_PP_DPM_VCLK_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCLK_BIT ); +break ; +case IP_VERSION (11 ,0 ,0 ): + *sysfs_if_supported |=BIT_ULL (AMD_SYSFS_IF_UNIQUE_ID_BIT ); + *sysfs_if_supported |=BIT_ULL (AMD_SYSFS_IF_PP_DPM_VCLK_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCLK_BIT ); +break ; +case IP_VERSION (11 ,0 ,2 ): + *sysfs_if_supported |=BIT_ULL (AMD_SYSFS_IF_PP_DPM_VCLK_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCLK_BIT ); +break ; +default : +break ; + } + } + +if (mp1_ver <IP_VERSION (10 ,0 ,0 )) + *sysfs_if_supported &= ~BIT_ULL (AMD_SYSFS_IF_PP_DPM_FCLK_BIT ); + +if (adev->flags &AMD_IS_APU ) + *sysfs_if_supported &= ~(BIT_ULL (AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PCIE_BW_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_FEATURES_BIT )); + +if (!amdgpu_dpm_is_overdrive_supported (adev)) + *sysfs_if_supported &= ~BIT_ULL (AMD_SYSFS_IF_PP_OD_CLK_VOLTAGE_BIT ); + +if (amdgpu_dpm_get_power_profile_mode (adev,NULL ) == -EOPNOTSUPP ) + *sysfs_if_supported &= ~BIT_ULL (AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT ); + +if (gc_ver >=IP_VERSION (10 ,0 ,0 )) + sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT ] &= ~S_IWUGO ; + +/* setting should not be allowed from VF if not in one VF mode */ +if (amdgpu_sriov_vf (adev) && + !amdgpu_sriov_is_pp_one_vf (adev)) { +for (i =0 ; i <AMD_MAX_NUMBER_OF_SYSFS_IF_SUPPORTED ; i++) + sysfs_if_attr_mode[i] &= ~S_IWUGO ; + } +} +int amdgpu_pm_sysfs_init (struct amdgpu_device *adev) {int ret;
@@ -3424,6 +3418,8 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)if (adev->pm.dpm_enabled ==0 )return 0 ; +amdgpu_sysfs_if_support_check (adev); + adev->pm.int_hwmon_dev =hwmon_device_register_with_groups (adev->dev,DRIVER_NAME , adev, hwmon_groups);
Signature · 1 line
2.34.1
Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces support
Quoted 204 lines · Evan Quan
Make the code more clean and readable with no real logics change.
Signed-off-by Evan Quan <[email protected]>Change-Id I21c879fa9abad9f6da3b5289adf3124950d2f4eb--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 200 ++++++++++++++--------------- 1 file changed, 98 insertions(+), 102 deletions(-)drivers/gpu/drm/amd/pm/amdgpu_pm.c +64
-102@@ -2006,9 +2006,6 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ uint32_t mask, enum amdgpu_device_attr_states *states) { struct device_attribute *dev_attr = &attr->dev_attr; -uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; -uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; -const char *attr_name = dev_attr->attr.name;if (!(attr->flags & mask) || !(AMD_SYSFS_IF_BITMASK (attr->if_bit) & adev->pm.sysfs_if_supported)) {@@ -2016,112 +2013,14 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_return 0 ; } -#define DEVICE_ATTR_IS (_name) (!strcmp(attr_name, #_name)) - -if (DEVICE_ATTR_IS (pp_dpm_socclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 ) || - gc_ver ==IP_VERSION (9 ,4 ,1 ) || - gc_ver ==IP_VERSION (9 ,4 ,2 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_fclk)) { -if (mp1_ver <IP_VERSION (10 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_od_clk_voltage)) { - *states =ATTR_STATE_UNSUPPORTED ; -if (amdgpu_dpm_is_overdrive_supported (adev)) - *states =ATTR_STATE_SUPPORTED ; - }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 (pcie_bw)) { -/* PCIe Perf counters won't work on APU nodes */ -if (adev->flags &AMD_IS_APU ) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (unique_id)) { -switch (gc_ver) { -case IP_VERSION (9 ,0 ,1 ): -case IP_VERSION (9 ,4 ,0 ): -case IP_VERSION (9 ,4 ,1 ): -case IP_VERSION (9 ,4 ,2 ): -case IP_VERSION (10 ,3 ,0 ): -case IP_VERSION (11 ,0 ,0 ): - *states =ATTR_STATE_SUPPORTED ; -break ; -default : - *states =ATTR_STATE_UNSUPPORTED ; - } - }else if (DEVICE_ATTR_IS (pp_features)) { -if (adev->flags &AMD_IS_APU || gc_ver <IP_VERSION (9 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (gpu_metrics)) { -if (gc_ver <IP_VERSION (9 ,1 ,0 )) - *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 ,0 ) || - gc_ver ==IP_VERSION (10 ,1 ,2 ) || - gc_ver ==IP_VERSION (11 ,0 ,0 ) || - gc_ver ==IP_VERSION (11 ,0 ,2 ))) - *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 ,0 ) || - gc_ver ==IP_VERSION (10 ,1 ,2 ) || - gc_ver ==IP_VERSION (11 ,0 ,0 ) || - gc_ver ==IP_VERSION (11 ,0 ,2 ))) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_power_profile_mode)) { -if (amdgpu_dpm_get_power_profile_mode (adev,NULL ) == -EOPNOTSUPP ) - *states =ATTR_STATE_UNSUPPORTED ; -else if (gc_ver ==IP_VERSION (10 ,3 ,0 ) &&amdgpu_sriov_vf (adev)) - *states =ATTR_STATE_UNSUPPORTED ; - } - -switch (gc_ver) { -case IP_VERSION (9 ,4 ,1 ): -case IP_VERSION (9 ,4 ,2 ): -/* the Mi series card does not support standalone mclk/socclk/fclk level setting */ -if (DEVICE_ATTR_IS (pp_dpm_mclk) || -DEVICE_ATTR_IS (pp_dpm_socclk) || -DEVICE_ATTR_IS (pp_dpm_fclk)) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } -break ; -case IP_VERSION (10 ,3 ,0 ): -if (DEVICE_ATTR_IS (power_dpm_force_performance_level) && -amdgpu_sriov_vf (adev)) { - dev_attr->attr.mode &= ~0222 ; - dev_attr->store =NULL ; - } -break ; -default : -break ; - } - -if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) { -/* SMU MP1 does not support dcefclk level setting */ -if (gc_ver >=IP_VERSION (10 ,0 ,0 )) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } - } - -/* setting should not be allowed from VF if not in one VF mode */ -if (amdgpu_sriov_vf (adev) && !amdgpu_sriov_is_pp_one_vf (adev)) { +if (!(adev->pm.sysfs_if_attr_mode[attr->if_bit] &S_IWUGO )) { dev_attr->attr.mode &= ~S_IWUGO ; dev_attr->store =NULL ; } -#undef DEVICE_ATTR_IS -return 0 ; } -static int amdgpu_device_attr_create (struct amdgpu_device *adev,struct amdgpu_device_attr *attr,uint32_t mask,struct list_head *attr_list)@@ -3411,6 +3310,101 @@ static const struct attribute_group *hwmon_groups[] = {NULL }; +static void amdgpu_sysfs_if_support_check (struct amdgpu_device *adev) +{ +uint64_t *sysfs_if_supported = &adev->pm.sysfs_if_supported; +umode_t *sysfs_if_attr_mode = adev->pm.sysfs_if_attr_mode; +uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; +uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; +int i; + +/* All but those specific ASICs support these */ + *sysfs_if_supported &= ~BIT_ULL (AMD_SYSFS_IF_UNIQUE_ID_BIT ); + *sysfs_if_supported &= ~(BIT_ULL (AMD_SYSFS_IF_PP_DPM_VCLK_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCLK_BIT )); + +if (gc_ver <IP_VERSION (9 ,1 ,0 )) { + *sysfs_if_supported &= ~BIT_ULL (AMD_SYSFS_IF_GPU_METRICS_BIT ); + +if (gc_ver ==IP_VERSION (9 ,0 ,1 )) { + *sysfs_if_supported &= ~BIT_ULL (AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT ); + *sysfs_if_supported |=BIT_ULL (AMD_SYSFS_IF_UNIQUE_ID_BIT ); + } + +if (gc_ver <IP_VERSION (9 ,0 ,0 )) + *sysfs_if_supported &= ~(BIT_ULL (AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_FEATURES_BIT )); + }else { +switch (gc_ver) { +case IP_VERSION (9 ,4 ,0 ): + *sysfs_if_supported |=BIT_ULL (AMD_SYSFS_IF_UNIQUE_ID_BIT ); +break ; +case IP_VERSION (9 ,4 ,1 ): +case IP_VERSION (9 ,4 ,2 ): + *sysfs_if_supported &= ~BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT ); + *sysfs_if_supported |=BIT_ULL (AMD_SYSFS_IF_UNIQUE_ID_BIT ); +/* the Mi series card does not support standalone mclk/socclk/fclk level setting */ + sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_MCLK_BIT ] &= ~S_IWUGO ; + sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT ] &= ~S_IWUGO ; + sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_FCLK_BIT ] &= ~S_IWUGO ; +break ; +case IP_VERSION (10 ,1 ,2 ): + *sysfs_if_supported |=BIT_ULL (AMD_SYSFS_IF_PP_DPM_VCLK_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCLK_BIT ); +break ; +case IP_VERSION (10 ,3 ,0 ): + *sysfs_if_supported |=BIT_ULL (AMD_SYSFS_IF_UNIQUE_ID_BIT ); + *sysfs_if_supported |=BIT_ULL (AMD_SYSFS_IF_PP_DPM_VCLK_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCLK_BIT ); +if (amdgpu_sriov_vf (adev)) { + *sysfs_if_supported &= ~BIT_ULL (AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT ); + sysfs_if_attr_mode[AMD_SYSFS_IF_POWER_DPM_FORCE_PERFORMANCE_LEVEL_BIT ] &= ~S_IWUGO ; + } +break ; +case IP_VERSION (10 ,3 ,1 ): + *sysfs_if_supported |=BIT_ULL (AMD_SYSFS_IF_PP_DPM_VCLK_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCLK_BIT ); +break ; +case IP_VERSION (11 ,0 ,0 ): + *sysfs_if_supported |=BIT_ULL (AMD_SYSFS_IF_UNIQUE_ID_BIT ); + *sysfs_if_supported |=BIT_ULL (AMD_SYSFS_IF_PP_DPM_VCLK_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCLK_BIT ); +break ; +case IP_VERSION (11 ,0 ,2 ): + *sysfs_if_supported |= BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT) |
drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = { · line 3385
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +10
-0+BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCLK_BIT ); +break ; +default : +break ; + } + } + +if (mp1_ver <IP_VERSION (10 ,0 ,0 )) + *sysfs_if_supported &= ~BIT_ULL (AMD_SYSFS_IF_PP_DPM_FCLK_BIT ); +
With this change, the IP version based checks need to be moved to respective smu_v* checks so that each IP version decides what is supported at which level (R/W) rather than consolidating it here. Only generic checks like amdgpu_sriov_is_pp_one_vf may be maintained here. That way it really helps.
Thanks,
Lijo
Quoted 34 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +24
-0+if (adev->flags &AMD_IS_APU ) + *sysfs_if_supported &= ~(BIT_ULL (AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PCIE_BW_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_FEATURES_BIT )); + +if (!amdgpu_dpm_is_overdrive_supported (adev)) + *sysfs_if_supported &= ~BIT_ULL (AMD_SYSFS_IF_PP_OD_CLK_VOLTAGE_BIT ); + +if (amdgpu_dpm_get_power_profile_mode (adev,NULL ) == -EOPNOTSUPP ) + *sysfs_if_supported &= ~BIT_ULL (AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT ); + +if (gc_ver >=IP_VERSION (10 ,0 ,0 )) + sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT ] &= ~S_IWUGO ; + +/* setting should not be allowed from VF if not in one VF mode */ +if (amdgpu_sriov_vf (adev) && + !amdgpu_sriov_is_pp_one_vf (adev)) { +for (i =0 ; i <AMD_MAX_NUMBER_OF_SYSFS_IF_SUPPORTED ; i++) + sysfs_if_attr_mode[i] &= ~S_IWUGO ; + } +} +int amdgpu_pm_sysfs_init (struct amdgpu_device *adev) {int ret;@@ -3424,6 +3418,8 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)if (adev->pm.dpm_enabled ==0 )return 0 ; +amdgpu_sysfs_if_support_check (adev); + adev->pm.int_hwmon_dev =hwmon_device_register_with_groups (adev->dev,DRIVER_NAME , adev, hwmon_groups);
RE: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces support
[AMD Official Use Only - General]
Quoted 270 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, January 5, 2023 9:58 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 6 lines · Evan Quan
Make the code more clean and readable with no real logics change.
Signed-off-by Evan Quan <[email protected]>Change-Id I21c879fa9abad9f6da3b5289adf3124950d2f4eb--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 200 ++++++++++++++---------------
drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct
Quoted 8 lines
1 file changed, 98 insertions(+), 102 deletions(-)drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0@@ -2006,9 +2006,6 @@ static int default_attr_update(struct
amdgpu_device*adev, structamdgpu_device_drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct · line 2006
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0uint32_t mask, enum amdgpu_device_attr_states*states)
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-3{struct device_attribute *dev_attr = &attr->dev_attr; -uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; -uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; -const char *attr_name = dev_attr->attr.name; if (!(attr->flags & mask) || !(AMD_SYSFS_IF_BITMASK(attr->if_bit) &
adev->pm.sysfs_if_supported)) { @@ -2016,112 +2013,14 @@ static intdefault_attr_update(struct
amdgpu_device*adev, structamdgpu_device_Quoted 12 lines
return 0; }drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-9-#define DEVICE_ATTR_IS (_name) (!strcmp(attr_name, #_name)) - -if (DEVICE_ATTR_IS (pp_dpm_socclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 ) || - gc_ver ==IP_VERSION (9 ,4 ,1 ) || - gc_ver ==IP_VERSION (9 ,4 ,2 ))drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- *states =ATTR_STATE_UNSUPPORTED ; - } else if (DEVICE_ATTR_IS(pp_dpm_fclk)) { -if (mp1_ver <IP_VERSION (10 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - } else if (DEVICE_ATTR_IS(pp_od_clk_voltage)) { - *states =ATTR_STATE_UNSUPPORTED ; -if (amdgpu_dpm_is_overdrive_supported (adev)) - *states =ATTR_STATE_SUPPORTED ; - } else if (DEVICE_ATTR_IS(mem_busy_percent)) { - if (adev->flags & AMD_IS_APU || gc_ver == IP_VERSION(9, 0,1))
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- *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 ) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (unique_id)) { -switch (gc_ver) { -case IP_VERSION (9 ,0 ,1 ): -case IP_VERSION (9 ,4 ,0 ): -case IP_VERSION (9 ,4 ,1 ):drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10-case IP_VERSION (9 ,4 ,2 ): -case IP_VERSION (10 ,3 ,0 ): -case IP_VERSION (11 ,0 ,0 ): - *states =ATTR_STATE_SUPPORTED ; -break ; -default : - *states =ATTR_STATE_UNSUPPORTED ; - } - } else if (DEVICE_ATTR_IS(pp_features)) { - if (adev->flags & AMD_IS_APU || gc_ver < IP_VERSION(9, 0,0))
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (gpu_metrics)) { -if (gc_ver <IP_VERSION (9 ,1 ,0 )) - *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 ,0 ) || - gc_ver ==IP_VERSION (10 ,1 ,2 ) || - gc_ver ==IP_VERSION (11 ,0 ,0 ) || - gc_ver ==IP_VERSION (11 ,0 ,2 )))drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- *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 ,0 ) || - gc_ver ==IP_VERSION (10 ,1 ,2 ) || - gc_ver ==IP_VERSION (11 ,0 ,0 ) || - gc_ver ==IP_VERSION (11 ,0 ,2 ))) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_power_profile_mode)) { - if (amdgpu_dpm_get_power_profile_mode(adev, NULL) ==
-EOPNOTSUPP)drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-2- *states =ATTR_STATE_UNSUPPORTED ; - else if (gc_ver == IP_VERSION(10, 3, 0) &&
amdgpu_sriov_vf(adev))drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 7 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-7- *states =ATTR_STATE_UNSUPPORTED ; - } - -switch (gc_ver) { -case IP_VERSION (9 ,4 ,1 ): -case IP_VERSION (9 ,4 ,2 ): -/* the Mi series card does not support standalone mclk/socclk/fclk level setting */
drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-9-if (DEVICE_ATTR_IS (pp_dpm_mclk) || -DEVICE_ATTR_IS (pp_dpm_socclk) || -DEVICE_ATTR_IS (pp_dpm_fclk)) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } -break ; -case IP_VERSION (10 ,3 ,0 ): - if (DEVICE_ATTR_IS(power_dpm_force_performance_level)&&
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-9- amdgpu_sriov_vf(adev)) { - dev_attr->attr.mode &= ~0222 ; - dev_attr->store =NULL ; - } -break ; -default : -break ; - } -drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10-if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) { -/* SMU MP1 does not support dcefclk level setting */ -if (gc_ver >=IP_VERSION (10 ,0 ,0 )) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } - } - -/* setting should not be allowed from VF if not in one VF mode */ -if (amdgpu_sriov_vf (adev) && !amdgpu_sriov_is_pp_one_vf (adev)){
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+if (!(adev->pm.sysfs_if_attr_mode[attr->if_bit] &S_IWUGO )) { dev_attr->attr.mode &= ~S_IWUGO ; dev_attr->store =NULL ; }drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ · line 2026
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-3-#undef DEVICE_ATTR_IS -return 0 ; } -static int amdgpu_device_attr_create (struct amdgpu_device *adev,struct amdgpu_device_attr *attr,uint32_t mask,struct list_head *attr_list)@@ -3411,6
Quoted 5 lines
+3310,101 @@ static const struct
attribute_group*hwmon_groups[] = {
NULL
};drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+static void amdgpu_sysfs_if_support_check (struct amdgpu_device *adev)drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +10
-0+{ +uint64_t *sysfs_if_supported = &adev->pm.sysfs_if_supported; +umode_t *sysfs_if_attr_mode = adev->pm.sysfs_if_attr_mode; +uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; +uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; +int i; + +/* All but those specific ASICs support these */ + *sysfs_if_supported &= ~BIT_ULL (AMD_SYSFS_IF_UNIQUE_ID_BIT ); + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+ +if (gc_ver <IP_VERSION (9 ,1 ,0 )) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_GPU_METRICS_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+ +if (gc_ver ==IP_VERSION (9 ,0 ,1 )) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ } + +if (gc_ver <IP_VERSION (9 ,0 ,0 )) + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_FEATURES_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ }else { +switch (gc_ver) { +case IP_VERSION (9 ,4 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+break ; +case IP_VERSION (9 ,4 ,1 ): +case IP_VERSION (9 ,4 ,2 ): + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+/* the Mi series card does not support standalone mclk/socclk/fclk level setting */
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_MCLK_BIT] &=~S_IWUGO;
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT] &=
~S_IWUGO;Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_FCLK_BIT] &=~S_IWUGO;
drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (10 ,1 ,2 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (10 ,3 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+if (amdgpu_sriov_vf (adev)) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT);
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_POWER_DPM_FORCE_PERFOR
MANCE_LEVEL_BIT] &= ~S_IWUGO;drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ } +break ; +case IP_VERSION (10 ,3 ,1 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (11 ,0 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (11 ,0 ,2 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +8
-0+break ; +default : +break ; + } + } + +if (mp1_ver <IP_VERSION (10 ,0 ,0 )) + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_DPM_FCLK_BIT);
Quoted 7 lines
Quoted 1 line
+
With this change, the IP version based checks need to be moved to respective smu_v* checks so that each IP version decides what is supported at which level (R/W) rather than consolidating it here. Only generic checks like
amdgpu_sriov_is_pp_one_vfmay be maintained here.
That way it really helps.
[Quan, Evan] For some of them, they could be moved to respective smu_v* or gfx_v* checks.
But for some of them, it will be difficult. For example, for "mp1_ver < IP_VERSION(10, 0, 0)" or " gc_ver >= IP_VERSION(10, 0, 0)", you need to figure out which asics it refers to first and then apply the same change to every of them. That seems more error prone. So, my thought is just left these old chunks as they were. And we just need to take care of the future/new asics. How do you think?
Evan
Quoted 50 lines
Thanks,
Lijodrivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+if (adev->flags &AMD_IS_APU ) + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PCIE_BW_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_FEATURES_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6
-0+ +if (!amdgpu_dpm_is_overdrive_supported (adev)) + *sysfs_if_supported &= +~BIT_ULL (AMD_SYSFS_IF_PP_OD_CLK_VOLTAGE_BIT ); + + if (amdgpu_dpm_get_power_profile_mode(adev, NULL) == -EOPNOTSUPP)
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +5
-0+ *sysfs_if_supported &= +~BIT_ULL (AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT ); + +if (gc_ver >=IP_VERSION (10 ,0 ,0 )) + sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT ]&= ~S_IWUGO;
drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +5
-0+ +/* setting should not be allowed from VF if not in one VF mode */ +if (amdgpu_sriov_vf (adev) && + !amdgpu_sriov_is_pp_one_vf (adev)) { + for (i = 0; i <
AMD_MAX_NUMBER_OF_SYSFS_IF_SUPPORTED; i++)drivers/gpu/drm/amd/pm/amdgpu_pm.c int amdgpu_pm_sysfs_init(struct amdgpu_device
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ sysfs_if_attr_mode[i] &= ~S_IWUGO ; + } +} +int amdgpu_pm_sysfs_init (struct amdgpu_device *adev) {int ret;@@ -3424,6 +3418,8 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device*adev)
drivers/gpu/drm/amd/pm/amdgpu_pm.c int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0if (adev->pm.dpm_enabled ==0 )return 0 ; +amdgpu_sysfs_if_support_check (adev); + adev->pm.int_hwmon_dev =hwmon_device_register_with_groups(adev->dev,
Quoted 1 line
DRIVER_NAME, adev,Quoted 1 line
hwmon_groups);
Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces support
Quoted 276 lines · Evan
[AMD Official Use Only - General]
Quoted 272 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, January 5, 2023 9:58 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 6 lines · Evan Quan
Make the code more clean and readable with no real logics change.
Signed-off-by Evan Quan <[email protected]>Change-Id I21c879fa9abad9f6da3b5289adf3124950d2f4eb--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 200 ++++++++++++++---------------
drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct
Quoted 8 lines
1 file changed, 98 insertions(+), 102 deletions(-)drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0@@ -2006,9 +2006,6 @@ static int default_attr_update(struct
amdgpu_device*adev, structamdgpu_device_drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct · line 2006
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0uint32_t mask, enum amdgpu_device_attr_states*states)
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-3{struct device_attribute *dev_attr = &attr->dev_attr; -uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; -uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; -const char *attr_name = dev_attr->attr.name; if (!(attr->flags & mask) || !(AMD_SYSFS_IF_BITMASK(attr->if_bit) &
adev->pm.sysfs_if_supported)) { @@ -2016,112 +2013,14 @@ static intdefault_attr_update(struct
amdgpu_device*adev, structamdgpu_device_Quoted 12 lines
return 0; }drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-9-#define DEVICE_ATTR_IS (_name) (!strcmp(attr_name, #_name)) - -if (DEVICE_ATTR_IS (pp_dpm_socclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 ) || - gc_ver ==IP_VERSION (9 ,4 ,1 ) || - gc_ver ==IP_VERSION (9 ,4 ,2 ))drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- *states =ATTR_STATE_UNSUPPORTED ; - } else if (DEVICE_ATTR_IS(pp_dpm_fclk)) { -if (mp1_ver <IP_VERSION (10 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - } else if (DEVICE_ATTR_IS(pp_od_clk_voltage)) { - *states =ATTR_STATE_UNSUPPORTED ; -if (amdgpu_dpm_is_overdrive_supported (adev)) - *states =ATTR_STATE_SUPPORTED ; - } else if (DEVICE_ATTR_IS(mem_busy_percent)) { - if (adev->flags & AMD_IS_APU || gc_ver == IP_VERSION(9, 0,1))
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- *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 ) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (unique_id)) { -switch (gc_ver) { -case IP_VERSION (9 ,0 ,1 ): -case IP_VERSION (9 ,4 ,0 ): -case IP_VERSION (9 ,4 ,1 ):drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10-case IP_VERSION (9 ,4 ,2 ): -case IP_VERSION (10 ,3 ,0 ): -case IP_VERSION (11 ,0 ,0 ): - *states =ATTR_STATE_SUPPORTED ; -break ; -default : - *states =ATTR_STATE_UNSUPPORTED ; - } - } else if (DEVICE_ATTR_IS(pp_features)) { - if (adev->flags & AMD_IS_APU || gc_ver < IP_VERSION(9, 0,0))
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (gpu_metrics)) { -if (gc_ver <IP_VERSION (9 ,1 ,0 )) - *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 ,0 ) || - gc_ver ==IP_VERSION (10 ,1 ,2 ) || - gc_ver ==IP_VERSION (11 ,0 ,0 ) || - gc_ver ==IP_VERSION (11 ,0 ,2 )))drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- *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 ,0 ) || - gc_ver ==IP_VERSION (10 ,1 ,2 ) || - gc_ver ==IP_VERSION (11 ,0 ,0 ) || - gc_ver ==IP_VERSION (11 ,0 ,2 ))) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_power_profile_mode)) { - if (amdgpu_dpm_get_power_profile_mode(adev, NULL) ==
-EOPNOTSUPP)drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-2- *states =ATTR_STATE_UNSUPPORTED ; - else if (gc_ver == IP_VERSION(10, 3, 0) &&
amdgpu_sriov_vf(adev))drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 7 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-7- *states =ATTR_STATE_UNSUPPORTED ; - } - -switch (gc_ver) { -case IP_VERSION (9 ,4 ,1 ): -case IP_VERSION (9 ,4 ,2 ): -/* the Mi series card does not support standalone mclk/socclk/fclk level setting */
drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-9-if (DEVICE_ATTR_IS (pp_dpm_mclk) || -DEVICE_ATTR_IS (pp_dpm_socclk) || -DEVICE_ATTR_IS (pp_dpm_fclk)) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } -break ; -case IP_VERSION (10 ,3 ,0 ): - if (DEVICE_ATTR_IS(power_dpm_force_performance_level)&&
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-9- amdgpu_sriov_vf(adev)) { - dev_attr->attr.mode &= ~0222 ; - dev_attr->store =NULL ; - } -break ; -default : -break ; - } -drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10-if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) { -/* SMU MP1 does not support dcefclk level setting */ -if (gc_ver >=IP_VERSION (10 ,0 ,0 )) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } - } - -/* setting should not be allowed from VF if not in one VF mode */ -if (amdgpu_sriov_vf (adev) && !amdgpu_sriov_is_pp_one_vf (adev)){
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+if (!(adev->pm.sysfs_if_attr_mode[attr->if_bit] &S_IWUGO )) { dev_attr->attr.mode &= ~S_IWUGO ; dev_attr->store =NULL ; }drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ · line 2026
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-3-#undef DEVICE_ATTR_IS -return 0 ; } -static int amdgpu_device_attr_create (struct amdgpu_device *adev,struct amdgpu_device_attr *attr,uint32_t mask,struct list_head *attr_list)@@ -3411,6
Quoted 5 lines
+3310,101 @@ static const struct attribute_group *hwmon_groups[] = { NULL };drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+static void amdgpu_sysfs_if_support_check (struct amdgpu_device *adev)drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +10
-0+{ +uint64_t *sysfs_if_supported = &adev->pm.sysfs_if_supported; +umode_t *sysfs_if_attr_mode = adev->pm.sysfs_if_attr_mode; +uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; +uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; +int i; + +/* All but those specific ASICs support these */ + *sysfs_if_supported &= ~BIT_ULL (AMD_SYSFS_IF_UNIQUE_ID_BIT ); + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+ +if (gc_ver <IP_VERSION (9 ,1 ,0 )) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_GPU_METRICS_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+ +if (gc_ver ==IP_VERSION (9 ,0 ,1 )) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ } + +if (gc_ver <IP_VERSION (9 ,0 ,0 )) + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_FEATURES_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ }else { +switch (gc_ver) { +case IP_VERSION (9 ,4 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+break ; +case IP_VERSION (9 ,4 ,1 ): +case IP_VERSION (9 ,4 ,2 ): + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+/* the Mi series card does not support standalone mclk/socclk/fclk level setting */
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_MCLK_BIT] &=~S_IWUGO;
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT] &=
~S_IWUGO;Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_FCLK_BIT] &=~S_IWUGO;
drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (10 ,1 ,2 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (10 ,3 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+if (amdgpu_sriov_vf (adev)) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT);
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_POWER_DPM_FORCE_PERFOR
MANCE_LEVEL_BIT] &= ~S_IWUGO;drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ } +break ; +case IP_VERSION (10 ,3 ,1 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (11 ,0 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (11 ,0 ,2 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +8
-0+break ; +default : +break ; + } + } + +if (mp1_ver <IP_VERSION (10 ,0 ,0 )) + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_DPM_FCLK_BIT);
Quoted 1 line
+
Quoted 9 lines
Quoted 5 lines
With this change, the IP version based checks need to be moved to respective smu_v* checks so that each IP version decides what is supported at which level (R/W) rather than consolidating it here. Only generic checks like
amdgpu_sriov_is_pp_one_vfmay be maintained here.
That way it really helps.[Quan, Evan] For some of them, they could be moved to respective smu_v* or gfx_v* checks.
But for some of them, it will be difficult. For example, for "mp1_ver<IP_VERSION(10, 0, 0)" or "gc_ver>=IP_VERSION(10, 0, 0)", you need to figure out which asics it refers to first and then apply the same change to every of them. That seems more error prone. So, my thought is just left these old chunks as they were. And we just need to take care of the future/new asics. How do you think?
My preference is to clean up this as much as possible. Also, you may be able to set some of them generically based on FEAT_DPM bits in swsmu/powerplay.
Thanks,
Lijo
Quoted 51 lines
Evan
Quoted 50 lines
Thanks,
Lijodrivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+if (adev->flags &AMD_IS_APU ) + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PCIE_BW_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_FEATURES_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6
-0+ +if (!amdgpu_dpm_is_overdrive_supported (adev)) + *sysfs_if_supported &= +~BIT_ULL (AMD_SYSFS_IF_PP_OD_CLK_VOLTAGE_BIT ); + + if (amdgpu_dpm_get_power_profile_mode(adev, NULL) == -EOPNOTSUPP)
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +5
-0+ *sysfs_if_supported &= +~BIT_ULL (AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT ); + +if (gc_ver >=IP_VERSION (10 ,0 ,0 )) + sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT ]&= ~S_IWUGO;
drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +5
-0+ +/* setting should not be allowed from VF if not in one VF mode */ +if (amdgpu_sriov_vf (adev) && + !amdgpu_sriov_is_pp_one_vf (adev)) { + for (i = 0; i <
AMD_MAX_NUMBER_OF_SYSFS_IF_SUPPORTED; i++)drivers/gpu/drm/amd/pm/amdgpu_pm.c int amdgpu_pm_sysfs_init(struct amdgpu_device
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ sysfs_if_attr_mode[i] &= ~S_IWUGO ; + } +} +int amdgpu_pm_sysfs_init (struct amdgpu_device *adev) {int ret;@@ -3424,6 +3418,8 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device*adev)
drivers/gpu/drm/amd/pm/amdgpu_pm.c int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0if (adev->pm.dpm_enabled ==0 )return 0 ; +amdgpu_sysfs_if_support_check (adev); + adev->pm.int_hwmon_dev =hwmon_device_register_with_groups(adev->dev,
Quoted 1 line
DRIVER_NAME, adev,Quoted 1 line
hwmon_groups);
RE: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces support
[AMD Official Use Only - General]
Quoted 301 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 6, 2023 11:55 AM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 21 lines · Evan
[AMD Official Use Only - General]
Quoted 17 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, January 5, 2023 9:58 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 6 lines · Evan Quan
Make the code more clean and readable with no real logics change.
Signed-off-by Evan Quan <[email protected]>Change-Id I21c879fa9abad9f6da3b5289adf3124950d2f4eb--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 200 ++++++++++++++---------
Quoted 18 lines
Quoted 18 lines
------
drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct
Quoted 8 lines
1 file changed, 98 insertions(+), 102 deletions(-)drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0@@ -2006,9 +2006,6 @@ static int default_attr_update(struct
amdgpu_device*adev, structamdgpu_device_drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct · line 2006
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0uint32_t mask, enum amdgpu_device_attr_states*states)
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-3{struct device_attribute *dev_attr = &attr->dev_attr; -uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; -uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; -const char *attr_name = dev_attr->attr.name;Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0if (!(attr->flags & mask) || !(AMD_SYSFS_IF_BITMASK(attr->if_bit) &
adev->pm.sysfs_if_supported)) { @@ -2016,112 +2013,14 @@ static intdefault_attr_update(struct
amdgpu_device*adev, struct
amdgpu_device_Quoted 168 lines
Quoted 168 lines
Quoted 12 lines
return 0; }drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-9-#define DEVICE_ATTR_IS (_name) (!strcmp(attr_name, #_name)) - -if (DEVICE_ATTR_IS (pp_dpm_socclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 ) || - gc_ver ==IP_VERSION (9 ,4 ,1 ) || - gc_ver ==IP_VERSION (9 ,4 ,2 ))drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- *states =ATTR_STATE_UNSUPPORTED ; - } else if (DEVICE_ATTR_IS(pp_dpm_fclk)) { -if (mp1_ver <IP_VERSION (10 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - } else if (DEVICE_ATTR_IS(pp_od_clk_voltage)) { - *states =ATTR_STATE_UNSUPPORTED ; -if (amdgpu_dpm_is_overdrive_supported (adev)) - *states =ATTR_STATE_SUPPORTED ; - } else if (DEVICE_ATTR_IS(mem_busy_percent)) { - if (adev->flags & AMD_IS_APU || gc_ver == IP_VERSION(9, 0,1))
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- *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 ) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (unique_id)) { -switch (gc_ver) { -case IP_VERSION (9 ,0 ,1 ): -case IP_VERSION (9 ,4 ,0 ): -case IP_VERSION (9 ,4 ,1 ):drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10-case IP_VERSION (9 ,4 ,2 ): -case IP_VERSION (10 ,3 ,0 ): -case IP_VERSION (11 ,0 ,0 ): - *states =ATTR_STATE_SUPPORTED ; -break ; -default : - *states =ATTR_STATE_UNSUPPORTED ; - } - } else if (DEVICE_ATTR_IS(pp_features)) { - if (adev->flags & AMD_IS_APU || gc_ver < IP_VERSION(9, 0,0))
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (gpu_metrics)) { -if (gc_ver <IP_VERSION (9 ,1 ,0 )) - *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 ,0 ) || - gc_ver ==IP_VERSION (10 ,1 ,2 ) || - gc_ver ==IP_VERSION (11 ,0 ,0 ) || - gc_ver ==IP_VERSION (11 ,0 ,2 )))drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- *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 ,0 ) || - gc_ver ==IP_VERSION (10 ,1 ,2 ) || - gc_ver ==IP_VERSION (11 ,0 ,0 ) || - gc_ver ==IP_VERSION (11 ,0 ,2 ))) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_power_profile_mode)) { - if (amdgpu_dpm_get_power_profile_mode(adev, NULL) ==
-EOPNOTSUPP)drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-2- *states =ATTR_STATE_UNSUPPORTED ; - else if (gc_ver == IP_VERSION(10, 3, 0) &&
amdgpu_sriov_vf(adev))drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 7 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-7- *states =ATTR_STATE_UNSUPPORTED ; - } - -switch (gc_ver) { -case IP_VERSION (9 ,4 ,1 ): -case IP_VERSION (9 ,4 ,2 ): -/* the Mi series card does not support standalone mclk/socclk/fclk level setting */
drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-9-if (DEVICE_ATTR_IS (pp_dpm_mclk) || -DEVICE_ATTR_IS (pp_dpm_socclk) || -DEVICE_ATTR_IS (pp_dpm_fclk)) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } -break ; -case IP_VERSION (10 ,3 ,0 ): - if (DEVICE_ATTR_IS(power_dpm_force_performance_level)&&
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-9- amdgpu_sriov_vf(adev)) { - dev_attr->attr.mode &= ~0222 ; - dev_attr->store =NULL ; - } -break ; -default : -break ; - } -drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10-if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) { -/* SMU MP1 does not support dcefclk level setting */ -if (gc_ver >=IP_VERSION (10 ,0 ,0 )) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } - } - -/* setting should not be allowed from VF if not in one VF mode */ -if (amdgpu_sriov_vf (adev) && !amdgpu_sriov_is_pp_one_vf (adev)){
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+if (!(adev->pm.sysfs_if_attr_mode[attr->if_bit] &S_IWUGO )) { dev_attr->attr.mode &= ~S_IWUGO ; dev_attr->store =NULL ; }drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ · line 2026
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-3-#undef DEVICE_ATTR_IS -return 0 ; } -static int amdgpu_device_attr_create (struct amdgpu_device *adev,struct amdgpu_device_attr *attr,uint32_t mask,struct list_head *attr_list)@@ -3411,6
Quoted 5 lines
+3310,101 @@ static const struct attribute_group *hwmon_groups[] = { NULL };drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+static void amdgpu_sysfs_if_support_check(struct amdgpu_devicedrivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +10
-0+*adev) { +uint64_t *sysfs_if_supported = &adev->pm.sysfs_if_supported; +umode_t *sysfs_if_attr_mode = adev->pm.sysfs_if_attr_mode; +uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; +uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; +int i; + +/* All but those specific ASICs support these */ + *sysfs_if_supported &= ~BIT_ULL (AMD_SYSFS_IF_UNIQUE_ID_BIT ); + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+ +if (gc_ver <IP_VERSION (9 ,1 ,0 )) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_GPU_METRICS_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+ +if (gc_ver ==IP_VERSION (9 ,0 ,1 )) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ } + +if (gc_ver <IP_VERSION (9 ,0 ,0 )) + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_FEATURES_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ }else { +switch (gc_ver) { +case IP_VERSION (9 ,4 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+break ; +case IP_VERSION (9 ,4 ,1 ): +case IP_VERSION (9 ,4 ,2 ): + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT);
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+/* the Mi series card does not support standalone mclk/socclk/fclk level setting */
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_MCLK_BIT] &=~S_IWUGO;
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT] &=
~S_IWUGO;
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_FCLK_BIT] &=~S_IWUGO;
Quoted 50 lines
Quoted 50 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (10 ,1 ,2 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (10 ,3 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+if (amdgpu_sriov_vf (adev)) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT);
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_POWER_DPM_FORCE_PERFOR
MANCE_LEVEL_BIT] &= ~S_IWUGO;drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ } +break ; +case IP_VERSION (10 ,3 ,1 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (11 ,0 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (11 ,0 ,2 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +8
-0+break ; +default : +break ; + } + } + +if (mp1_ver <IP_VERSION (10 ,0 ,0 )) + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_DPM_FCLK_BIT);
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
+
With this change, the IP version based checks need to be moved to respective smu_v* checks so that each IP version decides what is supported at which level (R/W) rather than consolidating it here. Only generic checks like
amdgpu_sriov_is_pp_one_vfmay be maintainedhere.
Quoted 2 lines
Quoted 1 line
That way it really helps.
[Quan, Evan] For some of them, they could be moved to respective
smu_v* or gfx_v* checks.
Quoted 1 line
But for some of them, it will be difficult. For example, for "
mp1_ver<
IP_VERSION(10, 0, 0)" or "gc_ver>=IP_VERSION(10, 0, 0)", you need to figure out which asics it refers to first and then apply the same change to every of them. That seems more error prone.
Quoted 6 lines
Quoted 1 line
So, my thought is just left these old chunks as they were. And we just need
to take care of the future/new asics. How do you think?
Quoted 1 line
My preference is to clean up this as much as possible. Also, you may be able to set some of them generically based on
FEAT_DPMbits in swsmu/powerplay.
I see. But I would expect the future ASICs take the way used in patch3(more straightforward instead of implicit checking for some APIs or DPM features). That's also the reason why I do not want to cleanup those old chunks. As I do not expect them to serve for future ASICs.
Then it's not worth to take the efforts(and risk) to do the cleanup. Thoughts?
BR
Evan
Quoted 56 lines
Thanks,
LijoQuoted 31 lines
Evan
Quoted 30 lines
Thanks,
Lijodrivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+if (adev->flags &AMD_IS_APU ) + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PCIE_BW_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_FEATURES_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6
-0+ +if (!amdgpu_dpm_is_overdrive_supported (adev)) + *sysfs_if_supported &= +~BIT_ULL (AMD_SYSFS_IF_PP_OD_CLK_VOLTAGE_BIT ); + + if (amdgpu_dpm_get_power_profile_mode(adev, NULL) == -EOPNOTSUPP)
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +5
-0+ *sysfs_if_supported &= +~BIT_ULL (AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT ); + +if (gc_ver >=IP_VERSION (10 ,0 ,0 )) + sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT ]&= ~S_IWUGO;
drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +5
-0+ +/* setting should not be allowed from VF if not in one VF mode */ +if (amdgpu_sriov_vf (adev) && + !amdgpu_sriov_is_pp_one_vf (adev)) { + for (i = 0; i <
AMD_MAX_NUMBER_OF_SYSFS_IF_SUPPORTED; i++)Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c int amdgpu_pm_sysfs_init(struct
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ sysfs_if_attr_mode[i] &= ~S_IWUGO ; + } +} +int amdgpu_pm_sysfs_init (struct amdgpu_device *adev) {int ret;@@ -3424,6 +3418,8 @@ int amdgpu_pm_sysfs_init(struct
amdgpu_deviceQuoted 12 lines
Quoted 12 lines
*adev)
drivers/gpu/drm/amd/pm/amdgpu_pm.c int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0if (adev->pm.dpm_enabled ==0 )return 0 ; +amdgpu_sysfs_if_support_check (adev); + adev->pm.int_hwmon_dev =hwmon_device_register_with_groups(adev->dev,
Quoted 1 line
DRIVER_NAME, adev,Quoted 1 line
hwmon_groups);
Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces support
Quoted 306 lines · Evan
[AMD Official Use Only - General]
Quoted 302 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 6, 2023 11:55 AM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 21 lines · Evan
[AMD Official Use Only - General]
Quoted 17 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, January 5, 2023 9:58 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 6 lines · Evan Quan
Make the code more clean and readable with no real logics change.
Signed-off-by Evan Quan <[email protected]>Change-Id I21c879fa9abad9f6da3b5289adf3124950d2f4eb--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 200 ++++++++++++++---------
Quoted 18 lines
Quoted 18 lines
------
drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct
Quoted 8 lines
1 file changed, 98 insertions(+), 102 deletions(-)drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0@@ -2006,9 +2006,6 @@ static int default_attr_update(struct
amdgpu_device*adev, structamdgpu_device_drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct · line 2006
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0uint32_t mask, enum amdgpu_device_attr_states*states)
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-3{struct device_attribute *dev_attr = &attr->dev_attr; -uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; -uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; -const char *attr_name = dev_attr->attr.name;Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0if (!(attr->flags & mask) || !(AMD_SYSFS_IF_BITMASK(attr->if_bit) &
adev->pm.sysfs_if_supported)) { @@ -2016,112 +2013,14 @@ static intdefault_attr_update(struct
amdgpu_device*adev, struct
amdgpu_device_Quoted 168 lines
Quoted 168 lines
Quoted 12 lines
return 0; }drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-9-#define DEVICE_ATTR_IS (_name) (!strcmp(attr_name, #_name)) - -if (DEVICE_ATTR_IS (pp_dpm_socclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 ) || - gc_ver ==IP_VERSION (9 ,4 ,1 ) || - gc_ver ==IP_VERSION (9 ,4 ,2 ))drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- *states =ATTR_STATE_UNSUPPORTED ; - } else if (DEVICE_ATTR_IS(pp_dpm_fclk)) { -if (mp1_ver <IP_VERSION (10 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - } else if (DEVICE_ATTR_IS(pp_od_clk_voltage)) { - *states =ATTR_STATE_UNSUPPORTED ; -if (amdgpu_dpm_is_overdrive_supported (adev)) - *states =ATTR_STATE_SUPPORTED ; - } else if (DEVICE_ATTR_IS(mem_busy_percent)) { - if (adev->flags & AMD_IS_APU || gc_ver == IP_VERSION(9, 0,1))
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- *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 ) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (unique_id)) { -switch (gc_ver) { -case IP_VERSION (9 ,0 ,1 ): -case IP_VERSION (9 ,4 ,0 ): -case IP_VERSION (9 ,4 ,1 ):drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10-case IP_VERSION (9 ,4 ,2 ): -case IP_VERSION (10 ,3 ,0 ): -case IP_VERSION (11 ,0 ,0 ): - *states =ATTR_STATE_SUPPORTED ; -break ; -default : - *states =ATTR_STATE_UNSUPPORTED ; - } - } else if (DEVICE_ATTR_IS(pp_features)) { - if (adev->flags & AMD_IS_APU || gc_ver < IP_VERSION(9, 0,0))
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (gpu_metrics)) { -if (gc_ver <IP_VERSION (9 ,1 ,0 )) - *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 ,0 ) || - gc_ver ==IP_VERSION (10 ,1 ,2 ) || - gc_ver ==IP_VERSION (11 ,0 ,0 ) || - gc_ver ==IP_VERSION (11 ,0 ,2 )))drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- *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 ,0 ) || - gc_ver ==IP_VERSION (10 ,1 ,2 ) || - gc_ver ==IP_VERSION (11 ,0 ,0 ) || - gc_ver ==IP_VERSION (11 ,0 ,2 ))) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_power_profile_mode)) { - if (amdgpu_dpm_get_power_profile_mode(adev, NULL) ==
-EOPNOTSUPP)drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-2- *states =ATTR_STATE_UNSUPPORTED ; - else if (gc_ver == IP_VERSION(10, 3, 0) &&
amdgpu_sriov_vf(adev))drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 7 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-7- *states =ATTR_STATE_UNSUPPORTED ; - } - -switch (gc_ver) { -case IP_VERSION (9 ,4 ,1 ): -case IP_VERSION (9 ,4 ,2 ): -/* the Mi series card does not support standalone mclk/socclk/fclk level setting */
drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-9-if (DEVICE_ATTR_IS (pp_dpm_mclk) || -DEVICE_ATTR_IS (pp_dpm_socclk) || -DEVICE_ATTR_IS (pp_dpm_fclk)) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } -break ; -case IP_VERSION (10 ,3 ,0 ): - if (DEVICE_ATTR_IS(power_dpm_force_performance_level)&&
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-9- amdgpu_sriov_vf(adev)) { - dev_attr->attr.mode &= ~0222 ; - dev_attr->store =NULL ; - } -break ; -default : -break ; - } -drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10-if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) { -/* SMU MP1 does not support dcefclk level setting */ -if (gc_ver >=IP_VERSION (10 ,0 ,0 )) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } - } - -/* setting should not be allowed from VF if not in one VF mode */ -if (amdgpu_sriov_vf (adev) && !amdgpu_sriov_is_pp_one_vf (adev)){
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+if (!(adev->pm.sysfs_if_attr_mode[attr->if_bit] &S_IWUGO )) { dev_attr->attr.mode &= ~S_IWUGO ; dev_attr->store =NULL ; }drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ · line 2026
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-3-#undef DEVICE_ATTR_IS -return 0 ; } -static int amdgpu_device_attr_create (struct amdgpu_device *adev,struct amdgpu_device_attr *attr,uint32_t mask,struct list_head *attr_list)@@ -3411,6
Quoted 5 lines
+3310,101 @@ static const struct attribute_group *hwmon_groups[] = { NULL };drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+static void amdgpu_sysfs_if_support_check(struct amdgpu_devicedrivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +10
-0+*adev) { +uint64_t *sysfs_if_supported = &adev->pm.sysfs_if_supported; +umode_t *sysfs_if_attr_mode = adev->pm.sysfs_if_attr_mode; +uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; +uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; +int i; + +/* All but those specific ASICs support these */ + *sysfs_if_supported &= ~BIT_ULL (AMD_SYSFS_IF_UNIQUE_ID_BIT ); + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+ +if (gc_ver <IP_VERSION (9 ,1 ,0 )) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_GPU_METRICS_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+ +if (gc_ver ==IP_VERSION (9 ,0 ,1 )) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ } + +if (gc_ver <IP_VERSION (9 ,0 ,0 )) + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_FEATURES_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ }else { +switch (gc_ver) { +case IP_VERSION (9 ,4 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+break ; +case IP_VERSION (9 ,4 ,1 ): +case IP_VERSION (9 ,4 ,2 ): + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT);
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+/* the Mi series card does not support standalone mclk/socclk/fclk level setting */
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_MCLK_BIT] &=~S_IWUGO;
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT] &=
~S_IWUGO;
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_FCLK_BIT] &=~S_IWUGO;
Quoted 50 lines
Quoted 50 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (10 ,1 ,2 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (10 ,3 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+if (amdgpu_sriov_vf (adev)) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT);
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_POWER_DPM_FORCE_PERFOR
MANCE_LEVEL_BIT] &= ~S_IWUGO;drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ } +break ; +case IP_VERSION (10 ,3 ,1 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (11 ,0 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (11 ,0 ,2 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +8
-0+break ; +default : +break ; + } + } + +if (mp1_ver <IP_VERSION (10 ,0 ,0 )) + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_DPM_FCLK_BIT);
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
+
With this change, the IP version based checks need to be moved to respective smu_v* checks so that each IP version decides what is supported at which level (R/W) rather than consolidating it here. Only generic checks like
amdgpu_sriov_is_pp_one_vfmay be maintainedhere.
Quoted 2 lines
Quoted 1 line
That way it really helps.
[Quan, Evan] For some of them, they could be moved to respective
smu_v* or gfx_v* checks.
Quoted 1 line
But for some of them, it will be difficult. For example, for "
mp1_ver<
IP_VERSION(10, 0, 0)" or "gc_ver>=IP_VERSION(10, 0, 0)", you need to figure out which asics it refers to first and then apply the same change to every of them. That seems more error prone.Quoted 1 line
So, my thought is just left these old chunks as they were. And we just need
Quoted 9 lines
Quoted 5 lines
to take care of the future/new asics. How do you think?
Quoted 1 line
My preference is to clean up this as much as possible. Also, you may be able to set some of them generically based on
FEAT_DPMbits in swsmu/powerplay.I see. But I would expect the future ASICs take the way used in patch3(more straightforward instead of implicit checking for some APIs or DPM features). That's also the reason why I do not want to cleanup those old chunks. As I do not expect them to serve for future ASICs.
Then it's not worth to take the efforts(and risk) to do the cleanup. Thoughts?
It's to make sure consistency. I don't think leaving two options to do the same thing is a good idea. Otherwise older will continue and cause confusion. Changing to newer one for all is the preferred method and handling common things in smu_common/powerplay is better rather than having to do everything in individual versions.
Thanks,
Lijo
Quoted 58 lines
BR
EvanQuoted 56 lines
Thanks,
LijoQuoted 31 lines
Evan
Quoted 30 lines
Thanks,
Lijodrivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+if (adev->flags &AMD_IS_APU ) + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PCIE_BW_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_FEATURES_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6
-0+ +if (!amdgpu_dpm_is_overdrive_supported (adev)) + *sysfs_if_supported &= +~BIT_ULL (AMD_SYSFS_IF_PP_OD_CLK_VOLTAGE_BIT ); + + if (amdgpu_dpm_get_power_profile_mode(adev, NULL) == -EOPNOTSUPP)
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +5
-0+ *sysfs_if_supported &= +~BIT_ULL (AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT ); + +if (gc_ver >=IP_VERSION (10 ,0 ,0 )) + sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT ]&= ~S_IWUGO;
drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +5
-0+ +/* setting should not be allowed from VF if not in one VF mode */ +if (amdgpu_sriov_vf (adev) && + !amdgpu_sriov_is_pp_one_vf (adev)) { + for (i = 0; i <
AMD_MAX_NUMBER_OF_SYSFS_IF_SUPPORTED; i++)Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c int amdgpu_pm_sysfs_init(struct
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ sysfs_if_attr_mode[i] &= ~S_IWUGO ; + } +} +int amdgpu_pm_sysfs_init (struct amdgpu_device *adev) {int ret;@@ -3424,6 +3418,8 @@ int amdgpu_pm_sysfs_init(struct
amdgpu_deviceQuoted 12 lines
Quoted 12 lines
*adev)
drivers/gpu/drm/amd/pm/amdgpu_pm.c int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0if (adev->pm.dpm_enabled ==0 )return 0 ; +amdgpu_sysfs_if_support_check (adev); + adev->pm.int_hwmon_dev =hwmon_device_register_with_groups(adev->dev,
Quoted 1 line
DRIVER_NAME, adev,Quoted 1 line
hwmon_groups);
RE: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces support
[AMD Official Use Only - General]
Quoted 350 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 6, 2023 6:01 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 23 lines · Evan
[AMD Official Use Only - General]
Quoted 19 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 6, 2023 11:55 AM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 8 lines · Evan
[AMD Official Use Only - General]
Quoted 4 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, January 5, 2023 9:58 PM
To: Quan, Evan <[email protected]>; amd-Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines · Evan Quan
Quoted 6 lines
Make the code more clean and readable with no real logics change.
Signed-off-by Evan Quan <[email protected]>Change-Id I21c879fa9abad9f6da3b5289adf3124950d2f4eb--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 200 ++++++++++++++------
Quoted 4 lines
Quoted 4 lines
---
Quoted 3 lines
Quoted 3 lines
------
Quoted 2 lines
1 file changed, 98 insertions(+), 102 deletions(-)Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0@@ -2006,9 +2006,6 @@ static int default_attr_update(struct
amdgpu_device*adev, structamdgpu_device_Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0uint32_t mask, enum
amdgpu_device_attr_statesQuoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
*states)
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-3{struct device_attribute *dev_attr = &attr->dev_attr; -uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; -uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; -const char *attr_name = dev_attr->attr.name; if (!(attr->flags & mask) || !(AMD_SYSFS_IF_BITMASK(attr->if_bit) &
adev->pm.sysfs_if_supported)) { @@ -2016,112 +2013,14 @@ staticadev->intdefault_attr_update(struct
amdgpu_device*adev, structQuoted 5 lines
Quoted 5 lines
amdgpu_device_Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
return 0; }-#define
DEVICE_ATTR_IS(_name)(!strcmp(attr_name,#_name))
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- -if (DEVICE_ATTR_IS (pp_dpm_socclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 ) || - gc_ver ==IP_VERSION (9 ,4 ,1 ) || - gc_ver ==IP_VERSION (9 ,4 ,2 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_fclk)) {Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-if (mp1_ver <IP_VERSION (10 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - } else if (DEVICE_ATTR_IS(pp_od_clk_voltage)) { - *states =ATTR_STATE_UNSUPPORTED ; -if (amdgpu_dpm_is_overdrive_supported (adev)) - *states =ATTR_STATE_SUPPORTED ; - } else if (DEVICE_ATTR_IS(mem_busy_percent)) { - if (adev->flags & AMD_IS_APU || gc_ver ==IP_VERSION(9, 0,
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
1))
Quoted 12 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-12- *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 ) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (unique_id)) { -switch (gc_ver) { -case IP_VERSION (9 ,0 ,1 ): -case IP_VERSION (9 ,4 ,0 ): -case IP_VERSION (9 ,4 ,1 ): -case IP_VERSION (9 ,4 ,2 ): -case IP_VERSION (10 ,3 ,0 ):Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-case IP_VERSION (11 ,0 ,0 ): - *states =ATTR_STATE_SUPPORTED ; -break ; -default : - *states =ATTR_STATE_UNSUPPORTED ; - } - } else if (DEVICE_ATTR_IS(pp_features)) { - if (adev->flags & AMD_IS_APU || gc_ver <IP_VERSION(9, 0,
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
0))
Quoted 12 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-12- *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (gpu_metrics)) { -if (gc_ver <IP_VERSION (9 ,1 ,0 )) - *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 ,0 ) || - gc_ver ==IP_VERSION (10 ,1 ,2 ) || - gc_ver ==IP_VERSION (11 ,0 ,0 ) || - gc_ver ==IP_VERSION (11 ,0 ,2 ))) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_dclk)) {Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-if (!(gc_ver ==IP_VERSION (10 ,3 ,1 ) || - 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 ,2 ))) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_power_profile_mode)) { - if (amdgpu_dpm_get_power_profile_mode(adev,NULL) ==
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
-EOPNOTSUPP)drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-2- *states =ATTR_STATE_UNSUPPORTED ; - else if (gc_ver == IP_VERSION(10, 3, 0) &&
amdgpu_sriov_vf(adev))drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 7 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-7- *states =ATTR_STATE_UNSUPPORTED ; - } - -switch (gc_ver) { -case IP_VERSION (9 ,4 ,1 ): -case IP_VERSION (9 ,4 ,2 ): -/* the Mi series card does not support standalone mclk/socclk/fclk level setting */
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-9-if (DEVICE_ATTR_IS (pp_dpm_mclk) || -DEVICE_ATTR_IS (pp_dpm_socclk) || -DEVICE_ATTR_IS (pp_dpm_fclk)) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } -break ; -case IP_VERSION (10 ,3 ,0 ): - if(
DEVICE_ATTR_IS(power_dpm_force_performance_level)Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
&&
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- amdgpu_sriov_vf(adev)) { - dev_attr->attr.mode &= ~0222 ; - dev_attr->store =NULL ; - } -break ; -default : -break ; - } - -if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) {Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-/* SMU MP1 does not support dcefclk level setting */ -if (gc_ver >=IP_VERSION (10 ,0 ,0 )) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } - } - -/* setting should not be allowed from VF if not in one VF mode */
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-1- if (amdgpu_sriov_vf(adev)&& !amdgpu_sriov_is_pp_one_vf(adev))
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
{
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+if (!(adev->pm.sysfs_if_attr_mode[attr->if_bit] &S_IWUGO )){
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
dev_attr->attr.mode &= ~S_IWUGO; dev_attr->store = NULL; }drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-2-#undef DEVICE_ATTR_IS -return 0 ; }Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
-
static int amdgpu_device_attr_create(structamdgpu_device*adev,
structamdgpu_device_attr*attr,uint32_tmask, structlist_head
*attr_list)Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
@@ -3411,6
Quoted 1 line
+3310,101 @@ static const struct
attribute_group*hwmon_groups[]=
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 7 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+{NULL }; +static void amdgpu_sysfs_if_support_check (struct amdgpu_device +*adev) { + uint64_t *sysfs_if_supported = &adev-pm.sysfs_if_supported;
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ umode_t *sysfs_if_attr_mode = adev-pm.sysfs_if_attr_mode;
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6
-0+uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; +uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; +int i; + +/* All but those specific ASICs support these */ + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+ +if (gc_ver <IP_VERSION (9 ,1 ,0 )) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_GPU_METRICS_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+ +if (gc_ver ==IP_VERSION (9 ,0 ,1 )) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ } + +if (gc_ver <IP_VERSION (9 ,0 ,0 )) + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_FEATURES_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ }else { +switch (gc_ver) { +case IP_VERSION (9 ,4 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+break ; +case IP_VERSION (9 ,4 ,1 ): +case IP_VERSION (9 ,4 ,2 ): + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+/* the Mi series card does not support standalone
Quoted 76 lines
Quoted 76 lines
Quoted 3 lines
Quoted 3 lines
mclk/socclk/fclk level setting */
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_MCLK_BIT] &=~S_IWUGO;
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT] &=
~S_IWUGO;
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_FCLK_BIT] &=~S_IWUGO;
Quoted 50 lines
Quoted 50 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (10 ,1 ,2 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (10 ,3 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+if (amdgpu_sriov_vf (adev)) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT);
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_POWER_DPM_FORCE_PERFOR
MANCE_LEVEL_BIT] &= ~S_IWUGO;drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ } +break ; +case IP_VERSION (10 ,3 ,1 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (11 ,0 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (11 ,0 ,2 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +8
-0+break ; +default : +break ; + } + } + +if (mp1_ver <IP_VERSION (10 ,0 ,0 )) + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_DPM_FCLK_BIT);
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
+
With this change, the IP version based checks need to be moved to respective smu_v* checks so that each IP version decides what is supported at which level (R/W) rather than consolidating it here. Only generic checks like
amdgpu_sriov_is_pp_one_vfmay be maintainedhere.
Quoted 2 lines
Quoted 1 line
That way it really helps.
[Quan, Evan] For some of them, they could be moved to respective
smu_v* or gfx_v* checks.
Quoted 2 lines
But for some of them, it will be difficult. For example, for "
mp1_ver<
IP_VERSION(10, 0, 0)" or "gc_ver>=IP_VERSION(10, 0, 0)", you need to figure out which asics it refers to first and then apply the same change to every of them. That seems more error prone.Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
So, my thought is just left these old chunks as they were. And we just need
to take care of the future/new asics. How do you think?
Quoted 1 line
My preference is to clean up this as much as possible. Also, you may be able to set some of them generically based on
FEAT_DPMbits in swsmu/powerplay.I see. But I would expect the future ASICs take the way used in
patch3(more straightforward instead of implicit checking for some APIs or DPM features).
Quoted 1 line
That's also the reason why I do not want to cleanup those old chunks. As I
do not expect them to serve for future ASICs.
Quoted 1 line
Then it's not worth to take the efforts(and risk) to do the cleanup.
Quoted 8 lines
Thoughts?
Quoted 1 line
It's to make sure consistency. I don't think leaving two options to do the same thing is a good idea. Otherwise older will continue and cause confusion. Changing to newer one for all is the preferred method and handling common things in smu_common/powerplay is better rather than having to do everything in individual versions.
Those old bunches left in amdgpu_sysfs_if_support_check() can be divided into three types:
1. those which check for the existence for some API(like amdgpu_dpm_is_overdrive_supported/ amdgpu_dpm_get_power_profile_mode). The better choice for them is still left in amdgpu_pm.c I believe.
2. those which check for some common flags(like sriov or apu). The better choice for them is also left in amdgpu_pm.c
3. those which check for gc ip version or smu ip version. A better choice for them might be to move to amdgpu_discovery.c I think. But as mentioned before, I do not think it's worth to take the efforts(and risk) to do so. So, as you can see, I do not think there is anything we can move to smu_common/powerplay part.
But if you were talking about splitting some changes in patch3 into smu_common/powerplay part, that will be a different story.
BR
Evan
Quoted 65 lines
Thanks,
LijoQuoted 16 lines
BR
EvanQuoted 14 lines
Thanks,
LijoQuoted 10 lines
Evan
Quoted 9 lines
Thanks,
Lijodrivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+if (adev->flags &AMD_IS_APU ) + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PCIE_BW_BIT)|Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_FEATURES_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6
-0+ +if (!amdgpu_dpm_is_overdrive_supported (adev)) + *sysfs_if_supported &= +~BIT_ULL (AMD_SYSFS_IF_PP_OD_CLK_VOLTAGE_BIT ); + + if (amdgpu_dpm_get_power_profile_mode(adev, NULL) ==-
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
EOPNOTSUPP)
drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = { · line 3399
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +5
-0+ *sysfs_if_supported &= +~BIT_ULL (AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT ); + +if (gc_ver >=IP_VERSION (10 ,0 ,0 )) +sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT]
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
&= ~S_IWUGO;
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+ +/* setting should not be allowed from VF if not in one VF mode */
Quoted 25 lines
Quoted 25 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c static const struct attribute_group *hwmon_groups[] = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+if (amdgpu_sriov_vf (adev) && + !amdgpu_sriov_is_pp_one_vf (adev)) { + for (i = 0; i <
AMD_MAX_NUMBER_OF_SYSFS_IF_SUPPORTED; i++)Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c int amdgpu_pm_sysfs_init(struct
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ sysfs_if_attr_mode[i] &= ~S_IWUGO ; + } +} +int amdgpu_pm_sysfs_init (struct amdgpu_device *adev) {int ret;@@ -3424,6 +3418,8 @@ int amdgpu_pm_sysfs_init(struct
amdgpu_deviceQuoted 12 lines
Quoted 12 lines
*adev)
drivers/gpu/drm/amd/pm/amdgpu_pm.c int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0if (adev->pm.dpm_enabled ==0 )return 0 ; +amdgpu_sysfs_if_support_check (adev); + adev->pm.int_hwmon_dev =hwmon_device_register_with_groups(adev->dev,
Quoted 1 line
DRIVER_NAME, adev,Quoted 1 line
hwmon_groups);
Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces support
Quoted 362 lines · Evan
[AMD Official Use Only - General]
Quoted 350 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 6, 2023 6:01 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 23 lines · Evan
[AMD Official Use Only - General]
Quoted 19 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 6, 2023 11:55 AM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 8 lines · Evan
[AMD Official Use Only - General]
Quoted 4 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, January 5, 2023 9:58 PM
To: Quan, Evan <[email protected]>; amd-Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines · Evan Quan
Quoted 6 lines
Make the code more clean and readable with no real logics change.
Signed-off-by Evan Quan <[email protected]>Change-Id I21c879fa9abad9f6da3b5289adf3124950d2f4eb--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 200 ++++++++++++++------
Quoted 4 lines
Quoted 4 lines
---
Quoted 3 lines
Quoted 3 lines
------
Quoted 2 lines
1 file changed, 98 insertions(+), 102 deletions(-)Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0@@ -2006,9 +2006,6 @@ static int default_attr_update(struct
amdgpu_device*adev, structamdgpu_device_Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0uint32_t mask, enum
amdgpu_device_attr_statesQuoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
*states)
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-3{struct device_attribute *dev_attr = &attr->dev_attr; -uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; -uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; -const char *attr_name = dev_attr->attr.name; if (!(attr->flags & mask) || !(AMD_SYSFS_IF_BITMASK(attr->if_bit) &
adev->pm.sysfs_if_supported)) { @@ -2016,112 +2013,14 @@ staticadev->intdefault_attr_update(struct
amdgpu_device*adev, structQuoted 5 lines
Quoted 5 lines
amdgpu_device_Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
return 0; }-#define
DEVICE_ATTR_IS(_name)(!strcmp(attr_name,#_name))
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- -if (DEVICE_ATTR_IS (pp_dpm_socclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 ) || - gc_ver ==IP_VERSION (9 ,4 ,1 ) || - gc_ver ==IP_VERSION (9 ,4 ,2 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_fclk)) {Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-if (mp1_ver <IP_VERSION (10 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - } else if (DEVICE_ATTR_IS(pp_od_clk_voltage)) { - *states =ATTR_STATE_UNSUPPORTED ; -if (amdgpu_dpm_is_overdrive_supported (adev)) - *states =ATTR_STATE_SUPPORTED ; - } else if (DEVICE_ATTR_IS(mem_busy_percent)) { - if (adev->flags & AMD_IS_APU || gc_ver ==IP_VERSION(9, 0,
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
1))
Quoted 12 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-12- *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 ) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (unique_id)) { -switch (gc_ver) { -case IP_VERSION (9 ,0 ,1 ): -case IP_VERSION (9 ,4 ,0 ): -case IP_VERSION (9 ,4 ,1 ): -case IP_VERSION (9 ,4 ,2 ): -case IP_VERSION (10 ,3 ,0 ):Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-case IP_VERSION (11 ,0 ,0 ): - *states =ATTR_STATE_SUPPORTED ; -break ; -default : - *states =ATTR_STATE_UNSUPPORTED ; - } - } else if (DEVICE_ATTR_IS(pp_features)) { - if (adev->flags & AMD_IS_APU || gc_ver <IP_VERSION(9, 0,
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
0))
Quoted 12 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-12- *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (gpu_metrics)) { -if (gc_ver <IP_VERSION (9 ,1 ,0 )) - *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 ,0 ) || - gc_ver ==IP_VERSION (10 ,1 ,2 ) || - gc_ver ==IP_VERSION (11 ,0 ,0 ) || - gc_ver ==IP_VERSION (11 ,0 ,2 ))) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_dclk)) {Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-if (!(gc_ver ==IP_VERSION (10 ,3 ,1 ) || - 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 ,2 ))) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_power_profile_mode)) { - if (amdgpu_dpm_get_power_profile_mode(adev,NULL) ==
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
-EOPNOTSUPP)drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-2- *states =ATTR_STATE_UNSUPPORTED ; - else if (gc_ver == IP_VERSION(10, 3, 0) &&
amdgpu_sriov_vf(adev))drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 7 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-7- *states =ATTR_STATE_UNSUPPORTED ; - } - -switch (gc_ver) { -case IP_VERSION (9 ,4 ,1 ): -case IP_VERSION (9 ,4 ,2 ): -/* the Mi series card does not support standalone mclk/socclk/fclk level setting */
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-9-if (DEVICE_ATTR_IS (pp_dpm_mclk) || -DEVICE_ATTR_IS (pp_dpm_socclk) || -DEVICE_ATTR_IS (pp_dpm_fclk)) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } -break ; -case IP_VERSION (10 ,3 ,0 ): - if(
DEVICE_ATTR_IS(power_dpm_force_performance_level)Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
&&
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- amdgpu_sriov_vf(adev)) { - dev_attr->attr.mode &= ~0222 ; - dev_attr->store =NULL ; - } -break ; -default : -break ; - } - -if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) {Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-/* SMU MP1 does not support dcefclk level setting */ -if (gc_ver >=IP_VERSION (10 ,0 ,0 )) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } - } - -/* setting should not be allowed from VF if not in one VF mode */
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-1- if (amdgpu_sriov_vf(adev)&& !amdgpu_sriov_is_pp_one_vf(adev))
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
{
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+if (!(adev->pm.sysfs_if_attr_mode[attr->if_bit] &S_IWUGO )){
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
dev_attr->attr.mode &= ~S_IWUGO; dev_attr->store = NULL; }drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-2-#undef DEVICE_ATTR_IS -return 0 ; }Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
-
static int amdgpu_device_attr_create(structamdgpu_device*adev,
structamdgpu_device_attr*attr,uint32_tmask, structlist_head
*attr_list)Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
@@ -3411,6
Quoted 1 line
+3310,101 @@ static const struct
attribute_group*hwmon_groups[]=
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 7 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+{NULL }; +static void amdgpu_sysfs_if_support_check (struct amdgpu_device +*adev) { + uint64_t *sysfs_if_supported = &adev-pm.sysfs_if_supported;
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ umode_t *sysfs_if_attr_mode = adev-pm.sysfs_if_attr_mode;
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6
-0+uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; +uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; +int i; + +/* All but those specific ASICs support these */ + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+ +if (gc_ver <IP_VERSION (9 ,1 ,0 )) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_GPU_METRICS_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+ +if (gc_ver ==IP_VERSION (9 ,0 ,1 )) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ } + +if (gc_ver <IP_VERSION (9 ,0 ,0 )) + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_FEATURES_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ }else { +switch (gc_ver) { +case IP_VERSION (9 ,4 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+break ; +case IP_VERSION (9 ,4 ,1 ): +case IP_VERSION (9 ,4 ,2 ): + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+/* the Mi series card does not support standalone
Quoted 76 lines
Quoted 76 lines
Quoted 3 lines
Quoted 3 lines
mclk/socclk/fclk level setting */
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_MCLK_BIT] &=~S_IWUGO;
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT] &=
~S_IWUGO;
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_FCLK_BIT] &=~S_IWUGO;
Quoted 50 lines
Quoted 50 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (10 ,1 ,2 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (10 ,3 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+if (amdgpu_sriov_vf (adev)) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT);
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_POWER_DPM_FORCE_PERFOR
MANCE_LEVEL_BIT] &= ~S_IWUGO;drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ } +break ; +case IP_VERSION (10 ,3 ,1 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (11 ,0 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (11 ,0 ,2 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +8
-0+break ; +default : +break ; + } + } + +if (mp1_ver <IP_VERSION (10 ,0 ,0 )) + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_DPM_FCLK_BIT);
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
+
With this change, the IP version based checks need to be moved to respective smu_v* checks so that each IP version decides what is supported at which level (R/W) rather than consolidating it here. Only generic checks like
amdgpu_sriov_is_pp_one_vfmay be maintainedhere.
Quoted 2 lines
Quoted 1 line
That way it really helps.
[Quan, Evan] For some of them, they could be moved to respective
smu_v* or gfx_v* checks.
Quoted 2 lines
But for some of them, it will be difficult. For example, for "
mp1_ver<
IP_VERSION(10, 0, 0)" or "gc_ver>=IP_VERSION(10, 0, 0)", you need to figure out which asics it refers to first and then apply the same change to every of them. That seems more error prone.Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
So, my thought is just left these old chunks as they were. And we just need
to take care of the future/new asics. How do you think?
Quoted 1 line
My preference is to clean up this as much as possible. Also, you may be able to set some of them generically based on
FEAT_DPMbits in swsmu/powerplay.I see. But I would expect the future ASICs take the way used in
patch3(more straightforward instead of implicit checking for some APIs or DPM features).
Quoted 1 line
That's also the reason why I do not want to cleanup those old chunks. As I
do not expect them to serve for future ASICs.
Quoted 1 line
Then it's not worth to take the efforts(and risk) to do the cleanup.
Quoted 8 lines
Thoughts?
Quoted 1 line
It's to make sure consistency. I don't think leaving two options to do the same thing is a good idea. Otherwise older will continue and cause confusion. Changing to newer one for all is the preferred method and handling common things in smu_common/powerplay is better rather than having to do everything in individual versions.
Quoted 5 lines
Those old bunches left in
amdgpu_sysfs_if_support_check()can be divided into three types:
1. those which check for the existence for someAPI(like amdgpu_dpm_is_overdrive_supported/ amdgpu_dpm_get_power_profile_mode). The better choice for them is still left inamdgpu_pm.cI believe.
2. those which check for some common flags(like sriov or apu). The better choice for them is also left inamdgpu_pm.c
3. those which check for gc ip version or smu ip version. A better choice for them might be to move toamdgpu_discovery.cI think. But as mentioned before, I do not think it's worth to take the efforts(and risk) to do so. So, as you can see, I do not think there is anything we can move to smu_common/powerplay part.
If you are moving to a different method, think in terms of the new method and not the legacy way. Otherwise, we can continue the legacy method as described above. Keeping two options open is not a choice.
Thanks,
Lijo
Quoted 69 lines
But if you were talking about splitting some changes in patch3 into smu_common/powerplay part, that will be a different story.
BR
EvanQuoted 65 lines
Thanks,
LijoQuoted 16 lines
BR
EvanQuoted 14 lines
Thanks,
LijoQuoted 10 lines
Evan
Quoted 9 lines
Thanks,
Lijodrivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+if (adev->flags &AMD_IS_APU ) + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PCIE_BW_BIT)|Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_FEATURES_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6
-0+ +if (!amdgpu_dpm_is_overdrive_supported (adev)) + *sysfs_if_supported &= +~BIT_ULL (AMD_SYSFS_IF_PP_OD_CLK_VOLTAGE_BIT ); + + if (amdgpu_dpm_get_power_profile_mode(adev, NULL) ==-
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
EOPNOTSUPP)
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +5
-0+ *sysfs_if_supported &= +~BIT_ULL (AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT ); + +if (gc_ver >=IP_VERSION (10 ,0 ,0 )) +sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT]
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
&= ~S_IWUGO;
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+ +/* setting should not be allowed from VF if not in one VF mode */
Quoted 25 lines
Quoted 25 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+if (amdgpu_sriov_vf (adev) && + !amdgpu_sriov_is_pp_one_vf (adev)) { + for (i = 0; i <
AMD_MAX_NUMBER_OF_SYSFS_IF_SUPPORTED; i++)Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c int amdgpu_pm_sysfs_init(struct
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ sysfs_if_attr_mode[i] &= ~S_IWUGO ; + } +} +int amdgpu_pm_sysfs_init (struct amdgpu_device *adev) {int ret;@@ -3424,6 +3418,8 @@ int amdgpu_pm_sysfs_init(struct
amdgpu_deviceQuoted 12 lines
Quoted 12 lines
*adev)
drivers/gpu/drm/amd/pm/amdgpu_pm.c int amdgpu_pm_sysfs_init(struct · line 3423
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0if (adev->pm.dpm_enabled ==0 )return 0 ; +amdgpu_sysfs_if_support_check (adev); + adev->pm.int_hwmon_dev =hwmon_device_register_with_groups(adev->dev,
Quoted 1 line
DRIVER_NAME, adev,Quoted 1 line
hwmon_groups);
RE: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces support
[AMD Official Use Only - General]
Quoted 396 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, January 9, 2023 11:28 AM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 23 lines · Evan
[AMD Official Use Only - General]
Quoted 19 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 6, 2023 6:01 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 8 lines · Evan
[AMD Official Use Only - General]
Quoted 4 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 6, 2023 11:55 AM
To: Quan, Evan <[email protected]>; amd-Quoted 22 lines
Quoted 22 lines
Quoted 7 lines
Quoted 7 lines
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportOn 1/6/2023 7:34 AM, Quan, Evan wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
[AMD Official Use Only - General]
Quoted 4 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, January 5, 2023 9:58 PM
To: Quan, Evan <[email protected]>; amd-Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines · Evan Quan
Quoted 6 lines
Make the code more clean and readable with no real logics change.
Signed-off-by Evan Quan <[email protected]>Change-Id I21c879fa9abad9f6da3b5289adf3124950d2f4eb--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 200++++++++++++++--
Quoted 21 lines
Quoted 21 lines
----
Quoted 4 lines
Quoted 4 lines
---
Quoted 3 lines
Quoted 3 lines
------
Quoted 2 lines
1 file changed, 98 insertions(+), 102 deletions(-)Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0@@ -2006,9 +2006,6 @@ static int default_attr_update(struct
amdgpu_device*adev, structamdgpu_device_Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0uint32_t mask, enum
amdgpu_device_attr_statesQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
*states)
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-3{struct device_attribute *dev_attr = &attr->dev_attr; -uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; -uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; -const char *attr_name = dev_attr->attr.name;Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0if (!(attr->flags & mask) || !(AMD_SYSFS_IF_BITMASK(attr->if_bit) &
adev->pm.sysfs_if_supported)) { @@ -2016,112 +2013,14 @@static
Quoted 122 lines
Quoted 122 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
adev->intdefault_attr_update(struct
amdgpu_device*adev, struct
amdgpu_device_Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
return 0; }-#define
DEVICE_ATTR_IS(_name)(!strcmp(attr_name,#_name))
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- -if (DEVICE_ATTR_IS (pp_dpm_socclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 ) || - gc_ver ==IP_VERSION (9 ,4 ,1 ) || - gc_ver ==IP_VERSION (9 ,4 ,2 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_fclk)) {Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-if (mp1_ver <IP_VERSION (10 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - } else if (DEVICE_ATTR_IS(pp_od_clk_voltage)) { - *states =ATTR_STATE_UNSUPPORTED ; -if (amdgpu_dpm_is_overdrive_supported (adev)) - *states =ATTR_STATE_SUPPORTED ; - } else if (DEVICE_ATTR_IS(mem_busy_percent)) { - if (adev->flags & AMD_IS_APU || gc_ver ==IP_VERSION(9, 0,
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
1))
Quoted 12 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-12- *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 ) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (unique_id)) { -switch (gc_ver) { -case IP_VERSION (9 ,0 ,1 ): -case IP_VERSION (9 ,4 ,0 ): -case IP_VERSION (9 ,4 ,1 ): -case IP_VERSION (9 ,4 ,2 ): -case IP_VERSION (10 ,3 ,0 ):Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-case IP_VERSION (11 ,0 ,0 ): - *states =ATTR_STATE_SUPPORTED ; -break ; -default : - *states =ATTR_STATE_UNSUPPORTED ; - } - } else if (DEVICE_ATTR_IS(pp_features)) { - if (adev->flags & AMD_IS_APU || gc_ver <IP_VERSION(9, 0,
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
0))
Quoted 12 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-12- *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (gpu_metrics)) { -if (gc_ver <IP_VERSION (9 ,1 ,0 )) - *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 ,0 ) || - gc_ver ==IP_VERSION (10 ,1 ,2 ) || - gc_ver ==IP_VERSION (11 ,0 ,0 ) || - gc_ver ==IP_VERSION (11 ,0 ,2 ))) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_dclk)) {Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-if (!(gc_ver ==IP_VERSION (10 ,3 ,1 ) || - 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 ,2 ))) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_power_profile_mode)) { - if (amdgpu_dpm_get_power_profile_mode(adev,NULL) ==
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
-EOPNOTSUPP)drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-2- *states =ATTR_STATE_UNSUPPORTED ; - else if (gc_ver == IP_VERSION(10, 3, 0) &&
amdgpu_sriov_vf(adev))drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 7 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-7- *states =ATTR_STATE_UNSUPPORTED ; - } - -switch (gc_ver) { -case IP_VERSION (9 ,4 ,1 ): -case IP_VERSION (9 ,4 ,2 ): -/* the Mi series card does not support standalone mclk/socclk/fclk level setting */
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-9-if (DEVICE_ATTR_IS (pp_dpm_mclk) || -DEVICE_ATTR_IS (pp_dpm_socclk) || -DEVICE_ATTR_IS (pp_dpm_fclk)) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } -break ; -case IP_VERSION (10 ,3 ,0 ): - if(
DEVICE_ATTR_IS(power_dpm_force_performance_level)Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
&&
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- amdgpu_sriov_vf(adev)) { - dev_attr->attr.mode &= ~0222 ; - dev_attr->store =NULL ; - } -break ; -default : -break ; - } - -if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) {Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-/* SMU MP1 does not support dcefclk level setting */ -if (gc_ver >=IP_VERSION (10 ,0 ,0 )) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } - } - -/* setting should not be allowed from VF if not in one VF mode */
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-1- if (amdgpu_sriov_vf(adev)&& !amdgpu_sriov_is_pp_one_vf(adev))
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
{
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+if (!(adev->pm.sysfs_if_attr_mode[attr->if_bit] &S_IWUGO )){
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
dev_attr->attr.mode &= ~S_IWUGO; dev_attr->store = NULL; }Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 7 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-3-#undef DEVICE_ATTR_IS -return 0 ; } - static int amdgpu_device_attr_create(struct amdgpu_device*adev,
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
struct
amdgpu_device_attr*attr,uint32_tmask, structlist_head
*attr_list)Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
@@ -3411,6
Quoted 1 line
+3310,101 @@ static const struct
attribute_group*hwmon_groups[]
Quoted 6 lines
Quoted 6 lines
=
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+{NULL }; +static void amdgpu_sysfs_if_support_check(struct
amdgpu_deviceQuoted 45 lines
Quoted 45 lines
Quoted 11 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+*adev) { + uint64_t *sysfs_if_supported = &adev-pm.sysfs_if_supported;
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ umode_t *sysfs_if_attr_mode = adev-pm.sysfs_if_attr_mode;
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6
-0+uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; +uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; +int i; + +/* All but those specific ASICs support these */ + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+ +if (gc_ver <IP_VERSION (9 ,1 ,0 )) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_GPU_METRICS_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+ +if (gc_ver ==IP_VERSION (9 ,0 ,1 )) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ } + +if (gc_ver <IP_VERSION (9 ,0 ,0 )) + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_FEATURES_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ }else { +switch (gc_ver) { +case IP_VERSION (9 ,4 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+break ; +case IP_VERSION (9 ,4 ,1 ): +case IP_VERSION (9 ,4 ,2 ): + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT);
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+/* the Mi series card does not support standalone
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
mclk/socclk/fclk level setting */
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_MCLK_BIT]
&=
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
~S_IWUGO;
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT]
&=
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
~S_IWUGO;
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_FCLK_BIT] &=~S_IWUGO;
Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (10 ,1 ,2 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (10 ,3 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+if (amdgpu_sriov_vf (adev)) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT);
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_POWER_DPM_FORCE_PERFOR
Quoted 59 lines
Quoted 59 lines
Quoted 47 lines
Quoted 47 lines
Quoted 31 lines
Quoted 31 lines
MANCE_LEVEL_BIT] &= ~S_IWUGO;drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ } +break ; +case IP_VERSION (10 ,3 ,1 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (11 ,0 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (11 ,0 ,2 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +8
-0+break ; +default : +break ; + } + } + +if (mp1_ver <IP_VERSION (10 ,0 ,0 )) + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_DPM_FCLK_BIT);
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
+
With this change, the IP version based checks need to be moved to respective smu_v* checks so that each IP version decides what is supported at which level (R/W) rather than consolidating it here. Only generic checks like
amdgpu_sriov_is_pp_one_vfmay be maintainedhere.
Quoted 2 lines
Quoted 1 line
That way it really helps.
[Quan, Evan] For some of them, they could be moved to respective
smu_v* or gfx_v* checks.
Quoted 2 lines
But for some of them, it will be difficult. For example, for "
mp1_ver<
IP_VERSION(10, 0, 0)" or "gc_ver>=IP_VERSION(10, 0, 0)", you need to figure out which asics it refers to first and then apply the same change to every of them. That seems more error prone.Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
So, my thought is just left these old chunks as they were. And we just need
to take care of the future/new asics. How do you think?
Quoted 1 line
My preference is to clean up this as much as possible. Also, you may be able to set some of them generically based on
FEAT_DPMbits in swsmu/powerplay.I see. But I would expect the future ASICs take the way used in
patch3(more straightforward instead of implicit checking for some APIs or DPM features).
Quoted 2 lines
That's also the reason why I do not want to cleanup those old chunks. As I
Quoted 7 lines
Quoted 7 lines
do not expect them to serve for future ASICs.
Quoted 1 line
Then it's not worth to take the efforts(and risk) to do the cleanup.
Thoughts?
Quoted 1 line
It's to make sure consistency. I don't think leaving two options to do the same thing is a good idea. Otherwise older will continue and cause
confusion.
Quoted 2 lines
Quoted 2 lines
Changing to newer one for all is the preferred method and handling common things in smu_common/powerplay is better rather than having
to
Quoted 2 lines
Quoted 1 line
do everything in individual versions.
Those old bunches left in
amdgpu_sysfs_if_support_check()can be dividedinto three types:
Quoted 1 line
1. those which check for the existence for some API(like
amdgpu_dpm_is_overdrive_supported/
amdgpu_dpm_get_power_profile_mode). The better choice for them is still left inamdgpu_pm.cI believe.Quoted 2 lines
2. those which check for some common flags(like sriov or apu). The better choice for them is also left in
amdgpu_pm.c3. those which check forgc ip version or smu ip version. A better choice for them might be to move to
amdgpu_discovery.cI think. But as mentioned before, I do not think it's worth to take the efforts(and risk) to do so.
Quoted 6 lines
Quoted 1 line
So, as you can see, I do not think there is anything we can move to
smu_common/powerplay part.
If you are moving to a different method, think in terms of the new method and not the legacy way. Otherwise, we can continue the legacy method as described above. Keeping two options open is not a choice.
[Quan, Evan] Sorry, I'm still not persuaded. It's not about legacy way.
In fact, all the code has been transformed into bitmask related.
I think your suggestions are about finding a new place for the code above.
I'm not convinced as i believe they served for legacy asics only and they cannot benefit for future asics. So, it's not worth to take efforts to move them to new places and take the risks.
BR
Evan
Quoted 74 lines
Thanks,
LijoQuoted 1 line
But if you were talking about splitting some changes in patch3 into
smu_common/powerplay part, that will be a different story.
Quoted 68 lines
BR
EvanQuoted 65 lines
Thanks,
LijoQuoted 16 lines
BR
EvanQuoted 14 lines
Thanks,
LijoQuoted 10 lines
Evan
Quoted 9 lines
Thanks,
Lijodrivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+if (adev->flags &AMD_IS_APU ) + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PCIE_BW_BIT)|Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_FEATURES_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6
-0+ +if (!amdgpu_dpm_is_overdrive_supported (adev)) + *sysfs_if_supported &= +~BIT_ULL (AMD_SYSFS_IF_PP_OD_CLK_VOLTAGE_BIT ); + + if (amdgpu_dpm_get_power_profile_mode(adev, NULL) ==-
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
EOPNOTSUPP)
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +5
-0+ *sysfs_if_supported &= +~BIT_ULL (AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT ); + +if (gc_ver >=IP_VERSION (10 ,0 ,0 )) +sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT]
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
&= ~S_IWUGO;
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+ +/* setting should not be allowed from VF if not in one VF mode */
Quoted 25 lines
Quoted 25 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+if (amdgpu_sriov_vf (adev) && + !amdgpu_sriov_is_pp_one_vf (adev)) { + for (i = 0; i <
AMD_MAX_NUMBER_OF_SYSFS_IF_SUPPORTED; i++)Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c int amdgpu_pm_sysfs_init(struct
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ sysfs_if_attr_mode[i] &= ~S_IWUGO ; + } +} +int amdgpu_pm_sysfs_init (struct amdgpu_device *adev) {int ret;@@ -3424,6 +3418,8 @@ int amdgpu_pm_sysfs_init(struct
amdgpu_deviceQuoted 12 lines
Quoted 12 lines
*adev)
drivers/gpu/drm/amd/pm/amdgpu_pm.c int amdgpu_pm_sysfs_init(struct · line 3423
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0if (adev->pm.dpm_enabled ==0 )return 0 ; +amdgpu_sysfs_if_support_check (adev); + adev->pm.int_hwmon_dev =hwmon_device_register_with_groups(adev->dev,
Quoted 1 line
DRIVER_NAME, adev,Quoted 1 line
hwmon_groups);
Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces support
Quoted 400 lines · Evan
[AMD Official Use Only - General]
Quoted 396 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, January 9, 2023 11:28 AM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 23 lines · Evan
[AMD Official Use Only - General]
Quoted 19 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 6, 2023 6:01 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 8 lines · Evan
[AMD Official Use Only - General]
Quoted 4 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 6, 2023 11:55 AM
To: Quan, Evan <[email protected]>; amd-Quoted 22 lines
Quoted 22 lines
Quoted 7 lines
Quoted 7 lines
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportOn 1/6/2023 7:34 AM, Quan, Evan wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
[AMD Official Use Only - General]
Quoted 4 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, January 5, 2023 9:58 PM
To: Quan, Evan <[email protected]>; amd-Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines · Evan Quan
Quoted 6 lines
Make the code more clean and readable with no real logics change.
Signed-off-by Evan Quan <[email protected]>Change-Id I21c879fa9abad9f6da3b5289adf3124950d2f4eb--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 200++++++++++++++--
Quoted 21 lines
Quoted 21 lines
----
Quoted 4 lines
Quoted 4 lines
---
Quoted 3 lines
Quoted 3 lines
------
Quoted 2 lines
1 file changed, 98 insertions(+), 102 deletions(-)Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0@@ -2006,9 +2006,6 @@ static int default_attr_update(struct
amdgpu_device*adev, structamdgpu_device_Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0uint32_t mask, enum
amdgpu_device_attr_statesQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
*states)
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-3{struct device_attribute *dev_attr = &attr->dev_attr; -uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; -uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; -const char *attr_name = dev_attr->attr.name;Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0if (!(attr->flags & mask) || !(AMD_SYSFS_IF_BITMASK(attr->if_bit) &
adev->pm.sysfs_if_supported)) { @@ -2016,112 +2013,14 @@static
Quoted 122 lines
Quoted 122 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
adev->intdefault_attr_update(struct
amdgpu_device*adev, struct
amdgpu_device_Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
return 0; }-#define
DEVICE_ATTR_IS(_name)(!strcmp(attr_name,#_name))
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- -if (DEVICE_ATTR_IS (pp_dpm_socclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 ) || - gc_ver ==IP_VERSION (9 ,4 ,1 ) || - gc_ver ==IP_VERSION (9 ,4 ,2 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_fclk)) {Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-if (mp1_ver <IP_VERSION (10 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - } else if (DEVICE_ATTR_IS(pp_od_clk_voltage)) { - *states =ATTR_STATE_UNSUPPORTED ; -if (amdgpu_dpm_is_overdrive_supported (adev)) - *states =ATTR_STATE_SUPPORTED ; - } else if (DEVICE_ATTR_IS(mem_busy_percent)) { - if (adev->flags & AMD_IS_APU || gc_ver ==IP_VERSION(9, 0,
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
1))
Quoted 12 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-12- *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 ) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (unique_id)) { -switch (gc_ver) { -case IP_VERSION (9 ,0 ,1 ): -case IP_VERSION (9 ,4 ,0 ): -case IP_VERSION (9 ,4 ,1 ): -case IP_VERSION (9 ,4 ,2 ): -case IP_VERSION (10 ,3 ,0 ):Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-case IP_VERSION (11 ,0 ,0 ): - *states =ATTR_STATE_SUPPORTED ; -break ; -default : - *states =ATTR_STATE_UNSUPPORTED ; - } - } else if (DEVICE_ATTR_IS(pp_features)) { - if (adev->flags & AMD_IS_APU || gc_ver <IP_VERSION(9, 0,
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
0))
Quoted 12 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-12- *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (gpu_metrics)) { -if (gc_ver <IP_VERSION (9 ,1 ,0 )) - *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 ,0 ) || - gc_ver ==IP_VERSION (10 ,1 ,2 ) || - gc_ver ==IP_VERSION (11 ,0 ,0 ) || - gc_ver ==IP_VERSION (11 ,0 ,2 ))) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_dclk)) {Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-if (!(gc_ver ==IP_VERSION (10 ,3 ,1 ) || - 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 ,2 ))) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_power_profile_mode)) { - if (amdgpu_dpm_get_power_profile_mode(adev,NULL) ==
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
-EOPNOTSUPP)drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-2- *states =ATTR_STATE_UNSUPPORTED ; - else if (gc_ver == IP_VERSION(10, 3, 0) &&
amdgpu_sriov_vf(adev))drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 7 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-7- *states =ATTR_STATE_UNSUPPORTED ; - } - -switch (gc_ver) { -case IP_VERSION (9 ,4 ,1 ): -case IP_VERSION (9 ,4 ,2 ): -/* the Mi series card does not support standalone mclk/socclk/fclk level setting */
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-9-if (DEVICE_ATTR_IS (pp_dpm_mclk) || -DEVICE_ATTR_IS (pp_dpm_socclk) || -DEVICE_ATTR_IS (pp_dpm_fclk)) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } -break ; -case IP_VERSION (10 ,3 ,0 ): - if(
DEVICE_ATTR_IS(power_dpm_force_performance_level)Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
&&
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- amdgpu_sriov_vf(adev)) { - dev_attr->attr.mode &= ~0222 ; - dev_attr->store =NULL ; - } -break ; -default : -break ; - } - -if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) {Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-/* SMU MP1 does not support dcefclk level setting */ -if (gc_ver >=IP_VERSION (10 ,0 ,0 )) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } - } - -/* setting should not be allowed from VF if not in one VF mode */
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-1- if (amdgpu_sriov_vf(adev)&& !amdgpu_sriov_is_pp_one_vf(adev))
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
{
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+if (!(adev->pm.sysfs_if_attr_mode[attr->if_bit] &S_IWUGO )){
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
dev_attr->attr.mode &= ~S_IWUGO; dev_attr->store = NULL; }Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 7 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-3-#undef DEVICE_ATTR_IS -return 0 ; } - static int amdgpu_device_attr_create(struct amdgpu_device*adev,
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
struct
amdgpu_device_attr*attr,uint32_tmask, structlist_head
*attr_list)Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
@@ -3411,6
Quoted 1 line
+3310,101 @@ static const struct
attribute_group*hwmon_groups[]
Quoted 6 lines
Quoted 6 lines
=
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+{NULL }; +static void amdgpu_sysfs_if_support_check(struct
amdgpu_deviceQuoted 45 lines
Quoted 45 lines
Quoted 11 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+*adev) { + uint64_t *sysfs_if_supported = &adev-pm.sysfs_if_supported;
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ umode_t *sysfs_if_attr_mode = adev-pm.sysfs_if_attr_mode;
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6
-0+uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; +uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; +int i; + +/* All but those specific ASICs support these */ + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+ +if (gc_ver <IP_VERSION (9 ,1 ,0 )) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_GPU_METRICS_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+ +if (gc_ver ==IP_VERSION (9 ,0 ,1 )) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ } + +if (gc_ver <IP_VERSION (9 ,0 ,0 )) + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_FEATURES_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ }else { +switch (gc_ver) { +case IP_VERSION (9 ,4 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+break ; +case IP_VERSION (9 ,4 ,1 ): +case IP_VERSION (9 ,4 ,2 ): + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT);
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+/* the Mi series card does not support standalone
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
mclk/socclk/fclk level setting */
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_MCLK_BIT]
&=
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
~S_IWUGO;
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT]
&=
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
~S_IWUGO;
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_FCLK_BIT] &=~S_IWUGO;
Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (10 ,1 ,2 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (10 ,3 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+if (amdgpu_sriov_vf (adev)) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT);
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_POWER_DPM_FORCE_PERFOR
Quoted 59 lines
Quoted 59 lines
Quoted 47 lines
Quoted 47 lines
Quoted 31 lines
Quoted 31 lines
MANCE_LEVEL_BIT] &= ~S_IWUGO;drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ } +break ; +case IP_VERSION (10 ,3 ,1 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (11 ,0 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (11 ,0 ,2 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +8
-0+break ; +default : +break ; + } + } + +if (mp1_ver <IP_VERSION (10 ,0 ,0 )) + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_DPM_FCLK_BIT);
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
+
With this change, the IP version based checks need to be moved to respective smu_v* checks so that each IP version decides what is supported at which level (R/W) rather than consolidating it here. Only generic checks like
amdgpu_sriov_is_pp_one_vfmay be maintainedhere.
Quoted 2 lines
Quoted 1 line
That way it really helps.
[Quan, Evan] For some of them, they could be moved to respective
smu_v* or gfx_v* checks.
Quoted 2 lines
But for some of them, it will be difficult. For example, for "
mp1_ver<
IP_VERSION(10, 0, 0)" or "gc_ver>=IP_VERSION(10, 0, 0)", you need to figure out which asics it refers to first and then apply the same change to every of them. That seems more error prone.Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
So, my thought is just left these old chunks as they were. And we just need
to take care of the future/new asics. How do you think?
Quoted 1 line
My preference is to clean up this as much as possible. Also, you may be able to set some of them generically based on
FEAT_DPMbits in swsmu/powerplay.I see. But I would expect the future ASICs take the way used in
patch3(more straightforward instead of implicit checking for some APIs or DPM features).
Quoted 2 lines
That's also the reason why I do not want to cleanup those old chunks. As I
Quoted 7 lines
Quoted 7 lines
do not expect them to serve for future ASICs.
Quoted 1 line
Then it's not worth to take the efforts(and risk) to do the cleanup.
Thoughts?
Quoted 1 line
It's to make sure consistency. I don't think leaving two options to do the same thing is a good idea. Otherwise older will continue and cause
confusion.
Quoted 2 lines
Quoted 2 lines
Changing to newer one for all is the preferred method and handling common things in smu_common/powerplay is better rather than having
to
Quoted 2 lines
Quoted 1 line
do everything in individual versions.
Those old bunches left in
amdgpu_sysfs_if_support_check()can be dividedinto three types:
Quoted 1 line
1. those which check for the existence for some API(like
amdgpu_dpm_is_overdrive_supported/
amdgpu_dpm_get_power_profile_mode). The better choice for them is still left inamdgpu_pm.cI believe.Quoted 2 lines
2. those which check for some common flags(like sriov or apu). The better choice for them is also left in
amdgpu_pm.c3. those which check forgc ip version or smu ip version. A better choice for them might be to move to
amdgpu_discovery.cI think. But as mentioned before, I do not think it's worth to take the efforts(and risk) to do so.
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
So, as you can see, I do not think there is anything we can move to
smu_common/powerplay part.
If you are moving to a different method, think in terms of the new method and not the legacy way. Otherwise, we can continue the legacy method as described above. Keeping two options open is not a choice.
[Quan, Evan] Sorry, I'm still not persuaded. It's not about legacy way.
What is the reason for anyone not to maintain it in the legacy way for new ASICs also. This patch is at best half cooked. Either cook it fully or throw it out.
Thanks,
Lijo
Quoted 81 lines
In fact, all the code has been transformed into bitmask related.
I think your suggestions are about finding a new place for the code above.
I'm not convinced as i believe they served for legacy asics only and they cannot benefit for future asics. So, it's not worth to take efforts to move them to new places and take the risks.BR
EvanQuoted 74 lines
Thanks,
LijoQuoted 1 line
But if you were talking about splitting some changes in patch3 into
smu_common/powerplay part, that will be a different story.
Quoted 68 lines
BR
EvanQuoted 65 lines
Thanks,
LijoQuoted 16 lines
BR
EvanQuoted 14 lines
Thanks,
LijoQuoted 10 lines
Evan
Quoted 9 lines
Thanks,
Lijodrivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+if (adev->flags &AMD_IS_APU ) + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PCIE_BW_BIT)|Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_FEATURES_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6
-0+ +if (!amdgpu_dpm_is_overdrive_supported (adev)) + *sysfs_if_supported &= +~BIT_ULL (AMD_SYSFS_IF_PP_OD_CLK_VOLTAGE_BIT ); + + if (amdgpu_dpm_get_power_profile_mode(adev, NULL) ==-
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
EOPNOTSUPP)
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +5
-0+ *sysfs_if_supported &= +~BIT_ULL (AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT ); + +if (gc_ver >=IP_VERSION (10 ,0 ,0 )) +sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT]
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
&= ~S_IWUGO;
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+ +/* setting should not be allowed from VF if not in one VF mode */
Quoted 25 lines
Quoted 25 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+if (amdgpu_sriov_vf (adev) && + !amdgpu_sriov_is_pp_one_vf (adev)) { + for (i = 0; i <
AMD_MAX_NUMBER_OF_SYSFS_IF_SUPPORTED; i++)Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c int amdgpu_pm_sysfs_init(struct
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ sysfs_if_attr_mode[i] &= ~S_IWUGO ; + } +} +int amdgpu_pm_sysfs_init (struct amdgpu_device *adev) {int ret;@@ -3424,6 +3418,8 @@ int amdgpu_pm_sysfs_init(struct
amdgpu_deviceQuoted 12 lines
Quoted 12 lines
*adev)
drivers/gpu/drm/amd/pm/amdgpu_pm.c int amdgpu_pm_sysfs_init(struct · line 3423
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0if (adev->pm.dpm_enabled ==0 )return 0 ; +amdgpu_sysfs_if_support_check (adev); + adev->pm.int_hwmon_dev =hwmon_device_register_with_groups(adev->dev,
Quoted 1 line
DRIVER_NAME, adev,Quoted 1 line
hwmon_groups);
RE: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces support
[AMD Official Use Only - General]
Quoted 422 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, January 9, 2023 6:52 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 23 lines · Evan
[AMD Official Use Only - General]
Quoted 19 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, January 9, 2023 11:28 AM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 8 lines · Evan
[AMD Official Use Only - General]
Quoted 4 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 6, 2023 6:01 PM
To: Quan, Evan <[email protected]>; amd-Quoted 32 lines
Quoted 32 lines
Quoted 7 lines
Quoted 7 lines
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportOn 1/6/2023 2:14 PM, Quan, Evan wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
[AMD Official Use Only - General]
Quoted 4 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 6, 2023 11:55 AM
To: Quan, Evan <[email protected]>; amd-Quoted 16 lines
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportOn 1/6/2023 7:34 AM, Quan, Evan wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
[AMD Official Use Only - General]
Quoted 4 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, January 5, 2023 9:58 PM
To: Quan, Evan <[email protected]>; amd-Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 1 line · Evan Quan
Make the code more clean and readable with no real logics
change.
Quoted 287 lines
Quoted 287 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Signed-off-by Evan Quan <[email protected]>Change-Id I21c879fa9abad9f6da3b5289adf3124950d2f4eb--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 200++++++++++++++--
Quoted 21 lines
Quoted 21 lines
----
Quoted 4 lines
Quoted 4 lines
---
Quoted 3 lines
Quoted 3 lines
------
Quoted 2 lines
1 file changed, 98 insertions(+), 102 deletions(-)Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0@@ -2006,9 +2006,6 @@ static int default_attr_update(struct
amdgpu_device*adev, structamdgpu_device_Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0uint32_t mask, enum
amdgpu_device_attr_statesQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
*states)
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-3{struct device_attribute *dev_attr = &attr->dev_attr; -uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; -uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; -const char *attr_name = dev_attr->attr.name;Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0if (!(attr->flags & mask) || !(AMD_SYSFS_IF_BITMASK(attr->if_bit) &
adev->pm.sysfs_if_supported)) { @@ -2016,112 +2013,14 @@static
Quoted 122 lines
Quoted 122 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
adev->intdefault_attr_update(struct
amdgpu_device*adev, struct
amdgpu_device_Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
return 0; }-#define
DEVICE_ATTR_IS(_name)(!strcmp(attr_name,#_name))
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- -if (DEVICE_ATTR_IS (pp_dpm_socclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 ) || - gc_ver ==IP_VERSION (9 ,4 ,1 ) || - gc_ver ==IP_VERSION (9 ,4 ,2 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_fclk)) {Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-if (mp1_ver <IP_VERSION (10 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - } else if (DEVICE_ATTR_IS(pp_od_clk_voltage)) { - *states =ATTR_STATE_UNSUPPORTED ; -if (amdgpu_dpm_is_overdrive_supported (adev)) - *states =ATTR_STATE_SUPPORTED ; - } else if (DEVICE_ATTR_IS(mem_busy_percent)) { - if (adev->flags & AMD_IS_APU || gc_ver ==IP_VERSION(9, 0,
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
1))
Quoted 12 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-12- *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 ) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (unique_id)) { -switch (gc_ver) { -case IP_VERSION (9 ,0 ,1 ): -case IP_VERSION (9 ,4 ,0 ): -case IP_VERSION (9 ,4 ,1 ): -case IP_VERSION (9 ,4 ,2 ): -case IP_VERSION (10 ,3 ,0 ):Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-case IP_VERSION (11 ,0 ,0 ): - *states =ATTR_STATE_SUPPORTED ; -break ; -default : - *states =ATTR_STATE_UNSUPPORTED ; - } - } else if (DEVICE_ATTR_IS(pp_features)) { - if (adev->flags & AMD_IS_APU || gc_ver <IP_VERSION(9, 0,
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
0))
Quoted 12 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-12- *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (gpu_metrics)) { -if (gc_ver <IP_VERSION (9 ,1 ,0 )) - *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 ,0 ) || - gc_ver ==IP_VERSION (10 ,1 ,2 ) || - gc_ver ==IP_VERSION (11 ,0 ,0 ) || - gc_ver ==IP_VERSION (11 ,0 ,2 ))) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_dclk)) {Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-if (!(gc_ver ==IP_VERSION (10 ,3 ,1 ) || - 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 ,2 ))) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_power_profile_mode)) { - if (amdgpu_dpm_get_power_profile_mode(adev,NULL) ==
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
-EOPNOTSUPP)drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-2- *states =ATTR_STATE_UNSUPPORTED ; - else if (gc_ver == IP_VERSION(10, 3, 0) &&
amdgpu_sriov_vf(adev))drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 7 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-7- *states =ATTR_STATE_UNSUPPORTED ; - } - -switch (gc_ver) { -case IP_VERSION (9 ,4 ,1 ): -case IP_VERSION (9 ,4 ,2 ): -/* the Mi series card does not support standalone mclk/socclk/fclk level setting */
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-9-if (DEVICE_ATTR_IS (pp_dpm_mclk) || -DEVICE_ATTR_IS (pp_dpm_socclk) || -DEVICE_ATTR_IS (pp_dpm_fclk)) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } -break ; -case IP_VERSION (10 ,3 ,0 ): - if(
DEVICE_ATTR_IS(power_dpm_force_performance_level)Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
&&
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- amdgpu_sriov_vf(adev)) { - dev_attr->attr.mode &= ~0222 ; - dev_attr->store =NULL ; - } -break ; -default : -break ; - } - -if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) {Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-/* SMU MP1 does not support dcefclk level setting */ -if (gc_ver >=IP_VERSION (10 ,0 ,0 )) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } - } - -/* setting should not be allowed from VF if not in one VF mode */
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-1- if (amdgpu_sriov_vf(adev)&& !amdgpu_sriov_is_pp_one_vf(adev))
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
{
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+if (!(adev->pm.sysfs_if_attr_mode[attr->if_bit] &S_IWUGO )){
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
dev_attr->attr.mode &= ~S_IWUGO; dev_attr->store = NULL; }Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-3-#undef DEVICE_ATTR_IS -return 0 ; } - static int amdgpu_device_attr_create(struct
amdgpu_device*adev,
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
struct
amdgpu_device_attr*attr,uint32_tmask, structlist_head
*attr_list)Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
@@ -3411,6
Quoted 1 line
+3310,101 @@ static const struct
attribute_group*hwmon_groups[]
Quoted 6 lines
Quoted 6 lines
=
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+{NULL }; +static void amdgpu_sysfs_if_support_check(struct
amdgpu_deviceQuoted 45 lines
Quoted 45 lines
Quoted 11 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+*adev) { + uint64_t *sysfs_if_supported = &adev-pm.sysfs_if_supported;
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ umode_t *sysfs_if_attr_mode = adev-pm.sysfs_if_attr_mode;
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6
-0+uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; +uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; +int i; + +/* All but those specific ASICs support these */ + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+ +if (gc_ver <IP_VERSION (9 ,1 ,0 )) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_GPU_METRICS_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+ +if (gc_ver ==IP_VERSION (9 ,0 ,1 )) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ } + +if (gc_ver <IP_VERSION (9 ,0 ,0 )) + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_FEATURES_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ }else { +switch (gc_ver) { +case IP_VERSION (9 ,4 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+break ; +case IP_VERSION (9 ,4 ,1 ): +case IP_VERSION (9 ,4 ,2 ): + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT);
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+/* the Mi series card does not support standalone
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
mclk/socclk/fclk level setting */
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_MCLK_BIT]
&=
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
~S_IWUGO;
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT]
&=
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
~S_IWUGO;
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_FCLK_BIT] &=~S_IWUGO;
Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (10 ,1 ,2 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (10 ,3 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+if (amdgpu_sriov_vf (adev)) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT);
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_POWER_DPM_FORCE_PERFOR
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
MANCE_LEVEL_BIT] &= ~S_IWUGO;drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ } +break ; +case IP_VERSION (10 ,3 ,1 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (11 ,0 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (11 ,0 ,2 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +8
-0+break ; +default : +break ; + } + } + +if (mp1_ver <IP_VERSION (10 ,0 ,0 )) + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_DPM_FCLK_BIT);
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
+
With this change, the IP version based checks need to be moved to respective smu_v* checks so that each IP version decides what is supported at which level (R/W) rather than consolidating it
here.
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 11 lines
Quoted 11 lines
Quoted 2 lines
Quoted 2 lines
Only generic checks like
amdgpu_sriov_is_pp_one_vfmay be maintainedhere.
Quoted 2 lines
Quoted 1 line
That way it really helps.
[Quan, Evan] For some of them, they could be moved to respective
smu_v* or gfx_v* checks.
Quoted 2 lines
But for some of them, it will be difficult. For example, for "
mp1_ver<
IP_VERSION(10, 0, 0)" or "gc_ver>=IP_VERSION(10, 0, 0)", you need to figure out which asics it refers to first and then apply the same change to every of them. That seems more error prone.Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
So, my thought is just left these old chunks as they were. And we just need
to take care of the future/new asics. How do you think?
Quoted 1 line
My preference is to clean up this as much as possible. Also, you may be able to set some of them generically based on
FEAT_DPMbits in swsmu/powerplay.I see. But I would expect the future ASICs take the way used in
patch3(more straightforward instead of implicit checking for some APIs or DPM features).
Quoted 2 lines
That's also the reason why I do not want to cleanup those old chunks. As I
do not expect them to serve for future ASICs.
Quoted 1 line
Then it's not worth to take the efforts(and risk) to do the cleanup.
Thoughts?
Quoted 1 line
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
It's to make sure consistency. I don't think leaving two options to do the same thing is a good idea. Otherwise older will continue and cause
confusion.
Quoted 2 lines
Quoted 2 lines
Changing to newer one for all is the preferred method and handling common things in smu_common/powerplay is better rather than
having
Quoted 18 lines
Quoted 18 lines
to
Quoted 3 lines
Quoted 1 line
do everything in individual versions.
Those old bunches left in
amdgpu_sysfs_if_support_check()can be dividedinto three types:
Quoted 1 line
1. those which check for the existence for some API(like
amdgpu_dpm_is_overdrive_supported/
amdgpu_dpm_get_power_profile_mode). The better choice for them is still left inamdgpu_pm.cI believe.Quoted 3 lines
2. those which check for some common flags(like sriov or apu). The better choice for them is also left in
amdgpu_pm.c3. those which check forgc ip version or smu ip version. A better choice for them might be to move to
amdgpu_discovery.cI think. But as mentioned before, I do not think it's worth to take the efforts(and risk) to do so.Quoted 1 line
So, as you can see, I do not think there is anything we can move to
smu_common/powerplay part.
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
If you are moving to a different method, think in terms of the new method and not the legacy way. Otherwise, we can continue the legacy method as described above. Keeping two options open is not a choice.
[Quan, Evan] Sorry, I'm still not persuaded. It's not about legacy way.
What is the reason for anyone not to maintain it in the legacy way for new ASICs also. This patch is at best half cooked. Either cook it fully or throw it out.
I think we spent too much time on those discussions about the proper designs(about where(which api/file) should some piece of code be placed). If you do not see any issue that affects these patch function correctly, can we just land them first?
Please let us do the thing right first.
And i'm open with(and welcome) any further update to the logics introduced in those patches if you do see a better design.
BR
Evan
Quoted 87 lines
Thanks,
LijoQuoted 3 lines
In fact, all the code has been transformed into bitmask related. I think your suggestions are about finding a new place for the code above. I'm not convinced as i believe they served for legacy asics only and they
cannot benefit for future asics.
Quoted 1 line
So, it's not worth to take efforts to move them to new places and take the
risks.
Quoted 77 lines
BR
EvanQuoted 74 lines
Thanks,
LijoQuoted 1 line
But if you were talking about splitting some changes in patch3 into
smu_common/powerplay part, that will be a different story.
Quoted 68 lines
BR
EvanQuoted 65 lines
Thanks,
LijoQuoted 16 lines
BR
EvanQuoted 14 lines
Thanks,
LijoQuoted 10 lines
Evan
Quoted 9 lines
Thanks,
Lijodrivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+if (adev->flags &AMD_IS_APU ) + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PCIE_BW_BIT)|Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_FEATURES_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6
-0+ +if (!amdgpu_dpm_is_overdrive_supported (adev)) + *sysfs_if_supported &= +~BIT_ULL (AMD_SYSFS_IF_PP_OD_CLK_VOLTAGE_BIT ); + + if (amdgpu_dpm_get_power_profile_mode(adev, NULL) ==-
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
EOPNOTSUPP)
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +5
-0+ *sysfs_if_supported &= +~BIT_ULL (AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT ); + +if (gc_ver >=IP_VERSION (10 ,0 ,0 )) +sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT]
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
&= ~S_IWUGO;
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+ +/* setting should not be allowed from VF if not in one VF mode */
Quoted 25 lines
Quoted 25 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+if (amdgpu_sriov_vf (adev) && + !amdgpu_sriov_is_pp_one_vf (adev)) { + for (i = 0; i <
AMD_MAX_NUMBER_OF_SYSFS_IF_SUPPORTED; i++)Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c int amdgpu_pm_sysfs_init(struct
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ sysfs_if_attr_mode[i] &= ~S_IWUGO ; + } +} +int amdgpu_pm_sysfs_init (struct amdgpu_device *adev) {int ret;@@ -3424,6 +3418,8 @@ int amdgpu_pm_sysfs_init(struct
amdgpu_deviceQuoted 12 lines
Quoted 12 lines
*adev)
drivers/gpu/drm/amd/pm/amdgpu_pm.c int amdgpu_pm_sysfs_init(struct · line 3423
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0if (adev->pm.dpm_enabled ==0 )return 0 ; +amdgpu_sysfs_if_support_check (adev); + adev->pm.int_hwmon_dev =hwmon_device_register_with_groups(adev->dev,
Quoted 1 line
DRIVER_NAME, adev,Quoted 1 line
hwmon_groups);
Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces support
Quoted 426 lines · Evan
[AMD Official Use Only - General]
Quoted 422 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, January 9, 2023 6:52 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 23 lines · Evan
[AMD Official Use Only - General]
Quoted 19 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, January 9, 2023 11:28 AM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 8 lines · Evan
[AMD Official Use Only - General]
Quoted 4 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 6, 2023 6:01 PM
To: Quan, Evan <[email protected]>; amd-Quoted 32 lines
Quoted 32 lines
Quoted 7 lines
Quoted 7 lines
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportOn 1/6/2023 2:14 PM, Quan, Evan wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
[AMD Official Use Only - General]
Quoted 4 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 6, 2023 11:55 AM
To: Quan, Evan <[email protected]>; amd-Quoted 16 lines
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportOn 1/6/2023 7:34 AM, Quan, Evan wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
[AMD Official Use Only - General]
Quoted 4 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, January 5, 2023 9:58 PM
To: Quan, Evan <[email protected]>; amd-Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/8] drm/amd/pm: refine the checks for sysfs interfaces supportQuoted 1 line · Evan Quan
Make the code more clean and readable with no real logics
change.
Quoted 287 lines
Quoted 287 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Signed-off-by Evan Quan <[email protected]>Change-Id I21c879fa9abad9f6da3b5289adf3124950d2f4eb--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 200++++++++++++++--
Quoted 21 lines
Quoted 21 lines
----
Quoted 4 lines
Quoted 4 lines
---
Quoted 3 lines
Quoted 3 lines
------
Quoted 2 lines
1 file changed, 98 insertions(+), 102 deletions(-)Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0@@ -2006,9 +2006,6 @@ static int default_attr_update(struct
amdgpu_device*adev, structamdgpu_device_Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0uint32_t mask, enum
amdgpu_device_attr_statesQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
*states)
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-3{struct device_attribute *dev_attr = &attr->dev_attr; -uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; -uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; -const char *attr_name = dev_attr->attr.name;Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-0if (!(attr->flags & mask) || !(AMD_SYSFS_IF_BITMASK(attr->if_bit) &
adev->pm.sysfs_if_supported)) { @@ -2016,112 +2013,14 @@static
Quoted 122 lines
Quoted 122 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
adev->intdefault_attr_update(struct
amdgpu_device*adev, struct
amdgpu_device_Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
return 0; }-#define
DEVICE_ATTR_IS(_name)(!strcmp(attr_name,#_name))
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- -if (DEVICE_ATTR_IS (pp_dpm_socclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) { -if (gc_ver <IP_VERSION (9 ,0 ,0 ) || - gc_ver ==IP_VERSION (9 ,4 ,1 ) || - gc_ver ==IP_VERSION (9 ,4 ,2 )) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_fclk)) {Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-if (mp1_ver <IP_VERSION (10 ,0 ,0 )) - *states =ATTR_STATE_UNSUPPORTED ; - } else if (DEVICE_ATTR_IS(pp_od_clk_voltage)) { - *states =ATTR_STATE_UNSUPPORTED ; -if (amdgpu_dpm_is_overdrive_supported (adev)) - *states =ATTR_STATE_SUPPORTED ; - } else if (DEVICE_ATTR_IS(mem_busy_percent)) { - if (adev->flags & AMD_IS_APU || gc_ver ==IP_VERSION(9, 0,
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
1))
Quoted 12 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-12- *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 ) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (unique_id)) { -switch (gc_ver) { -case IP_VERSION (9 ,0 ,1 ): -case IP_VERSION (9 ,4 ,0 ): -case IP_VERSION (9 ,4 ,1 ): -case IP_VERSION (9 ,4 ,2 ): -case IP_VERSION (10 ,3 ,0 ):Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-case IP_VERSION (11 ,0 ,0 ): - *states =ATTR_STATE_SUPPORTED ; -break ; -default : - *states =ATTR_STATE_UNSUPPORTED ; - } - } else if (DEVICE_ATTR_IS(pp_features)) { - if (adev->flags & AMD_IS_APU || gc_ver <IP_VERSION(9, 0,
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
0))
Quoted 12 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-12- *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (gpu_metrics)) { -if (gc_ver <IP_VERSION (9 ,1 ,0 )) - *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 ,0 ) || - gc_ver ==IP_VERSION (10 ,1 ,2 ) || - gc_ver ==IP_VERSION (11 ,0 ,0 ) || - gc_ver ==IP_VERSION (11 ,0 ,2 ))) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_dpm_dclk)) {Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-if (!(gc_ver ==IP_VERSION (10 ,3 ,1 ) || - 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 ,2 ))) - *states =ATTR_STATE_UNSUPPORTED ; - }else if (DEVICE_ATTR_IS (pp_power_profile_mode)) { - if (amdgpu_dpm_get_power_profile_mode(adev,NULL) ==
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
-EOPNOTSUPP)drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-2- *states =ATTR_STATE_UNSUPPORTED ; - else if (gc_ver == IP_VERSION(10, 3, 0) &&
amdgpu_sriov_vf(adev))drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 7 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-7- *states =ATTR_STATE_UNSUPPORTED ; - } - -switch (gc_ver) { -case IP_VERSION (9 ,4 ,1 ): -case IP_VERSION (9 ,4 ,2 ): -/* the Mi series card does not support standalone mclk/socclk/fclk level setting */
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-9-if (DEVICE_ATTR_IS (pp_dpm_mclk) || -DEVICE_ATTR_IS (pp_dpm_socclk) || -DEVICE_ATTR_IS (pp_dpm_fclk)) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } -break ; -case IP_VERSION (10 ,3 ,0 ): - if(
DEVICE_ATTR_IS(power_dpm_force_performance_level)Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
&&
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-10- amdgpu_sriov_vf(adev)) { - dev_attr->attr.mode &= ~0222 ; - dev_attr->store =NULL ; - } -break ; -default : -break ; - } - -if (DEVICE_ATTR_IS (pp_dpm_dcefclk)) {Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-8-/* SMU MP1 does not support dcefclk level setting */ -if (gc_ver >=IP_VERSION (10 ,0 ,0 )) { - dev_attr->attr.mode &= ~S_IWUGO ; - dev_attr->store =NULL ; - } - } - -/* setting should not be allowed from VF if not in one VF mode */
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-1- if (amdgpu_sriov_vf(adev)&& !amdgpu_sriov_is_pp_one_vf(adev))
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
{
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+if (!(adev->pm.sysfs_if_attr_mode[attr->if_bit] &S_IWUGO )){
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
dev_attr->attr.mode &= ~S_IWUGO; dev_attr->store = NULL; }Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0
-3-#undef DEVICE_ATTR_IS -return 0 ; } - static int amdgpu_device_attr_create(struct
amdgpu_device*adev,
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
struct
amdgpu_device_attr*attr,uint32_tmask, structlist_head
*attr_list)Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
@@ -3411,6
Quoted 1 line
+3310,101 @@ static const struct
attribute_group*hwmon_groups[]
Quoted 6 lines
Quoted 6 lines
=
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+{NULL }; +static void amdgpu_sysfs_if_support_check(struct
amdgpu_deviceQuoted 45 lines
Quoted 45 lines
Quoted 11 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+*adev) { + uint64_t *sysfs_if_supported = &adev-pm.sysfs_if_supported;
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ umode_t *sysfs_if_attr_mode = adev-pm.sysfs_if_attr_mode;
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6
-0+uint32_t mp1_ver = adev->ip_versions[MP1_HWIP ][0 ]; +uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; +int i; + +/* All but those specific ASICs support these */ + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+ +if (gc_ver <IP_VERSION (9 ,1 ,0 )) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_GPU_METRICS_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+ +if (gc_ver ==IP_VERSION (9 ,0 ,1 )) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT);
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ } + +if (gc_ver <IP_VERSION (9 ,0 ,0 )) + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_FEATURES_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ }else { +switch (gc_ver) { +case IP_VERSION (9 ,4 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+break ; +case IP_VERSION (9 ,4 ,1 ): +case IP_VERSION (9 ,4 ,2 ): + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT);
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+/* the Mi series card does not support standalone
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
mclk/socclk/fclk level setting */
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_MCLK_BIT]
&=
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
~S_IWUGO;
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_SOCCLK_BIT]
&=
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
~S_IWUGO;
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_FCLK_BIT] &=~S_IWUGO;
Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (10 ,1 ,2 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (10 ,3 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+if (amdgpu_sriov_vf (adev)) { + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT);
Quoted 1 line
+
sysfs_if_attr_mode[AMD_SYSFS_IF_POWER_DPM_FORCE_PERFOR
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
MANCE_LEVEL_BIT] &= ~S_IWUGO;drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ } +break ; +case IP_VERSION (10 ,3 ,1 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (11 ,0 ,0 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_UNIQUE_ID_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1
-0+ *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+break ; +case IP_VERSION (11 ,0 ,2 ): + *sysfs_if_supported |=
BIT_ULL(AMD_SYSFS_IF_PP_DPM_VCLK_BIT)|Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCLK_BIT);drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +8
-0+break ; +default : +break ; + } + } + +if (mp1_ver <IP_VERSION (10 ,0 ,0 )) + *sysfs_if_supported &=~BIT_ULL(AMD_SYSFS_IF_PP_DPM_FCLK_BIT);
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
+
With this change, the IP version based checks need to be moved to respective smu_v* checks so that each IP version decides what is supported at which level (R/W) rather than consolidating it
here.
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 11 lines
Quoted 11 lines
Quoted 2 lines
Quoted 2 lines
Only generic checks like
amdgpu_sriov_is_pp_one_vfmay be maintainedhere.
Quoted 2 lines
Quoted 1 line
That way it really helps.
[Quan, Evan] For some of them, they could be moved to respective
smu_v* or gfx_v* checks.
Quoted 2 lines
But for some of them, it will be difficult. For example, for "
mp1_ver<
IP_VERSION(10, 0, 0)" or "gc_ver>=IP_VERSION(10, 0, 0)", you need to figure out which asics it refers to first and then apply the same change to every of them. That seems more error prone.Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
So, my thought is just left these old chunks as they were. And we just need
to take care of the future/new asics. How do you think?
Quoted 1 line
My preference is to clean up this as much as possible. Also, you may be able to set some of them generically based on
FEAT_DPMbits in swsmu/powerplay.I see. But I would expect the future ASICs take the way used in
patch3(more straightforward instead of implicit checking for some APIs or DPM features).
Quoted 2 lines
That's also the reason why I do not want to cleanup those old chunks. As I
do not expect them to serve for future ASICs.
Quoted 1 line
Then it's not worth to take the efforts(and risk) to do the cleanup.
Thoughts?
Quoted 1 line
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
It's to make sure consistency. I don't think leaving two options to do the same thing is a good idea. Otherwise older will continue and cause
confusion.
Quoted 2 lines
Quoted 2 lines
Changing to newer one for all is the preferred method and handling common things in smu_common/powerplay is better rather than
having
Quoted 18 lines
Quoted 18 lines
to
Quoted 3 lines
Quoted 1 line
do everything in individual versions.
Those old bunches left in
amdgpu_sysfs_if_support_check()can be dividedinto three types:
Quoted 1 line
1. those which check for the existence for some API(like
amdgpu_dpm_is_overdrive_supported/
amdgpu_dpm_get_power_profile_mode). The better choice for them is still left inamdgpu_pm.cI believe.Quoted 3 lines
2. those which check for some common flags(like sriov or apu). The better choice for them is also left in
amdgpu_pm.c3. those which check forgc ip version or smu ip version. A better choice for them might be to move to
amdgpu_discovery.cI think. But as mentioned before, I do not think it's worth to take the efforts(and risk) to do so.Quoted 1 line
So, as you can see, I do not think there is anything we can move to
smu_common/powerplay part.
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
If you are moving to a different method, think in terms of the new method and not the legacy way. Otherwise, we can continue the legacy method as described above. Keeping two options open is not a choice.
[Quan, Evan] Sorry, I'm still not persuaded. It's not about legacy way.
What is the reason for anyone not to maintain it in the legacy way for new ASICs also. This patch is at best half cooked. Either cook it fully or throw it out.
I think we spent too much time on those discussions about the proper designs(about where(which api/file) should some piece of code be placed).
Yes, the time is spent as the patch doesn't look fine.
Quoted 2 lines
If you do not see any issue that affects these patch function correctly, can we just land them first? Please let us do the thing right first.
Sorry, I don't think this is the right approach. I suggest to drop this for now and do it in the right way later rather than using fix-it-later approach.
Thanks,
Lijo
Quoted 91 lines
And i'm open with(and welcome) any further update to the logics introduced in those patches if you do see a better design.
BR
EvanQuoted 87 lines
Thanks,
LijoQuoted 3 lines
In fact, all the code has been transformed into bitmask related. I think your suggestions are about finding a new place for the code above. I'm not convinced as i believe they served for legacy asics only and they
cannot benefit for future asics.
Quoted 1 line
So, it's not worth to take efforts to move them to new places and take the
risks.
Quoted 77 lines
BR
EvanQuoted 74 lines
Thanks,
LijoQuoted 1 line
But if you were talking about splitting some changes in patch3 into
smu_common/powerplay part, that will be a different story.
Quoted 68 lines
BR
EvanQuoted 65 lines
Thanks,
LijoQuoted 16 lines
BR
EvanQuoted 14 lines
Thanks,
LijoQuoted 10 lines
Evan
Quoted 9 lines
Thanks,
Lijodrivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+if (adev->flags &AMD_IS_APU ) + *sysfs_if_supported &=~(BIT_ULL(AMD_SYSFS_IF_MEM_BUSY_PERCENT_BIT) |
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PCIE_BW_BIT)|Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
+
BIT_ULL(AMD_SYSFS_IF_PP_FEATURES_BIT));drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6
-0+ +if (!amdgpu_dpm_is_overdrive_supported (adev)) + *sysfs_if_supported &= +~BIT_ULL (AMD_SYSFS_IF_PP_OD_CLK_VOLTAGE_BIT ); + + if (amdgpu_dpm_get_power_profile_mode(adev, NULL) ==-
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
EOPNOTSUPP)
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 5 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +5
-0+ *sysfs_if_supported &= +~BIT_ULL (AMD_SYSFS_IF_PP_POWER_PROFILE_MODE_BIT ); + +if (gc_ver >=IP_VERSION (10 ,0 ,0 )) +sysfs_if_attr_mode[AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT]
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
&= ~S_IWUGO;
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0+ +/* setting should not be allowed from VF if not in one VF mode */
Quoted 25 lines
Quoted 25 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c
Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3
-0+if (amdgpu_sriov_vf (adev) && + !amdgpu_sriov_is_pp_one_vf (adev)) { + for (i = 0; i <
AMD_MAX_NUMBER_OF_SYSFS_IF_SUPPORTED; i++)Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c int amdgpu_pm_sysfs_init(struct
Quoted 8 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4
-0+ sysfs_if_attr_mode[i] &= ~S_IWUGO ; + } +} +int amdgpu_pm_sysfs_init (struct amdgpu_device *adev) {int ret;@@ -3424,6 +3418,8 @@ int amdgpu_pm_sysfs_init(struct
amdgpu_deviceQuoted 12 lines
Quoted 12 lines
*adev)
drivers/gpu/drm/amd/pm/amdgpu_pm.c int amdgpu_pm_sysfs_init(struct · line 3423
Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2
-0if (adev->pm.dpm_enabled ==0 )return 0 ; +amdgpu_sysfs_if_support_check (adev); + adev->pm.int_hwmon_dev =hwmon_device_register_with_groups(adev->dev,
Quoted 1 line
DRIVER_NAME, adev,Quoted 1 line
hwmon_groups);
PATCH 3/8 drm/amd/pm: drop the support for legacy sysfs interfaces on SMU13.0.0
In reply to Evan QuanThose legacy sysfs interfaces are actually not supported. Their outputs are confusing.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +9 -0
@@ -2052,4 +2052,13 @@ void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu) smu->pwr_src_map = smu_v13_0_0_pwr_src_map; smu->workload_map = smu_v13_0_0_workload_map;smu_v13_0_0_set_smu_mailbox_registers (smu); +/* Unset those legacy interfaces which are not supported */ + smu->adev->pm.sysfs_if_supported &= ~(BIT_ULL (AMD_SYSFS_IF_POWER_DPM_STATE_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_NUM_STATES_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_CUR_STATE_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_FORCE_STATE_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_TABLE_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_SCLK_OD_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_MCLK_OD_BIT )); }
Signature · 1 line
2.34.1
PATCH 4/8 drm/amd/pm: drop the support for legacy sysfs interfaces on SMU13.0.7
In reply to Evan QuanThose legacy sysfs interfaces are actually not supported. Their outputs are confusing.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +9 -0
@@ -1727,4 +1727,13 @@ void smu_v13_0_7_set_ppt_funcs(struct smu_context *smu) smu->pwr_src_map = smu_v13_0_7_pwr_src_map; smu->workload_map = smu_v13_0_7_workload_map;smu_v13_0_set_smu_mailbox_registers (smu); +/* Unset those legacy interfaces which are not supported */ + smu->adev->pm.sysfs_if_supported &= ~(BIT_ULL (AMD_SYSFS_IF_POWER_DPM_STATE_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_NUM_STATES_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_CUR_STATE_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_FORCE_STATE_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_TABLE_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_SCLK_OD_BIT ) | +BIT_ULL (AMD_SYSFS_IF_PP_MCLK_OD_BIT )); }
Signature · 1 line
2.34.1
PATCH 5/8 drm/amdgpu: add bitmask controll for hwmon related interfaces
In reply to Evan QuanVia this, the logic for adding/dropping the support for some specific hwmon interface can be greatly simplified.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 ++- drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h | 52 ++++++++++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -2
@@ -3640,13 +3640,16 @@ int amdgpu_device_init(struct amdgpu_device *adev,ratelimit_set_flags (&adev->throttling_logging_rs,RATELIMIT_MSG_ON_RELEASE );/* -* At default, all sysfs interfaces are claimed to be supported. -* And every sysfs interface is readable and writable. However, +* At default, all sysfs and hwmon interfaces are claimed to be supported. +* And every interface is readable and writable. However, * each ASIC can have its own setting by overriding these. */ adev->pm.sysfs_if_supported =AMD_SYSFS_IF_BITMASK_ALL_SUPPORTED ;for (i =0 ; i <AMD_MAX_NUMBER_OF_SYSFS_IF_SUPPORTED ; i++) adev->pm.sysfs_if_attr_mode[i] =S_IRUGO |S_IWUGO ; + adev->pm.hwmon_if_supported =AMD_HWMON_IF_BITMASK_ALL_SUPPORTED ; +for (i =0 ; i <AMD_MAX_NUMBER_OF_HWMON_IF_SUPPORTED ; i++) + adev->pm.hwmon_if_attr_mode[i] =S_IRUGO |S_IWUSR ;/* Registers mapping */ /* TODO: block userspace mapping of io register */
drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +52 -0
64 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 6/8 drm/amd/pm: refine the checks for hwmon interfaces support
In reply to Evan QuanMake the code more clean and readable with no real logics change.
--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 329 ++++++++++++++++++----------- 1 file changed, 206 insertions(+), 123 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +206 -123
@@ -3155,161 +3155,242 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,struct device *dev =kobj_to_dev (kobj);struct amdgpu_device *adev =dev_get_drvdata (dev);umode_t effective_mode = attr->mode; +uint32_t if_bit; + +if (attr == &sensor_dev_attr_temp1_input.dev_attr.attr) + if_bit =AMD_HWMON_IF_TEMP1_INPUT_BIT ; +else if (attr == &sensor_dev_attr_temp1_crit.dev_attr.attr) + if_bit =AMD_HWMON_IF_TEMP1_CRIT_BIT ; +else if (attr == &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr) + if_bit =AMD_HWMON_IF_TEMP1_CRIT_HYST_BIT ; +else if (attr == &sensor_dev_attr_temp2_input.dev_attr.attr) + if_bit =AMD_HWMON_IF_TEMP2_INPUT_BIT ; +else if (attr == &sensor_dev_attr_temp2_crit.dev_attr.attr) + if_bit =AMD_HWMON_IF_TEMP2_CRIT_BIT ; +else if (attr == &sensor_dev_attr_temp2_crit_hyst.dev_attr.attr) + if_bit =AMD_HWMON_IF_TEMP2_CRIT_HYST_BIT ; +else if (attr == &sensor_dev_attr_temp3_input.dev_attr.attr) + if_bit =AMD_HWMON_IF_TEMP3_INPUT_BIT ; +else if (attr == &sensor_dev_attr_temp3_crit.dev_attr.attr) + if_bit =AMD_HWMON_IF_TEMP3_CRIT_BIT ; +else if (attr == &sensor_dev_attr_temp3_crit_hyst.dev_attr.attr) + if_bit =AMD_HWMON_IF_TEMP3_CRIT_HYST_BIT ; +else if (attr == &sensor_dev_attr_temp1_emergency.dev_attr.attr) + if_bit =AMD_HWMON_IF_TEMP1_EMERGENCY_BIT ; +else if (attr == &sensor_dev_attr_temp2_emergency.dev_attr.attr) + if_bit =AMD_HWMON_IF_TEMP2_EMERGENCY_BIT ; +else if (attr == &sensor_dev_attr_temp3_emergency.dev_attr.attr) + if_bit =AMD_HWMON_IF_TEMP3_EMERGENCY_BIT ; +else if (attr == &sensor_dev_attr_temp1_label.dev_attr.attr) + if_bit =AMD_HWMON_IF_TEMP1_LABEL_BIT ; +else if (attr == &sensor_dev_attr_temp2_label.dev_attr.attr) + if_bit =AMD_HWMON_IF_TEMP2_LABEL_BIT ; +else if (attr == &sensor_dev_attr_temp3_label.dev_attr.attr) + if_bit =AMD_HWMON_IF_TEMP3_LABEL_BIT ; +else if (attr == &sensor_dev_attr_pwm1.dev_attr.attr) + if_bit =AMD_HWMON_IF_PWM1_BIT ; +else if (attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr) + if_bit =AMD_HWMON_IF_PWM1_ENABLE_BIT ; +else if (attr == &sensor_dev_attr_pwm1_min.dev_attr.attr) + if_bit =AMD_HWMON_IF_PWM1_MIN_BIT ; +else if (attr == &sensor_dev_attr_pwm1_max.dev_attr.attr) + if_bit =AMD_HWMON_IF_PWM1_MAX_BIT ; +else if (attr == &sensor_dev_attr_fan1_input.dev_attr.attr) + if_bit =AMD_HWMON_IF_FAN1_INPUT_BIT ; +else if (attr == &sensor_dev_attr_fan1_min.dev_attr.attr) + if_bit =AMD_HWMON_IF_FAN1_MIN_BIT ; +else if (attr == &sensor_dev_attr_fan1_max.dev_attr.attr) + if_bit =AMD_HWMON_IF_FAN1_MAX_BIT ; +else if (attr == &sensor_dev_attr_fan1_target.dev_attr.attr) + if_bit =AMD_HWMON_IF_FAN1_TARGET_BIT ; +else if (attr == &sensor_dev_attr_fan1_enable.dev_attr.attr) + if_bit =AMD_HWMON_IF_FAN1_ENABLE_BIT ; +else if (attr == &sensor_dev_attr_in0_input.dev_attr.attr) + if_bit =AMD_HWMON_IF_IN0_INPUT_BIT ; +else if (attr == &sensor_dev_attr_in0_label.dev_attr.attr) + if_bit =AMD_HWMON_IF_IN0_LABEL_BIT ; +else if (attr == &sensor_dev_attr_in1_input.dev_attr.attr) + if_bit =AMD_HWMON_IF_IN1_INPUT_BIT ; +else if (attr == &sensor_dev_attr_in1_label.dev_attr.attr) + if_bit =AMD_HWMON_IF_IN1_LABEL_BIT ; +else if (attr == &sensor_dev_attr_power1_average.dev_attr.attr) + if_bit =AMD_HWMON_IF_POWER1_AVERAGE_BIT ; +else if (attr == &sensor_dev_attr_power1_cap_max.dev_attr.attr) + if_bit =AMD_HWMON_IF_POWER1_CAP_MAX_BIT ; +else if (attr == &sensor_dev_attr_power1_cap_min.dev_attr.attr) + if_bit =AMD_HWMON_IF_POWER1_CAP_MIN_BIT ; +else if (attr == &sensor_dev_attr_power1_cap.dev_attr.attr) + if_bit =AMD_HWMON_IF_POWER1_CAP_BIT ; +else if (attr == &sensor_dev_attr_power1_cap_default.dev_attr.attr) + if_bit =AMD_HWMON_IF_POWER1_CAP_DEFAULT_BIT ; +else if (attr == &sensor_dev_attr_power1_label.dev_attr.attr) + if_bit =AMD_HWMON_IF_POWER1_LABEL_BIT ; +else if (attr == &sensor_dev_attr_power2_average.dev_attr.attr) + if_bit =AMD_HWMON_IF_POWER2_AVERAGE_BIT ; +else if (attr == &sensor_dev_attr_power2_cap_max.dev_attr.attr) + if_bit =AMD_HWMON_IF_POWER2_CAP_MAX_BIT ; +else if (attr == &sensor_dev_attr_power2_cap_min.dev_attr.attr) + if_bit =AMD_HWMON_IF_POWER2_CAP_MIN_BIT ; +else if (attr == &sensor_dev_attr_power2_cap.dev_attr.attr) + if_bit =AMD_HWMON_IF_POWER2_CAP_BIT ; +else if (attr == &sensor_dev_attr_power2_cap_default.dev_attr.attr) + if_bit =AMD_HWMON_IF_POWER2_CAP_DEFAULT_BIT ; +else if (attr == &sensor_dev_attr_power2_label.dev_attr.attr) + if_bit =AMD_HWMON_IF_POWER2_LABEL_BIT ; +else if (attr == &sensor_dev_attr_freq1_input.dev_attr.attr) + if_bit =AMD_HWMON_IF_FREQ1_INPUT_BIT ; +else if (attr == &sensor_dev_attr_freq1_label.dev_attr.attr) + if_bit =AMD_HWMON_IF_FREQ1_LABEL_BIT ; +else if (attr == &sensor_dev_attr_freq2_input.dev_attr.attr) + if_bit =AMD_HWMON_IF_FREQ2_INPUT_BIT ; +else if (attr == &sensor_dev_attr_freq2_label.dev_attr.attr) + if_bit =AMD_HWMON_IF_FREQ2_LABEL_BIT ; + +if (!(adev->pm.hwmon_if_supported &BIT_ULL (if_bit))) +return 0 ; + + effective_mode &= adev->pm.hwmon_if_attr_mode[if_bit]; + +return effective_mode; +} + +static const struct attribute_group hwmon_attrgroup = { + .attrs = hwmon_attributes, + .is_visible = hwmon_attributes_visible, +}; + +static const struct attribute_group *hwmon_groups[] = { + &hwmon_attrgroup, +NULL +}; + +static void amdgpu_hwmon_if_support_check (struct amdgpu_device *adev) +{uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; +int i;/* under multi-vf mode, the hwmon attributes are all not supported */ -if (amdgpu_sriov_vf (adev) && !amdgpu_sriov_is_pp_one_vf (adev)) -return 0 ; +if (amdgpu_sriov_vf (adev) && + !amdgpu_sriov_is_pp_one_vf (adev)) { + adev->pm.hwmon_if_supported =0 ; +return ; + }/* under pp one vf mode manage of hwmon attributes is not supported */ -if (amdgpu_sriov_is_pp_one_vf (adev)) - effective_mode &= ~S_IWUSR ; +if (amdgpu_sriov_is_pp_one_vf (adev)) { +for (i =0 ; i <AMD_MAX_NUMBER_OF_HWMON_IF_SUPPORTED ; i++) + adev->pm.hwmon_if_attr_mode[i] &= ~S_IWUSR ; + }/* Skip fan attributes if fan is not present */ -if (adev->pm.no_fan && (attr == &sensor_dev_attr_pwm1.dev_attr.attr || - attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr || - attr == &sensor_dev_attr_pwm1_max.dev_attr.attr || - attr == &sensor_dev_attr_pwm1_min.dev_attr.attr || - attr == &sensor_dev_attr_fan1_input.dev_attr.attr || - attr == &sensor_dev_attr_fan1_min.dev_attr.attr || - attr == &sensor_dev_attr_fan1_max.dev_attr.attr || - attr == &sensor_dev_attr_fan1_target.dev_attr.attr || - attr == &sensor_dev_attr_fan1_enable.dev_attr.attr)) -return 0 ; - -/* Skip fan attributes on APU */ -if ((adev->flags &AMD_IS_APU ) && - (attr == &sensor_dev_attr_pwm1.dev_attr.attr || - attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr || - attr == &sensor_dev_attr_pwm1_max.dev_attr.attr || - attr == &sensor_dev_attr_pwm1_min.dev_attr.attr || - attr == &sensor_dev_attr_fan1_input.dev_attr.attr || - attr == &sensor_dev_attr_fan1_min.dev_attr.attr || - attr == &sensor_dev_attr_fan1_max.dev_attr.attr || - attr == &sensor_dev_attr_fan1_target.dev_attr.attr || - attr == &sensor_dev_attr_fan1_enable.dev_attr.attr)) -return 0 ; +if (adev->pm.no_fan || + (adev->flags &AMD_IS_APU )) + adev->pm.hwmon_if_supported &= ~(BIT_ULL (AMD_HWMON_IF_PWM1_BIT ) | +BIT_ULL (AMD_HWMON_IF_PWM1_ENABLE_BIT ) | +BIT_ULL (AMD_HWMON_IF_PWM1_MAX_BIT ) | +BIT_ULL (AMD_HWMON_IF_PWM1_MIN_BIT ) | +BIT_ULL (AMD_HWMON_IF_FAN1_INPUT_BIT ) | +BIT_ULL (AMD_HWMON_IF_FAN1_MIN_BIT ) | +BIT_ULL (AMD_HWMON_IF_FAN1_MAX_BIT ) | +BIT_ULL (AMD_HWMON_IF_FAN1_TARGET_BIT ) | +BIT_ULL (AMD_HWMON_IF_FAN1_ENABLE_BIT ));/* Skip crit temp on APU */ -if ((adev->flags &AMD_IS_APU ) && (adev->family >=AMDGPU_FAMILY_CZ ) && - (attr == &sensor_dev_attr_temp1_crit.dev_attr.attr || - attr == &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr)) -return 0 ; +if ((adev->flags &AMD_IS_APU ) && + (adev->family >=AMDGPU_FAMILY_CZ )) + adev->pm.hwmon_if_supported &= ~(BIT_ULL (AMD_HWMON_IF_TEMP1_CRIT_BIT ) | +BIT_ULL (AMD_HWMON_IF_TEMP1_CRIT_HYST_BIT ));/* Skip limit attributes if DPM is not enabled */ -if (!adev->pm.dpm_enabled && - (attr == &sensor_dev_attr_temp1_crit.dev_attr.attr || - attr == &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr || - attr == &sensor_dev_attr_pwm1.dev_attr.attr || - attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr || - attr == &sensor_dev_attr_pwm1_max.dev_attr.attr || - attr == &sensor_dev_attr_pwm1_min.dev_attr.attr || - attr == &sensor_dev_attr_fan1_input.dev_attr.attr || - attr == &sensor_dev_attr_fan1_min.dev_attr.attr || - attr == &sensor_dev_attr_fan1_max.dev_attr.attr || - attr == &sensor_dev_attr_fan1_target.dev_attr.attr || - attr == &sensor_dev_attr_fan1_enable.dev_attr.attr)) -return 0 ; +if (!adev->pm.dpm_enabled) + adev->pm.hwmon_if_supported &= ~(BIT_ULL (AMD_HWMON_IF_TEMP1_CRIT_BIT ) | +BIT_ULL (AMD_HWMON_IF_TEMP1_CRIT_HYST_BIT ) | +BIT_ULL (AMD_HWMON_IF_PWM1_BIT ) | +BIT_ULL (AMD_HWMON_IF_PWM1_ENABLE_BIT ) | +BIT_ULL (AMD_HWMON_IF_PWM1_MAX_BIT ) | +BIT_ULL (AMD_HWMON_IF_PWM1_MIN_BIT ) | +BIT_ULL (AMD_HWMON_IF_FAN1_INPUT_BIT ) | +BIT_ULL (AMD_HWMON_IF_FAN1_MIN_BIT ) | +BIT_ULL (AMD_HWMON_IF_FAN1_MAX_BIT ) | +BIT_ULL (AMD_HWMON_IF_FAN1_TARGET_BIT ) | +BIT_ULL (AMD_HWMON_IF_FAN1_ENABLE_BIT ));/* mask fan attributes if we have no bindings for this asic to expose */ -if (((amdgpu_dpm_get_fan_speed_pwm (adev,NULL ) == -EOPNOTSUPP ) && - attr == &sensor_dev_attr_pwm1.dev_attr.attr) ||/* can't query fan */ - ((amdgpu_dpm_get_fan_control_mode (adev,NULL ) == -EOPNOTSUPP ) && - attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr))/* can't query state */ - effective_mode &= ~S_IRUGO ; - -if (((amdgpu_dpm_set_fan_speed_pwm (adev,U32_MAX ) == -EOPNOTSUPP ) && - attr == &sensor_dev_attr_pwm1.dev_attr.attr) ||/* can't manage fan */ - ((amdgpu_dpm_set_fan_control_mode (adev,U32_MAX ) == -EOPNOTSUPP ) && - attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr))/* can't manage state */ - effective_mode &= ~S_IWUSR ; +if (amdgpu_dpm_get_fan_speed_pwm (adev,NULL ) == -EOPNOTSUPP ) + adev->pm.hwmon_if_attr_mode[AMD_HWMON_IF_PWM1_BIT ] &= ~S_IRUGO ; +if (amdgpu_dpm_get_fan_control_mode (adev,NULL ) == -EOPNOTSUPP ) + adev->pm.hwmon_if_attr_mode[AMD_HWMON_IF_PWM1_ENABLE_BIT ] &= ~S_IRUGO ; +if (amdgpu_dpm_set_fan_speed_pwm (adev,U32_MAX ) == -EOPNOTSUPP ) + adev->pm.hwmon_if_attr_mode[AMD_HWMON_IF_PWM1_BIT ] &= ~S_IWUSR ; +if (amdgpu_dpm_set_fan_control_mode (adev,U32_MAX ) == -EOPNOTSUPP ) + adev->pm.hwmon_if_attr_mode[AMD_HWMON_IF_PWM1_ENABLE_BIT ] &= ~S_IWUSR ;/* not implemented yet for GC 10.3.1 APUs */ -if (((adev->family ==AMDGPU_FAMILY_SI ) || - ((adev->flags &AMD_IS_APU ) && (gc_ver !=IP_VERSION (10 ,3 ,1 )))) && - (attr == &sensor_dev_attr_power1_cap_max.dev_attr.attr || - attr == &sensor_dev_attr_power1_cap_min.dev_attr.attr || - attr == &sensor_dev_attr_power1_cap.dev_attr.attr || - attr == &sensor_dev_attr_power1_cap_default.dev_attr.attr)) -return 0 ; +if ((adev->family ==AMDGPU_FAMILY_SI ) || + ((adev->flags &AMD_IS_APU ) && (gc_ver !=IP_VERSION (10 ,3 ,1 )))) + adev->pm.hwmon_if_supported &= ~(BIT_ULL (AMD_HWMON_IF_POWER1_CAP_MAX_BIT ) | +BIT_ULL (AMD_HWMON_IF_POWER1_CAP_MIN_BIT ) | +BIT_ULL (AMD_HWMON_IF_POWER1_CAP_BIT ) | +BIT_ULL (AMD_HWMON_IF_POWER1_CAP_DEFAULT_BIT ));/* not implemented yet for APUs having <= GC 9.3.0 */ -if (((adev->family ==AMDGPU_FAMILY_SI ) || - ((adev->flags &AMD_IS_APU ) && (gc_ver <IP_VERSION (9 ,3 ,0 )))) && - (attr == &sensor_dev_attr_power1_average.dev_attr.attr)) -return 0 ; +if ((adev->family ==AMDGPU_FAMILY_SI ) || + ((adev->flags &AMD_IS_APU ) && (gc_ver <IP_VERSION (9 ,3 ,0 )))) + adev->pm.hwmon_if_supported &= ~BIT_ULL (AMD_HWMON_IF_POWER1_AVERAGE_BIT );/* hide max/min values if we can't both query and manage the fan */ -if (((amdgpu_dpm_set_fan_speed_pwm (adev,U32_MAX ) == -EOPNOTSUPP ) && - (amdgpu_dpm_get_fan_speed_pwm (adev,NULL ) == -EOPNOTSUPP ) && - (amdgpu_dpm_set_fan_speed_rpm (adev,U32_MAX ) == -EOPNOTSUPP ) && - (amdgpu_dpm_get_fan_speed_rpm (adev,NULL ) == -EOPNOTSUPP )) && - (attr == &sensor_dev_attr_pwm1_max.dev_attr.attr || - attr == &sensor_dev_attr_pwm1_min.dev_attr.attr)) -return 0 ; +if ((amdgpu_dpm_set_fan_speed_pwm (adev,U32_MAX ) == -EOPNOTSUPP ) && + (amdgpu_dpm_get_fan_speed_pwm (adev,NULL ) == -EOPNOTSUPP ) && + (amdgpu_dpm_set_fan_speed_rpm (adev,U32_MAX ) == -EOPNOTSUPP ) && + (amdgpu_dpm_get_fan_speed_rpm (adev,NULL ) == -EOPNOTSUPP )) + adev->pm.hwmon_if_supported &= ~(BIT_ULL (AMD_HWMON_IF_PWM1_MAX_BIT ) | +BIT_ULL (AMD_HWMON_IF_PWM1_MIN_BIT ));if ((amdgpu_dpm_set_fan_speed_rpm (adev,U32_MAX ) == -EOPNOTSUPP ) && - (amdgpu_dpm_get_fan_speed_rpm (adev,NULL ) == -EOPNOTSUPP ) && - (attr == &sensor_dev_attr_fan1_max.dev_attr.attr || - attr == &sensor_dev_attr_fan1_min.dev_attr.attr)) -return 0 ; + (amdgpu_dpm_get_fan_speed_rpm (adev,NULL ) == -EOPNOTSUPP )) + adev->pm.hwmon_if_supported &= ~(BIT_ULL (AMD_HWMON_IF_FAN1_MAX_BIT ) | +BIT_ULL (AMD_HWMON_IF_FAN1_MIN_BIT )); -if ((adev->family ==AMDGPU_FAMILY_SI ||/* not implemented yet */ - adev->family ==AMDGPU_FAMILY_KV ) &&/* not implemented yet */ - (attr == &sensor_dev_attr_in0_input.dev_attr.attr || - attr == &sensor_dev_attr_in0_label.dev_attr.attr)) -return 0 ; +if (adev->family ==AMDGPU_FAMILY_SI || + adev->family ==AMDGPU_FAMILY_KV ) + adev->pm.hwmon_if_supported &= ~(BIT_ULL (AMD_HWMON_IF_IN0_INPUT_BIT ) | +BIT_ULL (AMD_HWMON_IF_IN0_LABEL_BIT ));/* only APUs have vddnb */ -if (!(adev->flags &AMD_IS_APU ) && - (attr == &sensor_dev_attr_in1_input.dev_attr.attr || - attr == &sensor_dev_attr_in1_label.dev_attr.attr)) -return 0 ; +if (!(adev->flags &AMD_IS_APU )) + adev->pm.hwmon_if_supported &= ~(BIT_ULL (AMD_HWMON_IF_IN1_INPUT_BIT ) | +BIT_ULL (AMD_HWMON_IF_IN1_LABEL_BIT ));/* no mclk on APUs */ -if ((adev->flags &AMD_IS_APU ) && - (attr == &sensor_dev_attr_freq2_input.dev_attr.attr || - attr == &sensor_dev_attr_freq2_label.dev_attr.attr)) -return 0 ; +if (adev->flags &AMD_IS_APU ) + adev->pm.hwmon_if_supported &= ~(BIT_ULL (AMD_HWMON_IF_FREQ2_INPUT_BIT ) | +BIT_ULL (AMD_HWMON_IF_FREQ2_LABEL_BIT ));/* only SOC15 dGPUs support hotspot and mem temperatures */ -if (((adev->flags &AMD_IS_APU ) || gc_ver <IP_VERSION (9 ,0 ,0 )) && - (attr == &sensor_dev_attr_temp2_crit.dev_attr.attr || - attr == &sensor_dev_attr_temp2_crit_hyst.dev_attr.attr || - attr == &sensor_dev_attr_temp3_crit.dev_attr.attr || - attr == &sensor_dev_attr_temp3_crit_hyst.dev_attr.attr || - attr == &sensor_dev_attr_temp1_emergency.dev_attr.attr || - attr == &sensor_dev_attr_temp2_emergency.dev_attr.attr || - attr == &sensor_dev_attr_temp3_emergency.dev_attr.attr || - attr == &sensor_dev_attr_temp2_input.dev_attr.attr || - attr == &sensor_dev_attr_temp3_input.dev_attr.attr || - attr == &sensor_dev_attr_temp2_label.dev_attr.attr || - attr == &sensor_dev_attr_temp3_label.dev_attr.attr)) -return 0 ; +if ((adev->flags &AMD_IS_APU ) || + gc_ver <IP_VERSION (9 ,0 ,0 )) + adev->pm.hwmon_if_supported &= ~(BIT_ULL (AMD_HWMON_IF_TEMP2_CRIT_BIT ) | +BIT_ULL (AMD_HWMON_IF_TEMP2_CRIT_HYST_BIT ) | +BIT_ULL (AMD_HWMON_IF_TEMP3_CRIT_BIT ) | +BIT_ULL (AMD_HWMON_IF_TEMP3_CRIT_HYST_BIT ) | +BIT_ULL (AMD_HWMON_IF_TEMP1_EMERGENCY_BIT ) | +BIT_ULL (AMD_HWMON_IF_TEMP2_EMERGENCY_BIT ) | +BIT_ULL (AMD_HWMON_IF_TEMP3_EMERGENCY_BIT ) | +BIT_ULL (AMD_HWMON_IF_TEMP2_INPUT_BIT ) | +BIT_ULL (AMD_HWMON_IF_TEMP3_INPUT_BIT ) | +BIT_ULL (AMD_HWMON_IF_TEMP2_LABEL_BIT ) | +BIT_ULL (AMD_HWMON_IF_TEMP3_LABEL_BIT ));/* only Vangogh has fast PPT limit and power labels */ -if (!(gc_ver ==IP_VERSION (10 ,3 ,1 )) && - (attr == &sensor_dev_attr_power2_average.dev_attr.attr || - attr == &sensor_dev_attr_power2_cap_max.dev_attr.attr || - attr == &sensor_dev_attr_power2_cap_min.dev_attr.attr || - attr == &sensor_dev_attr_power2_cap.dev_attr.attr || - attr == &sensor_dev_attr_power2_cap_default.dev_attr.attr || - attr == &sensor_dev_attr_power2_label.dev_attr.attr)) -return 0 ; - -return effective_mode; +if (gc_ver !=IP_VERSION (10 ,3 ,1 )) + adev->pm.hwmon_if_supported &= ~(BIT_ULL (AMD_HWMON_IF_POWER2_AVERAGE_BIT ) | +BIT_ULL (AMD_HWMON_IF_POWER2_CAP_MAX_BIT ) | +BIT_ULL (AMD_HWMON_IF_POWER2_CAP_MIN_BIT ) | +BIT_ULL (AMD_HWMON_IF_POWER2_CAP_BIT ) | +BIT_ULL (AMD_HWMON_IF_POWER2_CAP_DEFAULT_BIT ) | +BIT_ULL (AMD_HWMON_IF_POWER2_LABEL_BIT )); } -static const struct attribute_group hwmon_attrgroup = { - .attrs = hwmon_attributes, - .is_visible = hwmon_attributes_visible, -}; - -static const struct attribute_group *hwmon_groups[] = { - &hwmon_attrgroup, -NULL -}; -static void amdgpu_sysfs_if_support_check (struct amdgpu_device *adev) {uint64_t *sysfs_if_supported = &adev->pm.sysfs_if_supported;
@@ -3418,6 +3499,8 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)if (adev->pm.dpm_enabled ==0 )return 0 ; +amdgpu_hwmon_if_support_check (adev); +amdgpu_sysfs_if_support_check (adev); adev->pm.int_hwmon_dev = hwmon_device_register_with_groups(adev->dev,
Signature · 1 line
2.34.1
PATCH 7/8 drm/amd/pm: drop the support for manual fan speed setting on SMU13.0.0
In reply to Evan QuanDue to lack of support from PMFW.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +5 -0
@@ -2061,4 +2061,9 @@ void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu)BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT ) |BIT_ULL (AMD_SYSFS_IF_PP_SCLK_OD_BIT ) | BIT_ULL(AMD_SYSFS_IF_PP_MCLK_OD_BIT)); +/* Drop the support for manual fan speed(RPM and PWM) setting */ + smu->adev->pm.hwmon_if_attr_mode[AMD_HWMON_IF_PWM1_ENABLE_BIT ] &= ~S_IWUSR ; + smu->adev->pm.hwmon_if_attr_mode[AMD_HWMON_IF_PWM1_BIT ] &= ~S_IWUSR ; + smu->adev->pm.hwmon_if_attr_mode[AMD_HWMON_IF_FAN1_ENABLE_BIT ] &= ~S_IWUSR ; + smu->adev->pm.hwmon_if_attr_mode[AMD_HWMON_IF_FAN1_TARGET_BIT ] &= ~S_IWUSR ; }
Signature · 1 line
2.34.1
Re: [PATCH 7/8] drm/amd/pm: drop the support for manual fan speed setting on SMU13.0.0
Quoted 13 lines · Evan Quan
Due to lack of support from PMFW.
Signed-off-by Evan Quan <[email protected]>Change-Id I5d466d3d521b26a484bd837e173b9b289d4020ec--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0
-0
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu) · line 2068
Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +5
-0@@ -2061,4 +2061,9 @@ void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu)BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT ) |BIT_ULL (AMD_SYSFS_IF_PP_SCLK_OD_BIT ) | BIT_ULL(AMD_SYSFS_IF_PP_MCLK_OD_BIT)); +/* Drop the support for manual fan speed(RPM and PWM) setting */ + smu->adev->pm.hwmon_if_attr_mode[AMD_HWMON_IF_PWM1_ENABLE_BIT ] &= ~S_IWUSR ; + smu->adev->pm.hwmon_if_attr_mode[AMD_HWMON_IF_PWM1_BIT ] &= ~S_IWUSR ; + smu->adev->pm.hwmon_if_attr_mode[AMD_HWMON_IF_FAN1_ENABLE_BIT ] &= ~S_IWUSR ; + smu->adev->pm.hwmon_if_attr_mode[AMD_HWMON_IF_FAN1_TARGET_BIT ] &= ~S_IWUSR ;
This will be taken care if you set the corresponding set ppt funcs to NULL.
Thanks,
Lijo
Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0
-0}
RE: [PATCH 7/8] drm/amd/pm: drop the support for manual fan speed setting on SMU13.0.0
[AMD Official Use Only - General]
Quoted 41 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, January 5, 2023 10:08 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 7/8] drm/amd/pm: drop the support for manual fan speed setting on SMU13.0.0Review
Quoted 9 lines · Evan Quan
Due to lack of support from PMFW.
Signed-off-by Evan Quan <[email protected]>Change-Id I5d466d3d521b26a484bd837e173b9b289d4020ec--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 5 +++++ 1 file changed, 5 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.cdrivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c void smu_v13_0_0_set_ppt_funcs(struct
Quoted 4 lines
index
75c9f510e713..59cd68862973100644drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0
-0@@ -2061,4 +2061,9 @@ void smu_v13_0_0_set_ppt_funcs(struct
smu_context*smu)Quoted 1 line
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT)|Quoted 1 line
BIT_ULL(AMD_SYSFS_IF_PP_SCLK_OD_BIT)|Quoted 1 line
BIT_ULL(AMD_SYSFS_IF_PP_MCLK_OD_BIT));Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +2
-0+/* Drop the support for manual fan speed(RPM and PWM) setting */ + smu->adev-pm.hwmon_if_attr_mode[AMD_HWMON_IF_PWM1_ENABLE_BIT] &=
~S_IWUSR;
Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +1
-0+ smu->adev-pm.hwmon_if_attr_mode[AMD_HWMON_IF_PWM1_BIT] &= ~S_IWUSR;
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +1
-0+ smu->adev-pm.hwmon_if_attr_mode[AMD_HWMON_IF_FAN1_ENABLE_BIT] &=
~S_IWUSR;
Quoted 5 lines
Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +1
-0+ smu->adev-pm.hwmon_if_attr_mode[AMD_HWMON_IF_FAN1_TARGET_BIT] &=
~S_IWUSR;
This will be taken care if you set the corresponding set ppt funcs to NULL.
[Quan, Evan] Yes, that should also work. But instead of using that implicit way, I would prefer this straightforward method.
If to drop the support(or setting support) for some specific interface, they just need to set the corresponding feature bit accordingly. No need to care how the internal implementations are. That seems more friendly. How do you think?
Evan
Quoted 5 lines
Thanks,
LijoQuoted 1 line
}
PATCH 8/8 drm/amd/pm: drop the support for manual fan speed setting on SMU13.0.7
In reply to Evan QuanDue to lack of support from PMFW.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +5 -0
@@ -1736,4 +1736,9 @@ void smu_v13_0_7_set_ppt_funcs(struct smu_context *smu)BIT_ULL (AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT ) |BIT_ULL (AMD_SYSFS_IF_PP_SCLK_OD_BIT ) | BIT_ULL(AMD_SYSFS_IF_PP_MCLK_OD_BIT)); +/* Drop the support for manual fan speed(RPM and PWM) setting */ + smu->adev->pm.hwmon_if_attr_mode[AMD_HWMON_IF_PWM1_ENABLE_BIT ] &= ~S_IWUSR ; + smu->adev->pm.hwmon_if_attr_mode[AMD_HWMON_IF_PWM1_BIT ] &= ~S_IWUSR ; + smu->adev->pm.hwmon_if_attr_mode[AMD_HWMON_IF_FAN1_ENABLE_BIT ] &= ~S_IWUSR ; + smu->adev->pm.hwmon_if_attr_mode[AMD_HWMON_IF_FAN1_TARGET_BIT ] &= ~S_IWUSR ; }
Signature · 1 line
2.34.1
RE: [PATCH 8/8] drm/amd/pm: drop the support for manual fan speed setting on SMU13.0.7
[AMD Official Use Only - General]
Anyone else can help to review this patch series?
We need these to address the fan speed setting failure reported for the new SMU13 asics. @Deucher, Alexander ?
Evan
Quoted 45 lines
-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Thursday, January 5, 2023 11:23 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH 8/8] drm/amd/pm: drop the support for manual fan speed setting on SMU13.0.7Due to lack of support from PMFW.
Signed-off-by Evan Quan <[email protected]>Change-Id I8439e72b95ad2fdf8cfdf1edc4d9c8af58109dc3--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +0
-0@@ -1736,4 +1736,9 @@ void smu_v13_0_7_set_ppt_funcs(struct smu_context *smu)
BIT_ULL(AMD_SYSFS_IF_PP_DPM_DCEFCLK_BIT)|
BIT_ULL(AMD_SYSFS_IF_PP_SCLK_OD_BIT)|
BIT_ULL(AMD_SYSFS_IF_PP_MCLK_OD_BIT));drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +2
-0+/* Drop the support for manual fan speed(RPM and PWM) setting */ + smu->adev-Quoted 1 line
pm.hwmon_if_attr_mode[AMD_HWMON_IF_PWM1_ENABLE_BIT] &=
~S_IWUSR;
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +1
-0+ smu->adev-Quoted 1 line
pm.hwmon_if_attr_mode[AMD_HWMON_IF_PWM1_BIT] &= ~S_IWUSR;
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +1
-0+ smu->adev-Quoted 1 line
pm.hwmon_if_attr_mode[AMD_HWMON_IF_FAN1_ENABLE_BIT] &=
~S_IWUSR;
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +1
-0+ smu->adev-Quoted 1 line
pm.hwmon_if_attr_mode[AMD_HWMON_IF_FAN1_TARGET_BIT] &=
~S_IWUSR;
}
--
2.34.1
Re: [PATCH 8/8] drm/amd/pm: drop the support for manual fan speed setting on SMU13.0.7
Quoted 3 lines · Evan
[AMD Official Use Only - General]
We need these to address the fan speed setting failure reported for the new SMU13 asics.
My opinion shouldn't matter much given sparseness of activity, but, despite his... short tonality, I agree with Lijo's assessment there.
As someone less familiar with the code base, the use of "multiple sources of truth" contributes to making it harder to understand and ramp up with.
As for the sysfs fan control issue itself, this won't really "fix" the issue, but rather just remove write permissions from the hwmon files (if my testing+understanding is right), so it wouldn't seem to be a hyper-critical deliverable to me as a random outsider looking in (despite being effected by the issue personally). Even with that interface removed, there isn't another way to control the "auto" fans, as the FW reports it doesn't support that capability in the OD table, and ignores anything set therein for that purpose. Hopefully that's temporary until FW gets fixed?
I also think the behavior of the other proposed solution (removal of interface functions from the ppt_funcs), is objectively a better experience w/r/t outcome. If the functions are NULL, then the hwmon device files go away *completely*, instead of just being masked from write permission, which would make the message clearer to the end user that it's not an error, but an actual lack of functionality.
Cheers, sorry I couldn't help, but wanted to at least have something come of the last few days I spent implmenting OD on SMU13 for nothing!
~Matt
RE: [PATCH 8/8] drm/amd/pm: drop the support for manual fan speed setting on SMU13.0.7
[AMD Official Use Only - General]
Hi Matt,
The problem with the approach(removal of interface functions from the ppt_funcs) is:
1. If to drop support for some sysfs interface, you need to know the internal implementation details to mask out the corresponding function. That's not straightforward and might be not an easy job for new comer.
2. Sometimes the missing of some interfaces is unintentional. It needs to be added instead of being treated as unsupported.
3. The removal of the interface cannot update the sysfs file permission together. That means the sysfs file might be still shown as writable while actually the setting is not supported at all.
The patch series try to address these in a simple and straightforward way.
Regarding the manual fan speed setting issue targeted by this patch, the SCPM feature of the new SMU13 asics prevents us from toggling the fan control feature from auto to manual. Without that, the manual fan speed setting to some specific RPM/PWM is not possible.
About the capability in the OD table you mentioned, it might be a different issue.
Since as I know, the capability the OD table provided is to change the minimum/maximum fan speed limit.
That should be not affected by the SCPM and relevant.
BR
Evan
Quoted 39 lines
-----Original Message-----
From: Matt Coffin <[email protected]>
Sent: Tuesday, January 10, 2023 9:57 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>
Subject: Re: [PATCH 8/8] drm/amd/pm: drop the support for manual fan speed setting on SMU13.0.7Quoted 3 lines · Evan
[AMD Official Use Only - General]
We need these to address the fan speed setting failure reported for the
new SMU13 asics.
My opinion shouldn't matter much given sparseness of activity, but, despite his... short tonality, I agree with Lijo's assessment there.As someone less familiar with the code base, the use of "multiple sources of truth" contributes to making it harder to understand and ramp up with.
As for the sysfs fan control issue itself, this won't really "fix" the issue, but rather just remove write permissions from the hwmon files (if my testing+understanding is right), so it wouldn't seem to be a hyper-critical deliverable to me as a random outsider looking in (despite being effected by the issue personally). Even with that interface removed, there isn't another way to control the "auto" fans, as the FW reports it doesn't support that capability in the OD table, and ignores anything set therein for that purpose. Hopefully that's temporary until FW gets fixed?
I also think the behavior of the other proposed solution (removal of interface functions from the
ppt_funcs), is objectively a better experience w/r/t outcome. If the functions are NULL, then the hwmon device files go away *completely*, instead of just being masked from write permission, which would make the message clearer to the end user that it's not an error, but an actual lack of functionality.Cheers, sorry I couldn't help, but wanted to at least have something come of the last few days I spent implmenting OD on SMU13 for nothing!
~Matt
Re: [PATCH 8/8] drm/amd/pm: drop the support for manual fan speed setting on SMU13.0.7
Quoted 13 lines · Evan
[AMD Official Use Only - General]
Hi Matt,
The problem with the
approach(removal of interface functions from the ppt_funcs)is:
1. If to drop support for some sysfs interface, you need to know the internal implementation details to mask out the corresponding function. That's not straightforward and might be not an easy job for new comer.
2. Sometimes the missing of some interfaces is unintentional. It needs to be added instead of being treated as unsupported.
3. The removal of the interface cannot update the sysfs file permission together. That means the sysfs file might be still shown as writable while actually the setting is not supported at all.
The patch series try to address these in a simple and straightforward way.
Quoted 5 lines
Regarding the manual fan speed setting issue targeted by this patch, the SCPM feature of the new SMU13 asics prevents us from toggling the fan control feature from auto to manual. Without that, the manual fan speed setting to some specific RPM/PWM is not possible.
About the capability in the OD table you mentioned, it might be a different issue.
Since as I know, the capability the OD table provided is to change the minimum/maximum fan speed limit.
That should be not affected by the SCPM and relevant.
Right. Manual fan control is no longer possible. As Evan said, you can adjust the automatic fan curve using the OD interface, but that is it.
Alex
Quoted 42 lines
BR
EvanQuoted 39 lines
-----Original Message-----
From: Matt Coffin <[email protected]>
Sent: Tuesday, January 10, 2023 9:57 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>
Subject: Re: [PATCH 8/8] drm/amd/pm: drop the support for manual fan speed setting on SMU13.0.7Quoted 3 lines · Evan
[AMD Official Use Only - General]
We need these to address the fan speed setting failure reported for the
new SMU13 asics.
My opinion shouldn't matter much given sparseness of activity, but, despite his... short tonality, I agree with Lijo's assessment there.As someone less familiar with the code base, the use of "multiple sources of truth" contributes to making it harder to understand and ramp up with.
As for the sysfs fan control issue itself, this won't really "fix" the issue, but rather just remove write permissions from the hwmon files (if my testing+understanding is right), so it wouldn't seem to be a hyper-critical deliverable to me as a random outsider looking in (despite being effected by the issue personally). Even with that interface removed, there isn't another way to control the "auto" fans, as the FW reports it doesn't support that capability in the OD table, and ignores anything set therein for that purpose. Hopefully that's temporary until FW gets fixed?
I also think the behavior of the other proposed solution (removal of interface functions from the
ppt_funcs), is objectively a better experience w/r/t outcome. If the functions are NULL, then the hwmon device files go away *completely*, instead of just being masked from write permission, which would make the message clearer to the end user that it's not an error, but an actual lack of functionality.Cheers, sorry I couldn't help, but wanted to at least have something come of the last few days I spent implmenting OD on SMU13 for nothing!
~Matt
Re: [PATCH 8/8] drm/amd/pm: drop the support for manual fan speed setting on SMU13.0.7
Quoted 5 lines · Alex Deucher
Quoted 4 lines · Evan
[AMD Official Use Only - General]
Regarding the manual fan speed setting issue targeted by this patch, the SCPM feature of the new SMU13 asics prevents us from toggling the fan control feature from auto to manual.
This makes sense as a move towards using the same interface that other platforms are most likely using.
Quoted 1 line
Quoted 1 line
About the capability in the OD table you mentioned, it might be a different issue.
I included some info/questions below; any hints you could give to point me in the right way to keep learning would be appreciated.
Quoted 4 lines
Right. Manual fan control is no longer possible. As Evan said, you can adjust the automatic fan curve using the OD interface, but that is it.
Sorry for the late reply; I became busy with day job. I've been working on implementing OD support (and a sysfs interface to set *any* OD setting by number, in contrast with pp_od_clk_voltage's pidgeon-holing into supporting only PP_OD_DPM_TABLE_COMMAND commands), at the very least for my own experimentation.
The following is what I see when I read the OD table out from the SMU (assuming that the inclusion of another VF curve setting at index 4 in the header was a mistake, based on the values returned by the SMU).
It seems that, at least in my case, my hardware is running in some kind of mode that would *not* allow changing of the fan curve? Is it possble that the header information in pm/inc/smu_v13_0_0_pptable.h is incorrect even beyond the potential idx 4 of ODSETTINGs?
It appears also that transferring the OD table *back* to the SMU results in no error, but also no action taken, as subsequent reads to not reflect any changes. I'm thinking this is due to some values read in on the inital read of the table being invalid, but seemingly irrelevant given what is reported by the capabilities (see: FAN_CURVE[*]).
Is there any hints you guys could offer in terms of
1. what might be mal-aligned or mis-labeled in the smu_v13 pptable header above?
2. What pre-requisites I might be missing to allow the support for ODCAP_FAN_CURVE?
3. Why the apparent values for some settings in the boot table seemingly wildly invalid? Will those somehow become valid once pre-requisites for OD operation are met?
I also feel like I've strayed from the original topic of the proposed patch, and this probably belongs in it's own thread... but quite know how to preserve any context there (sorry).
Thanks in advance for helping out an eager outsider, Matt
Capabilities:
SMU_13_0_0_ODCAP_GFXCLK_LIMITS[0] true
SMU_13_0_0_ODCAP_GFXCLK_CURVE[1] true
SMU_13_0_0_ODCAP_UCLK_LIMITS[2] true
SMU_13_0_0_ODCAP_POWER_LIMIT[3] true
SMU_13_0_0_ODCAP_FAN_ACOUSTIC_LIMIT[4] true
SMU_13_0_0_ODCAP_FAN_SPEED_MIN[5] true
SMU_13_0_0_ODCAP_TEMPERATURE_FAN[6] true
SMU_13_0_0_ODCAP_TEMPERATURE_SYSTEM[7] true
SMU_13_0_0_ODCAP_MEMORY_TIMING_TUNE[8] true
SMU_13_0_0_ODCAP_FAN_ZERO_RPM_CONTROL[9] true
SMU_13_0_0_ODCAP_AUTO_UV_ENGINE[10] true
SMU_13_0_0_ODCAP_AUTO_OC_ENGINE[11] true
SMU_13_0_0_ODCAP_AUTO_OC_MEMORY[12] true
SMU_13_0_0_ODCAP_FAN_CURVE[13] false
SMU_13_0_0_ODCAP_AUTO_FAN_ACOUSTIC_LIMIT[14] true
SMU_13_0_0_ODCAP_POWER_MODE[15] false
Limits:
SMU_13_0_0_ODSETTING_GFXCLKFMAX[0] - [500,5000] SMU_13_0_0_ODSETTING_GFXCLKFMIN[1] - [500,5000] SMU_13_0_0_ODSETTING_CUSTOM_GFX_VF_CURVE_A[2] - [97,1500] SMU_13_0_0_ODSETTING_CUSTOM_GFX_VF_CURVE_B[3] - [97,1500] SMU_13_0_0_ODSETTING_CUSTOM_CURVE_VFT_FMIN[4] - [10,15] SMU_13_0_0_ODSETTING_UCLKFMIN[5] - [500,3200] SMU_13_0_0_ODSETTING_UCLKFMAX[6] - [500,3200] SMU_13_0_0_ODSETTING_POWERPERCENTAGE[7] - [25,105] SMU_13_0_0_ODSETTING_FANRPMMIN[8] - [50,110] SMU_13_0_0_ODSETTING_FANRPMACOUSTICLIMIT[9] - [0,1] SMU_13_0_0_ODSETTING_FANTARGETTEMPERATURE[10] - [0,1] SMU_13_0_0_ODSETTING_OPERATINGTEMPMAX[11] - [0,1] SMU_13_0_0_ODSETTING_ACTIMING[12] - [0,1] SMU_13_0_0_ODSETTING_FAN_ZERO_RPM_CONTROL[13] - [0,1] SMU_13_0_0_ODSETTING_AUTOUVENGINE[14] - [25,100] SMU_13_0_0_ODSETTING_AUTOOCENGINE[15] - [23,100] SMU_13_0_0_ODSETTING_AUTOOCMEMORY[16] - [25,100] SMU_13_0_0_ODSETTING_FAN_CURVE_TEMPERATURE_1[17] - [23,100] SMU_13_0_0_ODSETTING_FAN_CURVE_SPEED_1[18] - [25,100] SMU_13_0_0_ODSETTING_FAN_CURVE_TEMPERATURE_2[19] - [23,100] SMU_13_0_0_ODSETTING_FAN_CURVE_SPEED_2[20] - [25,100] SMU_13_0_0_ODSETTING_FAN_CURVE_TEMPERATURE_3[21] - [23,100] SMU_13_0_0_ODSETTING_FAN_CURVE_SPEED_3[22] - [25,100] SMU_13_0_0_ODSETTING_FAN_CURVE_TEMPERATURE_4[23] - [23,100] SMU_13_0_0_ODSETTING_FAN_CURVE_SPEED_4[24] - [0,0] SMU_13_0_0_ODSETTING_FAN_CURVE_TEMPERATURE_5[25] - [0,1] SMU_13_0_0_ODSETTING_FAN_CURVE_SPEED_5[26] - [0,0] SMU_13_0_0_ODSETTING_AUTO_FAN_ACOUSTIC_LIMIT[27] - [0,0] SMU_13_0_0_ODSETTING_POWER_MODE[28] - [0,0]
Boot OD Table:
GFXFLK: [600, 2945]
UCLK: [97, 1249]
FAN_CURVE[0]: 0 @ 0
FAN_CURVE[1]: 0 @ 0
FAN_CURVE[2]: 0 @ 0
FAN_CURVE[3]: 0 @ 0
FAN_CURVE[4]: 0 @ 0
FAN_CURVE[5]: 0 @ 0FAN_MIN_PWM: 35FAN_TARGET_TEMP: 94FAN_ZERO_RPM_ENABLE: trueFAN_MODE: 0
Re: [PATCH 8/8] drm/amd/pm: drop the support for manual fan speed setting on SMU13.0.7
Quoted 8 lines · Matt Coffin
Quoted 5 lines · Alex Deucher
Quoted 4 lines · Evan
[AMD Official Use Only - General]
Regarding the manual fan speed setting issue targeted by this patch, the SCPM feature of the new SMU13 asics prevents us from toggling the fan control feature from auto to manual.
Quoted 7 lines
This makes sense as a move towards using the same interface that other platforms are most likely using.
Quoted 1 line
Quoted 1 line
About the capability in the OD table you mentioned, it might be a different issue.
I included some info/questions below; any hints you could give to point me in the right way to keep learning would be appreciated.
I'm following up with the SMU teams. Will get back to you when I know more.
Thanks,
Alex
Quoted 106 lines
Quoted 5 lines
Right. Manual fan control is no longer possible. As Evan said, you can adjust the automatic fan curve using the OD interface, but that is it.
Sorry for the late reply; I became busy with day job. I've been working on implementing OD support (and a sysfs interface to set *any* OD setting by number, in contrast with pp_od_clk_voltage's pidgeon-holing into supporting only
PP_OD_DPM_TABLE_COMMANDcommands), at the very least for my own experimentation.The following is what I see when I read the OD table out from the SMU (assuming that the inclusion of another VF curve setting at index 4 in the header was a mistake, based on the values returned by the SMU).
It seems that, at least in my case, my hardware is running in some kind of mode that would *not* allow changing of the fan curve? Is it possble that the header information in
pm/inc/smu_v13_0_0_pptable.his incorrect even beyond the potential idx 4 of ODSETTINGs?It appears also that transferring the OD table *back* to the SMU results in no error, but also no action taken, as subsequent reads to not reflect any changes. I'm thinking this is due to some values read in on the inital read of the table being invalid, but seemingly irrelevant given what is reported by the capabilities (see: FAN_CURVE[*]).
Is there any hints you guys could offer in terms of
1. what might be mal-aligned or mis-labeled in the
smu_v13pptable header above?
2. What pre-requisites I might be missing to allow the support forODCAP_FAN_CURVE?
3. Why the apparent values for some settings in the boot table seemingly wildly invalid? Will those somehow become valid once pre-requisites for OD operation are met?I also feel like I've strayed from the original topic of the proposed patch, and this probably belongs in it's own thread... but quite know how to preserve any context there (sorry).
Thanks in advance for helping out an eager outsider, Matt
Capabilities:
SMU_13_0_0_ODCAP_GFXCLK_LIMITS[0] true
SMU_13_0_0_ODCAP_GFXCLK_CURVE[1] true
SMU_13_0_0_ODCAP_UCLK_LIMITS[2] true
SMU_13_0_0_ODCAP_POWER_LIMIT[3] true
SMU_13_0_0_ODCAP_FAN_ACOUSTIC_LIMIT[4] true
SMU_13_0_0_ODCAP_FAN_SPEED_MIN[5] true
SMU_13_0_0_ODCAP_TEMPERATURE_FAN[6] true
SMU_13_0_0_ODCAP_TEMPERATURE_SYSTEM[7] true
SMU_13_0_0_ODCAP_MEMORY_TIMING_TUNE[8] true
SMU_13_0_0_ODCAP_FAN_ZERO_RPM_CONTROL[9] true
SMU_13_0_0_ODCAP_AUTO_UV_ENGINE[10] true
SMU_13_0_0_ODCAP_AUTO_OC_ENGINE[11] true
SMU_13_0_0_ODCAP_AUTO_OC_MEMORY[12] true
SMU_13_0_0_ODCAP_FAN_CURVE[13] false
SMU_13_0_0_ODCAP_AUTO_FAN_ACOUSTIC_LIMIT[14] true
SMU_13_0_0_ODCAP_POWER_MODE[15] falseLimits:
SMU_13_0_0_ODSETTING_GFXCLKFMAX[0] - [500,5000] SMU_13_0_0_ODSETTING_GFXCLKFMIN[1] - [500,5000] SMU_13_0_0_ODSETTING_CUSTOM_GFX_VF_CURVE_A[2] - [97,1500] SMU_13_0_0_ODSETTING_CUSTOM_GFX_VF_CURVE_B[3] - [97,1500] SMU_13_0_0_ODSETTING_CUSTOM_CURVE_VFT_FMIN[4] - [10,15] SMU_13_0_0_ODSETTING_UCLKFMIN[5] - [500,3200] SMU_13_0_0_ODSETTING_UCLKFMAX[6] - [500,3200] SMU_13_0_0_ODSETTING_POWERPERCENTAGE[7] - [25,105] SMU_13_0_0_ODSETTING_FANRPMMIN[8] - [50,110] SMU_13_0_0_ODSETTING_FANRPMACOUSTICLIMIT[9] - [0,1] SMU_13_0_0_ODSETTING_FANTARGETTEMPERATURE[10] - [0,1] SMU_13_0_0_ODSETTING_OPERATINGTEMPMAX[11] - [0,1] SMU_13_0_0_ODSETTING_ACTIMING[12] - [0,1] SMU_13_0_0_ODSETTING_FAN_ZERO_RPM_CONTROL[13] - [0,1] SMU_13_0_0_ODSETTING_AUTOUVENGINE[14] - [25,100] SMU_13_0_0_ODSETTING_AUTOOCENGINE[15] - [23,100] SMU_13_0_0_ODSETTING_AUTOOCMEMORY[16] - [25,100] SMU_13_0_0_ODSETTING_FAN_CURVE_TEMPERATURE_1[17] - [23,100] SMU_13_0_0_ODSETTING_FAN_CURVE_SPEED_1[18] - [25,100] SMU_13_0_0_ODSETTING_FAN_CURVE_TEMPERATURE_2[19] - [23,100] SMU_13_0_0_ODSETTING_FAN_CURVE_SPEED_2[20] - [25,100] SMU_13_0_0_ODSETTING_FAN_CURVE_TEMPERATURE_3[21] - [23,100] SMU_13_0_0_ODSETTING_FAN_CURVE_SPEED_3[22] - [25,100] SMU_13_0_0_ODSETTING_FAN_CURVE_TEMPERATURE_4[23] - [23,100] SMU_13_0_0_ODSETTING_FAN_CURVE_SPEED_4[24] - [0,0] SMU_13_0_0_ODSETTING_FAN_CURVE_TEMPERATURE_5[25] - [0,1] SMU_13_0_0_ODSETTING_FAN_CURVE_SPEED_5[26] - [0,0] SMU_13_0_0_ODSETTING_AUTO_FAN_ACOUSTIC_LIMIT[27] - [0,0] SMU_13_0_0_ODSETTING_POWER_MODE[28] - [0,0]Boot OD Table:
GFXFLK: [600, 2945]
UCLK: [97, 1249]
FAN_CURVE[0]: 0 @ 0
FAN_CURVE[1]: 0 @ 0
FAN_CURVE[2]: 0 @ 0
FAN_CURVE[3]: 0 @ 0
FAN_CURVE[4]: 0 @ 0
FAN_CURVE[5]: 0 @ 0FAN_MIN_PWM: 35FAN_TARGET_TEMP: 94FAN_ZERO_RPM_ENABLE: trueFAN_MODE: 0
Re: [PATCH 8/8] drm/amd/pm: drop the support for manual fan speed setting on SMU13.0.7
Quoted 1 line · Alex Deucher
I'm following up with the SMU teams. Will get back to you when I know more.
Hey again guys,
I'm still relatively stuck on this, both due to being confused the *seemingly* out-of-date information in the pm/inc/smu_v13_0_0_pptable.h header, and my general lack of experience in any kind of reversing when it comes to hardware interaction.
I do have one update, though: I found that the smu *is* able to accept *some* changes in the overdrive table, so the message to upload it to VRAM *is* working. The only thing I've been able to modify is the FeaturesCtrlMask, but I haven't been able to discern which bits would correspond to which features, but it doesn't appear to have a correlation to the SMU_13_0_0_ODFEATURE mask(s) if the supported capabilities information is to be beleived (if that were the case, then it's rejecting bits being set that it says it supports, *OR* the header is more off than I'd thought).
I know y'all are busy, so sorry to bother, but anything helps since I don't quite know where to go from here right now.
Cheers,
Matt
Quoted 100 lines
Quoted 100 lines
Sorry for the late reply; I became busy with day job. I've been working on implementing OD support (and a sysfs interface to set *any* OD setting by number, in contrast with pp_od_clk_voltage's pidgeon-holing into supporting only
PP_OD_DPM_TABLE_COMMANDcommands), at the very least for my own experimentation.The following is what I see when I read the OD table out from the SMU (assuming that the inclusion of another VF curve setting at index 4 in the header was a mistake, based on the values returned by the SMU).
It seems that, at least in my case, my hardware is running in some kind of mode that would *not* allow changing of the fan curve? Is it possble that the header information in
pm/inc/smu_v13_0_0_pptable.his incorrect even beyond the potential idx 4 of ODSETTINGs?It appears also that transferring the OD table *back* to the SMU results in no error, but also no action taken, as subsequent reads to not reflect any changes. I'm thinking this is due to some values read in on the inital read of the table being invalid, but seemingly irrelevant given what is reported by the capabilities (see: FAN_CURVE[*]).
Is there any hints you guys could offer in terms of
1. what might be mal-aligned or mis-labeled in the
smu_v13pptable header above?
2. What pre-requisites I might be missing to allow the support forODCAP_FAN_CURVE?
3. Why the apparent values for some settings in the boot table seemingly wildly invalid? Will those somehow become valid once pre-requisites for OD operation are met?I also feel like I've strayed from the original topic of the proposed patch, and this probably belongs in it's own thread... but quite know how to preserve any context there (sorry).
Thanks in advance for helping out an eager outsider, Matt
Capabilities:
SMU_13_0_0_ODCAP_GFXCLK_LIMITS[0] true
SMU_13_0_0_ODCAP_GFXCLK_CURVE[1] true
SMU_13_0_0_ODCAP_UCLK_LIMITS[2] true
SMU_13_0_0_ODCAP_POWER_LIMIT[3] true
SMU_13_0_0_ODCAP_FAN_ACOUSTIC_LIMIT[4] true
SMU_13_0_0_ODCAP_FAN_SPEED_MIN[5] true
SMU_13_0_0_ODCAP_TEMPERATURE_FAN[6] true
SMU_13_0_0_ODCAP_TEMPERATURE_SYSTEM[7] true
SMU_13_0_0_ODCAP_MEMORY_TIMING_TUNE[8] true
SMU_13_0_0_ODCAP_FAN_ZERO_RPM_CONTROL[9] true
SMU_13_0_0_ODCAP_AUTO_UV_ENGINE[10] true
SMU_13_0_0_ODCAP_AUTO_OC_ENGINE[11] true
SMU_13_0_0_ODCAP_AUTO_OC_MEMORY[12] true
SMU_13_0_0_ODCAP_FAN_CURVE[13] false
SMU_13_0_0_ODCAP_AUTO_FAN_ACOUSTIC_LIMIT[14] true
SMU_13_0_0_ODCAP_POWER_MODE[15] falseLimits:
SMU_13_0_0_ODSETTING_GFXCLKFMAX[0] - [500,5000] SMU_13_0_0_ODSETTING_GFXCLKFMIN[1] - [500,5000] SMU_13_0_0_ODSETTING_CUSTOM_GFX_VF_CURVE_A[2] - [97,1500] SMU_13_0_0_ODSETTING_CUSTOM_GFX_VF_CURVE_B[3] - [97,1500] SMU_13_0_0_ODSETTING_CUSTOM_CURVE_VFT_FMIN[4] - [10,15] SMU_13_0_0_ODSETTING_UCLKFMIN[5] - [500,3200] SMU_13_0_0_ODSETTING_UCLKFMAX[6] - [500,3200] SMU_13_0_0_ODSETTING_POWERPERCENTAGE[7] - [25,105] SMU_13_0_0_ODSETTING_FANRPMMIN[8] - [50,110] SMU_13_0_0_ODSETTING_FANRPMACOUSTICLIMIT[9] - [0,1] SMU_13_0_0_ODSETTING_FANTARGETTEMPERATURE[10] - [0,1] SMU_13_0_0_ODSETTING_OPERATINGTEMPMAX[11] - [0,1] SMU_13_0_0_ODSETTING_ACTIMING[12] - [0,1] SMU_13_0_0_ODSETTING_FAN_ZERO_RPM_CONTROL[13] - [0,1] SMU_13_0_0_ODSETTING_AUTOUVENGINE[14] - [25,100] SMU_13_0_0_ODSETTING_AUTOOCENGINE[15] - [23,100] SMU_13_0_0_ODSETTING_AUTOOCMEMORY[16] - [25,100] SMU_13_0_0_ODSETTING_FAN_CURVE_TEMPERATURE_1[17] - [23,100] SMU_13_0_0_ODSETTING_FAN_CURVE_SPEED_1[18] - [25,100] SMU_13_0_0_ODSETTING_FAN_CURVE_TEMPERATURE_2[19] - [23,100] SMU_13_0_0_ODSETTING_FAN_CURVE_SPEED_2[20] - [25,100] SMU_13_0_0_ODSETTING_FAN_CURVE_TEMPERATURE_3[21] - [23,100] SMU_13_0_0_ODSETTING_FAN_CURVE_SPEED_3[22] - [25,100] SMU_13_0_0_ODSETTING_FAN_CURVE_TEMPERATURE_4[23] - [23,100] SMU_13_0_0_ODSETTING_FAN_CURVE_SPEED_4[24] - [0,0] SMU_13_0_0_ODSETTING_FAN_CURVE_TEMPERATURE_5[25] - [0,1] SMU_13_0_0_ODSETTING_FAN_CURVE_SPEED_5[26] - [0,0] SMU_13_0_0_ODSETTING_AUTO_FAN_ACOUSTIC_LIMIT[27] - [0,0] SMU_13_0_0_ODSETTING_POWER_MODE[28] - [0,0]Boot OD Table:
GFXFLK: [600, 2945]
UCLK: [97, 1249]
FAN_CURVE[0]: 0 @ 0
FAN_CURVE[1]: 0 @ 0
FAN_CURVE[2]: 0 @ 0
FAN_CURVE[3]: 0 @ 0
FAN_CURVE[4]: 0 @ 0
FAN_CURVE[5]: 0 @ 0FAN_MIN_PWM: 35FAN_TARGET_TEMP: 94FAN_ZERO_RPM_ENABLE: trueFAN_MODE: 0