<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>Kinda buried trying to sort out the gfx6 boot failure but if someone can just email as an attachment the 5 patches I'll test them on my Stoney system (my CZ system is being used by the Tahiti board...)</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> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Deucher, Alexander <Alexander.Deucher@amd.com><br>
<b>Sent:</b> Wednesday, November 9, 2016 11:03<br>
<b>To:</b> Zhu, Rex; amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Zhu, Rex<br>
<b>Subject:</b> RE: [PATCH 4/5] drm/amdgpu: refine uvd 6.0 clock gate feature.</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">> -----Original Message-----<br>
> From: amd-gfx [<a href="mailto:amd-gfx-bounces@lists.freedesktop.org">mailto:amd-gfx-bounces@lists.freedesktop.org</a>] On Behalf<br>
> Of Rex Zhu<br>
> Sent: Wednesday, November 09, 2016 2:42 AM<br>
> To: amd-gfx@lists.freedesktop.org<br>
> Cc: Zhu, Rex<br>
> Subject: [PATCH 4/5] drm/amdgpu: refine uvd 6.0 clock gate feature.<br>
> <br>
> Change-Id: I3b665f26689dd35750e1a6521cd5fac5456f7556<br>
> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com><br>
<br>
Can someone make sure this doesn't regress CZ and ST? As long as they are still ok, the patches 4, 5 are:<br>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
<br>
> ---<br>
> drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 112<br>
> ++++++++++++++++++++++++++++------<br>
> 1 file changed, 92 insertions(+), 20 deletions(-)<br>
> <br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c<br>
> b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c<br>
> index 00fad69..c697a73 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c<br>
> @@ -42,6 +42,10 @@ static void uvd_v6_0_set_irq_funcs(struct<br>
> amdgpu_device *adev);<br>
> static int uvd_v6_0_start(struct amdgpu_device *adev);<br>
> static void uvd_v6_0_stop(struct amdgpu_device *adev);<br>
> static void uvd_v6_0_set_sw_clock_gating(struct amdgpu_device *adev);<br>
> +static int uvd_v6_0_set_clockgating_state(void *handle,<br>
> + enum amd_clockgating_state state);<br>
> +static void uvd_v6_0_enable_mgcg(struct amdgpu_device *adev,<br>
> + bool enable);<br>
> <br>
> /**<br>
> * uvd_v6_0_ring_get_rptr - get read pointer<br>
> @@ -151,8 +155,6 @@ static int uvd_v6_0_hw_init(void *handle)<br>
> uint32_t tmp;<br>
> int r;<br>
> <br>
> - amdgpu_asic_set_uvd_clocks(adev, 10000, 10000);<br>
> -<br>
> r = uvd_v6_0_start(adev);<br>
> if (r)<br>
> goto done;<br>
> @@ -395,11 +397,11 @@ static int uvd_v6_0_start(struct amdgpu_device<br>
> *adev)<br>
> lmi_swap_cntl = 0;<br>
> mp_swap_cntl = 0;<br>
> <br>
> + amdgpu_asic_set_uvd_clocks(adev, 10000, 10000);<br>
> + uvd_v6_0_set_clockgating_state(adev, AMD_CG_STATE_UNGATE);<br>
> + uvd_v6_0_enable_mgcg(adev, true);<br>
> uvd_v6_0_mc_resume(adev);<br>
> <br>
> - /* disable clock gating */<br>
> - WREG32_FIELD(UVD_CGC_CTRL, DYN_CLOCK_MODE, 0);<br>
> -<br>
> /* disable interupt */<br>
> WREG32_FIELD(UVD_MASTINT_EN, VCPU_EN, 0);<br>
> <br>
> @@ -838,22 +840,69 @@ static int uvd_v6_0_process_interrupt(struct<br>
> amdgpu_device *adev,<br>
> return 0;<br>
> }<br>
> <br>
> +static void uvd_v6_0_enable_clock_gating(struct amdgpu_device *adev,<br>
> bool enable)<br>
> +{<br>
> + uint32_t data1, data3;<br>
> +<br>
> + data1 = RREG32(mmUVD_SUVD_CGC_GATE);<br>
> + data3 = RREG32(mmUVD_CGC_GATE);<br>
> +<br>
> + data1 |= UVD_SUVD_CGC_GATE__SRE_MASK |<br>
> + UVD_SUVD_CGC_GATE__SIT_MASK |<br>
> + UVD_SUVD_CGC_GATE__SMP_MASK |<br>
> + UVD_SUVD_CGC_GATE__SCM_MASK |<br>
> + UVD_SUVD_CGC_GATE__SDB_MASK |<br>
> + UVD_SUVD_CGC_GATE__SRE_H264_MASK |<br>
> + UVD_SUVD_CGC_GATE__SRE_HEVC_MASK |<br>
> + UVD_SUVD_CGC_GATE__SIT_H264_MASK |<br>
> + UVD_SUVD_CGC_GATE__SIT_HEVC_MASK |<br>
> + UVD_SUVD_CGC_GATE__SCM_H264_MASK |<br>
> + UVD_SUVD_CGC_GATE__SCM_HEVC_MASK |<br>
> + UVD_SUVD_CGC_GATE__SDB_H264_MASK |<br>
> + UVD_SUVD_CGC_GATE__SDB_HEVC_MASK;<br>
> +<br>
> + if (enable) {<br>
> + data3 |= (UVD_CGC_GATE__SYS_MASK |<br>
> + UVD_CGC_GATE__UDEC_MASK |<br>
> + UVD_CGC_GATE__MPEG2_MASK |<br>
> + UVD_CGC_GATE__RBC_MASK |<br>
> + UVD_CGC_GATE__LMI_MC_MASK |<br>
> + UVD_CGC_GATE__LMI_UMC_MASK |<br>
> + UVD_CGC_GATE__IDCT_MASK |<br>
> + UVD_CGC_GATE__MPRD_MASK |<br>
> + UVD_CGC_GATE__MPC_MASK |<br>
> + UVD_CGC_GATE__LBSI_MASK |<br>
> + UVD_CGC_GATE__LRBBM_MASK |<br>
> + UVD_CGC_GATE__UDEC_RE_MASK |<br>
> + UVD_CGC_GATE__UDEC_CM_MASK |<br>
> + UVD_CGC_GATE__UDEC_IT_MASK |<br>
> + UVD_CGC_GATE__UDEC_DB_MASK |<br>
> + UVD_CGC_GATE__UDEC_MP_MASK |<br>
> + UVD_CGC_GATE__WCB_MASK |<br>
> + UVD_CGC_GATE__VCPU_MASK |<br>
> + UVD_CGC_GATE__JPEG_MASK |<br>
> + UVD_CGC_GATE__SCPU_MASK |<br>
> + UVD_CGC_GATE__JPEG2_MASK);<br>
> + data3 &= ~UVD_CGC_GATE__REGS_MASK;<br>
> + } else {<br>
> + data3 = 0;<br>
> + }<br>
> +<br>
> + WREG32(mmUVD_SUVD_CGC_GATE, data1);<br>
> + WREG32(mmUVD_CGC_GATE, data3);<br>
> +}<br>
> +<br>
> static void uvd_v6_0_set_sw_clock_gating(struct amdgpu_device *adev)<br>
> {<br>
> - uint32_t data, data1, data2, suvd_flags;<br>
> + uint32_t data, data2;<br>
> <br>
> data = RREG32(mmUVD_CGC_CTRL);<br>
> - data1 = RREG32(mmUVD_SUVD_CGC_GATE);<br>
> data2 = RREG32(mmUVD_SUVD_CGC_CTRL);<br>
> <br>
> +<br>
> data &= ~(UVD_CGC_CTRL__CLK_OFF_DELAY_MASK |<br>
> UVD_CGC_CTRL__CLK_GATE_DLY_TIMER_MASK);<br>
> <br>
> - suvd_flags = UVD_SUVD_CGC_GATE__SRE_MASK |<br>
> - UVD_SUVD_CGC_GATE__SIT_MASK |<br>
> - UVD_SUVD_CGC_GATE__SMP_MASK |<br>
> - UVD_SUVD_CGC_GATE__SCM_MASK |<br>
> - UVD_SUVD_CGC_GATE__SDB_MASK;<br>
> <br>
> data |= UVD_CGC_CTRL__DYN_CLOCK_MODE_MASK |<br>
> (1 << REG_FIELD_SHIFT(UVD_CGC_CTRL,<br>
> CLK_GATE_DLY_TIMER)) |<br>
> @@ -886,11 +935,8 @@ static void uvd_v6_0_set_sw_clock_gating(struct<br>
> amdgpu_device *adev)<br>
> UVD_SUVD_CGC_CTRL__SMP_MODE_MASK |<br>
> UVD_SUVD_CGC_CTRL__SCM_MODE_MASK |<br>
> UVD_SUVD_CGC_CTRL__SDB_MODE_MASK);<br>
> - data1 |= suvd_flags;<br>
> <br>
> WREG32(mmUVD_CGC_CTRL, data);<br>
> - WREG32(mmUVD_CGC_GATE, 0);<br>
> - WREG32(mmUVD_SUVD_CGC_GATE, data1);<br>
> WREG32(mmUVD_SUVD_CGC_CTRL, data2);<br>
> }<br>
> <br>
> @@ -937,6 +983,32 @@ static void uvd_v6_0_set_hw_clock_gating(struct<br>
> amdgpu_device *adev)<br>
> }<br>
> #endif<br>
> <br>
> +static void uvd_v6_0_enable_mgcg(struct amdgpu_device *adev,<br>
> + bool enable)<br>
> +{<br>
> + u32 orig, data;<br>
> +<br>
> + if (enable && (adev->cg_flags & AMD_CG_SUPPORT_UVD_MGCG))<br>
> {<br>
> + data = RREG32_UVD_CTX(ixUVD_CGC_MEM_CTRL);<br>
> + data |= 0xfff;<br>
> + WREG32_UVD_CTX(ixUVD_CGC_MEM_CTRL, data);<br>
> +<br>
> + orig = data = RREG32(mmUVD_CGC_CTRL);<br>
> + data |= UVD_CGC_CTRL__DYN_CLOCK_MODE_MASK;<br>
> + if (orig != data)<br>
> + WREG32(mmUVD_CGC_CTRL, data);<br>
> + } else {<br>
> + data = RREG32_UVD_CTX(ixUVD_CGC_MEM_CTRL);<br>
> + data &= ~0xfff;<br>
> + WREG32_UVD_CTX(ixUVD_CGC_MEM_CTRL, data);<br>
> +<br>
> + orig = data = RREG32(mmUVD_CGC_CTRL);<br>
> + data &= ~UVD_CGC_CTRL__DYN_CLOCK_MODE_MASK;<br>
> + if (orig != data)<br>
> + WREG32(mmUVD_CGC_CTRL, data);<br>
> + }<br>
> +}<br>
> +<br>
> static int uvd_v6_0_set_clockgating_state(void *handle,<br>
> enum amd_clockgating_state state)<br>
> {<br>
> @@ -947,17 +1019,17 @@ static int uvd_v6_0_set_clockgating_state(void<br>
> *handle,<br>
> return 0;<br>
> <br>
> if (enable) {<br>
> - /* disable HW gating and enable Sw gating */<br>
> - uvd_v6_0_set_sw_clock_gating(adev);<br>
> - } else {<br>
> /* wait for STATUS to clear */<br>
> if (uvd_v6_0_wait_for_idle(handle))<br>
> return -EBUSY;<br>
> -<br>
> + uvd_v6_0_enable_clock_gating(adev, true);<br>
> /* enable HW gates because UVD is idle */<br>
> /* uvd_v6_0_set_hw_clock_gating(adev); */<br>
> + } else {<br>
> + /* disable HW gating and enable Sw gating */<br>
> + uvd_v6_0_enable_clock_gating(adev, false);<br>
> }<br>
> -<br>
> + uvd_v6_0_set_sw_clock_gating(adev);<br>
> return 0;<br>
> }<br>
> <br>
> --<br>
> 1.9.1<br>
> <br>
> _______________________________________________<br>
> amd-gfx mailing list<br>
> amd-gfx@lists.freedesktop.org<br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</div>
</body>
</html>