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

Tom St Denis tom.stdenis at amd.com
Tue Feb 14 18:08:06 UTC 2017


On 14/02/17 12:52 PM, Tom St Denis wrote:
> On 14/02/17 12:16 PM, Tom St Denis wrote:
>> On 14/02/17 12:01 PM, Samuel Pitoiset wrote:
>>> 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.
>
> It seems returning an error code causes it to do "bad things" on read
>
> [root at kaveri linux]# git diff
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 80821b4..d63c443 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -3198,6 +3198,9 @@ static ssize_t amdgpu_debugfs_sensor_read(struct
> file *f, char __user *buf,
>         if (size & 3 || *pos & 0x3)
>                 return -EINVAL;
>
> +       if (amdgpu_dpm == 0)
> +               return -EINVAL;
> +
>         /* convert offset to sensor number */
>         idx = *pos >> 2;
>
> That's what I applied on top of Samuel's three patches.
>
> With DPM enabled it works fine obviously, with it disabled the entire
> system hangs.  I think probably because the VFS spins trying to read but
> never finishes...

Nevermind, the issue is umr reading UVD registers when dpm=0 on KV. 
Without sampling UVD the error works properly.

So add those three lines to your patch (and similar in the ioctl) you 
should be fine.

Cheers,
Tom


More information about the amd-gfx mailing list