All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] tools/aubdump: dump 48-bit addresses
@ 2018-03-30 19:56 Scott D Phillips
  2018-03-30 20:18 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Scott D Phillips @ 2018-03-30 19:56 UTC (permalink / raw)
  To: igt-dev, Jordan Justen

For gen10+, write out PPGTT tables in aub files so that full
48-bit addresses can be serialized.

Signed-off-by: Scott D Phillips <scott.d.phillips@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
---
 lib/intel_aub.h |   3 +-
 tools/aubdump.c | 276 +++++++++++++++++++++++++-------------------------------
 2 files changed, 125 insertions(+), 154 deletions(-)

diff --git a/lib/intel_aub.h b/lib/intel_aub.h
index 9ca548ed..28885150 100644
--- a/lib/intel_aub.h
+++ b/lib/intel_aub.h
@@ -117,7 +117,8 @@
 /* DW3 */
 
 #define AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_MASK		0xf0000000
-#define AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL	(1 << 28)
+#define AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT		(0 << 28)
+#define AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_PHYSICAL	(2 << 28)
 #define AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT_ENTRY	(4 << 28)
 
 /**
diff --git a/tools/aubdump.c b/tools/aubdump.c
index 267061b0..78fda93c 100644
--- a/tools/aubdump.c
+++ b/tools/aubdump.c
@@ -56,6 +56,12 @@
 	_a < _b ? _a : _b;		\
 })
 
+#define max(a, b) ({			\
+	typeof(a) _a = (a);		\
+	typeof(b) _b = (b);		\
+	_a > _b ? _a : _b;		\
+})
+
 #define HWS_PGA_RCSUNIT		0x02080
 #define HWS_PGA_VCSUNIT0	0x12080
 #define HWS_PGA_BCSUNIT		0x22080
@@ -107,12 +113,14 @@
 #define STATIC_GGTT_MAP_END (VIDEO_CONTEXT_ADDR + PPHWSP_SIZE + GEN8_LR_CONTEXT_OTHER_SIZE)
 #define STATIC_GGTT_MAP_SIZE (STATIC_GGTT_MAP_END - STATIC_GGTT_MAP_START)
 
-#define CONTEXT_FLAGS (0x229)	/* Normal Priority | L3-LLC Coherency |
-	Legacy Context with no 64 bit VA support | Valid */
+#define PML4_PHYS_ADDR ((uint64_t)(STATIC_GGTT_MAP_END))
+
+#define CONTEXT_FLAGS (0x339)	/* Normal Priority | L3-LLC Coherency |
+	PPGTT Enabled | Legacy Context with 64 bit VA support | Valid */
 
