[AMD Official Use Only - Internal Distribution Only] Reviewed-by: Evan Quan <evan.quan@xxxxxxx> -----Original Message----- From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of Alex Deucher Sent: Thursday, May 28, 2020 9:00 PM To: amd-gfx list <amd-gfx@xxxxxxxxxxxxxxxxxxxxx> Cc: Deucher, Alexander <Alexander.Deucher@xxxxxxx> Subject: Re: [PATCH] drm/amdgpu/pm: don't bail for in_suspend Ping? On Wed, May 27, 2020 at 6:52 PM Alex Deucher <alexdeucher@xxxxxxxxx> wrote: > > Otherwise we disable sysfs/debugfs access with runtime pm. > > Fixes: f7c8d853b029df ("drm/amdgpu/pm: return an error during GPU > reset or suspend") > Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 114 > ++++++++++++------------- > 1 file changed, 57 insertions(+), 57 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c > index 808884aaf36d..775e389c9a13 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c > @@ -163,7 +163,7 @@ static ssize_t amdgpu_get_power_dpm_state(struct device *dev, > enum amd_pm_state_type pm; > int ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = pm_runtime_get_sync(ddev->dev); @@ -199,7 +199,7 @@ > static ssize_t amdgpu_set_power_dpm_state(struct device *dev, > enum amd_pm_state_type state; > int ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > if (strncmp("battery", buf, strlen("battery")) == 0) @@ -303,7 > +303,7 @@ static ssize_t amdgpu_get_power_dpm_force_performance_level(struct device *dev, > enum amd_dpm_forced_level level = 0xff; > int ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = pm_runtime_get_sync(ddev->dev); @@ -343,7 +343,7 @@ > static ssize_t amdgpu_set_power_dpm_force_performance_level(struct device *dev, > enum amd_dpm_forced_level current_level = 0xff; > int ret = 0; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > if (strncmp("low", buf, strlen("low")) == 0) { @@ -445,7 > +445,7 @@ static ssize_t amdgpu_get_pp_num_states(struct device *dev, > struct pp_states_info data; > int i, buf_len, ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = pm_runtime_get_sync(ddev->dev); @@ -487,7 +487,7 @@ > static ssize_t amdgpu_get_pp_cur_state(struct device *dev, > enum amd_pm_state_type pm = 0; > int i = 0, ret = 0; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = pm_runtime_get_sync(ddev->dev); @@ -526,7 +526,7 @@ > static ssize_t amdgpu_get_pp_force_state(struct device *dev, > struct drm_device *ddev = dev_get_drvdata(dev); > struct amdgpu_device *adev = ddev->dev_private; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > if (adev->pp_force_state_enabled) @@ -546,7 +546,7 @@ static > ssize_t amdgpu_set_pp_force_state(struct device *dev, > unsigned long idx; > int ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > if (strlen(buf) == 1) > @@ -604,7 +604,7 @@ static ssize_t amdgpu_get_pp_table(struct device *dev, > char *table = NULL; > int size, ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = pm_runtime_get_sync(ddev->dev); @@ -646,7 +646,7 @@ > static ssize_t amdgpu_set_pp_table(struct device *dev, > struct amdgpu_device *adev = ddev->dev_private; > int ret = 0; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = pm_runtime_get_sync(ddev->dev); @@ -751,7 +751,7 @@ > static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev, > const char delimiter[3] = {' ', '\n', '\0'}; > uint32_t type; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > if (count > 127) > @@ -843,7 +843,7 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev, > ssize_t size; > int ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = pm_runtime_get_sync(ddev->dev); @@ -895,7 +895,7 @@ > static ssize_t amdgpu_set_pp_features(struct device *dev, > uint64_t featuremask; > int ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = kstrtou64(buf, 0, &featuremask); @@ -938,7 +938,7 @@ > static ssize_t amdgpu_get_pp_features(struct device *dev, > ssize_t size; > int ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = pm_runtime_get_sync(ddev->dev); @@ -997,7 +997,7 @@ > static ssize_t amdgpu_get_pp_dpm_sclk(struct device *dev, > ssize_t size; > int ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = pm_runtime_get_sync(ddev->dev); @@ -1063,7 +1063,7 @@ > static ssize_t amdgpu_set_pp_dpm_sclk(struct device *dev, > int ret; > uint32_t mask = 0; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = amdgpu_read_mask(buf, count, &mask); @@ -1097,7 +1097,7 > @@ static ssize_t amdgpu_get_pp_dpm_mclk(struct device *dev, > ssize_t size; > int ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = pm_runtime_get_sync(ddev->dev); @@ -1127,7 +1127,7 @@ > static ssize_t amdgpu_set_pp_dpm_mclk(struct device *dev, > uint32_t mask = 0; > int ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = amdgpu_read_mask(buf, count, &mask); @@ -1161,7 +1161,7 > @@ static ssize_t amdgpu_get_pp_dpm_socclk(struct device *dev, > ssize_t size; > int ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = pm_runtime_get_sync(ddev->dev); @@ -1191,7 +1191,7 @@ > static ssize_t amdgpu_set_pp_dpm_socclk(struct device *dev, > int ret; > uint32_t mask = 0; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = amdgpu_read_mask(buf, count, &mask); @@ -1227,7 +1227,7 > @@ static ssize_t amdgpu_get_pp_dpm_fclk(struct device *dev, > ssize_t size; > int ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = pm_runtime_get_sync(ddev->dev); @@ -1257,7 +1257,7 @@ > static ssize_t amdgpu_set_pp_dpm_fclk(struct device *dev, > int ret; > uint32_t mask = 0; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = amdgpu_read_mask(buf, count, &mask); @@ -1293,7 +1293,7 > @@ static ssize_t amdgpu_get_pp_dpm_dcefclk(struct device *dev, > ssize_t size; > int ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = pm_runtime_get_sync(ddev->dev); @@ -1323,7 +1323,7 @@ > static ssize_t amdgpu_set_pp_dpm_dcefclk(struct device *dev, > int ret; > uint32_t mask = 0; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = amdgpu_read_mask(buf, count, &mask); @@ -1359,7 +1359,7 > @@ static ssize_t amdgpu_get_pp_dpm_pcie(struct device *dev, > ssize_t size; > int ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = pm_runtime_get_sync(ddev->dev); @@ -1389,7 +1389,7 @@ > static ssize_t amdgpu_set_pp_dpm_pcie(struct device *dev, > int ret; > uint32_t mask = 0; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = amdgpu_read_mask(buf, count, &mask); @@ -1425,7 +1425,7 > @@ static ssize_t amdgpu_get_pp_sclk_od(struct device *dev, > uint32_t value = 0; > int ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = pm_runtime_get_sync(ddev->dev); @@ -1453,7 +1453,7 @@ > static ssize_t amdgpu_set_pp_sclk_od(struct device *dev, > int ret; > long int value; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = kstrtol(buf, 0, &value); @@ -1494,7 +1494,7 @@ static > ssize_t amdgpu_get_pp_mclk_od(struct device *dev, > uint32_t value = 0; > int ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = pm_runtime_get_sync(ddev->dev); @@ -1522,7 +1522,7 @@ > static ssize_t amdgpu_set_pp_mclk_od(struct device *dev, > int ret; > long int value; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = kstrtol(buf, 0, &value); @@ -1583,7 +1583,7 @@ static > ssize_t amdgpu_get_pp_power_profile_mode(struct device *dev, > ssize_t size; > int ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = pm_runtime_get_sync(ddev->dev); @@ -1621,7 +1621,7 @@ > static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev, > long int profile_mode = 0; > const char delimiter[3] = {' ', '\n', '\0'}; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > tmp[0] = *(buf); > @@ -1683,7 +1683,7 @@ static ssize_t amdgpu_get_gpu_busy_percent(struct device *dev, > struct amdgpu_device *adev = ddev->dev_private; > int r, value, size = sizeof(value); > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > r = pm_runtime_get_sync(ddev->dev); @@ -1719,7 +1719,7 @@ > static ssize_t amdgpu_get_mem_busy_percent(struct device *dev, > struct amdgpu_device *adev = ddev->dev_private; > int r, value, size = sizeof(value); > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > r = pm_runtime_get_sync(ddev->dev); @@ -1760,7 +1760,7 @@ > static ssize_t amdgpu_get_pcie_bw(struct device *dev, > uint64_t count0 = 0, count1 = 0; > int ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > if (adev->flags & AMD_IS_APU) > @@ -1799,7 +1799,7 @@ static ssize_t amdgpu_get_unique_id(struct device *dev, > struct drm_device *ddev = dev_get_drvdata(dev); > struct amdgpu_device *adev = ddev->dev_private; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > if (adev->unique_id) > @@ -1996,7 +1996,7 @@ static ssize_t amdgpu_hwmon_show_temp(struct device *dev, > int channel = to_sensor_dev_attr(attr)->index; > int r, temp = 0, size = sizeof(temp); > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > if (channel >= PP_TEMP_MAX) > @@ -2130,7 +2130,7 @@ static ssize_t amdgpu_hwmon_get_pwm1_enable(struct device *dev, > u32 pwm_mode = 0; > int ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = pm_runtime_get_sync(adev->ddev->dev); > @@ -2164,7 +2164,7 @@ static ssize_t amdgpu_hwmon_set_pwm1_enable(struct device *dev, > int err, ret; > int value; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > err = kstrtoint(buf, 10, &value); @@ -2216,7 +2216,7 @@ static > ssize_t amdgpu_hwmon_set_pwm1(struct device *dev, > u32 value; > u32 pwm_mode; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > err = pm_runtime_get_sync(adev->ddev->dev); > @@ -2268,7 +2268,7 @@ static ssize_t amdgpu_hwmon_get_pwm1(struct device *dev, > int err; > u32 speed = 0; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > err = pm_runtime_get_sync(adev->ddev->dev); > @@ -2301,7 +2301,7 @@ static ssize_t amdgpu_hwmon_get_fan1_input(struct device *dev, > int err; > u32 speed = 0; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > err = pm_runtime_get_sync(adev->ddev->dev); > @@ -2333,7 +2333,7 @@ static ssize_t amdgpu_hwmon_get_fan1_min(struct device *dev, > u32 size = sizeof(min_rpm); > int r; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > r = pm_runtime_get_sync(adev->ddev->dev); > @@ -2361,7 +2361,7 @@ static ssize_t amdgpu_hwmon_get_fan1_max(struct device *dev, > u32 size = sizeof(max_rpm); > int r; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > r = pm_runtime_get_sync(adev->ddev->dev); > @@ -2388,7 +2388,7 @@ static ssize_t amdgpu_hwmon_get_fan1_target(struct device *dev, > int err; > u32 rpm = 0; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > err = pm_runtime_get_sync(adev->ddev->dev); > @@ -2420,7 +2420,7 @@ static ssize_t amdgpu_hwmon_set_fan1_target(struct device *dev, > u32 value; > u32 pwm_mode; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > err = pm_runtime_get_sync(adev->ddev->dev); > @@ -2469,7 +2469,7 @@ static ssize_t amdgpu_hwmon_get_fan1_enable(struct device *dev, > u32 pwm_mode = 0; > int ret; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > ret = pm_runtime_get_sync(adev->ddev->dev); > @@ -2504,7 +2504,7 @@ static ssize_t amdgpu_hwmon_set_fan1_enable(struct device *dev, > int value; > u32 pwm_mode; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > err = kstrtoint(buf, 10, &value); @@ -2547,7 +2547,7 @@ static > ssize_t amdgpu_hwmon_show_vddgfx(struct device *dev, > u32 vddgfx; > int r, size = sizeof(vddgfx); > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > r = pm_runtime_get_sync(adev->ddev->dev); > @@ -2582,7 +2582,7 @@ static ssize_t amdgpu_hwmon_show_vddnb(struct device *dev, > u32 vddnb; > int r, size = sizeof(vddnb); > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > /* only APUs have vddnb */ > @@ -2622,7 +2622,7 @@ static ssize_t amdgpu_hwmon_show_power_avg(struct device *dev, > int r, size = sizeof(u32); > unsigned uw; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > r = pm_runtime_get_sync(adev->ddev->dev); > @@ -2661,7 +2661,7 @@ static ssize_t amdgpu_hwmon_show_power_cap_max(struct device *dev, > ssize_t size; > int r; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > r = pm_runtime_get_sync(adev->ddev->dev); > @@ -2693,7 +2693,7 @@ static ssize_t amdgpu_hwmon_show_power_cap(struct device *dev, > ssize_t size; > int r; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > r = pm_runtime_get_sync(adev->ddev->dev); > @@ -2726,7 +2726,7 @@ static ssize_t amdgpu_hwmon_set_power_cap(struct device *dev, > int err; > u32 value; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > if (amdgpu_sriov_vf(adev)) > @@ -2767,7 +2767,7 @@ static ssize_t amdgpu_hwmon_show_sclk(struct device *dev, > uint32_t sclk; > int r, size = sizeof(sclk); > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > r = pm_runtime_get_sync(adev->ddev->dev); > @@ -2802,7 +2802,7 @@ static ssize_t amdgpu_hwmon_show_mclk(struct device *dev, > uint32_t mclk; > int r, size = sizeof(mclk); > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > r = pm_runtime_get_sync(adev->ddev->dev); > @@ -3665,7 +3665,7 @@ static int amdgpu_debugfs_pm_info(struct seq_file *m, void *data) > u32 flags = 0; > int r; > > - if (adev->in_gpu_reset || adev->in_suspend) > + if (adev->in_gpu_reset) > return -EPERM; > > r = pm_runtime_get_sync(dev->dev); > -- > 2.25.4 > _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cevan.quan%40amd.com%7C97b6a87de2fd4bc7ed6308d803070c10%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637262676586697822&sdata=8V2SIQumUqRoJX%2FFwH8%2FS9x6XEy3ykBFJHm%2B9%2Fa2kpg%3D&reserved=0 _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx