public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ben Widawsky <benjamin.widawsky@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Ben Widawsky <ben@bwidawsk.net>,
	Ben Widawsky <benjamin.widawsky@intel.com>
Subject: [PATCH 7/7] intel_gtt: Raw PTE dumper mode
Date: Sun,  1 Sep 2013 12:51:26 -0700	[thread overview]
Message-ID: <1378065086-28705-7-git-send-email-benjamin.widawsky@intel.com> (raw)
In-Reply-To: <1378065086-28705-1-git-send-email-benjamin.widawsky@intel.com>

./tools/intel_gtt -d | head
GTT offset |                 PTEs
--------------------------------------------------------
  0x000000 | 0xe4005015 0xe2854015 0xe283e015 0xe283f015
  0x004000 | 0xe28ba015 0xe28bb015 0xe28b6015 0xe28b7015
  0x008000 | 0xe2828015 0xe2829015 0xe282a015 0xe282b015
  0x00c000 | 0xe2928015 0xe2929015 0xe292a015 0xe292b015
  0x010000 | 0xe2918015 0xe2919015 0xe291a015 0xe291b015
  0x014000 | 0xe291c015 0xe291d015 0xe291e015 0xe291f015
  0x018000 | 0xe2920015 0xe2921015 0xe2922015 0xe2923015
  0x01c000 | 0xe2924015 0xe2925015 0xe2926015 0xe2927015

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 tools/intel_gtt.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/tools/intel_gtt.c b/tools/intel_gtt.c
index acf63c1..090e88d 100644
--- a/tools/intel_gtt.c
+++ b/tools/intel_gtt.c
@@ -58,6 +58,25 @@ static uint64_t get_phys(uint32_t pt_offset)
 	return (phys | pae) & ~0xfff;
 }
 
+static void pte_dump(int size, uint32_t offset) {
+	int start;
+	/* Want to print 4 ptes at a time (4b PTE assumed). */
+	if (size % 16)
+		size = (size + 16) & ~0xffff;
+
+
+	printf("GTT offset |                 PTEs\n");
+	printf("--------------------------------------------------------\n");
+	for (start = 0; start < size; start += KB(16)) {
+		printf("  0x%06x | 0x%08x 0x%08x 0x%08x 0x%08x\n",
+				start,
+				INGTT(start + 0x0),
+				INGTT(start + 0x1000),
+				INGTT(start + 0x2000),
+				INGTT(start + 0x3000));
+	}
+}
+
 int main(int argc, char **argv)
 {
 	struct pci_device *pci_dev;
@@ -105,6 +124,10 @@ int main(int argc, char **argv)
 	}
 
 	aper_size = pci_dev->regions[2].size;
+	if (argc > 1 && !strncmp("-d", argv[1], 2)) {
+		pte_dump(aper_size, 0);
+		return 0;
+	}
 
 	for (start = 0; start < aper_size; start += KB(4)) {
 		uint64_t start_phys = get_phys(start);
-- 
1.8.4

      parent reply	other threads:[~2013-09-01 19:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-01 19:51 [PATCH 1/7] intel_reg_dumper: Silence GCC for uninitialized clock Ben Widawsky
2013-09-01 19:51 ` [PATCH 2/7] gem_vmap_blits: Demote warning to note Ben Widawsky
2013-09-01 19:51 ` [PATCH 3/7] tools/Makefile.am: use -Werror Ben Widawsky
2013-09-01 19:51 ` [PATCH 4/7] intel_gtt: Use function to get the physical address Ben Widawsky
2013-09-01 19:51 ` [PATCH 5/7] intel_gtt: Properly support gen6+ GTT PTEs Ben Widawsky
2013-09-02  7:14   ` Daniel Vetter
2013-09-01 19:51 ` [PATCH 6/7] intel_gtt: Support HSW PTEs Ben Widawsky
2013-09-01 19:51 ` Ben Widawsky [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1378065086-28705-7-git-send-email-benjamin.widawsky@intel.com \
    --to=benjamin.widawsky@intel.com \
    --cc=ben@bwidawsk.net \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox