<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">No, problem. It's only the coding style
      anyway.<br>
      <br>
      It's just horrible annoying when we run into a ping/pong situation
      where AMD developers break the coding style and community patches
      are fixing it again.<br>
      <br>
      Regards,<br>
      Christian.<br>
      <br>
      Am 19.07.2016 um 04:52 schrieb Qu, Jim:<br>
    </div>
    <blockquote
cite="mid:BY2PR12MB0614FEDBB1AA69083C5B302899370@BY2PR12MB0614.namprd12.prod.outlook.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
      <div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
        <p>Hi Christian:</p>
        <p><br>
        </p>
        <p>Sorry, I have pushed the patch. anyway, I could push a new
          patch to correct them.</p>
        <p><br>
        </p>
        <p>Thanks</p>
        <p>JimQu<br>
        </p>
      </div>
      <hr style="display:inline-block;width:98%" tabindex="-1">
      <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
          face="Calibri, sans-serif" color="#000000"><b>发件人:</b>
          Christian König <a class="moz-txt-link-rfc2396E" href="mailto:deathsimple@vodafone.de"><deathsimple@vodafone.de></a><br>
          <b>发送时间:</b> 2016年7月18日 22:09:16<br>
          <b>收件人:</b> Wang, Qingqing; Qu, Jim;
          <a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
          <b>主题:</b> Re: SPAM //答复: [v2] drm/amdgpu: S3 resume fail on
          Polaris10</font>
        <div> </div>
      </div>
      <div>
        <div class="moz-cite-prefix">Am 18.07.2016 um 16:07 schrieb
          Christian König:<br>
        </div>
        <blockquote cite="mid:578CE2BE.5080707@vodafone.de" type="cite">
          <div class="moz-cite-prefix">Am 15.07.2016 um 10:59 schrieb
            Wang, Qingqing:<br>
          </div>
          <blockquote
