All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Zhu, Rex" <Rex.Zhu@amd.com>
Cc: "dri-devel@lists.freedesktop.org" <dri-devel@lists.freedesktop.org>
Subject: Re: drm/amd/powerplay: show gpu load when print gpu performance for Cz. (v2)
Date: Fri, 8 Jan 2016 13:17:27 +0300	[thread overview]
Message-ID: <20160108101727.GC5177@mwanda> (raw)
In-Reply-To: <SN1PR12MB06720D97231F9BF58DBA3766FBF60@SN1PR12MB0672.namprd12.prod.outlook.com>

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@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-01-08 10:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-07 20:39 drm/amd/powerplay: show gpu load when print gpu performance for Cz. (v2) Dan Carpenter
2016-01-08  3:44 ` Zhu, Rex
2016-01-08 10:17   ` Dan Carpenter [this message]
2016-01-11  3:51 ` Zhu, Rex

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160108101727.GC5177@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=Rex.Zhu@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.