diff options
author | Ben Widawsky <benjamin.widawsky@intel.com> | 2013-09-01 11:49:12 -0700 |
---|---|---|
committer | Ben Widawsky <benjamin.widawsky@intel.com> | 2013-09-03 15:31:14 -0700 |
commit | 8adfb5886dd1128fc8c8c70c79fffbc62b0a7975 (patch) | |
tree | e8228be5e3e7c7b64f1e7ddec775beb4d76d8c7f | |
parent | a3276e9713a7014bfcd84f29fea4dceb5670f488 (diff) |
intel_gtt: Use function to get the physical address
The GTT PTEs that the tool is trying to compare is really about
addresses, and not the PTE itself. To accomplish this, make which
calculates the physical address we actually want.
This commit itself doesn't change any functionality; just the wording in
the code.
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
-rw-r--r-- | tools/intel_gtt.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/tools/intel_gtt.c b/tools/intel_gtt.c index 7885610e..32a66187 100644 --- a/tools/intel_gtt.c +++ b/tools/intel_gtt.c @@ -34,16 +34,20 @@ #include "intel_gpu_tools.h" -#define INGTT(offset) (*(volatile uint32_t *)(gtt + (offset) / (KB(4) / 4))) - #define KB(x) ((x) * 1024) #define MB(x) ((x) * 1024 * 1024) +unsigned char *gtt; + +#define INGTT(offset) (*(volatile uint32_t *)(gtt + (offset) / (KB(4) / 4))) +static uint64_t get_phys(uint32_t pt_offset) +{ + return INGTT(pt_offset); +} int main(int argc, char **argv) { struct pci_device *pci_dev; int start, aper_size; - unsigned char *gtt; uint32_t devid; int flag[] = { PCI_DEV_MAP_FLAG_WRITE_COMBINE, @@ -90,15 +94,15 @@ int main(int argc, char **argv) aper_size = pci_dev->regions[2].size; for (start = 0; start < aper_size; start += KB(4)) { - uint32_t start_pte = INGTT(start); + uint32_t start_phys = INGTT(start); uint32_t end; int constant_length = 0; int linear_length = 0; /* Check if it's a linear sequence */ for (end = start + KB(4); end < aper_size; end += KB(4)) { - uint32_t end_pte = INGTT(end); - if (end_pte == start_pte + (end - start)) + uint32_t end_phys = INGTT(end); + if (end_phys == start_phys + (end - start)) linear_length++; else break; @@ -107,27 +111,27 @@ int main(int argc, char **argv) printf("0x%08x - 0x%08x: linear from " "0x%08x to 0x%08x\n", start, end - KB(4), - start_pte, start_pte + (end - start) - KB(4)); + start_phys, start_phys + (end - start) - KB(4)); start = end - KB(4); continue; } /* Check if it's a constant sequence */ for (end = start + KB(4); end < aper_size; end += KB(4)) { - uint32_t end_pte = INGTT(end); - if (end_pte == start_pte) + uint32_t end_phys = INGTT(end); + if (end_phys == start_phys) constant_length++; else break; } if (constant_length > 0) { printf("0x%08x - 0x%08x: constant 0x%08x\n", - start, end - KB(4), start_pte); + start, end - KB(4), start_phys); start = end - KB(4); continue; } - printf("0x%08x: 0x%08x\n", start, start_pte); + printf("0x%08x: 0x%08x\n", start, start_phys); } return 0; |