From patchwork Mon May 30 09:52:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sagar.a.kamble@intel.com X-Patchwork-Id: 9140831 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1680C60757 for ; Mon, 30 May 2016 09:50:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07FF820410 for ; Mon, 30 May 2016 09:50:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE51028212; Mon, 30 May 2016 09:50:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83D6020410 for ; Mon, 30 May 2016 09:50:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 63CE16E76F; Mon, 30 May 2016 09:50:17 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 06FE36E76F for ; Mon, 30 May 2016 09:50:15 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 30 May 2016 02:50:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,389,1459839600"; d="scan'208";a="710986216" Received: from sakamble-desktop.iind.intel.com ([10.223.82.59]) by FMSMGA003.fm.intel.com with ESMTP; 30 May 2016 02:50:12 -0700 From: Sagar Arun Kamble To: intel-gfx@lists.freedesktop.org Date: Mon, 30 May 2016 15:22:31 +0530 Message-Id: <1464601951-25318-1-git-send-email-sagar.a.kamble@intel.com> X-Mailer: git-send-email 1.9.1 Cc: Zhe Wang , Akash Goel , "Satyanantha, Rama Gopal M" , Deepak S Subject: [Intel-gfx] [PATCH 1/1] drm/i915: Update GEN6_PMINTRMSK setup with GuC submission 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-Virus-Scanned: ClamAV using ClamSMTP On Loading, GuC sets PM interrupts routing (bit 31) and unmasks ARAT expired interrupt (bit 9). Host turbo also updates this register in RPS flows. This patch ensures bit 31 and bit 9 setup by GuC persists. ARAT timer interrupt is needed in GuC for various features. It also facilitates halting GuC and hence achieving RC6. PM interrupt routing will not impact RPS interrupt reception by host as GuC will redirect them. This patch fixes igt test pm_rc6_residency. Tested with SKL GuC v6.1 and BXT GuC v5.1 and v8.7. Cc: Chris Harris Cc: Zhe Wang Cc: Deepak S Cc: Satyanantha, Rama Gopal M Cc: Akash Goel Signed-off-by: Sagar Arun Kamble --- drivers/gpu/drm/i915/i915_guc_submission.c | 8 ++++++++ drivers/gpu/drm/i915/i915_irq.c | 14 ++++++++++++-- drivers/gpu/drm/i915/i915_reg.h | 3 ++- drivers/gpu/drm/i915/intel_guc.h | 3 +++ drivers/gpu/drm/i915/intel_guc_loader.c | 2 ++ drivers/gpu/drm/i915/intel_pm.c | 16 +++++++++++++++- 6 files changed, 42 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c index 169242a..4749588 100644 --- a/drivers/gpu/drm/i915/i915_guc_submission.c +++ b/drivers/gpu/drm/i915/i915_guc_submission.c @@ -941,6 +941,14 @@ void i915_guc_submission_disable(struct drm_device *dev) guc->execbuf_client = NULL; } +void i915_guc_get_pm_state(struct drm_device *dev) +{ + struct drm_i915_private *dev_priv = dev->dev_private; + struct intel_guc *guc = &dev_priv->guc; + + guc->pm_intr_mask = I915_READ(GEN6_PMINTRMSK); +} + void i915_guc_submission_fini(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index f0d9414..25c0b192 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -364,6 +364,8 @@ void gen6_enable_rps_interrupts(struct drm_i915_private *dev_priv) u32 gen6_sanitize_rps_pm_mask(struct drm_i915_private *dev_priv, u32 mask) { + struct intel_guc *guc = &dev_priv->guc; + /* * SNB,IVB can while VLV,CHV may hard hang on looping batchbuffer * if GEN6_PM_UP_EI_EXPIRED is masked. @@ -373,8 +375,16 @@ u32 gen6_sanitize_rps_pm_mask(struct drm_i915_private *dev_priv, u32 mask) if (INTEL_INFO(dev_priv)->gen <= 7 && !IS_HASWELL(dev_priv)) mask &= ~GEN6_PM_RP_UP_EI_EXPIRED; - if (INTEL_INFO(dev_priv)->gen >= 8) - mask &= ~GEN8_PMINTR_REDIRECT_TO_NON_DISP; + /* + * If PM interrupts are routed to GuC, Set mask for ARAT Expired + * interrupt based on mask set by GuC. + */ + if (INTEL_INFO(dev_priv)->gen >= 8) { + if (guc->pm_intr_mask & GEN8_PMINTR_REDIRECT_TO_NON_DISP) + mask &= guc->pm_intr_mask | ~GEN8_ARAT_EXPIRED_INT_MASK; + else + mask &= ~GEN8_PMINTR_REDIRECT_TO_NON_DISP; + } return mask; } diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 86fbf72..98c20d7 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -7030,7 +7030,8 @@ enum skl_disp_power_wells { #define VLV_RCEDATA _MMIO(0xA0BC) #define GEN6_RC6pp_THRESHOLD _MMIO(0xA0C0) #define GEN6_PMINTRMSK _MMIO(0xA168) -#define GEN8_PMINTR_REDIRECT_TO_NON_DISP (1<<31) +#define GEN8_PMINTR_REDIRECT_TO_NON_DISP (1<<31) +#define GEN8_ARAT_EXPIRED_INT_MASK (1<<9) #define VLV_PWRDWNUPCTL _MMIO(0xA294) #define GEN9_MEDIA_PG_IDLE_HYSTERESIS _MMIO(0xA0C4) #define GEN9_RENDER_PG_IDLE_HYSTERESIS _MMIO(0xA0C8) diff --git a/drivers/gpu/drm/i915/intel_guc.h b/drivers/gpu/drm/i915/intel_guc.h index 9d79c4c..65904ab 100644 --- a/drivers/gpu/drm/i915/intel_guc.h +++ b/drivers/gpu/drm/i915/intel_guc.h @@ -135,6 +135,8 @@ struct intel_guc { uint64_t submissions[GUC_MAX_ENGINES_NUM]; uint32_t last_seqno[GUC_MAX_ENGINES_NUM]; + + uint32_t pm_intr_mask; }; /* intel_guc_loader.c */ @@ -151,6 +153,7 @@ int i915_guc_submission_enable(struct drm_device *dev); int i915_guc_submit(struct i915_guc_client *client, struct drm_i915_gem_request *rq); void i915_guc_submission_disable(struct drm_device *dev); +void i915_guc_get_pm_state(struct drm_device *dev); void i915_guc_submission_fini(struct drm_device *dev); int i915_guc_wq_check_space(struct i915_guc_client *client); diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c index 23345e1..33c6046 100644 --- a/drivers/gpu/drm/i915/intel_guc_loader.c +++ b/drivers/gpu/drm/i915/intel_guc_loader.c @@ -476,6 +476,8 @@ int intel_guc_ucode_load(struct drm_device *dev) /* The execbuf_client will be recreated. Release it first. */ i915_guc_submission_disable(dev); + i915_guc_get_pm_state(dev); + err = i915_guc_submission_enable(dev); if (err) goto fail; diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index adb6463..c5e2311 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -4708,6 +4708,9 @@ void gen6_rps_busy(struct drm_i915_private *dev_priv) void gen6_rps_idle(struct drm_i915_private *dev_priv) { + struct intel_guc *guc = &dev_priv->guc; + u32 mask = 0xffffffff; + mutex_lock(&dev_priv->rps.hw_lock); if (dev_priv->rps.enabled) { if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) @@ -4715,7 +4718,18 @@ void gen6_rps_idle(struct drm_i915_private *dev_priv) else gen6_set_rps(dev_priv, dev_priv->rps.idle_freq); dev_priv->rps.last_adj = 0; - I915_WRITE(GEN6_PMINTRMSK, 0xffffffff); + + /* + * If PM interrupts are routed to GuC, Set mask for ARAT Expired + * interrupt based on mask set by GuC. + */ + if (INTEL_INFO(dev_priv)->gen >= 8) { + if (guc->pm_intr_mask & GEN8_PMINTR_REDIRECT_TO_NON_DISP) + mask &= guc->pm_intr_mask | ~GEN8_ARAT_EXPIRED_INT_MASK; + else + mask &= ~GEN8_PMINTR_REDIRECT_TO_NON_DISP; + } + I915_WRITE(GEN6_PMINTRMSK, mask); } mutex_unlock(&dev_priv->rps.hw_lock);