Enable panwrap to compile
authorCafe <cafe@not.applicable>
Tue, 1 Aug 2017 15:20:36 +0000 (15:20 +0000)
committerCafe <cafe@not.applicable>
Tue, 1 Aug 2017 15:20:36 +0000 (15:20 +0000)
src/chai-notes.h
src/jobs.h
src/trace.c

index ab748ef590c2f9094af24325de6608c3f114426c..990cee085140bdebfefe2929eb001c7d329d9e5b 100644 (file)
@@ -16,6 +16,8 @@
 
 #include <stddef.h>
 
+#include "jobs.h"
+
 /* See corresponding structures in chai/jobs.h */
 
 struct payload_set_value {
index fd9ca72638048f3f7a3ab527fddd03e7b95f67a1..b34599fe92c3c8f1b229f5bd6fc8421ae51681bf 100644 (file)
@@ -30,5 +30,9 @@ struct job_descriptor_header {
        u16 job_index;
        u16 job_dependency_index_1;
        u16 job_dependency_index_2;
-       u64 next_job;
+       union {
+               u64 _64;
+               u64 _32;
+       } next_job;
+
 } __attribute__((packed));
index 1fc1eca54d20ff8360742781e623afbf875f17bf..a239f7473abfae12c7ab80a9227405bb765e04b2 100644 (file)
@@ -13,6 +13,8 @@
  *
  */
 
+#include "shim.h"
+
 static void formatted_hex_dump(char *array, uint8_t *buffer, size_t s) 
 {
        if (!buffer) return;
@@ -34,7 +36,7 @@ static void formatted_hex_dump(char *array, uint8_t *buffer, size_t s)
 
 #define CPU_DUMP_SIZE 256
 
-static void *kbase_fetch_cpu(void __user *cpu_addr, size_t *size_o, size_t size_i)
+static void *chai_fetch_cpu(void __user *cpu_addr, size_t *size_o, size_t size_i)
 {
        uint8_t *buffer;
 
@@ -58,22 +60,22 @@ static void *kbase_fetch_cpu(void __user *cpu_addr, size_t *size_o, size_t size_
 }
 
 /* Dump GPU memory by address.
- * See mali_kbase_debug_mem_view.c for more information */
+ * See mali_chai_debug_mem_view.c for more information */
 
-int kbase_jd_umm_map(struct kbase_va_region *reg);
-void kbase_jd_umm_unmap(struct kbase_mem_phy_alloc *alloc);
+int chai_jd_umm_map(struct chai_va_region *reg);
+void chai_jd_umm_unmap(struct chai_mem_phy_alloc *alloc);
 
-static void *kbase_fetch_gpu(u64 gpu_addr, size_t *size_o, size_t size_i)
+static void *chai_fetch_gpu(u64 gpu_addr, size_t *size_o, size_t size_i)
 {
-       struct kbase_va_region *reg;
-       struct kbase_mem_phy_alloc *alloc;
+       struct chai_va_region *reg;
+       struct chai_mem_phy_alloc *alloc;
        uint8_t *buffer;
        uint8_t *buffer_on;
        int p;
        pgprot_t prot = PAGE_KERNEL;
        uint64_t offset;
 
-       reg = kbase_region_tracker_find_region_enclosing_address(gpu_addr);
+       reg = chai_region_tracker_find_region_enclosing_address(gpu_addr);
 
        if (!reg) {
                printf("Region not found!");
@@ -94,10 +96,10 @@ static void *kbase_fetch_gpu(u64 gpu_addr, size_t *size_o, size_t size_i)
                return NULL;
        }
 
-       alloc = kbase_mem_phy_alloc_get(reg->gpu_alloc);
+       alloc = chai_mem_phy_alloc_get(reg->gpu_alloc);
 
        if (alloc->type == KBASE_MEM_TYPE_IMPORTED_UMM) {
-               kbase_jd_umm_map(reg);
+               chai_jd_umm_map(reg);
        }
 
        if (!alloc->nents) {
@@ -144,23 +146,23 @@ static void *kbase_fetch_gpu(u64 gpu_addr, size_t *size_o, size_t size_i)
        }
 
        if (alloc->type == KBASE_MEM_TYPE_IMPORTED_UMM) {
-               kbase_jd_umm_unmap(alloc);
+               chai_jd_umm_unmap(alloc);
        }
 
        return buffer;
 }
 
-static void kbase_push_gpu(void *buffer, u64 gpu_addr, size_t s)
+static void chai_push_gpu(void *buffer, u64 gpu_addr, size_t s)
 {
-       struct kbase_va_region *reg;
-       struct kbase_mem_phy_alloc *alloc;
+       struct chai_va_region *reg;
+       struct chai_mem_phy_alloc *alloc;
        int p;
        pgprot_t prot = PAGE_KERNEL;
        uint64_t offset;
        uint32_t buffer_offset = 0;
        bool first_page = true;
 
-       reg = kbase_region_tracker_find_region_enclosing_address(gpu_addr);
+       reg = chai_region_tracker_find_region_enclosing_address(gpu_addr);
 
        if (!reg) {
                printf("Region not found!");
@@ -181,10 +183,10 @@ static void kbase_push_gpu(void *buffer, u64 gpu_addr, size_t s)
                return;
        }
 
-       alloc = kbase_mem_phy_alloc_get(reg->gpu_alloc);
+       alloc = chai_mem_phy_alloc_get(reg->gpu_alloc);
 
        if (alloc->type == KBASE_MEM_TYPE_IMPORTED_UMM) {
-               kbase_jd_umm_map(reg);
+               chai_jd_umm_map(reg);
        }
 
        if (!alloc->nents) {
@@ -233,7 +235,7 @@ static void kbase_push_gpu(void *buffer, u64 gpu_addr, size_t s)
        }
 
        if (alloc->type == KBASE_MEM_TYPE_IMPORTED_UMM) {
-               kbase_jd_umm_unmap(alloc);
+               chai_jd_umm_unmap(alloc);
        }
 }
 
@@ -299,7 +301,7 @@ static void quick_dump_gpu(uint64_t addr, size_t s)
 
 #define DEFINE_CASE(label) case label: return #label;
 
-static char *kbase_job_type_name(int type)
+static char *chai_job_type_name(int type)
 {
        switch (type) {
                DEFINE_CASE(JOB_NOT_STARTED)
@@ -318,7 +320,7 @@ static char *kbase_job_type_name(int type)
        }
 }
 
-static char* kbase_gl_mode_name(uint8_t b) 
+static char* chai_gl_mode_name(uint8_t b) 
 {
        switch (b) {
                DEFINE_CASE(CHAI_POINTS)
@@ -336,7 +338,7 @@ static char* kbase_gl_mode_name(uint8_t b)
 /* TODO: Figure out what "fbd" means */
 /* TODO: Corresponding SFBD decode (don't assume MFBD) */
 
-static void kbase_trace_fbd(uint32_t fbd)
+static void chai_trace_fbd(uint32_t fbd)
 {
        struct tentative_mfbd *mfbd = (struct tentative_mfbd *) fetch_mapped_gpu((uint64_t) (uint32_t) fbd & FBD_POINTER_MASK, sizeof(struct tentative_mfbd));
        uint8_t *buf;
@@ -425,7 +427,7 @@ static void kbase_trace_fbd(uint32_t fbd)
        relax_mapped_gpu(mfbd);
 }
 
-static void kbase_trace_vecN_as_uint32_hex(uint32_t *p, size_t count)
+static void chai_trace_vecN_as_uint32_hex(uint32_t *p, size_t count)
 {
        if(count == 1) 
                printf("\t<%X>,", p[0]);
@@ -439,7 +441,7 @@ static void kbase_trace_vecN_as_uint32_hex(uint32_t *p, size_t count)
                printf("Cannot print vec%d", count);
 }
 
-static void kbase_trace_attribute(uint64_t address)
+static void chai_trace_attribute(uint64_t address)
 {
        uint64_t raw;
        uint64_t flags;
@@ -466,16 +468,16 @@ static void kbase_trace_attribute(uint64_t address)
        printf("attribute vec%d mem%LXflag%LX = {", component_count, raw, flags);
 
        for (i = 0; i < vertex_count; i++, p += component_count)
-               kbase_trace_vecN_as_uint32_hex(p, component_count);
+               chai_trace_vecN_as_uint32_hex(p, component_count);
 
        printf("}");
 
-       //kbase_push_gpu(v, raw, vb->total_size);
+       //chai_push_gpu(v, raw, vb->total_size);
 
        relax_mapped_gpu(vb);
 }
 
-static void kbase_trace_hw_chain(uint64_t chain)
+static void chai_trace_hw_chain(uint64_t chain)
 {
        struct job_descriptor_header *h;
        uint8_t *gen_pay;
@@ -486,7 +488,7 @@ static void kbase_trace_hw_chain(uint64_t chain)
        h = fetch_mapped_gpu(chain, sizeof(*h));
 
        printf("%s job, %d-bit, status %X, incomplete %X, fault %LX, barrier %d, index %hX, dependencies (%hX, %hX)",
-                       kbase_job_type_name(h->job_type),
+                       chai_job_type_name(h->job_type),
                        h->job_descriptor_size ? 64 : 32,
                        h->exception_status,
                        h->first_incomplete_task,
@@ -554,7 +556,7 @@ static void kbase_trace_hw_chain(uint64_t chain)
                                        ATTRIBUTE_NO(*attr_meta),
                                        ATTRIBUTE_FLAGS(*attr_meta));
 
-                       kbase_trace_attribute(v->attributes + ATTRIBUTE_NO(*attr_meta) * sizeof(struct attribute_buffer));
+                       chai_trace_attribute(v->attributes + ATTRIBUTE_NO(*attr_meta) * sizeof(struct attribute_buffer));
 
                        s += sizeof(attribute_meta_t);
 
@@ -562,7 +564,7 @@ static void kbase_trace_hw_chain(uint64_t chain)
                }
 
                if (h->job_type == JOB_TYPE_TILER)
-                       printf("Drawing in %s", kbase_gl_mode_name(((uint8_t *) v->block1)[8]));
+                       printf("Drawing in %s", chai_gl_mode_name(((uint8_t *) v->block1)[8]));
 
                assert_gpu_zeroes(v->zeroes, 64);
 
@@ -570,7 +572,7 @@ static void kbase_trace_hw_chain(uint64_t chain)
                        printf("Null tripped?");
 
                printf("%cFBD", v->fbd & FBD_TYPE ? 'M' : 'S');
-               kbase_trace_fbd(v->fbd);
+               chai_trace_fbd(v->fbd);
 
                formatted_hex_dump("Block 1", (uint8_t *) v->block1, sizeof(v->block1));
 
@@ -650,7 +652,7 @@ static void kbase_trace_hw_chain(uint64_t chain)
                                f->fragment_fbd,
                                f->fragment_fbd & FBD_POINTER_MASK);
 
-               kbase_trace_fbd(f->fragment_fbd);
+               chai_trace_fbd(f->fragment_fbd);
 
                relax_mapped_gpu(f);
                break;
@@ -659,7 +661,7 @@ static void kbase_trace_hw_chain(uint64_t chain)
        default: {
                printf("Dumping payload %LX for job type %s",
                                payload,
-                               kbase_job_type_name(h->job_type));
+                               chai_job_type_name(h->job_type));
 
                gen_pay = fetch_mapped_gpu(payload, 256);
                formatted_hex_dump("pl", gen_pay, 256);
@@ -675,12 +677,10 @@ static void kbase_trace_hw_chain(uint64_t chain)
 
        /* Traverse the job chain */
        if (next)
-               kbase_trace_hw_chain(next);
+               chai_trace_hw_chain(next);
 }
 
-static void kbase_trace_special_base_jd_atom_v2(
-               struct kbase_context *kctx,
-               struct base_jd_atom_v2 *v)
+static void chai_trace_atom(struct base_jd_atom_v2 *v)
 {
        if (v->core_req & MALI_JD_REQ_SOFT_JOB) {
                if (v->core_req & MALI_JD_REQ_SOFT_REPLAY) {
@@ -708,6 +708,6 @@ static void kbase_trace_special_base_jd_atom_v2(
                        printf("Unknown soft job");
                }
        } else {
-               kbase_trace_hw_chain(v->jc);
+               chai_trace_hw_chain(v->jc);
        }
 }