intel: aubinator: fix read the context/ring
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Tue, 31 Jul 2018 06:12:56 +0000 (07:12 +0100)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Sat, 4 Aug 2018 08:38:34 +0000 (09:38 +0100)
Up to now we've been lucky that the buffer returned was always exactly
at the address we requested.

Fixes: 144b40db5411 ("intel: aubinator: drop the 1Tb GTT mapping")
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
src/intel/tools/aubinator.c

index 8989d558b66fa203eb91410c61faeaf1fd6d1365..3fec04c24c4355ca1ac749ed0906cd08c707bed6 100644 (file)
@@ -590,7 +590,7 @@ handle_memtrace_reg_write(uint32_t *p)
    uint32_t pphwsp_addr = context_descriptor & 0xfffff000;
    struct gen_batch_decode_bo pphwsp_bo = get_ggtt_batch_bo(NULL, pphwsp_addr);
    uint32_t *context = (uint32_t *)((uint8_t *)pphwsp_bo.map +
-                                    (pphwsp_bo.addr - pphwsp_addr) +
+                                    (pphwsp_addr - pphwsp_bo.addr) +
                                     pphwsp_size);
 
    uint32_t ring_buffer_head = context[5];
@@ -601,7 +601,7 @@ handle_memtrace_reg_write(uint32_t *p)
    struct gen_batch_decode_bo ring_bo = get_ggtt_batch_bo(NULL,
                                                           ring_buffer_start);
    assert(ring_bo.size > 0);
-   void *commands = (uint8_t *)ring_bo.map + (ring_bo.addr - ring_buffer_start);
+   void *commands = (uint8_t *)ring_bo.map + (ring_buffer_start - ring_bo.addr);
 
    if (context_descriptor & 0x100 /* ppgtt */) {
       batch_ctx.get_bo = get_ppgtt_batch_bo;