intel/tools/aubwrite: Always use physical addresses for traces.
authorRafael Antognolli <rafael.antognolli@intel.com>
Tue, 21 Aug 2018 16:49:03 +0000 (09:49 -0700)
committerRafael Antognolli <rafael.antognolli@intel.com>
Wed, 22 Aug 2018 19:52:41 +0000 (12:52 -0700)
It looks like we can't rely on the simulator to always translate virtual
addresses to physical ones correctly. So let's use physical everywhere.

Since our current GGTT maps virtual to physical addresses in a 1:1 way,
no further changes are required.

Additionally, we have other address spaces not in use right now. So
let's make it easier to switch which one we are using but putting the
default one into the aub_file struct.

Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/tools/aub_write.c
src/intel/tools/aub_write.h

index 5d59b4ef28a5c6dfe4dc4bb1f5c7dc539c099f2b..5d272f67b579bc9d5a28f7a230b91e6c58257432 100644 (file)
@@ -126,6 +126,7 @@ aub_file_init(struct aub_file *aub, FILE *file, uint16_t pci_id)
    aub->addr_bits = aub->devinfo.gen >= 8 ? 48 : 32;
 
    aub->pml4.phys_addr = PML4_PHYS_ADDR;
+   aub->default_addr_space = AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_PHYSICAL;
 }
 
 void
@@ -240,7 +241,7 @@ populate_ppgtt_table(struct aub_file *aub, struct aub_ppgtt_table *table,
       uint64_t write_size = (dirty_end - dirty_start + 1) *
          sizeof(uint64_t);
       mem_trace_memory_write_header_out(aub, write_addr, write_size,
-                                        AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_PHYSICAL,
+                                        aub->default_addr_space,
                                         "PPGTT update");
       data_out(aub, entries + dirty_start, write_size);
    }
@@ -339,7 +340,7 @@ write_execlists_header(struct aub_file *aub, const char *name)
 
    /* RENDER_RING */
    mem_trace_memory_write_header_out(aub, RENDER_RING_ADDR, RING_SIZE,
-                                     AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT,
+                                     aub->default_addr_space,
                                      "RENDER RING");
    for (uint32_t i = 0; i < RING_SIZE; i += sizeof(uint32_t))
       dword_out(aub, 0);
@@ -348,7 +349,7 @@ write_execlists_header(struct aub_file *aub, const char *name)
    mem_trace_memory_write_header_out(aub, RENDER_CONTEXT_ADDR,
                                      PPHWSP_SIZE +
                                      CONTEXT_RENDER_SIZE,
-                                     AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT,
+                                     aub->default_addr_space,
                                      "RENDER PPHWSP");
    for (uint32_t i = 0; i < PPHWSP_SIZE; i += sizeof(uint32_t))
       dword_out(aub, 0);
@@ -358,7 +359,7 @@ write_execlists_header(struct aub_file *aub, const char *name)
 
    /* BLITTER_RING */
    mem_trace_memory_write_header_out(aub, BLITTER_RING_ADDR, RING_SIZE,
-                                     AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT,
+                                     aub->default_addr_space,
                                      "BLITTER RING");
    for (uint32_t i = 0; i < RING_SIZE; i += sizeof(uint32_t))
       dword_out(aub, 0);
@@ -367,7 +368,7 @@ write_execlists_header(struct aub_file *aub, const char *name)
    mem_trace_memory_write_header_out(aub, BLITTER_CONTEXT_ADDR,
                                      PPHWSP_SIZE +
                                      CONTEXT_OTHER_SIZE,
-                                     AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT,
+                                     aub->default_addr_space,
                                      "BLITTER PPHWSP");
    for (uint32_t i = 0; i < PPHWSP_SIZE; i += sizeof(uint32_t))
       dword_out(aub, 0);
@@ -377,7 +378,7 @@ write_execlists_header(struct aub_file *aub, const char *name)
 
    /* VIDEO_RING */
    mem_trace_memory_write_header_out(aub, VIDEO_RING_ADDR, RING_SIZE,
-                                     AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT,
+                                     aub->default_addr_space,
                                      "VIDEO RING");
    for (uint32_t i = 0; i < RING_SIZE; i += sizeof(uint32_t))
       dword_out(aub, 0);
@@ -386,7 +387,7 @@ write_execlists_header(struct aub_file *aub, const char *name)
    mem_trace_memory_write_header_out(aub, VIDEO_CONTEXT_ADDR,
                                      PPHWSP_SIZE +
                                      CONTEXT_OTHER_SIZE,
-                                     AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT,
+                                     aub->default_addr_space,
                                      "VIDEO PPHWSP");
    for (uint32_t i = 0; i < PPHWSP_SIZE; i += sizeof(uint32_t))
       dword_out(aub, 0);
@@ -477,7 +478,7 @@ aub_write_trace_block(struct aub_file *aub,
          mem_trace_memory_write_header_out(aub,
                                            ppgtt_lookup(aub, gtt_offset + offset),
                                            block_size,
-                                           AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_PHYSICAL,
+                                           aub->default_addr_space,
                                            "Trace Block");
       } else {
          dword_out(aub, CMD_AUB_TRACE_HEADER_BLOCK |
@@ -542,7 +543,7 @@ aub_dump_execlist(struct aub_file *aub, uint64_t batch_offset, int ring_flag)
    }
 
    mem_trace_memory_write_header_out(aub, ring_addr, 16,
-                                     AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT,
+                                     aub->default_addr_space,
                                      "RING MI_BATCH_BUFFER_START user");
    dword_out(aub, AUB_MI_BATCH_BUFFER_START | MI_BATCH_NON_SECURE_I965 | (3 - 2));
    dword_out(aub, batch_offset & 0xFFFFFFFF);
@@ -550,11 +551,11 @@ aub_dump_execlist(struct aub_file *aub, uint64_t batch_offset, int ring_flag)
    dword_out(aub, 0 /* MI_NOOP */);
 
    mem_trace_memory_write_header_out(aub, ring_addr + 8192 + 20, 4,
-                                     AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT,
+                                     aub->default_addr_space,
                                      "RING BUFFER HEAD");
    dword_out(aub, 0); /* RING_BUFFER_HEAD */
    mem_trace_memory_write_header_out(aub, ring_addr + 8192 + 28, 4,
-                                     AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT,
+                                     aub->default_addr_space,
                                      "RING BUFFER TAIL");
    dword_out(aub, 16); /* RING_BUFFER_TAIL */
 
index 6a09c1747b9f352d86782872970c9d54cc12a4e0..69ad4a877d496c39e94efe93a9e905abc304f828 100644 (file)
@@ -52,6 +52,7 @@ struct aub_file {
    int addr_bits;
 
    struct aub_ppgtt_table pml4;
+   uint32_t default_addr_space;
 };
 
 void aub_file_init(struct aub_file *aub, FILE *file, uint16_t pci_id);