From 688d757e15e2a7142312d74748142bee1f3b6d74 Mon Sep 17 00:00:00 2001 From: Rafael Antognolli Date: Tue, 3 Jul 2018 11:38:39 -0700 Subject: [PATCH] intel/tools/dump_gpu: Add option to print ppgtt mappings. Using -vv will increase the verbosity, by printing the ppgtt mappings as they get written into the aub file. Cc: Lionel Landwerlin Reviewed-by: Lionel Landwerlin --- src/intel/tools/intel_dump_gpu.c | 25 ++++++++++++++++++++++++- src/intel/tools/intel_dump_gpu.in | 6 ++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/intel/tools/intel_dump_gpu.c b/src/intel/tools/intel_dump_gpu.c index c909d63d88f..1201fa35ae0 100644 --- a/src/intel/tools/intel_dump_gpu.c +++ b/src/intel/tools/intel_dump_gpu.c @@ -38,6 +38,7 @@ #include #include #include +#include #include "intel_aub.h" @@ -389,6 +390,11 @@ populate_ppgtt_table(struct ppgtt_table *table, int start, int end, uint64_t entries[512] = {0}; int dirty_start = 512, dirty_end = 0; + if (verbose == 2) { + printf(" PPGTT (0x%016" PRIx64 "), lvl %d, start: %x, end: %x\n", + table->phys_addr, level, start, end); + } + for (int i = start; i <= end; i++) { if (!table->subtables[i]) { dirty_start = min(dirty_start, i); @@ -396,11 +402,19 @@ populate_ppgtt_table(struct ppgtt_table *table, int start, int end, if (level == 1) { table->subtables[i] = (void *)(phys_addrs_allocator++ << 12); + if (verbose == 2) { + printf(" Adding entry: %x, phys_addr: 0x%016" PRIx64 "\n", + i, (uint64_t)table->subtables[i]); + } } else { table->subtables[i] = calloc(1, sizeof(struct ppgtt_table)); table->subtables[i]->phys_addr = phys_addrs_allocator++ << 12; + if (verbose == 2) { + printf(" Adding entry: %x, phys_addr: 0x%016" PRIx64 "\n", + i, table->subtables[i]->phys_addr); + } } } entries[i] = 3 /* read/write | present */ | @@ -434,6 +448,11 @@ map_ppgtt(uint64_t start, uint64_t size) #define L2_table(addr) (L3_table(addr)->subtables[L3_index(addr)]) #define L1_table(addr) (L2_table(addr)->subtables[L2_index(addr)]) + if (verbose == 2) { + printf(" Mapping PPGTT address: 0x%" PRIx64 ", size: %" PRIu64"\n", + start, size); + } + populate_ppgtt_table(&pml4, L4_index(l4_start), L4_index(l4_end), 4); for (uint64_t l4 = l4_start; l4 < l4_end; l4 += (1ULL << 39)) { @@ -1072,7 +1091,11 @@ maybe_init(void) config = fdopen(3, "r"); while (fscanf(config, "%m[^=]=%m[^\n]\n", &key, &value) != EOF) { if (!strcmp(key, "verbose")) { - verbose = 1; + if (!strcmp(value, "1")) { + verbose = 1; + } else if (!strcmp(value, "2")) { + verbose = 2; + } } else if (!strcmp(key, "device")) { fail_if(sscanf(value, "%i", &device) != 1, "intel_aubdump: failed to parse device id '%s'", diff --git a/src/intel/tools/intel_dump_gpu.in b/src/intel/tools/intel_dump_gpu.in index 875a67e7682..b9887f0ed2e 100755 --- a/src/intel/tools/intel_dump_gpu.in +++ b/src/intel/tools/intel_dump_gpu.in @@ -17,6 +17,8 @@ contents and execution of the GEM application. -v Enable verbose output + -vv Enable extra verbosity - dumps gtt mappings + --help Display this help message and exit EOF @@ -55,6 +57,10 @@ while true; do add_arg "verbose=1" shift 1 ;; + -vv) + add_arg "verbose=2" + shift 1 + ;; -o*) file=${1##-o} add_arg "file=${file:-$(basename ${file}).aub}" -- 2.30.2