[PATCH] drm/amdgpu: expose amdgpu_sensors on pre-powerplay chips

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Feb 14 14:44:51 UTC 2017



On 02/14/2017 03:04 PM, Tom St Denis wrote:
> On 13/02/17 07:23 PM, Samuel Pitoiset wrote:
>> Totally untested but as long as read_sensor() has been recently
>> implemented for dpm based boards, amdgpu_sensors can now be
>> exposed.
>>
>> Cc: Tom St Denis <tom.stdenis at amd.com>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +----
>>  1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> index 6f021e70f15f..1a8e3b9a2268 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> @@ -3202,10 +3202,7 @@ static ssize_t
>> amdgpu_debugfs_sensor_read(struct file *f, char __user *buf,
>>      idx = *pos >> 2;
>>
>>      valuesize = sizeof(values);
>> -    if (adev->powerplay.pp_funcs &&
>> adev->powerplay.pp_funcs->read_sensor)
>> -        r =
>> adev->powerplay.pp_funcs->read_sensor(adev->powerplay.pp_handle, idx,
>> &values[0], &valuesize);
>> -    else
>> -        return -EINVAL;
>> +    r = amdgpu_dpm_read_sensor(adev, idx, &values[0], &valuesize);
>>
>>      if (size > valuesize)
>>          return -EINVAL;
>>
>
> NAK, this will oops the kernel if amdgpu.dpm=0 and on powerplay systems
> if powerplay=0.
>

The powerplay parameter has been removed recently.

commit a48203f576e7f708093f7a9d9dcc9ff7b067e559
Author: Rex Zhu <Rex.Zhu at amd.com>
Date:   Tue Dec 27 15:51:45 2016 +0800

     drm/amdgpu: delete dead module parameter:amdgpu_powerplay.

     Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
     Signed-off-by: Rex Zhu <Rex.Zhu at amd.com>
     Signed-off-by: Alex Deucher <alexander.deucher at amd.com>

But I do agree for pre-powerplay chips.

> Otherwise, it seems to work though the GPU_TEMP reads as "5000" on my
> Kaveri (meaning temp of 5C which isn't true).
>
> I suspect the dpm code is reading the wrong register to get the temp but
> we can fix that in another change later on.

No idea. It was just a copy-n-paste. Maybe the initial code is buggy?

>
> Tom


More information about the amd-gfx mailing list