cite="mid:CY1PR12MB050892397B75C63C46A3CEAFEC330@CY1PR12MB0508.namprd12.prod.outlook.com"
            type="cite">
            <meta http-equiv="Context-Type" content="text/html;
              charset=gb2312">
            <meta name="Generator" content="Microsoft Exchange Server">
            <div id="divtagdefaultwrapper">
              <p><span>+static int vce_v3_0_firmware_loaded(struct
                  amdgpu_device *adev)<br>
                  +{<br>
                  +       int i, j;<br>
                  +<br>
                  +       for (i = 0; i < 10; ++i) {<br>
                  +               uint32_t status;</span></p>
              <p><br>
              </p>
              <p>Please move the definition of status to the start of
                the function and give it an intial value.</p>
            </div>
          </blockquote>
          <br>
          NAK, that is exactly what we should *NOT* do here.<br>
          <br>
          "status" is just a temporary variable for the register content
          and as such should only be declared where needed.<br>
          <br>
          Additional to that please stop initializing variables when
          that isn't necessary, we are already getting patches to remove
          that cruft from all over the code.<br>
          <br>
          What you should clearly do on the other hand is sending the
          patches as text, not HTML mail. We can really review them this
          way.<br>
        </blockquote>
        <br>
        Typo that should have read "can't really review them".<br>
        <br>
        Sorry for that,<br>
        Christian.<br>
        <br>
        <blockquote cite="mid:578CE2BE.5080707@vodafone.de" type="cite"><br>
          Regards,<br>
          Christian.<br>
          <br>
          <blockquote
cite="mid:CY1PR12MB050892397B75C63C46A3CEAFEC330@CY1PR12MB0508.namprd12.prod.outlook.com"
            type="cite">
            <div id="divtagdefaultwrapper">
              <p>With that fixed.</p>
              <p>Reviewed-by: Ken Wang <a moz-do-not-send="true"
                  class="moz-txt-link-rfc2396E"
                  href="mailto:Qingqing.Wang@amd.com">
                  <Qingqing.Wang@amd.com></a><br>
              </p>
            </div>
            <hr tabindex="-1">
            <div id="divRplyFwdMsg" dir="ltr"><b>发件人:</b> amd-gfx <a
                moz-do-not-send="true" class="moz-txt-link-rfc2396E"
                href="mailto:amd-gfx-bounces@lists.freedesktop.org">
              </a><a moz-do-not-send="true"
                class="moz-txt-link-rfc2396E"
                href="mailto:amd-gfx-bounces@lists.freedesktop.org"><amd-gfx-bounces@lists.freedesktop.org></a>
              代表 Qu, Jim
              <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
                href="mailto:Jim.Qu@amd.com">
                <Jim.Qu@amd.com></a><br>
              <b>发送时间:</b> 2016年7月15日 10:45:07<br>
              <b>收件人:</b> <a moz-do-not-send="true"
                class="moz-txt-link-abbreviated"
                href="mailto:amd-gfx@lists.freedesktop.org">
                amd-gfx@lists.freedesktop.org</a><br>
              <b>主题:</b> 答复: [v2] drm/amdgpu: S3 resume fail on
              Polaris10
              <div> </div>
            </div>
            <div>
              <meta content="text/html; charset=UTF-8">
              <div dir="ltr">
                <div id="x_divtagdefaultwrapper">
                  <p>Hi:</p>
                  <p><br>
                  </p>
                  <p>Patch has updated, Please review.</p>
                  <p><br>
                  </p>
                  <p>Thanks</p>
                  <p>JimQu<br>
                  </p>
                </div>
                <hr tabindex="-1">
                <div id="x_divRplyFwdMsg" dir="ltr"><b>发件人:</b> jimqu <a
                    moz-do-not-send="true" class="moz-txt-link-rfc2396E"
                    href="mailto:Jim.Qu@amd.com">
                  </a><a moz-do-not-send="true"
                    class="moz-txt-link-rfc2396E"
                    href="mailto:Jim.Qu@amd.com"><Jim.Qu@amd.com></a><br>
                  <b>发送时间:</b> 2016年7月15日 10:33:56<br>
                  <b>收件人:</b> <a moz-do-not-send="true"
                    class="moz-txt-link-abbreviated"
                    href="mailto:amd-gfx@lists.freedesktop.org">
                    amd-gfx@lists.freedesktop.org</a><br>
                  <b>抄送:</b> Qu, Jim<br>
                  <b>主题:</b> [v2] drm/amdgpu: S3 resume fail on
                  Polaris10
                  <div> </div>
                </div>
              </div>
              <span>
                <div class="PlainText">Sometimes, driver can not return
                  from fence waiting when doing VCE ring<br>
                  ib test. The issue is a asic special and random issue.
                  so adjust VCE suspend<br>
                  and resume sequence.<br>
                  <br>
                  Change-Id: If9e2006521ff17e55c33b18b1500126b9e7f2874<br>
                  Signed-off-by: JimQu <a moz-do-not-send="true"
                    class="moz-txt-link-rfc2396E"
                    href="mailto:Jim.Qu@amd.com">
                    <Jim.Qu@amd.com></a><br>
                  ---<br>
                   drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 143
                  +++++++++++++++++++++++-----------<br>
                   1 file changed, 97 insertions(+), 46 deletions(-)<br>
                  <br>
                  diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
                  b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c<br>
                  index 30e8099..885b625 100644<br>
                  --- a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c<br>
                  +++ b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c<br>
                  @@ -43,6 +43,7 @@<br>
                   #define mmVCE_LMI_VCPU_CACHE_40BIT_BAR0 0x8616<br>
                   #define mmVCE_LMI_VCPU_CACHE_40BIT_BAR1 0x8617<br>
                   #define mmVCE_LMI_VCPU_CACHE_40BIT_BAR2 0x8618<br>
                  +#define VCE_STATUS_VCPU_REPORT_FW_LOADED_MASK  0x02<br>
                   <br>
                   #define VCE_V3_0_FW_SIZE        (384 * 1024)<br>
                   #define VCE_V3_0_STACK_SIZE     (64 * 1024)<br>
                  @@ -51,6 +52,7 @@<br>
                   static void vce_v3_0_mc_resume(struct amdgpu_device
                  *adev, int idx);<br>
                   static void vce_v3_0_set_ring_funcs(struct
                  amdgpu_device *adev);<br>
                   static void vce_v3_0_set_irq_funcs(struct
                  amdgpu_device *adev);<br>
                  +static int vce_v3_0_wait_for_idle(void *handle);<br>
                   <br>
                   /**<br>
                    * vce_v3_0_ring_get_rptr - get read pointer<br>
                  @@ -205,6 +207,32 @@ static void
                  vce_v3_0_set_vce_sw_clock_gating(struct amdgpu_device
                  *adev,<br>
                           vce_v3_0_override_vce_clock_gating(adev,
                  false);<br>
                   }<br>
                   <br>
                  +static int vce_v3_0_firmware_loaded(struct
                  amdgpu_device *adev)<br>
                  +{<br>
                  +       int i, j;<br>
                  +<br>
                  +       for (i = 0; i < 10; ++i) {<br>
                  +               uint32_t status;<br>
                  +               for (j = 0; j < 100; ++j) {<br>
                  +                       status = RREG32(mmVCE_STATUS);<br>
                  +                       if (status &
                  VCE_STATUS_VCPU_REPORT_FW_LOADED_MASK)<br>
                  +                               return 0;<br>
                  +                       mdelay(10);<br>
                  +               }<br>
                  +<br>
                  +               DRM_ERROR("VCE not responding, trying
                  to reset the ECPU!!!\n");<br>
                  +               WREG32_P(mmVCE_SOFT_RESET,<br>
                  +                      
                  VCE_SOFT_RESET__ECPU_SOFT_RESET_MASK,<br>
                  +                      
                  ~VCE_SOFT_RESET__ECPU_SOFT_RESET_MASK);<br>
                  +               mdelay(10);<br>
                  +               WREG32_P(mmVCE_SOFT_RESET, 0,<br>
                  +                      
                  ~VCE_SOFT_RESET__ECPU_SOFT_RESET_MASK);<br>
                  +               mdelay(10);<br>
                  +       }<br>
                  +<br>
                  +       return -ETIMEDOUT;<br>
                  +}<br>
                  +<br>
                   /**<br>
                    * vce_v3_0_start - start VCE block<br>
                    *<br>
                  @@ -215,11 +243,24 @@ static void
                  vce_v3_0_set_vce_sw_clock_gating(struct amdgpu_device
                  *adev,<br>
                   static int vce_v3_0_start(struct amdgpu_device *adev)<br>
                   {<br>
                           struct amdgpu_ring *ring;<br>
                  -       int idx, i, j, r;<br>
                  +       int idx, r;<br>
                  +<br>
                  +       ring = &adev->vce.ring[0];<br>
                  +       WREG32(mmVCE_RB_RPTR, ring->wptr);<br>
                  +       WREG32(mmVCE_RB_WPTR, ring->wptr);<br>
                  +       WREG32(mmVCE_RB_BASE_LO, ring->gpu_addr);<br>
                  +       WREG32(mmVCE_RB_BASE_HI,
                  upper_32_bits(ring->gpu_addr));<br>
                  +       WREG32(mmVCE_RB_SIZE, ring->ring_size / 4);<br>
                  +<br>
                  +       ring = &adev->vce.ring[1];<br>
                  +       WREG32(mmVCE_RB_RPTR2, ring->wptr);<br>
                  +       WREG32(mmVCE_RB_WPTR2, ring->wptr);<br>
                  +       WREG32(mmVCE_RB_BASE_LO2, ring->gpu_addr);<br>
                  +       WREG32(mmVCE_RB_BASE_HI2,
                  upper_32_bits(ring->gpu_addr));<br>
                  +       WREG32(mmVCE_RB_SIZE2, ring->ring_size /
                  4);<br>
                   <br>
                           mutex_lock(&adev->grbm_idx_mutex);<br>
                           for (idx = 0; idx < 2; ++idx) {<br>
                  -<br>
                                   if (adev->vce.harvest_config &
                  (1 << idx))<br>
                                           continue;<br>
                   <br>
                  @@ -233,48 +274,24 @@ static int vce_v3_0_start(struct
                  amdgpu_device *adev)<br>
                   <br>
                                   vce_v3_0_mc_resume(adev, idx);<br>
                   <br>
                  -               /* set BUSY flag */<br>
                  -               WREG32_P(mmVCE_STATUS, 1, ~1);<br>
                  +               WREG32_P(mmVCE_STATUS,
                  VCE_STATUS__JOB_BUSY_MASK,<br>
                  +                        ~VCE_STATUS__JOB_BUSY_MASK);<br>
                  +<br>
                                   if (adev->asic_type >=
                  CHIP_STONEY)<br>
                                           WREG32_P(mmVCE_VCPU_CNTL, 1,
                  ~0x200001);<br>
                                   else<br>
                                           WREG32_P(mmVCE_VCPU_CNTL,
                  VCE_VCPU_CNTL__CLK_EN_MASK,<br>
                                                  
                  ~VCE_VCPU_CNTL__CLK_EN_MASK);<br>
                   <br>
                  -               WREG32_P(mmVCE_SOFT_RESET,<br>
                  -                       
                  VCE_SOFT_RESET__ECPU_SOFT_RESET_MASK,<br>
                  -                       
                  ~VCE_SOFT_RESET__ECPU_SOFT_RESET_MASK);<br>
                  -<br>
                  -               mdelay(100);<br>
                  -<br>
                                   WREG32_P(mmVCE_SOFT_RESET, 0,<br>
                                          
                  ~VCE_SOFT_RESET__ECPU_SOFT_RESET_MASK);<br>
                   <br>
                  -               for (i = 0; i < 10; ++i) {<br>
                  -                       uint32_t status;<br>
                  -                       for (j = 0; j < 100; ++j) {<br>
                  -                               status =
                  RREG32(mmVCE_STATUS);<br>
                  -                               if (status & 2)<br>
                  -                                       break;<br>
                  -                               mdelay(10);<br>
                  -                       }<br>
                  -                       r = 0;<br>
                  -                       if (status & 2)<br>
                  -                               break;<br>
                  -<br>
                  -                       DRM_ERROR("VCE not responding,
                  trying to reset the ECPU!!!\n");<br>
                  -                       WREG32_P(mmVCE_SOFT_RESET,<br>
                  -                              
                  VCE_SOFT_RESET__ECPU_SOFT_RESET_MASK,<br>
                  -                              
                  ~VCE_SOFT_RESET__ECPU_SOFT_RESET_MASK);<br>
                  -                       mdelay(10);<br>
                  -                       WREG32_P(mmVCE_SOFT_RESET, 0,<br>
                  -                              
                  ~VCE_SOFT_RESET__ECPU_SOFT_RESET_MASK);<br>
                  -                       mdelay(10);<br>
                  -                       r = -1;<br>
                  -               }<br>
                  +               mdelay(100);<br>
                  +<br>
                  +               r = vce_v3_0_firmware_loaded(adev);<br>
                   <br>
                                   /* clear BUSY flag */<br>
                  -               WREG32_P(mmVCE_STATUS, 0, ~1);<br>
                  +               WREG32_P(mmVCE_STATUS, 0,
                  ~VCE_STATUS__JOB_BUSY_MASK);<br>
                   <br>
                                   /* Set Clock-Gating off */<br>
                                   if (adev->cg_flags &
                  AMD_CG_SUPPORT_VCE_MGCG)<br>
                  @@ -290,19 +307,46 @@ static int vce_v3_0_start(struct
                  amdgpu_device *adev)<br>
                           WREG32_P(mmGRBM_GFX_INDEX, 0,
                  ~GRBM_GFX_INDEX__VCE_INSTANCE_MASK);<br>
                           mutex_unlock(&adev->grbm_idx_mutex);<br>
                   <br>
                  -       ring = &adev->vce.ring[0];<br>
                  -       WREG32(mmVCE_RB_RPTR, ring->wptr);<br>
                  -       WREG32(mmVCE_RB_WPTR, ring->wptr);<br>
                  -       WREG32(mmVCE_RB_BASE_LO, ring->gpu_addr);<br>
                  -       WREG32(mmVCE_RB_BASE_HI,
                  upper_32_bits(ring->gpu_addr));<br>
                  -       WREG32(mmVCE_RB_SIZE, ring->ring_size / 4);<br>
                  +       return 0;<br>
                  +}<br>
                   <br>
                  -       ring = &adev->vce.ring[1];<br>
                  -       WREG32(mmVCE_RB_RPTR2, ring->wptr);<br>
                  -       WREG32(mmVCE_RB_WPTR2, ring->wptr);<br>
                  -       WREG32(mmVCE_RB_BASE_LO2, ring->gpu_addr);<br>
                  -       WREG32(mmVCE_RB_BASE_HI2,
                  upper_32_bits(ring->gpu_addr));<br>
                  -       WREG32(mmVCE_RB_SIZE2, ring->ring_size /
                  4);<br>
                  +static int vce_v3_0_stop(struct amdgpu_device *adev)<br>
                  +{<br>
                  +       int idx;<br>
                  +<br>
                  +       mutex_lock(&adev->grbm_idx_mutex);<br>
                  +       for (idx = 0; idx < 2; ++idx) {<br>
                  +               if (adev->vce.harvest_config &
                  (1 << idx))<br>
                  +                       continue;<br>
                  +<br>
                  +               if (idx == 0)<br>
                  +                       WREG32_P(mmGRBM_GFX_INDEX, 0,<br>
                  +                              
                  ~GRBM_GFX_INDEX__VCE_INSTANCE_MASK);<br>
                  +               else<br>
                  +                       WREG32_P(mmGRBM_GFX_INDEX,<br>
                  +                              
                  GRBM_GFX_INDEX__VCE_INSTANCE_MASK,<br>
                  +                              
                  ~GRBM_GFX_INDEX__VCE_INSTANCE_MASK);<br>
                  +<br>
                  +               if (adev->asic_type >=
                  CHIP_STONEY)<br>
                  +                       WREG32_P(mmVCE_VCPU_CNTL, 0,
                  ~0x200001);<br>
                  +               else<br>
                  +                       WREG32_P(mmVCE_VCPU_CNTL, 0,<br>
                  +                              
                  ~VCE_VCPU_CNTL__CLK_EN_MASK);<br>
                  +               /* hold on ECPU */<br>
                  +               WREG32_P(mmVCE_SOFT_RESET,<br>
                  +                       
                  VCE_SOFT_RESET__ECPU_SOFT_RESET_MASK,<br>
                  +                       
                  ~VCE_SOFT_RESET__ECPU_SOFT_RESET_MASK);<br>
                  +<br>
                  +               /* clear BUSY flag */<br>
                  +               WREG32_P(mmVCE_STATUS, 0,
                  ~VCE_STATUS__JOB_BUSY_MASK);<br>
                  +<br>
                  +               /* Set Clock-Gating off */<br>
                  +               if (adev->cg_flags &
                  AMD_CG_SUPPORT_VCE_MGCG)<br>
                  +                      
                  vce_v3_0_set_vce_sw_clock_gating(adev, false);<br>
                  +       }<br>
                  +<br>
                  +       WREG32_P(mmGRBM_GFX_INDEX, 0,
                  ~GRBM_GFX_INDEX__VCE_INSTANCE_MASK);<br>
                  +       mutex_unlock(&adev->grbm_idx_mutex);<br>
                   <br>
                           return 0;<br>
                   }<br>
                  @@ -441,7 +485,14 @@ static int vce_v3_0_hw_init(void
                  *handle)<br>
                   <br>
                   static int vce_v3_0_hw_fini(void *handle)<br>
                   {<br>
                  -       return 0;<br>
                  +       int r;<br>
                  +       struct amdgpu_device *adev = (struct
                  amdgpu_device *)handle;<br>
                  +<br>
                  +       r = vce_v3_0_wait_for_idle(handle);<br>
                  +       if (r)<br>
                  +               return r;<br>
                  +<br>
                  +       return vce_v3_0_stop(adev);<br>
                   }<br>
                   <br>
                   static int vce_v3_0_suspend(void *handle)<br>
                  -- <br>
                  1.9.1<br>
                  <br>
                </div>
              </span></div>
            <br>
            <fieldset class="mimeAttachmentHeader"></fieldset>
            <br>
            <pre wrap="">_______________________________________________
amd-gfx mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a>
</pre>
          </blockquote>
          <br>
          <br>
          <fieldset class="mimeAttachmentHeader"></fieldset>
          <br>
          <pre wrap="">_______________________________________________
amd-gfx mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a>
</pre>
        </blockquote>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>