<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p>Yes, holding pm.mutex will prevent PP/DPM from entering/leaving PG states and is used as a means to probe power/clock related signals reliably (except for VCE clock signals which aren't part of an AON tile).</p>
<p><br>
</p>
<p>You just can't take it from a "set" state function since the higher up API will take it.</p>
<p><br>
</p>
<p>Tom</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Koenig, Christian<br>
<b>Sent:</b> Monday, January 9, 2017 09:45<br>
<b>To:</b> Huang, Ray; StDenis, Tom<br>
<b>Cc:</b> Deucher, Alexander; amd-gfx@lists.freedesktop.org; Zhu, Rex; Mao, David; Fu, Ping; Zhang, Hawking; Kuehling, Felix<br>
<b>Subject:</b> Re: [PART1 PATCH v4 7/8] drm/amdgpu: add get clockgating_state method for uvd v5&v6</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Am 09.01.2017 um 15:46 schrieb Huang Rui:<br>
> On Mon, Jan 09, 2017 at 07:29:00PM +0800, StDenis, Tom wrote:<br>
>> Yup it's held by both amdgpu_dpm_enable_uvd() and amdgpu_dpm_enable_vce()<br>
>><br>
>> Tom<br>
>><br>
> <snip><br>
><br>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c b/drivers/gpu/drm/amd/<br>
>> amdgpu/uvd_v5_0.c<br>
>>> index 03a35d9..e647d3e 100644<br>
>>> --- a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c<br>
>>> +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c<br>
>>> @@ -781,16 +781,48 @@ static int uvd_v5_0_set_powergating_state(void *handle,<br>
>>> * the smc and the hw blocks<br>
>>> */<br>
>>> struct amdgpu_device *adev = (struct amdgpu_device *)handle;<br>
>>> + int ret = 0;<br>
>>> <br>
>>> if (!(adev->pg_flags & AMD_PG_SUPPORT_UVD))<br>
>>> return 0;<br>
>>> <br>
>>> + mutex_lock(&adev->pm.mutex);<br>
>> Might be that I'm wrong, but didn't Tom said the mutex is taken anyway<br>
>> when this function is called?<br>
>><br>
>> If that's true we would certainly run into problem when we try to<br>
>> acquire it again.<br>
>><br>
> OK, I see. Actually, pm.mutex is already held on upper layer call<br>
> (amdgpu_dpm_enable_uvd). So we should not hold it again here.<br>
><br>
>>> +<br>
>>> +static void uvd_v5_0_get_clockgating_state(void *handle, u32 *flags)<br>
>>> +{<br>
>>> + struct amdgpu_device *adev = (struct amdgpu_device *)handle;<br>
>>> + int data;<br>
>>> +<br>
>>> + mutex_lock(&adev->pm.mutex);<br>
>>> +<br>
> We just need keep pm.mutex here in set_clockgating_state, that's enough.<br>
><br>
> Christian, Tom, am I right?<br>
<br>
Yes, I think so.<br>
<br>
Christian.<br>
<br>
><br>
> Thanks,<br>
> Rui<br>
<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>