From patchwork Wed Oct 30 21:40:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 3117051 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 01B21BF924 for ; Wed, 30 Oct 2013 21:41:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7778C20416 for ; Wed, 30 Oct 2013 21:41:01 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C078620431 for ; Wed, 30 Oct 2013 21:40:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1C293EF02B; Wed, 30 Oct 2013 14:40:55 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by gabe.freedesktop.org (Postfix) with ESMTP id 33DF9EF02F for ; Wed, 30 Oct 2013 14:40:50 -0700 (PDT) Received: by mail-ve0-f174.google.com with SMTP id pa12so1448124veb.5 for ; Wed, 30 Oct 2013 14:40:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=80lpmsKGHAlnAUJv75MpTCYeaLalPMvOM0PH/1kWXQ0=; b=M28Sg5EQjG5XQOB+ePy6wvD2FXitwBc+T7FrPYU34eORXPwg5X8CFgSsmb1R/3eZbA CYGvTxIjMUlEifWtvQLKMdsnan9t9m1gLXZAVEnlu0Hgt4GO6kWWhULRjAoVzM4NUEhm PQ4fQ2O2DRWmCqeVpN2uV/3Gd8nEMysoGmixffEH4tXLa7edEVHvbFBduyZz7Ucuja9P vRAF91vFKyKPPVl0OxqTIN8LBVdREbO8poMlSGzhOyAoRoi0n6sv0IaIRyqnIHYabUEG 6WxQljdKKPlvFntlYmQlWSLD/LULN7qa95tjk2O0/zRYNxPuR/8AuJzXvqNSBgzYiDJj 2n1g== X-Received: by 10.220.183.199 with SMTP id ch7mr61831vcb.27.1383169249704; Wed, 30 Oct 2013 14:40:49 -0700 (PDT) Received: from localhost.localdomain ([177.133.211.156]) by mx.google.com with ESMTPSA id tn2sm95219vdc.2.2013.10.30.14.40.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Oct 2013 14:40:49 -0700 (PDT) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Wed, 30 Oct 2013 19:40:25 -0200 Message-Id: <1383169226-16707-4-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1383169226-16707-1-git-send-email-przanoni@gmail.com> References: <1383169226-16707-1-git-send-email-przanoni@gmail.com> Cc: Paulo Zanoni Subject: [Intel-gfx] [PATCH 3/4] drm/i915: get a PC8 reference when enabling the power well X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Paulo Zanoni In the current code, at haswell_modeset_global_resources, first we decide if we want to enable/disable the power well, then we decide if we want to enable/disable PC8. On the case where we're enabling PC8 this works fine, but on the case where we disable PC8 due to a non-eDP monitor being enabled, we first enable the power well and then disable PC8. Although wrong, this doesn't seem to be causing any problems now, and we don't even see anything in dmesg. But the patches for runtime D3 turn this problem into a real bug, so we need to fix it. This fixes the "modeset-non-lpsp" test from both "pc8" and "runtime_pm" tests from intel-gpu-tools. Signed-off-by: Paulo Zanoni --- drivers/gpu/drm/i915/intel_pm.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index a0c907f..5b50083 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5547,6 +5547,8 @@ static void __intel_set_power_well(struct drm_device *dev, bool enable) bool is_enabled, enable_requested; uint32_t tmp; + WARN_ON(dev_priv->pc8.enabled); + tmp = I915_READ(HSW_PWR_WELL_DRIVER); is_enabled = tmp & HSW_PWR_WELL_STATE_ENABLED; enable_requested = tmp & HSW_PWR_WELL_ENABLE_REQUEST; @@ -5591,16 +5593,24 @@ static void __intel_set_power_well(struct drm_device *dev, bool enable) static void __intel_power_well_get(struct drm_device *dev, struct i915_power_well *power_well) { - if (!power_well->count++) + struct drm_i915_private *dev_priv = dev->dev_private; + + if (!power_well->count++) { + hsw_disable_package_c8(dev_priv); __intel_set_power_well(dev, true); + } } static void __intel_power_well_put(struct drm_device *dev, struct i915_power_well *power_well) { + struct drm_i915_private *dev_priv = dev->dev_private; + WARN_ON(!power_well->count); - if (!--power_well->count) + if (!--power_well->count) { __intel_set_power_well(dev, false); + hsw_enable_package_c8(dev_priv); + } } void intel_display_power_get(struct drm_device *dev,