Hi Slava, Ah yes, I copied it from another function (because the struct path to the pp functions is annoying to look up hehehehe). Thanks! I'll submit a v2 in a bit. Cheers, Tom On 06/20/2018 10:41 AM, Abramov, Slava wrote: > Should the comment then say 'get the load' instead of 'get the temperature'? > > ------------------------------------------------------------------------ > *From:* StDenis, Tom > *Sent:* Wednesday, June 20, 2018 10:39:25 AM > *To:* Abramov, Slava; amd-gfx at lists.freedesktop.org > *Subject:* Re: [PATCH] drm/amd/amdgpu: Add a GPU_LOAD entry to sysfs > > > On 06/20/2018 10:37 AM, Abramov, Slava wrote: >> I see some functions in amdgpu_pm.c have function level documentation, >> so that it would be good to have this for newly added functions. > > Sure I can add some comments/docs. > >> Another comment is inline. >> >> >>>From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of Tom St Denis <tom.stdenis at amd.com> >> >>Â >Sent: Wednesday, June 20, 2018 8:31 AM >>Â >To: amd-gfx at lists.freedesktop.org >>Â >Cc: StDenis, Tom >>Â >Subject: [PATCH] drm/amd/amdgpu: Add a GPU_LOAD entry to sysfs >>Â > >>Â >This adds what should be a stable interface to read GPU >>Â >load from userspace. >>Â > >>Â >Signed-off-by: Tom St Denis <tom.stdenis at amd.com> >>Â >--- >>Â > drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 41 >> ++++++++++++++++++++++++++++++++++ >>Â > 1 file changed, 41 insertions(+) >>Â > >>Â >diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c >> b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c >>Â >index 113edffb5960..d57b414ac228 100644 >>Â >--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c >>Â >+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c >>Â >@@ -918,6 +918,37 @@ static ssize_t >> amdgpu_set_pp_power_profile_mode(struct device *dev, >>Â >Â Â Â Â Â return -EINVAL; >>Â > } >>Â > >>Â >+static ssize_t amdgpu_get_busy_level(struct device *dev, >>Â >+Â Â Â Â Â Â Â Â struct device_attribute *attr, >>Â >+Â Â Â Â Â Â Â Â char *buf) >>Â >+{ >>Â >+Â Â Â Â struct drm_device *ddev = dev_get_drvdata(dev); >>Â >+Â Â Â Â struct amdgpu_device *adev = ddev->dev_private; >>Â >+Â Â Â Â int r, value, size = sizeof(value); >>Â >+ >>Â >+Â Â Â Â /* sanity check PP is enabled */ >>Â >+Â Â Â Â if (!(adev->powerplay.pp_funcs && >>Â >+Â Â Â Â Â Â Â adev->powerplay.pp_funcs->read_sensor)) >>Â >+Â Â Â Â Â Â Â Â return -EINVAL; >>Â >+ >>Â >+Â Â Â Â /* get the temperature */ >> >> Is load is the same thing as temperature? > > > Nope, there is a separate sensor for that but it is included in hwmon > and Alex would rather not duplicate it. > > GPU_LOAD is a value returned by firmware based on the RLC busy status (I > think...). > > Tom