From patchwork Tue Jun 30 18:28:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lespiau, Damien" X-Patchwork-Id: 6698011 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4F4FCC05AD for ; Tue, 30 Jun 2015 18:29:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5491D2062A for ; Tue, 30 Jun 2015 18:29:17 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5706E205FA for ; Tue, 30 Jun 2015 18:29:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B76EB6EA1F; Tue, 30 Jun 2015 11:29:15 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id 43D746EA1D for ; Tue, 30 Jun 2015 11:29:10 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 30 Jun 2015 11:29:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,379,1432623600"; d="scan'208";a="737894748" Received: from amunshi-mobl4.amr.corp.intel.com (HELO strange.amr.corp.intel.com) ([10.254.100.153]) by fmsmga001.fm.intel.com with ESMTP; 30 Jun 2015 11:29:08 -0700 From: Damien Lespiau To: intel-gfx@lists.freedesktop.org Date: Tue, 30 Jun 2015 19:28:58 +0100 Message-Id: <1435688939-26523-6-git-send-email-damien.lespiau@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1435688939-26523-1-git-send-email-damien.lespiau@intel.com> References: <1435688939-26523-1-git-send-email-damien.lespiau@intel.com> Subject: [Intel-gfx] [PATCH 5/6] drm/i915/skl: Print out if we allow DC5/DC6 in debugfs X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 Instead of following the traces, it's easier to just look at a debugfs file to figure out if the driver is allowing the CSR to go into DC states. We cache that information into the CSR structure as we don't want to read registers in D3 (for instance). Signed-off-by: Damien Lespiau --- drivers/gpu/drm/i915/i915_debugfs.c | 5 +++++ drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_runtime_pm.c | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 0af19c0..878cc7f 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -2623,6 +2623,11 @@ static int i915_dmc_info(struct seq_file *m, void *unused) seq_printf(m, "version: %d.%d\n", CSR_VERSION_MAJOR(csr->version), CSR_VERSION_MINOR(csr->version)); + mutex_lock(&csr->lock); + seq_printf(m, "DC5 allowed: %s\n", yesno(csr->dc5_allowed)); + seq_printf(m, "DC6 allowed: %s\n", yesno(csr->dc6_allowed)); + mutex_unlock(&csr->lock); + if (IS_SKYLAKE(dev) && csr->version >= CSR_VERSION(1, 6)) { seq_printf(m, "DC3 -> DC5 count: %d\n", I915_READ(SKL_CSR_DC3_DC5_COUNT)); diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 64c5184..99a09dd 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -751,6 +751,7 @@ struct intel_csr { uint32_t mmioaddr[8]; uint32_t mmiodata[8]; enum csr_state state; + bool dc5_allowed, dc6_allowed; }; #define DEV_INFO_FOR_EACH_FLAG(func, sep) \ diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c index e021b1a..bfcc990 100644 --- a/drivers/gpu/drm/i915/intel_runtime_pm.c +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c @@ -491,6 +491,7 @@ static void assert_can_disable_dc5(struct drm_i915_private *dev_priv) static void gen9_enable_dc5(struct drm_i915_private *dev_priv) { + struct intel_csr *csr = &dev_priv->csr; uint32_t val; assert_can_enable_dc5(dev_priv); @@ -504,10 +505,15 @@ static void gen9_enable_dc5(struct drm_i915_private *dev_priv) val |= DC_STATE_EN_UPTO_DC5; I915_WRITE(DC_STATE_EN, val); POSTING_READ(DC_STATE_EN); + + mutex_lock(&csr->lock); + csr->dc5_allowed = true; + mutex_unlock(&csr->lock); } static void gen9_disable_dc5(struct drm_i915_private *dev_priv) { + struct intel_csr *csr = &dev_priv->csr; uint32_t val; assert_can_disable_dc5(dev_priv); @@ -518,6 +524,10 @@ static void gen9_disable_dc5(struct drm_i915_private *dev_priv) val &= ~DC_STATE_EN_UPTO_DC5; I915_WRITE(DC_STATE_EN, val); POSTING_READ(DC_STATE_EN); + + mutex_lock(&csr->lock); + csr->dc5_allowed = false; + mutex_unlock(&csr->lock); } static void assert_can_enable_dc6(struct drm_i915_private *dev_priv) @@ -550,6 +560,7 @@ static void assert_can_disable_dc6(struct drm_i915_private *dev_priv) static void skl_enable_dc6(struct drm_i915_private *dev_priv) { + struct intel_csr *csr = &dev_priv->csr; uint32_t val; assert_can_enable_dc6(dev_priv); @@ -563,10 +574,15 @@ static void skl_enable_dc6(struct drm_i915_private *dev_priv) val |= DC_STATE_EN_UPTO_DC6; I915_WRITE(DC_STATE_EN, val); POSTING_READ(DC_STATE_EN); + + mutex_lock(&csr->lock); + csr->dc6_allowed = true; + mutex_unlock(&csr->lock); } static void skl_disable_dc6(struct drm_i915_private *dev_priv) { + struct intel_csr *csr = &dev_priv->csr; uint32_t val; if (intel_csr_load_status_get(dev_priv) != FW_LOADED) @@ -580,6 +596,10 @@ static void skl_disable_dc6(struct drm_i915_private *dev_priv) val &= ~DC_STATE_EN_UPTO_DC6; I915_WRITE(DC_STATE_EN, val); POSTING_READ(DC_STATE_EN); + + mutex_lock(&csr->lock); + csr->dc6_allowed = false; + mutex_unlock(&csr->lock); } static void skl_set_power_well(struct drm_i915_private *dev_priv,