-#define RENDER_CONTEXT_DESCRIPTOR  ((uint64_t)1 << 32 | RENDER_CONTEXT_ADDR  | CONTEXT_FLAGS)
-#define BLITTER_CONTEXT_DESCRIPTOR ((uint64_t)2 << 32 | BLITTER_CONTEXT_ADDR | CONTEXT_FLAGS)
-#define VIDEO_CONTEXT_DESCRIPTOR   ((uint64_t)3 << 32 | VIDEO_CONTEXT_ADDR   | CONTEXT_FLAGS)
+#define RENDER_CONTEXT_DESCRIPTOR  ((uint64_t)1 << 62 | RENDER_CONTEXT_ADDR  | CONTEXT_FLAGS)
+#define BLITTER_CONTEXT_DESCRIPTOR ((uint64_t)2 << 62 | BLITTER_CONTEXT_ADDR | CONTEXT_FLAGS)
+#define VIDEO_CONTEXT_DESCRIPTOR   ((uint64_t)3 << 62 | VIDEO_CONTEXT_ADDR   | CONTEXT_FLAGS)
 
 static const uint32_t render_context_init[GEN10_LR_CONTEXT_RENDER_SIZE /
 					  sizeof(uint32_t)] = {
@@ -144,8 +152,8 @@ static const uint32_t render_context_init[GEN10_LR_CONTEXT_RENDER_SIZE /
 	0x2280 /* PDP2_LDW */,		0,
 	0x227C /* PDP1_UDW */,		0,
 	0x2278 /* PDP1_LDW */,		0,
-	0x2274 /* PDP0_UDW */,		0,
-	0x2270 /* PDP0_LDW */,		0,
+	0x2274 /* PDP0_UDW */,		PML4_PHYS_ADDR >> 32,
+	0x2270 /* PDP0_LDW */,		PML4_PHYS_ADDR,
 	/* MI_NOOP */
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 
@@ -182,8 +190,8 @@ static const uint32_t blitter_context_init[GEN8_LR_CONTEXT_OTHER_SIZE /
 	0x22280 /* PDP2_LDW */,		0,
 	0x2227C /* PDP1_UDW */,		0,
 	0x22278 /* PDP1_LDW */,		0,
-	0x22274 /* PDP0_UDW */,		0,
-	0x22270 /* PDP0_LDW */,		0,
+	0x22274 /* PDP0_UDW */,		PML4_PHYS_ADDR >> 32,
+	0x22270 /* PDP0_LDW */,		PML4_PHYS_ADDR,
 	/* MI_NOOP */
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 
@@ -217,8 +225,8 @@ static const uint32_t video_context_init[GEN8_LR_CONTEXT_OTHER_SIZE /
 	0x1C280 /* PDP2_LDW */,		0,
 	0x1C27C /* PDP1_UDW */,		0,
 	0x1C278 /* PDP1_LDW */,		0,
-	0x1C274 /* PDP0_UDW */,		0,
-	0x1C270 /* PDP0_LDW */,		0,
+	0x1C274 /* PDP0_UDW */,		PML4_PHYS_ADDR >> 32,
+	0x1C270 /* PDP0_LDW */,		PML4_PHYS_ADDR,
 	/* MI_NOOP */
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 
@@ -316,12 +324,6 @@ align_u32(uint32_t v, uint32_t a)
 	return (v + a - 1) & ~(a - 1);
 }
 
-static inline uint64_t
-align_u64(uint64_t v, uint64_t a)
-{
-	return (v + a - 1) & ~(a - 1);
-}
-
 static void
 dword_out(uint32_t data)
 {
@@ -382,132 +384,101 @@ register_write_out(uint32_t addr, uint32_t value)
 	dword_out(value);
 }
 
-static void
-gen8_emit_ggtt_pte_for_range(uint64_t start, uint64_t end)
-{
-	uint64_t entry_addr;
-	uint64_t page_num;
-	uint64_t end_aligned = align_u64(end, 4096);
-
-	if (start >= end || end > (1ull << 32))
-		return;
-
-	entry_addr = start & ~(4096 - 1);
-	do {
-		page_num = entry_addr >> 21;
-		uint64_t last_page_entry =
-			min((page_num + 1) << 21, end_aligned);
-		uint64_t num_entries = (last_page_entry - entry_addr) >> 12;
-		mem_trace_memory_write_header_out(
-			entry_addr >> 9, num_entries * GEN8_PTE_SIZE,
-			AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT_ENTRY);
-		while (num_entries-- > 0) {
-			dword_out((entry_addr & ~(4096 - 1)) |
-			          3 /* read/write | present */);
-			dword_out(entry_addr >> 32);
-			entry_addr += 4096;
-		}
-	} while (entry_addr < end);
-}
-
-/**
- * Sets bits `start` through `end` - 1 in the bitmap array.
- */
-static void
-set_bitmap_range(uint32_t *bitmap, uint32_t start, uint32_t end)
-{
-	uint32_t pos = start;
-	while (pos < end) {
-		const uint32_t bit = 1 << (pos & 0x1f);
-		if (bit == 1 && (end - pos) > 32) {
-			bitmap[pos >> 5] = 0xffffffff;
-			pos += 32;
-		} else {
-			bitmap[pos >> 5] |= bit;
-			pos++;
-		}
-	}
-}
-
-/**
- * Finds the next `set` (or clear) bit in the bitmap array.
- *
- * The search starts at `*start` and only checks until `end` - 1.
- *
- * If found, returns true, and the found bit index in `*start`.
- */
-static bool
-find_bitmap_bit(uint32_t *bitmap, bool set, uint32_t *start, uint32_t end)
-{
-	uint32_t pos = *start;
-	const uint32_t neg_dw = set ? 0 : -1;
-	while (pos < end) {
-		const uint32_t dw = bitmap[pos >> 5];
-		const uint32_t bit = 1 << (pos & 0x1f);
-		if (!!(dw & bit) == set) {
-			*start = pos;
-			return true;
-		} else if (bit == 1 && dw == neg_dw)
-			pos += 32;
-		else
-			pos++;
-	}
-	return false;
-}
-
-/**
- * Finds a range of clear bits within the bitmap array.
- *
- * The search starts at `*start` and only checks until `*end` - 1.
- *
- * If found, returns true, and `*start` and `*end` are set for the
- * range of clear bits.
- */
-static bool
-find_bitmap_clear_bit_range(uint32_t *bitmap, uint32_t *start, uint32_t *end)
-{
-	if (find_bitmap_bit(bitmap, false, start, *end)) {
-		uint32_t found_end = *start;
-		if (find_bitmap_bit(bitmap, true, &found_end, *end))
-			*end = found_end;
-		return true;
-	}
-	return false;
-}
-
-static void
-gen8_map_ggtt_range(uint64_t start, uint64_t end)
-{
-	uint32_t pos1, pos2, end_pos;
-	static uint32_t *bitmap = NULL;
-	if (bitmap == NULL) {
-		/* 4GiB (32-bits) of 4KiB pages (12-bits) in dwords (5-bits) */
-		bitmap = calloc(1 << (32 - 12 - 5), sizeof(*bitmap));
-		if (bitmap == NULL)
-			return;
-	}
-
-	pos1 = start >> 12;
-	end_pos = (end + 4096 - 1) >> 12;
-	while (pos1 < end_pos) {
-		pos2 = end_pos;
-		if (!find_bitmap_clear_bit_range(bitmap, &pos1, &pos2))
-			break;
-
-		if (verbose)
-			printf("MAPPING 0x%08lx-0x%08lx\n",
-			       (uint64_t)pos1 << 12, (uint64_t)pos2 << 12);
-		gen8_emit_ggtt_pte_for_range((uint64_t)pos1 << 12,
-		                             (uint64_t)pos2 << 12);
-		set_bitmap_range(bitmap, (uint64_t)pos1, (uint64_t)pos2);
-		pos1 = pos2;
-	}
-}
-
-static void
-gen8_map_base_size(uint64_t base, uint64_t size)
-{
-	gen8_map_ggtt_range(base, base + size);
-}
-
+static struct ppgtt_table {
+	uint64_t phys_addr;
+	struct ppgtt_table *subtables[512];
+} pml4 = {PML4_PHYS_ADDR};
+
+static void
+populate_ppgtt_table(struct ppgtt_table *table, int start, int end,
+		     int level)
+{
+	static uint64_t phys_addrs_allocator = (PML4_PHYS_ADDR >> 12) + 1;
+	uint64_t entries[512] = {0};
+	int dirty_start = 512, dirty_end = 0;
+
+	for (int i = start; i < end; i++) {
+		if (!table->subtables[i]) {
+			dirty_start = min(dirty_start, i);
+			dirty_end = max(dirty_end, i + 1);
+			if (level == 1) {
+				table->subtables[i] =
+					(void *)(phys_addrs_allocator++ << 12);
+			} else {
+				table->subtables[i] =
+					calloc(1, sizeof(struct ppgtt_table));
+				table->subtables[i]->phys_addr =
+					phys_addrs_allocator++ << 12;
+			}
+		}
+		entries[i] = 3 /* read/write | present */ |
+			(level == 1 ? (uint64_t)table->subtables[i] :
+			 table->subtables[i]->phys_addr);
+	}
+
+	if (dirty_start < dirty_end) {
+		uint64_t write_addr = table->phys_addr + dirty_start *
+			sizeof(uint64_t);
+		uint64_t write_size = (dirty_end - dirty_start) *
+			sizeof(uint64_t);
+		mem_trace_memory_write_header_out(write_addr, write_size,
+						  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_PHYSICAL);
+		data_out(entries + dirty_start, write_size);
+	}
+}
+
+static void
+map_ppgtt(uint64_t start, uint64_t size)
+{
+	uint64_t l4_start = start & 0xff8000000000;
+	uint64_t l3_start = start & 0xffffc0000000;
+	uint64_t l2_start = start & 0xffffffe00000;
+	uint64_t l1_start = start & 0xfffffffff000;
+	uint64_t l4_end = (start + size + (1ULL << 39) - 1) & 0xff8000000000;
+	uint64_t l3_end = (start + size + (1ULL << 30) - 1) & 0xffffc0000000;
+	uint64_t l2_end = (start + size + (1ULL << 21) - 1) & 0xffffffe00000;
+	uint64_t l1_end = (start + size + (1ULL << 12) - 1) & 0xfffffffff000;
+
+#define L4_index(addr) (((addr) >> 39) & 0x1ff)
+#define L3_index(addr) (((addr) >> 30) & 0x1ff)
+#define L2_index(addr) (((addr) >> 21) & 0x1ff)
+#define L1_index(addr) (((addr) >> 12) & 0x1ff)
+
+#define L3_table(addr) (pml4.subtables[L4_index(addr)])
+#define L2_table(addr) (L3_table(addr)->subtables[L3_index(addr)])
+#define L1_table(addr) (L2_table(addr)->subtables[L2_index(addr)])
+
+	populate_ppgtt_table(&pml4, L4_index(l4_start), L4_index(l4_end), 4);
+
+	for (uint64_t a = l4_start; a < l4_end; a += (1ULL << 39)) {
+		uint64_t _start = max(a, l3_start);
+		uint64_t _end = min(a + (1ULL << 39), l3_end);
+
+		populate_ppgtt_table(L3_table(a), L3_index(_start),
+				     L3_index(_end), 3);
+	}
+
+	for (uint64_t a = l3_start; a < l3_end; a += (1ULL << 30)) {
+		uint64_t _start = max(a, l2_start);
+		uint64_t _end = min(a + (1ULL << 30), l2_end);
+
+		populate_ppgtt_table(L2_table(a), L2_index(_start),
+				     L2_index(_end), 2);
+	}
+
+	for (uint64_t a = l2_start; a < l2_end; a += (1ULL << 21)) {
+		uint64_t _start = max(a, l1_start);
+		uint64_t _end = min(a + (1ULL << 21), l1_end);
+
+		populate_ppgtt_table(L1_table(a), L1_index(_start),
+				     L1_index(_end), 1);
+	}
+}
+
+static uint64_t
+ppgtt_lookup(uint64_t ppgtt_addr)
+{
+	return (uint64_t)L1_table(ppgtt_addr)->subtables[L1_index(ppgtt_addr)];
+}
+
 static void
@@ -524,26 +495,33 @@ gen10_write_header(void)
 	dwords = 5 + app_name_len / sizeof(uint32_t);
 	dword_out(CMD_MEM_TRACE_VERSION | (dwords - 1));
 	dword_out(AUB_MEM_TRACE_VERSION_FILE_VERSION);
-	dword_out(AUB_MEM_TRACE_VERSION_DEVICE_CNL |
-		  AUB_MEM_TRACE_VERSION_METHOD_PHY);
+	dword_out(AUB_MEM_TRACE_VERSION_DEVICE_CNL);
 	dword_out(0);		/* version */
 	dword_out(0);		/* version */
 	data_out(app_name, app_name_len);
 
+	/* GGTT PT */
+	uint32_t ggtt_ptes = STATIC_GGTT_MAP_SIZE >> 12;
+
+	mem_trace_memory_write_header_out(STATIC_GGTT_MAP_START >> 12,
+					  ggtt_ptes * GEN8_PTE_SIZE,
+					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT_ENTRY);
+	for (uint32_t i = 0; i < ggtt_ptes; i++) {
+		dword_out(3 + 0x1000 * i + STATIC_GGTT_MAP_START);
+		dword_out(0);
+	}
+
 	/* RENDER_RING */
-	gen8_map_base_size(RENDER_RING_ADDR, RING_SIZE);
 	mem_trace_memory_write_header_out(RENDER_RING_ADDR, RING_SIZE,
-					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
+					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT);
 	for (uint32_t i = 0; i < RING_SIZE; i += sizeof(uint32_t))
 		dword_out(0);
 
 	/* RENDER_PPHWSP */
-	gen8_map_base_size(RENDER_CONTEXT_ADDR,
-	                   PPHWSP_SIZE + sizeof(render_context_init));
 	mem_trace_memory_write_header_out(RENDER_CONTEXT_ADDR,
 					  PPHWSP_SIZE +
 					  sizeof(render_context_init),
-					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
+					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT);
 	for (uint32_t i = 0; i < PPHWSP_SIZE; i += sizeof(uint32_t))
 		dword_out(0);
 
@@ -551,19 +529,16 @@ gen10_write_header(void)
 	data_out(render_context_init, sizeof(render_context_init));
 
 	/* BLITTER_RING */
-	gen8_map_base_size(BLITTER_RING_ADDR, RING_SIZE);
 	mem_trace_memory_write_header_out(BLITTER_RING_ADDR, RING_SIZE,
-					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
+					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT);
 	for (uint32_t i = 0; i < RING_SIZE; i += sizeof(uint32_t))
 		dword_out(0);
 
 	/* BLITTER_PPHWSP */
-	gen8_map_base_size(BLITTER_CONTEXT_ADDR,
-	                   PPHWSP_SIZE + sizeof(blitter_context_init));
 	mem_trace_memory_write_header_out(BLITTER_CONTEXT_ADDR,
 					  PPHWSP_SIZE +
 					  sizeof(blitter_context_init),
-					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
+					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT);
 	for (uint32_t i = 0; i < PPHWSP_SIZE; i += sizeof(uint32_t))
 		dword_out(0);
 
@@ -571,19 +546,16 @@ gen10_write_header(void)
 	data_out(blitter_context_init, sizeof(blitter_context_init));
 
 	/* VIDEO_RING */
-	gen8_map_base_size(VIDEO_RING_ADDR, RING_SIZE);
 	mem_trace_memory_write_header_out(VIDEO_RING_ADDR, RING_SIZE,
-					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
+					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT);
 	for (uint32_t i = 0; i < RING_SIZE; i += sizeof(uint32_t))
 		dword_out(0);
 
 	/* VIDEO_PPHWSP */
-	gen8_map_base_size(VIDEO_CONTEXT_ADDR,
-	                   PPHWSP_SIZE + sizeof(video_context_init));
 	mem_trace_memory_write_header_out(VIDEO_CONTEXT_ADDR,
 					  PPHWSP_SIZE +
 					  sizeof(video_context_init),
-					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
+					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT);
 	for (uint32_t i = 0; i < PPHWSP_SIZE; i += sizeof(uint32_t))
 		dword_out(0);
 
@@ -654,15 +626,13 @@ aub_write_trace_block(uint32_t type, void *virtual, uint32_t size, uint64_t gtt_
 	static const char null_block[8 * 4096];
 
 	for (uint32_t offset = 0; offset < size; offset += block_size) {
-		block_size = size - offset;
-
-		if (block_size > 8 * 4096)
-			block_size = 8 * 4096;
+		block_size = min(8 * 4096, size - offset);
 
 		if (gen >= 10) {
-			mem_trace_memory_write_header_out(gtt_offset + offset,
+			block_size = min(4096, block_size);
+			mem_trace_memory_write_header_out(ppgtt_lookup(gtt_offset + offset),
 							  block_size,
-							  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
+							  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_PHYSICAL);
 		} else {
 			dword_out(CMD_AUB_TRACE_HEADER_BLOCK |
 				  ((addr_bits > 32 ? 6 : 5) - 2));
@@ -750,17 +720,17 @@ aub_dump_execlist(uint64_t batch_offset, int ring_flag)
 	}
 
 	mem_trace_memory_write_header_out(ring_addr, 16,
-					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
-	dword_out(AUB_MI_BATCH_BUFFER_START | (3 - 2));
+					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT);
+	dword_out(AUB_MI_BATCH_BUFFER_START | /* ppgtt */ 0x100 | (3 - 2));
 	dword_out(batch_offset & 0xFFFFFFFF);
 	dword_out(batch_offset >> 32);
 	dword_out(0 /* MI_NOOP */);
 
 	mem_trace_memory_write_header_out(ring_addr + 8192 + 20, 4,
-					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
+					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT);
 	dword_out(0); /* RING_BUFFER_HEAD */
 	mem_trace_memory_write_header_out(ring_addr + 8192 + 28, 4,
-					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
+					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT);
 	dword_out(16); /* RING_BUFFER_TAIL */
 
 	if (gen >= 11) {
@@ -936,7 +906,7 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2)
 	}
 
 	if (gen >= 10)
-		offset = STATIC_GGTT_MAP_END;
+		offset = 0x1000;
 	else
 		offset = gtt_size();
 
@@ -976,7 +946,7 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2)
 		fail_if(bo->map == MAP_FAILED, "intel_aubdump: bo mmap failed\n");
 
 		if (gen >= 10)
-			gen8_map_ggtt_range(bo->offset, bo->offset + bo->size);
+			map_ppgtt(bo->offset, bo->size);
 	}
 
 	batch_index = (execbuffer2->flags & I915_EXEC_BATCH_FIRST) ? 0 :
-- 
2.14.3

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for tools/aubdump: dump 48-bit addresses
  2018-03-30 19:56 [igt-dev] [PATCH i-g-t] tools/aubdump: dump 48-bit addresses Scott D Phillips
@ 2018-03-30 20:18 ` Patchwork
  2018-03-30 20:50 ` [igt-dev] [PATCH i-g-t] " Scott D Phillips
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2018-03-30 20:18 UTC (permalink / raw)
  To: Scott D Phillips; +Cc: igt-dev

== Series Details ==

Series: tools/aubdump: dump 48-bit addresses
URL   : https://patchwork.freedesktop.org/series/40972/
State : success

== Summary ==

IGT patchset tested on top of latest successful build
2cbd4ddf11b3eaf01f33d8bc2ad46411ec6c299a lib/igt_kms: Improve connector probing in igt_display_init(), v2.

with latest DRM-Tip kernel build CI_DRM_4013
c46052cde6a5 drm-tip: 2018y-03m-30d-18h-56m-26s UTC integration manifest

No testlist changes.

---- Known issues:

Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-c:
                pass       -> INCOMPLETE (fi-bxt-dsi) fdo#103927

fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927

fi-bdw-5557u     total:285  pass:264  dwarn:0   dfail:0   fail:0   skip:21  time:436s
fi-bdw-gvtdvm    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:443s
fi-blb-e6850     total:285  pass:220  dwarn:1   dfail:0   fail:0   skip:64  time:382s
fi-bsw-n3050     total:285  pass:239  dwarn:0   dfail:0   fail:0   skip:46  time:540s
fi-bwr-2160      total:285  pass:180  dwarn:0   dfail:0   fail:0   skip:105 time:297s
fi-bxt-dsi       total:243  pass:216  dwarn:0   dfail:0   fail:0   skip:26 
fi-bxt-j4205     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:514s
fi-byt-j1900     total:285  pass:250  dwarn:0   dfail:0   fail:0   skip:35  time:521s
fi-byt-n2820     total:285  pass:246  dwarn:0   dfail:0   fail:0   skip:39  time:519s
fi-cfl-8700k     total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:413s
fi-cfl-s3        total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:560s
fi-cfl-u         total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:513s
fi-cnl-y3        total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:586s
fi-elk-e7500     total:285  pass:225  dwarn:1   dfail:0   fail:0   skip:59  time:420s
fi-gdg-551       total:285  pass:176  dwarn:0   dfail:0   fail:1   skip:108 time:319s
fi-glk-1         total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:542s
fi-hsw-4770      total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:404s
fi-ilk-650       total:285  pass:225  dwarn:0   dfail:0   fail:0   skip:60  time:423s
fi-ivb-3520m     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:471s
fi-ivb-3770      total:285  pass:252  dwarn:0   dfail:0   fail:0   skip:33  time:433s
fi-kbl-7500u     total:285  pass:260  dwarn:1   dfail:0   fail:0   skip:24  time:469s
fi-kbl-7567u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:463s
fi-kbl-r         total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:508s
fi-pnv-d510      total:285  pass:219  dwarn:1   dfail:0   fail:0   skip:65  time:660s
fi-skl-6260u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:439s
fi-skl-6600u     total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:537s
fi-skl-6700k2    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:499s
fi-skl-6770hq    total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:516s
fi-skl-guc       total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:431s
fi-skl-gvtdvm    total:285  pass:262  dwarn:0   dfail:0   fail:0   skip:23  time:447s
fi-snb-2520m     total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:590s
fi-snb-2600      total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:404s
Blacklisted hosts:
fi-cnl-psr       total:285  pass:256  dwarn:3   dfail:0   fail:0   skip:26  time:511s
fi-glk-j4005     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:483s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1213/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] tools/aubdump: dump 48-bit addresses
  2018-03-30 19:56 [igt-dev] [PATCH i-g-t] tools/aubdump: dump 48-bit addresses Scott D Phillips
  2018-03-30 20:18 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
@ 2018-03-30 20:50 ` Scott D Phillips
  2018-03-30 21:08 ` [igt-dev] ✗ Fi.CI.IGT: warning for " Patchwork
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Scott D Phillips @ 2018-03-30 20:50 UTC (permalink / raw)
  To: igt-dev, Jordan Justen

Scott D Phillips <scott.d.phillips@intel.com> writes:

> For gen10+, write out PPGTT tables in aub files so that full
> 48-bit addresses can be serialized.
>
> Signed-off-by: Scott D Phillips <scott.d.phillips@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> ---
>  lib/intel_aub.h |   3 +-
>  tools/aubdump.c | 276 +++++++++++++++++++++++++-------------------------------
>  2 files changed, 125 insertions(+), 154 deletions(-)
>
> diff --git a/lib/intel_aub.h b/lib/intel_aub.h
> index 9ca548ed..28885150 100644
> --- a/lib/intel_aub.h
> +++ b/lib/intel_aub.h
> @@ -117,7 +117,8 @@
>  /* DW3 */
>  
>  #define AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_MASK		0xf0000000
> -#define AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL	(1 << 28)
> +#define AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT		(0 << 28)
> +#define AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_PHYSICAL	(2 << 28)
>  #define AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT_ENTRY	(4 << 28)
>  
>  /**
> diff --git a/tools/aubdump.c b/tools/aubdump.c
> index 267061b0..78fda93c 100644
> --- a/tools/aubdump.c
> +++ b/tools/aubdump.c
> @@ -56,6 +56,12 @@
>  	_a < _b ? _a : _b;		\
>  })
>  
> +#define max(a, b) ({			\
> +	typeof(a) _a = (a);		\
> +	typeof(b) _b = (b);		\
> +	_a > _b ? _a : _b;		\
> +})
> +
>  #define HWS_PGA_RCSUNIT		0x02080
>  #define HWS_PGA_VCSUNIT0	0x12080
>  #define HWS_PGA_BCSUNIT		0x22080
> @@ -107,12 +113,14 @@
>  #define STATIC_GGTT_MAP_END (VIDEO_CONTEXT_ADDR + PPHWSP_SIZE + GEN8_LR_CONTEXT_OTHER_SIZE)
>  #define STATIC_GGTT_MAP_SIZE (STATIC_GGTT_MAP_END - STATIC_GGTT_MAP_START)
>  
> -#define CONTEXT_FLAGS (0x229)	/* Normal Priority | L3-LLC Coherency |
> -	Legacy Context with no 64 bit VA support | Valid */
> +#define PML4_PHYS_ADDR ((uint64_t)(STATIC_GGTT_MAP_END))
> +
> +#define CONTEXT_FLAGS (0x339)	/* Normal Priority | L3-LLC Coherency |
> +	PPGTT Enabled | Legacy Context with 64 bit VA support | Valid */
>  
> -#define RENDER_CONTEXT_DESCRIPTOR  ((uint64_t)1 << 32 | RENDER_CONTEXT_ADDR  | CONTEXT_FLAGS)
> -#define BLITTER_CONTEXT_DESCRIPTOR ((uint64_t)2 << 32 | BLITTER_CONTEXT_ADDR | CONTEXT_FLAGS)
> -#define VIDEO_CONTEXT_DESCRIPTOR   ((uint64_t)3 << 32 | VIDEO_CONTEXT_ADDR   | CONTEXT_FLAGS)
> +#define RENDER_CONTEXT_DESCRIPTOR  ((uint64_t)1 << 62 | RENDER_CONTEXT_ADDR  | CONTEXT_FLAGS)
> +#define BLITTER_CONTEXT_DESCRIPTOR ((uint64_t)2 << 62 | BLITTER_CONTEXT_ADDR | CONTEXT_FLAGS)
> +#define VIDEO_CONTEXT_DESCRIPTOR   ((uint64_t)3 << 62 | VIDEO_CONTEXT_ADDR   | CONTEXT_FLAGS)
>  
>  static const uint32_t render_context_init[GEN10_LR_CONTEXT_RENDER_SIZE /
>  					  sizeof(uint32_t)] = {
> @@ -144,8 +152,8 @@ static const uint32_t render_context_init[GEN10_LR_CONTEXT_RENDER_SIZE /
>  	0x2280 /* PDP2_LDW */,		0,
>  	0x227C /* PDP1_UDW */,		0,
>  	0x2278 /* PDP1_LDW */,		0,
> -	0x2274 /* PDP0_UDW */,		0,
> -	0x2270 /* PDP0_LDW */,		0,
> +	0x2274 /* PDP0_UDW */,		PML4_PHYS_ADDR >> 32,
> +	0x2270 /* PDP0_LDW */,		PML4_PHYS_ADDR,
>  	/* MI_NOOP */
>  	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
>  
> @@ -182,8 +190,8 @@ static const uint32_t blitter_context_init[GEN8_LR_CONTEXT_OTHER_SIZE /
>  	0x22280 /* PDP2_LDW */,		0,
>  	0x2227C /* PDP1_UDW */,		0,
>  	0x22278 /* PDP1_LDW */,		0,
> -	0x22274 /* PDP0_UDW */,		0,
> -	0x22270 /* PDP0_LDW */,		0,
> +	0x22274 /* PDP0_UDW */,		PML4_PHYS_ADDR >> 32,
> +	0x22270 /* PDP0_LDW */,		PML4_PHYS_ADDR,
>  	/* MI_NOOP */
>  	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
>  
> @@ -217,8 +225,8 @@ static const uint32_t video_context_init[GEN8_LR_CONTEXT_OTHER_SIZE /
>  	0x1C280 /* PDP2_LDW */,		0,
>  	0x1C27C /* PDP1_UDW */,		0,
>  	0x1C278 /* PDP1_LDW */,		0,
> -	0x1C274 /* PDP0_UDW */,		0,
> -	0x1C270 /* PDP0_LDW */,		0,
> +	0x1C274 /* PDP0_UDW */,		PML4_PHYS_ADDR >> 32,
> +	0x1C270 /* PDP0_LDW */,		PML4_PHYS_ADDR,
>  	/* MI_NOOP */
>  	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
>  
> @@ -316,12 +324,6 @@ align_u32(uint32_t v, uint32_t a)
>  	return (v + a - 1) & ~(a - 1);
>  }
>  
> -static inline uint64_t
> -align_u64(uint64_t v, uint64_t a)
> -{
> -	return (v + a - 1) & ~(a - 1);
> -}
> -
>  static void
>  dword_out(uint32_t data)
>  {
> @@ -382,132 +384,101 @@ register_write_out(uint32_t addr, uint32_t value)
>  	dword_out(value);
>  }
>  
> -static void
> -gen8_emit_ggtt_pte_for_range(uint64_t start, uint64_t end)
> -{
> -	uint64_t entry_addr;
> -	uint64_t page_num;
> -	uint64_t end_aligned = align_u64(end, 4096);
> -
> -	if (start >= end || end > (1ull << 32))
> -		return;
> -
> -	entry_addr = start & ~(4096 - 1);
> -	do {
> -		page_num = entry_addr >> 21;
> -		uint64_t last_page_entry =
> -			min((page_num + 1) << 21, end_aligned);
> -		uint64_t num_entries = (last_page_entry - entry_addr) >> 12;
> -		mem_trace_memory_write_header_out(
> -			entry_addr >> 9, num_entries * GEN8_PTE_SIZE,
> -			AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT_ENTRY);
> -		while (num_entries-- > 0) {
> -			dword_out((entry_addr & ~(4096 - 1)) |
> -			          3 /* read/write | present */);
> -			dword_out(entry_addr >> 32);
> -			entry_addr += 4096;
> -		}
> -	} while (entry_addr < end);
> -}
> -
> -/**
> - * Sets bits `start` through `end` - 1 in the bitmap array.
> - */
> -static void
> -set_bitmap_range(uint32_t *bitmap, uint32_t start, uint32_t end)
> -{
> -	uint32_t pos = start;
> -	while (pos < end) {
> -		const uint32_t bit = 1 << (pos & 0x1f);
> -		if (bit == 1 && (end - pos) > 32) {
> -			bitmap[pos >> 5] = 0xffffffff;
> -			pos += 32;
> -		} else {
> -			bitmap[pos >> 5] |= bit;
> -			pos++;
> -		}
> -	}
> -}
> -
> -/**
> - * Finds the next `set` (or clear) bit in the bitmap array.
> - *
> - * The search starts at `*start` and only checks until `end` - 1.
> - *
> - * If found, returns true, and the found bit index in `*start`.
> - */
> -static bool
> -find_bitmap_bit(uint32_t *bitmap, bool set, uint32_t *start, uint32_t end)
> -{
> -	uint32_t pos = *start;
> -	const uint32_t neg_dw = set ? 0 : -1;
> -	while (pos < end) {
> -		const uint32_t dw = bitmap[pos >> 5];
> -		const uint32_t bit = 1 << (pos & 0x1f);
> -		if (!!(dw & bit) == set) {
> -			*start = pos;
> -			return true;
> -		} else if (bit == 1 && dw == neg_dw)
> -			pos += 32;
> -		else
> -			pos++;
> -	}
> -	return false;
> -}
> -
> -/**
> - * Finds a range of clear bits within the bitmap array.
> - *
> - * The search starts at `*start` and only checks until `*end` - 1.
> - *
> - * If found, returns true, and `*start` and `*end` are set for the
> - * range of clear bits.
> - */
> -static bool
> -find_bitmap_clear_bit_range(uint32_t *bitmap, uint32_t *start, uint32_t *end)
> -{
> -	if (find_bitmap_bit(bitmap, false, start, *end)) {
> -		uint32_t found_end = *start;
> -		if (find_bitmap_bit(bitmap, true, &found_end, *end))
> -			*end = found_end;
> -		return true;
> -	}
> -	return false;
> -}
> -
> -static void
> -gen8_map_ggtt_range(uint64_t start, uint64_t end)
> -{
> -	uint32_t pos1, pos2, end_pos;
> -	static uint32_t *bitmap = NULL;
> -	if (bitmap == NULL) {
> -		/* 4GiB (32-bits) of 4KiB pages (12-bits) in dwords (5-bits) */
> -		bitmap = calloc(1 << (32 - 12 - 5), sizeof(*bitmap));
> -		if (bitmap == NULL)
> -			return;
> -	}
> -
> -	pos1 = start >> 12;
> -	end_pos = (end + 4096 - 1) >> 12;
> -	while (pos1 < end_pos) {
> -		pos2 = end_pos;
> -		if (!find_bitmap_clear_bit_range(bitmap, &pos1, &pos2))
> -			break;
> -
> -		if (verbose)
> -			printf("MAPPING 0x%08lx-0x%08lx\n",
> -			       (uint64_t)pos1 << 12, (uint64_t)pos2 << 12);
> -		gen8_emit_ggtt_pte_for_range((uint64_t)pos1 << 12,
> -		                             (uint64_t)pos2 << 12);
> -		set_bitmap_range(bitmap, (uint64_t)pos1, (uint64_t)pos2);
> -		pos1 = pos2;
> -	}
> -}
> -
> -static void
> -gen8_map_base_size(uint64_t base, uint64_t size)
> -{
> -	gen8_map_ggtt_range(base, base + size);
> -}
> -
> +static struct ppgtt_table {
> +	uint64_t phys_addr;
> +	struct ppgtt_table *subtables[512];
> +} pml4 = {PML4_PHYS_ADDR};
> +
> +static void
> +populate_ppgtt_table(struct ppgtt_table *table, int start, int end,
> +		     int level)
> +{
> +	static uint64_t phys_addrs_allocator = (PML4_PHYS_ADDR >> 12) + 1;
> +	uint64_t entries[512] = {0};
> +	int dirty_start = 512, dirty_end = 0;

end is one past the last element to populate, in the range [1, 512]. The
bit masks that generate it in map_ppgtt will alias 512 to zero. So this
needs:

	if (end == 0)
		end = 512;

> +
> +	for (int i = start; i < end; i++) {
> +		if (!table->subtables[i]) {
> +			dirty_start = min(dirty_start, i);
> +			dirty_end = max(dirty_end, i + 1);
> +			if (level == 1) {
> +				table->subtables[i] =
> +					(void *)(phys_addrs_allocator++ << 12);
> +			} else {
> +				table->subtables[i] =
> +					calloc(1, sizeof(struct ppgtt_table));
> +				table->subtables[i]->phys_addr =
> +					phys_addrs_allocator++ << 12;
> +			}
> +		}
> +		entries[i] = 3 /* read/write | present */ |
> +			(level == 1 ? (uint64_t)table->subtables[i] :
> +			 table->subtables[i]->phys_addr);
> +	}
> +
> +	if (dirty_start < dirty_end) {
> +		uint64_t write_addr = table->phys_addr + dirty_start *
> +			sizeof(uint64_t);
> +		uint64_t write_size = (dirty_end - dirty_start) *
> +			sizeof(uint64_t);
> +		mem_trace_memory_write_header_out(write_addr, write_size,
> +						  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_PHYSICAL);
> +		data_out(entries + dirty_start, write_size);
> +	}
> +}
> +
> +static void
> +map_ppgtt(uint64_t start, uint64_t size)
> +{
> +	uint64_t l4_start = start & 0xff8000000000;
> +	uint64_t l3_start = start & 0xffffc0000000;
> +	uint64_t l2_start = start & 0xffffffe00000;
> +	uint64_t l1_start = start & 0xfffffffff000;
> +	uint64_t l4_end = (start + size + (1ULL << 39) - 1) & 0xff8000000000;
> +	uint64_t l3_end = (start + size + (1ULL << 30) - 1) & 0xffffc0000000;
> +	uint64_t l2_end = (start + size + (1ULL << 21) - 1) & 0xffffffe00000;
> +	uint64_t l1_end = (start + size + (1ULL << 12) - 1) & 0xfffffffff000;
> +
> +#define L4_index(addr) (((addr) >> 39) & 0x1ff)
> +#define L3_index(addr) (((addr) >> 30) & 0x1ff)
> +#define L2_index(addr) (((addr) >> 21) & 0x1ff)
> +#define L1_index(addr) (((addr) >> 12) & 0x1ff)
> +
> +#define L3_table(addr) (pml4.subtables[L4_index(addr)])
> +#define L2_table(addr) (L3_table(addr)->subtables[L3_index(addr)])
> +#define L1_table(addr) (L2_table(addr)->subtables[L2_index(addr)])
> +
> +	populate_ppgtt_table(&pml4, L4_index(l4_start), L4_index(l4_end), 4);
> +
> +	for (uint64_t a = l4_start; a < l4_end; a += (1ULL << 39)) {
> +		uint64_t _start = max(a, l3_start);
> +		uint64_t _end = min(a + (1ULL << 39), l3_end);
> +
> +		populate_ppgtt_table(L3_table(a), L3_index(_start),
> +				     L3_index(_end), 3);
> +	}
> +
> +	for (uint64_t a = l3_start; a < l3_end; a += (1ULL << 30)) {
> +		uint64_t _start = max(a, l2_start);
> +		uint64_t _end = min(a + (1ULL << 30), l2_end);
> +
> +		populate_ppgtt_table(L2_table(a), L2_index(_start),
> +				     L2_index(_end), 2);
> +	}
> +
> +	for (uint64_t a = l2_start; a < l2_end; a += (1ULL << 21)) {
> +		uint64_t _start = max(a, l1_start);
> +		uint64_t _end = min(a + (1ULL << 21), l1_end);
> +
> +		populate_ppgtt_table(L1_table(a), L1_index(_start),
> +				     L1_index(_end), 1);
> +	}
> +}
> +
> +static uint64_t
> +ppgtt_lookup(uint64_t ppgtt_addr)
> +{
> +	return (uint64_t)L1_table(ppgtt_addr)->subtables[L1_index(ppgtt_addr)];
> +}
> +
>  static void
> @@ -524,26 +495,33 @@ gen10_write_header(void)
>  	dwords = 5 + app_name_len / sizeof(uint32_t);
>  	dword_out(CMD_MEM_TRACE_VERSION | (dwords - 1));
>  	dword_out(AUB_MEM_TRACE_VERSION_FILE_VERSION);
> -	dword_out(AUB_MEM_TRACE_VERSION_DEVICE_CNL |
> -		  AUB_MEM_TRACE_VERSION_METHOD_PHY);
> +	dword_out(AUB_MEM_TRACE_VERSION_DEVICE_CNL);
>  	dword_out(0);		/* version */
>  	dword_out(0);		/* version */
>  	data_out(app_name, app_name_len);
>  
> +	/* GGTT PT */
> +	uint32_t ggtt_ptes = STATIC_GGTT_MAP_SIZE >> 12;
> +
> +	mem_trace_memory_write_header_out(STATIC_GGTT_MAP_START >> 12,
> +					  ggtt_ptes * GEN8_PTE_SIZE,
> +					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT_ENTRY);
> +	for (uint32_t i = 0; i < ggtt_ptes; i++) {
> +		dword_out(3 + 0x1000 * i + STATIC_GGTT_MAP_START);
> +		dword_out(0);
> +	}
> +
>  	/* RENDER_RING */
> -	gen8_map_base_size(RENDER_RING_ADDR, RING_SIZE);
>  	mem_trace_memory_write_header_out(RENDER_RING_ADDR, RING_SIZE,
> -					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
> +					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT);
>  	for (uint32_t i = 0; i < RING_SIZE; i += sizeof(uint32_t))
>  		dword_out(0);
>  
>  	/* RENDER_PPHWSP */
> -	gen8_map_base_size(RENDER_CONTEXT_ADDR,
> -	                   PPHWSP_SIZE + sizeof(render_context_init));
>  	mem_trace_memory_write_header_out(RENDER_CONTEXT_ADDR,
>  					  PPHWSP_SIZE +
>  					  sizeof(render_context_init),
> -					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
> +					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT);
>  	for (uint32_t i = 0; i < PPHWSP_SIZE; i += sizeof(uint32_t))
>  		dword_out(0);
>  
> @@ -551,19 +529,16 @@ gen10_write_header(void)
>  	data_out(render_context_init, sizeof(render_context_init));
>  
>  	/* BLITTER_RING */
> -	gen8_map_base_size(BLITTER_RING_ADDR, RING_SIZE);
>  	mem_trace_memory_write_header_out(BLITTER_RING_ADDR, RING_SIZE,
> -					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
> +					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT);
>  	for (uint32_t i = 0; i < RING_SIZE; i += sizeof(uint32_t))
>  		dword_out(0);
>  
>  	/* BLITTER_PPHWSP */
> -	gen8_map_base_size(BLITTER_CONTEXT_ADDR,
> -	                   PPHWSP_SIZE + sizeof(blitter_context_init));
>  	mem_trace_memory_write_header_out(BLITTER_CONTEXT_ADDR,
>  					  PPHWSP_SIZE +
>  					  sizeof(blitter_context_init),
> -					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
> +					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT);
>  	for (uint32_t i = 0; i < PPHWSP_SIZE; i += sizeof(uint32_t))
>  		dword_out(0);
>  
> @@ -571,19 +546,16 @@ gen10_write_header(void)
>  	data_out(blitter_context_init, sizeof(blitter_context_init));
>  
>  	/* VIDEO_RING */
> -	gen8_map_base_size(VIDEO_RING_ADDR, RING_SIZE);
>  	mem_trace_memory_write_header_out(VIDEO_RING_ADDR, RING_SIZE,
> -					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
> +					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT);
>  	for (uint32_t i = 0; i < RING_SIZE; i += sizeof(uint32_t))
>  		dword_out(0);
>  
>  	/* VIDEO_PPHWSP */
> -	gen8_map_base_size(VIDEO_CONTEXT_ADDR,
> -	                   PPHWSP_SIZE + sizeof(video_context_init));
>  	mem_trace_memory_write_header_out(VIDEO_CONTEXT_ADDR,
>  					  PPHWSP_SIZE +
>  					  sizeof(video_context_init),
> -					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
> +					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT);
>  	for (uint32_t i = 0; i < PPHWSP_SIZE; i += sizeof(uint32_t))
>  		dword_out(0);
>  
> @@ -654,15 +626,13 @@ aub_write_trace_block(uint32_t type, void *virtual, uint32_t size, uint64_t gtt_
>  	static const char null_block[8 * 4096];
>  
>  	for (uint32_t offset = 0; offset < size; offset += block_size) {
> -		block_size = size - offset;
> -
> -		if (block_size > 8 * 4096)
> -			block_size = 8 * 4096;
> +		block_size = min(8 * 4096, size - offset);
>  
>  		if (gen >= 10) {
> -			mem_trace_memory_write_header_out(gtt_offset + offset,
> +			block_size = min(4096, block_size);
> +			mem_trace_memory_write_header_out(ppgtt_lookup(gtt_offset + offset),
>  							  block_size,
> -							  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
> +							  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_PHYSICAL);
>  		} else {
>  			dword_out(CMD_AUB_TRACE_HEADER_BLOCK |
>  				  ((addr_bits > 32 ? 6 : 5) - 2));
> @@ -750,17 +720,17 @@ aub_dump_execlist(uint64_t batch_offset, int ring_flag)
>  	}
>  
>  	mem_trace_memory_write_header_out(ring_addr, 16,
> -					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
> -	dword_out(AUB_MI_BATCH_BUFFER_START | (3 - 2));
> +					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT);
> +	dword_out(AUB_MI_BATCH_BUFFER_START | /* ppgtt */ 0x100 | (3 - 2));
>  	dword_out(batch_offset & 0xFFFFFFFF);
>  	dword_out(batch_offset >> 32);
>  	dword_out(0 /* MI_NOOP */);
>  
>  	mem_trace_memory_write_header_out(ring_addr + 8192 + 20, 4,
> -					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
> +					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT);
>  	dword_out(0); /* RING_BUFFER_HEAD */
>  	mem_trace_memory_write_header_out(ring_addr + 8192 + 28, 4,
> -					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
> +					  AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT);
>  	dword_out(16); /* RING_BUFFER_TAIL */
>  
>  	if (gen >= 11) {
> @@ -936,7 +906,7 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2)
>  	}
>  
>  	if (gen >= 10)
> -		offset = STATIC_GGTT_MAP_END;
> +		offset = 0x1000;
>  	else
>  		offset = gtt_size();
>  
> @@ -976,7 +946,7 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2)
>  		fail_if(bo->map == MAP_FAILED, "intel_aubdump: bo mmap failed\n");
>  
>  		if (gen >= 10)
> -			gen8_map_ggtt_range(bo->offset, bo->offset + bo->size);
> +			map_ppgtt(bo->offset, bo->size);
>  	}
>  
>  	batch_index = (execbuffer2->flags & I915_EXEC_BATCH_FIRST) ? 0 :
> -- 
> 2.14.3
>
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [igt-dev] ✗ Fi.CI.IGT: warning for tools/aubdump: dump 48-bit addresses
  2018-03-30 19:56 [igt-dev] [PATCH i-g-t] tools/aubdump: dump 48-bit addresses Scott D Phillips
  2018-03-30 20:18 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
  2018-03-30 20:50 ` [igt-dev] [PATCH i-g-t] " Scott D Phillips
@ 2018-03-30 21:08 ` Patchwork
  2018-04-03 21:06 ` [igt-dev] [PATCH i-g-t] " Lionel Landwerlin
  2018-04-03 21:25 ` Lionel Landwerlin
  4 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2018-03-30 21:08 UTC (permalink / raw)
  To: Scott D Phillips; +Cc: igt-dev

== Series Details ==

Series: tools/aubdump: dump 48-bit addresses
URL   : https://patchwork.freedesktop.org/series/40972/
State : warning

== Summary ==

---- Possible new issues:

Test kms_cursor_crc:
        Subgroup cursor-64x64-suspend:
                dmesg-warn -> PASS       (shard-snb)
Test kms_cursor_legacy:
        Subgroup flip-vs-cursor-atomic-transitions:
                pass       -> SKIP       (shard-snb)

---- Known issues:

Test gem_softpin:
        Subgroup noreloc-s3:
                incomplete -> PASS       (shard-hsw) fdo#103540
Test kms_flip:
        Subgroup plain-flip-ts-check-interruptible:
                pass       -> FAIL       (shard-hsw) fdo#100368
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-primscrn-shrfb-msflip-blt:
                dmesg-fail -> PASS       (shard-apl) fdo#104727
Test kms_rotation_crc:
        Subgroup primary-rotation-180:
                pass       -> FAIL       (shard-snb) fdo#103925 +1

fdo#103540 https://bugs.freedesktop.org/show_bug.cgi?id=103540
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#104727 https://bugs.freedesktop.org/show_bug.cgi?id=104727
fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925

shard-apl        total:3495 pass:1831 dwarn:1   dfail:0   fail:7   skip:1655 time:12935s
shard-hsw        total:3495 pass:1782 dwarn:1   dfail:0   fail:2   skip:1709 time:11535s
shard-snb        total:3495 pass:1373 dwarn:1   dfail:0   fail:3   skip:2118 time:7071s
Blacklisted hosts:
shard-kbl        total:3495 pass:1957 dwarn:1   dfail:0   fail:8   skip:1529 time:9356s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1213/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] tools/aubdump: dump 48-bit addresses
  2018-03-30 19:56 [igt-dev] [PATCH i-g-t] tools/aubdump: dump 48-bit addresses Scott D Phillips
                   ` (2 preceding siblings ...)
  2018-03-30 21:08 ` [igt-dev] ✗ Fi.CI.IGT: warning for " Patchwork
@ 2018-04-03 21:06 ` Lionel Landwerlin
  2018-04-03 21:25 ` Lionel Landwerlin
  4 siblings, 0 replies; 6+ messages in thread
From: Lionel Landwerlin @ 2018-04-03 21:06 UTC (permalink / raw)
  To: Scott D Phillips, igt-dev, Jordan Justen


[-- Attachment #1.1: Type: text/plain, Size: 391 bytes --]

On 30/03/18 20:56, Scott D Phillips wrote:
> For gen10+, write out PPGTT tables in aub files so that full
> 48-bit addresses can be serialized.
>
> Signed-off-by: Scott D Phillips<scott.d.phillips@intel.com>
> Cc: Jordan Justen<jordan.l.justen@intel.com>
Struggled a bit with the page table stuff, otherwise looks good to me :

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>

[-- Attachment #1.2: Type: text/html, Size: 1063 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] tools/aubdump: dump 48-bit addresses
  2018-03-30 19:56 [igt-dev] [PATCH i-g-t] tools/aubdump: dump 48-bit addresses Scott D Phillips
                   ` (3 preceding siblings ...)
  2018-04-03 21:06 ` [igt-dev] [PATCH i-g-t] " Lionel Landwerlin
@ 2018-04-03 21:25 ` Lionel Landwerlin
  4 siblings, 0 replies; 6+ messages in thread
From: Lionel Landwerlin @ 2018-04-03 21:25 UTC (permalink / raw)
  To: Scott D Phillips, igt-dev, Jordan Justen

On 30/03/18 20:56, Scott D Phillips wrote:
> index 267061b0..78fda93c 100644
> --- a/tools/aubdump.c
> +++ b/tools/aubdump.c
> @@ -56,6 +56,12 @@
>   	_a < _b ? _a : _b;		\
>   })
>   
> +#define max(a, b) ({			\
> +	typeof(a) _a = (a);		\
> +	typeof(b) _b = (b);		\
> +	_a > _b ? _a : _b;		\
> +})
> +
I forgot to suggest that you just include igt.h
According to meson.build we already pull in the igt dep into aubdump so 
better reuse the macros from there.

Just a nit really...
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-04-03 21:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-30 19:56 [igt-dev] [PATCH i-g-t] tools/aubdump: dump 48-bit addresses Scott D Phillips
2018-03-30 20:18 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-03-30 20:50 ` [igt-dev] [PATCH i-g-t] " Scott D Phillips
2018-03-30 21:08 ` [igt-dev] ✗ Fi.CI.IGT: warning for " Patchwork
2018-04-03 21:06 ` [igt-dev] [PATCH i-g-t] " Lionel Landwerlin
2018-04-03 21:25 ` Lionel Landwerlin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.