From patchwork Fri Mar 1 22:08:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 2204941 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 4923F3FCA4 for ; Fri, 1 Mar 2013 22:14:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 49C84E67C2 for ; Fri, 1 Mar 2013 14:14:48 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from oproxy7-pub.bluehost.com (oproxy7-pub.bluehost.com [67.222.55.9]) by gabe.freedesktop.org (Postfix) with SMTP id 60476E676D for ; Fri, 1 Mar 2013 14:08:32 -0800 (PST) Received: (qmail 20323 invoked by uid 0); 1 Mar 2013 22:08:31 -0000 Received: from unknown (HELO box514.bluehost.com) (74.220.219.114) by oproxy7.bluehost.com with SMTP; 1 Mar 2013 22:08:31 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuousgeek.org; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:To:From; bh=XOLgFY0eFG+7Rzal0+Hr34mVlS+exMlQ3/VHDT1JhTY=; b=SiC/emYCIvg1cMsouiGGulrDRnO2z/8SfrKj3TEyRJwBOEJlpK9hbJ++tlhikLTdm5JgbkuDI+1f2FWTbFZZybVwN2q7KMtXB/KfnsX9X5iexeIwz5cQrrVsUiP6zAg9; Received: from [67.161.37.189] (port=37931 helo=jbarnes-desktop.intel.com) by box514.bluehost.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.80) (envelope-from ) id 1UBY7y-0005Ib-Si for intel-gfx@lists.freedesktop.org; Fri, 01 Mar 2013 15:08:31 -0700 From: Jesse Barnes To: intel-gfx@lists.freedesktop.org Date: Fri, 1 Mar 2013 14:08:25 -0800 Message-Id: <1362175722-9281-9-git-send-email-jbarnes@virtuousgeek.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1362175722-9281-1-git-send-email-jbarnes@virtuousgeek.org> References: <1362175722-9281-1-git-send-email-jbarnes@virtuousgeek.org> X-Identified-User: {10642:box514.bluehost.com:virtuous:virtuousgeek.org} {sentby:smtp auth 67.161.37.189 authed with jbarnes@virtuousgeek.org} Subject: [Intel-gfx] [PATCH 09/26] drm/i915: add power context allocation and setup on VLV 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+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org The Gunit has a separate reg for this, so allocate some stolen space for the power context and initialize the reg. Signed-off-by: Jesse Barnes --- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/i915_gem_stolen.c | 41 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/i915_reg.h | 1 + 3 files changed, 44 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 48426e1..871d7c8 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1024,6 +1024,8 @@ typedef struct drm_i915_private { struct i915_gpu_error gpu_error; + struct drm_mm_node *vlv_pctx; + /* list of fbdev register on this device */ struct intel_fbdev *fbdev; diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index 69d97cb..0d137de 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c @@ -171,11 +171,49 @@ void i915_gem_stolen_cleanup_compression(struct drm_device *dev) dev_priv->cfb_size = 0; } +static void i915_setup_pctx(struct drm_device *dev) +{ + struct drm_i915_private *dev_priv = dev->dev_private; + struct drm_mm_node *pctx; + unsigned long pctx_paddr; + int pctx_size = 24*1024; + + pctx = drm_mm_search_free(&dev_priv->mm.stolen, pctx_size, 4096, 0); + if (pctx) + pctx = drm_mm_get_block(pctx, pctx_size, 4096); + if (!pctx) + goto err; + + pctx_paddr = dev_priv->mm.stolen_base + pctx->start; + if (!pctx_paddr) + goto err_free_pctx; + + dev_priv->vlv_pctx = pctx; + I915_WRITE(VLV_PCBR, pctx_paddr); + + return; + +err_free_pctx: + drm_mm_put_block(pctx); +err: + DRM_DEBUG("not enough stolen space for PCTX, disabling\n"); +} + +static void i915_cleanup_pctx(struct drm_device *dev) +{ + struct drm_i915_private *dev_priv = dev->dev_private; + + I915_WRITE(VLV_PCBR, 0); + drm_mm_put_block(dev_priv->vlv_pctx); +} + void i915_gem_cleanup_stolen(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; i915_gem_stolen_cleanup_compression(dev); + if (IS_VALLEYVIEW(dev) && i915_powersave) + i915_cleanup_pctx(dev); drm_mm_takedown(&dev_priv->mm.stolen); } @@ -193,6 +231,9 @@ int i915_gem_init_stolen(struct drm_device *dev) /* Basic memrange allocator for stolen space */ drm_mm_init(&dev_priv->mm.stolen, 0, dev_priv->gtt.stolen_size); + if (IS_VALLEYVIEW(dev) && i915_powersave) + i915_setup_pctx(dev); + return 0; } diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 766518b..539301d 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -623,6 +623,7 @@ #define VLV_IIR (VLV_DISPLAY_BASE + 0x20a4) #define VLV_IMR (VLV_DISPLAY_BASE + 0x20a8) #define VLV_ISR (VLV_DISPLAY_BASE + 0x20ac) +#define VLV_PCBR (VLV_DISPLAY_BASE + 0x2120) #define I915_PIPE_CONTROL_NOTIFY_INTERRUPT (1<<18) #define I915_DISPLAY_PORT_INTERRUPT (1<<17) #define I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT (1<<15)