From patchwork Mon Jun 24 17:01:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 2772361 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 E0095C0AB1 for ; Mon, 24 Jun 2013 16:58:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C001420205 for ; Mon, 24 Jun 2013 16:58:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 955CC20203 for ; Mon, 24 Jun 2013 16:58:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5246AE605C for ; Mon, 24 Jun 2013 09:58:37 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from shiva.localdomain (unknown [209.20.75.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 59984E5C73 for ; Mon, 24 Jun 2013 09:58:27 -0700 (PDT) Received: by shiva.localdomain (Postfix, from userid 99) id 0F709886A3; Mon, 24 Jun 2013 16:58:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lundgren.jf.intel.com (jfdmzpr01-ext.jf.intel.com [134.134.139.70]) by shiva.localdomain (Postfix) with ESMTPSA id 5B2AB884FB; Mon, 24 Jun 2013 16:58:26 +0000 (UTC) From: Ben Widawsky To: Intel GFX Date: Mon, 24 Jun 2013 10:01:33 -0700 Message-Id: <1372093293-27986-2-git-send-email-ben@bwidawsk.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1372093293-27986-1-git-send-email-ben@bwidawsk.net> References: <1372093293-27986-1-git-send-email-ben@bwidawsk.net> Cc: Ben Widawsky Subject: [Intel-gfx] [PATCH] drm/i915: PPGTT dump for debug 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 X-Virus-Scanned: ClamAV using ClamSMTP No users yet Signed-off-by: Ben Widawsky --- drivers/gpu/drm/i915/i915_gem_gtt.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 893007a..005358f 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -99,6 +99,37 @@ static gen6_gtt_pte_t hsw_pte_encode(dma_addr_t addr, return pte; } +void gen6_dump_ppgtt(struct i915_hw_ppgtt *ppgtt) +{ + struct drm_i915_private *dev_priv = ppgtt->base.dev->dev_private; + gen6_gtt_pte_t __iomem *pd_addr; + uint32_t pd_entry; + int i, j; + + pd_addr = (gen6_gtt_pte_t __iomem*)dev_priv->gtt.gsm + + ppgtt->pd_offset / sizeof(gen6_gtt_pte_t); + + for (i = 0; i < ppgtt->num_pd_entries; i++) { + gen6_gtt_pte_t *pt_vaddr; + dma_addr_t pt_addr = ppgtt->pt_dma_addr[i]; + pd_entry = readl(pd_addr + i); + + if (pd_entry != (u32)(GEN6_PDE_ADDR_ENCODE(pt_addr) | GEN6_PDE_VALID)) + DRM_ERROR("Actual PDE: %x Expected PDE: %x", + pd_entry, + (u32)(GEN6_PDE_ADDR_ENCODE(pt_addr) | GEN6_PDE_VALID)); + + pt_vaddr = kmap_atomic(ppgtt->pt_pages[i]); + for (j = 0; j < I915_PPGTT_PT_ENTRIES; j++) { + gen6_gtt_pte_t scratch_pte = + ppgtt->base.pte_encode(ppgtt->base.scratch.addr, + I915_CACHE_LLC); + if (pt_vaddr[j] != scratch_pte) + DRM_ERROR("\tPTE = %x (%d %d)", pt_vaddr[j], i,j); + } + kunmap_atomic(pt_vaddr); + } +} static void gen6_write_pdes(struct i915_hw_ppgtt *ppgtt) {