[Mesa-dev] [PATCH 2/2] intel/toosl/aubwrite: Always use physical addresses for traces.

Rafael Antognolli rafael.antognolli at intel.com
Tue Aug 21 17:38:56 UTC 2018


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 by putting the
default one into the aub_file struct.

Cc: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
---
 src/intel/tools/aub_write.c | 21 +++++++++++----------
 src/intel/tools/aub_write.h |  1 +
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/intel/tools/aub_write.c b/src/intel/tools/aub_write.c
index 5d59b4ef28a..fb4e0de93e3 100644
--- a/src/intel/tools/aub_write.c
+++ b/src/intel/tools/aub_write.c
@@ -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
@@ -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 */
 
diff --git a/src/intel/tools/aub_write.h b/src/intel/tools/aub_write.h
index b421679b9eb..1429aac88ed 100644
--- a/src/intel/tools/aub_write.h
+++ b/src/intel/tools/aub_write.h
@@ -48,6 +48,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);
-- 
2.17.1



More information about the mesa-dev mailing list