<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>So you didn't compare the result with AGT, but I did. The reality
      is not like your speculation.</p>
    <p><br>
    </p>
    <p>Regards,</p>
    <p>Eric<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 2018-04-04 11:50 AM, Zhu, Rex wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CY4PR12MB1687C34CD0753343A795544CFBA40@CY4PR12MB1687.namprd12.prod.outlook.com">
      <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;font-family:Calibri,Helvetica,sans-serif;"
        dir="ltr">
        <p style="margin-top:0;margin-bottom:0">If user send <span
            style="font-family: Calibri, Helvetica, sans-serif,
            EmojiFont, "Apple Color Emoji", "Segoe UI
            Emoji", NotoColorEmoji, "Segoe UI Symbol",
            "Android Emoji", EmojiSymbols; font-size:
            14.6667px;">message PPSMC_MSG_GetCurrPkgPwr, firmware will
            return the pkgpwr immediately as current power value.</span></p>
        <p style="margin-top:0;margin-bottom:0"><span
            style="font-family: Calibri, Helvetica, sans-serif,
            EmojiFont, "Apple Color Emoji", "Segoe UI
            Emoji", NotoColorEmoji, "Segoe UI Symbol",
            "Android Emoji", EmojiSymbols; font-size:
            14.6667px;">as no <span style="font-family: Calibri,
              Helvetica, sans-serif, EmojiFont, "Apple Color
              Emoji", "Segoe UI Emoji", NotoColorEmoji,
              "Segoe UI Symbol", "Android Emoji",
              EmojiSymbols; font-size: 14.6667px;">PPSMC_MSG_GetCurrPkgPwr
              support, so send message  let firmware write <span
                style="font-family: Calibri, Helvetica, sans-serif,
                EmojiFont, "Apple Color Emoji", "Segoe UI
                Emoji", NotoColorEmoji, "Segoe UI
                Symbol", "Android Emoji", EmojiSymbols;
                font-size: 14.6667px;">pkgpwr  to <span
                  style="font-family: Calibri, Helvetica, sans-serif,
                  EmojiFont, "Apple Color Emoji", "Segoe
                  UI Emoji", NotoColorEmoji, "Segoe UI
                  Symbol", "Android Emoji", EmojiSymbols;
                  font-size: 14.6667px;">ixSMU_PM_STATUS_94,</span></span></span></span></p>
        <p style="margin-top:0;margin-bottom:0"><span
            style="font-family: Calibri, Helvetica, sans-serif,
            EmojiFont, "Apple Color Emoji", "Segoe UI
            Emoji", NotoColorEmoji, "Segoe UI Symbol",
            "Android Emoji", EmojiSymbols; font-size:
            14.6667px;"><span style="font-family: Calibri, Helvetica,
              sans-serif, EmojiFont, "Apple Color Emoji",
              "Segoe UI Emoji", NotoColorEmoji, "Segoe UI
              Symbol", "Android Emoji", EmojiSymbols;
              font-size: 14.6667px;"><span style="font-family: Calibri,
                Helvetica, sans-serif, EmojiFont, "Apple Color
                Emoji", "Segoe UI Emoji", NotoColorEmoji,
                "Segoe UI Symbol", "Android Emoji",
                EmojiSymbols; font-size: 14.6667px;"><span
                  style="font-family: Calibri, Helvetica, sans-serif,
                  EmojiFont, "Apple Color Emoji", "Segoe
                  UI Emoji", NotoColorEmoji, "Segoe UI
                  Symbol", "Android Emoji", EmojiSymbols;
                  font-size: 14.6667px;">and driver delay 10ms to read <span
                    style="font-family: Calibri, Helvetica, sans-serif,
                    EmojiFont, "Apple Color Emoji",
                    "Segoe UI Emoji", NotoColorEmoji,
                    "Segoe UI Symbol", "Android
                    Emoji", EmojiSymbols; font-size: 14.6667px;">
                    ixSMU_PM_STATUS_94.</span></span></span></span></span></p>
        <p style="margin-top:0;margin-bottom:0"><br>
        </p>
        <p style="margin-top:0;margin-bottom:0">I don't think there is
          any problem. otherwise, there is same issue on polaris/vega.</p>
        <p style="margin-top:0;margin-bottom:0"><br>
        </p>
        <p style="margin-top:0;margin-bottom:0">I clean <span
            style="font-family: Calibri, Helvetica, sans-serif,
            EmojiFont, "Apple Color Emoji", "Segoe UI
            Emoji", NotoColorEmoji, "Segoe UI Symbol",
            "Android Emoji", EmojiSymbols; font-size:
            14.6667px;">
            ixSMU_PM_STATUS_94 before let smu write it.</span></p>
        <p style="margin-top:0;margin-bottom:0"><span
            style="font-family: Calibri, Helvetica, sans-serif,
            EmojiFont, "Apple Color Emoji", "Segoe UI
            Emoji", NotoColorEmoji, "Segoe UI Symbol",
            "Android Emoji", EmojiSymbols; font-size:
            14.6667px;">The delay time is enough unless we got 0 from <span
              style="font-family: Calibri, Helvetica, sans-serif,
              EmojiFont, "Apple Color Emoji", "Segoe UI
              Emoji", NotoColorEmoji, "Segoe UI Symbol",
              "Android Emoji", EmojiSymbols; font-size:
              14.6667px;">
              ixSMU_PM_STATUS_94 </span>.</span></p>
        <p style="margin-top:0;margin-bottom:0"><span
            style="font-family: Calibri, Helvetica, sans-serif,
            EmojiFont, "Apple Color Emoji", "Segoe UI
            Emoji", NotoColorEmoji, "Segoe UI Symbol",
            "Android Emoji", EmojiSymbols; font-size:
            14.6667px;"><br>
          </span></p>
        <p style="margin-top:0;margin-bottom:0"><br>
        </p>
        <p style="margin-top:0;margin-bottom:0">Best Regards</p>
        <p style="margin-top:0;margin-bottom:0">Rex</p>
        <p style="margin-top:0;margin-bottom:0"><br>
        </p>
        <br>
        <div style="color: rgb(0, 0, 0);">
          <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>From:</b>
              amd-gfx <a class="moz-txt-link-rfc2396E" href="mailto:amd-gfx-bounces@lists.freedesktop.org"><amd-gfx-bounces@lists.freedesktop.org></a> on
              behalf of Eric Huang <a class="moz-txt-link-rfc2396E" href="mailto:jinhuieric.huang@amd.com"><jinhuieric.huang@amd.com></a><br>
              <b>Sent:</b> Wednesday, April 4, 2018 11:36 PM<br>
              <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
              <b>Subject:</b> Re: [PATCH 2/3] drm/amd/pp: Refine
              get_gpu_power for VI</font>
            <div> </div>
          </div>
          <div class="BodyFragment"><font size="2"><span
                style="font-size:11pt;">
                <div class="PlainText">Sampling period is too short. The
                  power reading value will be not
                  <br>
                  aligned with AGT's. It will confuse user that why AMD
                  provides two <br>
                  different power results.<br>
                  <br>
                  Regards,<br>
                  Eric<br>
                  <br>
                  On 2018-04-04 04:25 AM, Rex Zhu wrote:<br>
                  > 1. On polaris10/11/12, Sending smu message
                  PPSMC_MSG_GetCurrPkgPwr to<br>
                  >     read currentpkgpwr directly.<br>
                  > 2. On Fiji/tonga/bonaire/hawwii, no
                  PPSMC_MSG_GetCurrPkgPwr support.<br>
                  >     Send PPSMC_MSG_PmStatusLogStart to let smu
                  write currentpkgpwr<br>
                  >     to ixSMU_PM_STATUS_94. this is asynchronous.
                  need to delay no less<br>
                  >     than 1ms.<br>
                  > 3. Clean ixSMU_PM_STATUS_94 immediately when send
                  PPSMC_MSG_PmStatusLogStart<br>
                  >     to avoid read old value.<br>
                  > 4. delay 10 ms instand of 20 ms. so the result
                  will more similar to<br>
                  >     the output of PPSMC_MSG_GetCurrPkgPwr.<br>
                  > 5. remove max power/vddc/vddci output to keep
                  consistent with vega.<br>
                  > 6. for vddc/vddci power, we can calculate the
                  average value per<br>
                  >     [10ms, 4s] in other interface if needed.<br>
                  ><br>
                  > Signed-off-by: Rex Zhu <a class="moz-txt-link-rfc2396E" href="mailto:Rex.Zhu@amd.com"><Rex.Zhu@amd.com></a><br>
                  > ---<br>
                  >  
                  drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 45
                  +++++++++++-------------<br>
                  >   1 file changed, 21 insertions(+), 24
                  deletions(-)<br>
                  ><br>
                  > diff --git
                  a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
                  b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
                  > index 40f2f87..c0ce672 100644<br>
                  > ---
                  a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
                  > +++
                  b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
                  > @@ -3363,30 +3363,27 @@ static int
                  smu7_get_pp_table_entry(struct pp_hwmgr *hwmgr,<br>
                  >   static int smu7_get_gpu_power(struct pp_hwmgr
                  *hwmgr,<br>
                  >                struct pp_gpu_power *query)<br>
                  >   {<br>
                  > -    
                  PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc(hwmgr,<br>
                  > -                    
                  PPSMC_MSG_PmStatusLogStart),<br>
                  > -                     "Failed to start pm status
                  log!",<br>
                  > -                     return -1);<br>
                  > -<br>
                  > -     msleep_interruptible(20);<br>
                  > -<br>
                  > -    
                  PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc(hwmgr,<br>
                  > -                    
                  PPSMC_MSG_PmStatusLogSample),<br>
                  > -                     "Failed to sample pm status
                  log!",<br>
                  > -                     return -1);<br>
                  > -<br>
                  > -     query->vddc_power =
                  cgs_read_ind_register(hwmgr->device,<br>
                  > -                     CGS_IND_REG__SMC,<br>
                  > -                     ixSMU_PM_STATUS_40);<br>
                  > -     query->vddci_power =
                  cgs_read_ind_register(hwmgr->device,<br>
                  > -                     CGS_IND_REG__SMC,<br>
                  > -                     ixSMU_PM_STATUS_49);<br>
                  > -     query->max_gpu_power =
                  cgs_read_ind_register(hwmgr->device,<br>
                  > -                     CGS_IND_REG__SMC,<br>
                  > -                     ixSMU_PM_STATUS_94);<br>
                  > -     query->average_gpu_power =
                  cgs_read_ind_register(hwmgr->device,<br>
                  > -                     CGS_IND_REG__SMC,<br>
                  > -                     ixSMU_PM_STATUS_95);<br>
                  > +     if (!query)<br>
                  > +             return -EINVAL;<br>
                  > +<br>
                  > +     memset(query, 0, sizeof *query);<br>
                  > +<br>
                  > +     if (hwmgr->chip_id >= CHIP_POLARIS10)
                  {<br>
                  > +             smum_send_msg_to_smc(hwmgr,
                  PPSMC_MSG_GetCurrPkgPwr);<br>
                  > +             query->average_gpu_power =
                  cgs_read_register(hwmgr->device, mmSMC_MSG_ARG_0);<br>
                  > +     } else {<br>
                  > +             smum_send_msg_to_smc(hwmgr,
                  PPSMC_MSG_PmStatusLogStart);<br>
                  > +            
                  cgs_write_ind_register(hwmgr->device,
                  CGS_IND_REG__SMC,<br>
                  > +                                    
                  ixSMU_PM_STATUS_94, 0);<br>
                  > +<br>
                  > +             msleep_interruptible(10);<br>
                  > +<br>
                  > +             smum_send_msg_to_smc(hwmgr,
                  PPSMC_MSG_PmStatusLogSample);<br>
                  > +<br>
                  > +             query->average_gpu_power =
                  cgs_read_ind_register(hwmgr->device,<br>
                  >
                  +                                                    
                  CGS_IND_REG__SMC,<br>
                  >
                  +                                                    
                  ixSMU_PM_STATUS_94);<br>
                  > +     }<br>
                  >   <br>
                  >        return 0;<br>
                  >   }<br>
                  <br>
                  _______________________________________________<br>
                  amd-gfx mailing list<br>
                  <a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
                  <a
                    href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx"
                    id="LPlnk731909" previewremoved="true"
                    moz-do-not-send="true">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a>
                  <div id="LPBorder_GT_15228562333390.979542144089784"
                    style="margin-bottom: 20px; overflow: auto; width:
                    100%; text-indent: 0px;">
                    <table
                      id="LPContainer_15228562333280.30238014676002334"
                      role="presentation" style="width: 90%;
                      background-color: rgb(255, 255, 255); position:
                      relative; overflow: auto; padding-top: 20px;
                      padding-bottom: 20px; margin-top: 20px;
                      border-top: 1px dotted rgb(200, 200, 200);
                      border-bottom: 1px dotted rgb(200, 200, 200);"
                      cellspacing="0">
                      <tbody>
                        <tr style="border-spacing: 0px;" valign="top">
                          <td
                            id="TextCell_15228562333320.0901521230341924"
                            colspan="2" style="vertical-align: top;
                            position: relative; padding: 0px; display:
                            table-cell;">
                            <div
                              id="LPTitle_15228562333330.17088493377011438"
                              style="top: 0px; color: rgb(0, 120, 215);
                              font-weight: normal; font-size: 21px;
                              font-family: wf_segoe-ui_light,
                              "Segoe UI Light", "Segoe WP
                              Light", "Segoe UI",
                              "Segoe WP", Tahoma, Arial,
                              sans-serif; line-height: 21px;">
                              <a
                                id="LPUrlAnchor_15228562333350.45851088175032095"
