dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: ben@bwidawsk.net
Cc: dri-devel@lists.freedesktop.org
Subject: re: drm/i915: Workaround to bump rc6 voltage to 450
Date: Fri, 1 Feb 2013 17:07:50 +0300	[thread overview]
Message-ID: <20130201140750.GA25600@elgon.mountain> (raw)

Hi Ben,

The patch 31643d54a739: "drm/i915: Workaround to bump rc6 voltage to 
450" from Sep 26, 2012, leads to the following warning:
"drivers/gpu/drm/i915/intel_pm.c:2662 gen6_enable_rps()
	 warn: boolean comparison inside select"

drivers/gpu/drm/i915/i915_reg.h
  4260  #define   GEN6_ENCODE_RC6_VID(mv)               (((mv) / 5) - 245) < 0 ?: 0
                  ^^^^^^^^^^^^^^^^^^^^^^
It returns either 1 or 0 depending on if mv is >= 1230.

  4261  #define   GEN6_DECODE_RC6_VID(vids)             (((vids) * 5) > 0 ? ((vids) * 5) + 245 : 0)

I think this is trying to reverse the other macro but the order of
operations are wrong.  It should be "(vids + 245) * 5".

drivers/gpu/drm/i915/intel_pm.c
  2654          rc6vids = 0;
  2655          ret = sandybridge_pcode_read(dev_priv, GEN6_PCODE_READ_RC6VIDS, &rc6vids);
  2656          if (IS_GEN6(dev) && ret) {
  2657                  DRM_DEBUG_DRIVER("Couldn't check for BIOS workaround\n");
  2658          } else if (IS_GEN6(dev) && (GEN6_DECODE_RC6_VID(rc6vids & 0xff) < 450)) {
  2659                  DRM_DEBUG_DRIVER("You should update your BIOS. Correcting minimum rc6 voltage (%dmV->%dmV)\n",
  2660                            GEN6_DECODE_RC6_VID(rc6vids & 0xff), 450);
  2661                  rc6vids &= 0xffff00;
  2662                  rc6vids |= GEN6_ENCODE_RC6_VID(450);
                                   ^^^^^^^^^^^^^^^^^^^^^^^
This is the only caller and 450 is less than 1230 we store zero.

  2663                  ret = sandybridge_pcode_write(dev_priv, GEN6_PCODE_WRITE_RC6VIDS, rc6vids);
  2664                  if (ret)
  2665                          DRM_ERROR("Couldn't fix incorrect rc6 voltage\n");
  2666          }

regards,
dan carpenter

             reply	other threads:[~2013-02-01 14:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-01 14:07 Dan Carpenter [this message]
2013-02-02  0:41 ` [PATCH] drm/i915: Fix RC6VIDS encode/devoce Ben Widawsky
2013-02-04 17:55   ` Daniel Vetter

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=20130201140750.GA25600@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=ben@bwidawsk.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox