mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-07-23 09:56:02 +00:00
tools/intel_gtt: Add support for gen8
Add 64bit ptes and 8MB mmiobar offset for gen8 Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Ben Widawsky <benjamin.widawsky@intel.com> Acked-by: Ben Widawsky <benjamin.widawsky@intel.com> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
This commit is contained in:
parent
5e4fc0c48c
commit
043f586958
@ -42,11 +42,31 @@
|
|||||||
unsigned char *gtt;
|
unsigned char *gtt;
|
||||||
uint32_t devid;
|
uint32_t devid;
|
||||||
|
|
||||||
#define INGTT(offset) (*(volatile uint32_t *)(gtt + (offset) / (KB(4) / 4)))
|
typedef uint32_t gen6_gtt_pte_t;
|
||||||
|
typedef uint64_t gen8_gtt_pte_t;
|
||||||
|
|
||||||
|
static gen6_gtt_pte_t gen6_gtt_pte(const unsigned i)
|
||||||
|
{
|
||||||
|
return *((volatile gen6_gtt_pte_t *)(gtt) + i);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gen8_gtt_pte_t gen8_gtt_pte(const unsigned i)
|
||||||
|
{
|
||||||
|
return *((volatile gen8_gtt_pte_t *)(gtt) + i);
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint64_t ingtt(const unsigned offset)
|
||||||
|
{
|
||||||
|
if (intel_gen(devid) < 8)
|
||||||
|
return gen6_gtt_pte(offset/KB(4));
|
||||||
|
|
||||||
|
return gen8_gtt_pte(offset/KB(4));
|
||||||
|
}
|
||||||
|
|
||||||
static uint64_t get_phys(uint32_t pt_offset)
|
static uint64_t get_phys(uint32_t pt_offset)
|
||||||
{
|
{
|
||||||
uint64_t pae = 0;
|
uint64_t pae = 0;
|
||||||
uint64_t phys = INGTT(pt_offset);
|
uint64_t phys = ingtt(pt_offset);
|
||||||
|
|
||||||
if (intel_gen(devid) < 4 && !IS_G33(devid))
|
if (intel_gen(devid) < 4 && !IS_G33(devid))
|
||||||
return phys & ~0xfff;
|
return phys & ~0xfff;
|
||||||
@ -64,6 +84,10 @@ static uint64_t get_phys(uint32_t pt_offset)
|
|||||||
else
|
else
|
||||||
pae = (phys & 0xff0) << 28;
|
pae = (phys & 0xff0) << 28;
|
||||||
break;
|
break;
|
||||||
|
case 8:
|
||||||
|
case 9:
|
||||||
|
phys = phys & 0x7ffffff000;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Unsupported platform\n");
|
fprintf(stderr, "Unsupported platform\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
@ -73,28 +97,49 @@ static uint64_t get_phys(uint32_t pt_offset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void pte_dump(int size, uint32_t offset) {
|
static void pte_dump(int size, uint32_t offset) {
|
||||||
int start;
|
int pte_size;
|
||||||
|
int entries;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
/* Want to print 4 ptes at a time (4b PTE assumed). */
|
/* Want to print 4 ptes at a time (4b PTE assumed). */
|
||||||
if (size % 16)
|
if (size % 16)
|
||||||
size = (size + 16) & ~0xffff;
|
size = (size + 16) & ~0xffff;
|
||||||
|
|
||||||
|
if (intel_gen(devid) < 8)
|
||||||
|
pte_size = 4;
|
||||||
|
else
|
||||||
|
pte_size = 8;
|
||||||
|
|
||||||
printf("GTT offset | PTEs\n");
|
entries = size / pte_size;
|
||||||
printf("--------------------------------------------------------\n");
|
|
||||||
for (start = 0; start < size; start += KB(16)) {
|
printf("GTT offset | %d PTEs (%d MB)\n", entries,
|
||||||
printf(" 0x%06x | 0x%08x 0x%08x 0x%08x 0x%08x\n",
|
entries * 4096 / 1024 / 1024);
|
||||||
start,
|
printf("----------------------------------------------------------\n");
|
||||||
INGTT(start + 0x0),
|
|
||||||
INGTT(start + 0x1000),
|
for (i = 0; i < entries; i += 4) {
|
||||||
INGTT(start + 0x2000),
|
if (intel_gen(devid) < 8) {
|
||||||
INGTT(start + 0x3000));
|
printf(" 0x%08x | 0x%08x 0x%08x 0x%08x 0x%08x\n",
|
||||||
|
KB(4 * i),
|
||||||
|
gen6_gtt_pte(i + 0),
|
||||||
|
gen6_gtt_pte(i + 1),
|
||||||
|
gen6_gtt_pte(i + 2),
|
||||||
|
gen6_gtt_pte(i + 3) );
|
||||||
|
} else {
|
||||||
|
printf(" 0x%08x | 0x%016" PRIx64 " 0x%016" PRIx64
|
||||||
|
" 0x%016" PRIx64 " 0x%016" PRIx64 " \n",
|
||||||
|
KB(4 * i),
|
||||||
|
gen8_gtt_pte(i + 0),
|
||||||
|
gen8_gtt_pte(i + 1),
|
||||||
|
gen8_gtt_pte(i + 2),
|
||||||
|
gen8_gtt_pte(i + 3) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct pci_device *pci_dev;
|
struct pci_device *pci_dev;
|
||||||
int start, gtt_size;
|
unsigned int start, gtt_size;
|
||||||
int flag[] = {
|
int flag[] = {
|
||||||
PCI_DEV_MAP_FLAG_WRITE_COMBINE,
|
PCI_DEV_MAP_FLAG_WRITE_COMBINE,
|
||||||
PCI_DEV_MAP_FLAG_WRITABLE,
|
PCI_DEV_MAP_FLAG_WRITABLE,
|
||||||
@ -119,11 +164,13 @@ int main(int argc, char **argv)
|
|||||||
(void **)>t) == 0)
|
(void **)>t) == 0)
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
int offset;
|
unsigned offset;
|
||||||
|
|
||||||
|
offset = pci_dev->regions[0].size / 2;
|
||||||
|
|
||||||
if (IS_GEN4(devid))
|
if (IS_GEN4(devid))
|
||||||
offset = KB(512);
|
offset = KB(512);
|
||||||
else
|
|
||||||
offset = MB(2);
|
|
||||||
if (pci_device_map_range(pci_dev,
|
if (pci_device_map_range(pci_dev,
|
||||||
pci_dev->regions[0].base_addr + offset,
|
pci_dev->regions[0].base_addr + offset,
|
||||||
offset,
|
offset,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user