href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx"
                                target="_blank" style="text-decoration:
                                none;" moz-do-not-send="true">amd-gfx
                                Info Page - freedesktop.org</a></div>
                            <div
                              id="LPMetadata_15228562333360.9650973279775443"
                              style="margin: 10px 0px 16px; color:
                              rgb(102, 102, 102); font-weight: normal;
                              font-family: wf_segoe-ui_normal,
                              "Segoe UI", "Segoe
                              WP", Tahoma, Arial, sans-serif;
                              font-size: 14px; line-height: 14px;">
                              lists.freedesktop.org</div>
                            <div
                              id="LPDescription_15228562333370.9839175290800748"
                              style="display: block; color: rgb(102,
                              102, 102); font-weight: normal;
                              font-family: wf_segoe-ui_normal,
                              "Segoe UI", "Segoe
                              WP", Tahoma, Arial, sans-serif;
                              font-size: 14px; line-height: 20px;
                              max-height: 100px; overflow: hidden;">
                              Subscribing to amd-gfx: Subscribe to
                              amd-gfx by filling out the following form.
                              Use of all freedesktop.org lists is
                              subject to our Code of Conduct.</div>
                          </td>
                        </tr>
                      </tbody>
                    </table>
                  </div>
                  <br>
                  <br>
                </div>
              </span></font></div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>