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

Tom St Denis tom.stdenis at amd.com
Tue Feb 14 17:16:16 UTC 2017


On 14/02/17 12:01 PM, Samuel Pitoiset wrote:
>
>
> On 02/14/2017 05:41 PM, Tom St Denis wrote:
>> On 14/02/17 10:08 AM, 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.
>>>
>>> v2: - make sure read_sensor is not NULL on dpm chips
>>>     - keep sanity check for powerplay chips
>>>
>>> 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 | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>> index 6f021e70f15f..80821b436aeb 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>> @@ -3204,6 +3204,9 @@ static ssize_t amdgpu_debugfs_sensor_read(struct
>>> file *f, char __user *buf,
>>>      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 if (adev->pm.funcs && adev->pm.funcs->read_sensor)
>>> +        r = adev->pm.funcs->read_sensor(adev, idx, &values[0],
>>> +                        &valuesize);
>>>      else
>>>          return -EINVAL;
>>>
>>>
>>
>> Sorry NAK again, even with dpm=0 those function pointers are set and you
>> end up inside the dpm code trying to parse data structures that aren't
>> initialized.
>
> No worries. I thought that check was enough. Anyway, writing code
> without the hardware should be avoided. :)
>
> Can you try the thing suggested by Alex? Because I will need to fix up
> the DRM ioctl codepath as well.

Sure, I'm building a module with a amdgpu_dpm check near the top of the 
debugfs read function.

Tom



More information about the amd-gfx mailing list