From patchwork Thu May 20 21:27:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 101247 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4KLT8Bk006810 for ; Thu, 20 May 2010 21:29:43 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 15EB79E86E for ; Thu, 20 May 2010 14:29:08 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from outbound-mail-313.bluehost.com (cpoproxy3-pub.bluehost.com [67.222.54.6]) by gabe.freedesktop.org (Postfix) with SMTP id C13559E776 for ; Thu, 20 May 2010 14:28:57 -0700 (PDT) Received: (qmail 21109 invoked by uid 0); 20 May 2010 21:28:57 -0000 Received: from unknown (HELO box514.bluehost.com) (74.220.219.114) by cpoproxy3.bluehost.com with SMTP; 20 May 2010 21:28:57 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=virtuousgeek.org; h=Received:Date:From:To:Subject:Message-ID:X-Mailer:Mime-Version:Content-Type:Content-Transfer-Encoding:X-Identified-User; b=BNo6CwJpJBNea/t1gEAPr30F2d0vcmCi+9PVl8IEMXCly+uPyTH7RHHcJn9ZUx8G3y7vx/qTuJjQYiNdxD38P0UafzNZoAGoqXDfrYe/+i7HNGGLSEkaoM10aiJPnyhR; Received: from [75.110.194.140] (helo=localhost) by box514.bluehost.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) (envelope-from ) id 1OFDIW-0002Hb-VR; Thu, 20 May 2010 15:28:57 -0600 Date: Thu, 20 May 2010 14:27:23 -0700 From: Jesse Barnes To: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, Matthew Garrett , eric@anholt.net Message-ID: <20100520142723.01c217d0@virtuousgeek.org> X-Mailer: Claws Mail 3.7.5 (GTK+ 2.18.9; x86_64-redhat-linux-gnu) Mime-Version: 1.0 X-Identified-User: {10642:box514.bluehost.com:virtuous:virtuousgeek.org} {sentby:smtp auth 75.110.194.140 authed with jbarnes@virtuousgeek.org} Subject: [Intel-gfx] [PATCH 1/2] IPS driver: add GPU busy and turbo checking X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 20 May 2010 21:29:44 +0000 (UTC) diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c index c675bf2..62b1e41 100644 --- a/drivers/platform/x86/intel_ips.c +++ b/drivers/platform/x86/intel_ips.c @@ -515,7 +515,10 @@ static void ips_disable_cpu_turbo(struct ips_driver *ips) */ static bool ips_gpu_busy(struct ips_driver *ips) { - return false; + if (!ips->gpu_turbo_enabled) + return false; + + return ips->gpu_busy(); } /** @@ -627,7 +630,7 @@ static bool cpu_exceeded(struct ips_driver *ips, int cpu) avg = cpu ? ips->ctv2_avg_temp : ips->ctv1_avg_temp; if (avg > (ips->limits->core_temp_limit * 100)) ret = true; - if (ips->cpu_avg_power > ips->core_power_limit) + if (ips->cpu_avg_power > ips->core_power_limit * 100) ret = true; spin_unlock_irqrestore(&ips->turbo_status_lock, flags); @@ -652,6 +655,8 @@ static bool mch_exceeded(struct ips_driver *ips) spin_lock_irqsave(&ips->turbo_status_lock, flags); if (ips->mch_avg_temp > (ips->limits->mch_temp_limit * 100)) ret = true; + if (ips->mch_avg_power > ips->mch_power_limit) + ret = true; spin_unlock_irqrestore(&ips->turbo_status_lock, flags); return ret; @@ -747,7 +752,7 @@ static int ips_adjust(void *data) ips_disable_gpu_turbo(ips); /* We're outside our comfort zone, crank them down */ - if (!mcp_exceeded(ips)) { + if (mcp_exceeded(ips)) { ips_cpu_lower(ips); ips_gpu_lower(ips); goto sleep; @@ -808,8 +813,7 @@ static u16 read_mgtv(struct ips_driver *ips) ret = ((val * slope + 0x40) >> 7) + offset; - - return ret; + return 0; /* MCH temp reporting buggy */ } static u16 read_ptv(struct ips_driver *ips) @@ -1471,14 +1475,6 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id) if (trc & TRC_CORE2_EN) ips->second_cpu = true; - if (!ips_get_i915_syms(ips)) { - dev_err(&dev->dev, "failed to get i915 symbols, graphics turbo disabled\n"); - ips->gpu_turbo_enabled = false; - } else { - dev_dbg(&dev->dev, "graphics turbo enabled\n"); - ips->gpu_turbo_enabled = true; - } - update_turbo_limits(ips); dev_dbg(&dev->dev, "max cpu power clamp: %dW\n", ips->mcp_power_limit / 10); @@ -1488,6 +1484,14 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id) if (thm_readl(THM_PSC) & PSP_PBRT) ips->poll_turbo_status = true; + if (!ips_get_i915_syms(ips)) { + dev_err(&dev->dev, "failed to get i915 symbols, graphics turbo disabled\n"); + ips->gpu_turbo_enabled = false; + } else { + dev_dbg(&dev->dev, "graphics turbo enabled\n"); + ips->gpu_turbo_enabled = true; + } + /* * Check PLATFORM_INFO MSR to make sure this chip is * turbo capable.