Re: drm/amd/powerplay: show gpu load when print gpu performance for Cz. (v2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 08, 2016 at 03:44:51AM +0000, Zhu, Rex wrote:
> Hi Dan,
> 
> It is (result == 0).
> 
> From code,  smum_send_msg_to_smc() will return negative a error code or zero.
> 
> 0  mean success.
> 

Hm..  I have investigated more and the problem is typos in
tonga_send_msg_to_smc().


drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
   183  /**
   184  * Send a message to the SMC, and wait for its response.
   185  *
   186  * @param    smumgr  the address of the powerplay hardware manager.
   187  * @param    msg the message to send.
   188  * @return   The response that came from the SMC.
   189  */
   190  static int tonga_send_msg_to_smc(struct pp_smumgr *smumgr, uint16_t msg)
   191  {
   192          if (smumgr == NULL || smumgr->device == NULL)
   193                  return -EINVAL;
   194  
   195          if (!tonga_is_smc_ram_running(smumgr))
   196                  return -1;
   197  
   198          SMUM_WAIT_FIELD_UNEQUAL(smumgr, SMC_RESP_0, SMC_RESP, 0);
   199          PP_ASSERT_WITH_CODE(
   200                  1 == SMUM_READ_FIELD(smumgr->device, SMC_RESP_0, SMC_RESP),
   201                  "Failed to send Previous Message.",
   202                  return 1);
                        ^^^^^^^^
We intended to return -EINVAL here.  (returning -1 means -EPERM but it's
sloppy to use -1 instead of -EPERM, -1 is never a valid error code).

   203  
   204          cgs_write_register(smumgr->device, mmSMC_MESSAGE_0, msg);
   205  
   206          SMUM_WAIT_FIELD_UNEQUAL(smumgr, SMC_RESP_0, SMC_RESP, 0);
   207          PP_ASSERT_WITH_CODE(
   208                  1 == SMUM_READ_FIELD(smumgr->device, SMC_RESP_0, SMC_RESP),
   209                  "Failed to send Message.",
   210                  return 1);
                        ^^^^^^^^

return -EINVAL;

   211  
   212          return 0;
   213  }

regards,
dan carpenter


_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux