Permalink
Browse files

Pick up kgsl changes from HP 3.0.4 drop

Change-Id: I98b79dbd05706809b360e991a11be912853f8f08
  • Loading branch information...
1 parent 84c9f4a commit 2fa1c28137de8afc0dc37f47e612c991e8630dfc @verygreen verygreen committed Oct 20, 2011
Showing with 45 additions and 7 deletions.
  1. +19 −0 drivers/gpu/msm/kgsl_mmu.c
  2. +4 −0 drivers/gpu/msm/kgsl_mmu.h
  3. +22 −7 drivers/gpu/msm/kgsl_postmortem.c
View
@@ -461,6 +461,25 @@ void kgsl_mh_intrcallback(struct kgsl_device *device)
KGSL_MEM_VDBG("return\n");
}
+int
+kgsl_get_ptname_from_ptbase(unsigned int pt_base)
+{
+ struct kgsl_pagetable *pt;
+ int ptid = -1;
+
+ mutex_lock(&kgsl_driver.pt_mutex);
+
+ list_for_each_entry(pt, &kgsl_driver.pagetable_list, list) {
+ if (pt_base == pt->base.gpuaddr) {
+ ptid = (int) pt->name;
+ break;
+ }
+ }
+ mutex_unlock(&kgsl_driver.pt_mutex);
+
+ return ptid;
+}
+
static struct kgsl_pagetable *kgsl_mmu_createpagetableobject(
struct kgsl_mmu *mmu,
unsigned int name)
@@ -205,6 +205,8 @@ void kgsl_ptpool_destroy(struct kgsl_ptpool *pool);
int kgsl_ptpool_init(struct kgsl_ptpool *pool, int ptsize, int entries);
+int kgsl_get_ptname_from_ptbase(unsigned int pt_base);
+
#else
static inline int kgsl_mmu_map(struct kgsl_pagetable *pagetable,
unsigned int address,
@@ -229,6 +231,8 @@ static inline int kgsl_ptpool_init(struct kgsl_ptpool *pool, int ptsize,
static inline void kgsl_ptpool_free(struct kgsl_ptpool *pool) { }
+static inline int kgsl_get_ptname_from_ptbase(unsigned int pt_base) { }
+
#endif
int kgsl_mmu_map_global(struct kgsl_pagetable *pagetable,
@@ -384,7 +384,7 @@ static int kgsl_dump_yamato(struct kgsl_device *device)
unsigned int r1, r2, r3, rbbm_status;
unsigned int cp_ib1_base, cp_ib1_bufsz, cp_stat;
unsigned int cp_ib2_base, cp_ib2_bufsz;
- unsigned int pt_base;
+ unsigned int pt_base, cur_pt_base;
unsigned int cp_rb_base, rb_count;
unsigned int cp_rb_wptr, cp_rb_rptr;
unsigned int i;
@@ -551,6 +551,7 @@ static int kgsl_dump_yamato(struct kgsl_device *device)
kgsl_regread(device, REG_MH_MMU_PT_BASE, &pt_base);
KGSL_LOG_DUMP(" MPU_END = %08X | VA_RANGE = %08X | PT_BASE ="
" %08X\n", r1, r2, pt_base);
+ cur_pt_base = pt_base;
kgsl_regread(device, REG_MH_MMU_TRAN_ERROR, &r1);
KGSL_LOG_DUMP(" TRAN_ERROR = %08X\n", r1);
@@ -810,7 +811,7 @@ static int kgsl_dump_yamato(struct kgsl_device *device)
KGSL_LOG_DUMP("RB: rd_addr:%8.8x rb_size:%d num_item:%d\n",
cp_rb_base, rb_count<<2, num_item);
- rb_vaddr = (const uint32_t *)kgsl_sharedmem_convertaddr(device, pt_base,
+ rb_vaddr = (const uint32_t *)kgsl_sharedmem_convertaddr(device, cur_pt_base,
cp_rb_base, &rb_memsize);
if (!rb_vaddr) {
KGSL_LOG_POSTMORTEM_WRITE("Can't fetch vaddr for CP_RB_BASE\n");
@@ -842,16 +843,30 @@ static int kgsl_dump_yamato(struct kgsl_device *device)
if (this_cmd == pm4_type3_packet(PM4_INDIRECT_BUFFER_PFD, 2)) {
uint32_t ib_addr = rb_copy[read_idx++];
uint32_t ib_size = rb_copy[read_idx++];
- dump_ib1(device, pt_base, (read_idx-3)<<2, ib_addr,
+ dump_ib1(device, cur_pt_base, (read_idx-3)<<2, ib_addr,
ib_size, &ib_list, 0);
for (; i < ib_list.count; ++i)
- dump_ib(device, "IB2:", pt_base,
+ dump_ib(device, "IB2:", cur_pt_base,
ib_list.offsets[i],
ib_list.bases[i],
ib_list.sizes[i], 0);
}
+ else if (this_cmd == pm4_type0_packet(REG_MH_MMU_PT_BASE, 1)) {
+ KGSL_LOG_DUMP("Current pagetable: %x pagetable base: %x\n",
+ kgsl_get_ptname_from_ptbase(cur_pt_base), cur_pt_base);
+
+ /* Set cur_pt_base to the new pagetable base */
+ cur_pt_base = rb_copy[read_idx++];
+
+ KGSL_LOG_DUMP("New pagetable: %x pagetable base: %x\n",
+ kgsl_get_ptname_from_ptbase(cur_pt_base), cur_pt_base);
+
+ }
}
-
+
+ /* Restore cur_pt_base back to the pt_base of the process in whose context the GPU hung */
+ cur_pt_base = pt_base;
+
read_idx = (int)cp_rb_rptr - 64;
if (read_idx < 0)
read_idx += rb_count;
@@ -869,7 +884,7 @@ static int kgsl_dump_yamato(struct kgsl_device *device)
if (cp_ib1_bufsz && cp_ib1_base == ib_addr) {
KGSL_LOG_DUMP("IB1: base:%8.8X "
"count:%d\n", ib_addr, ib_size);
- dump_ib(device, "IB1: ", pt_base,
+ dump_ib(device, "IB1: ", cur_pt_base,
read_idx<<2, ib_addr, ib_size,
1);
}
@@ -881,7 +896,7 @@ static int kgsl_dump_yamato(struct kgsl_device *device)
uint32_t ib_offset = ib_list.offsets[i];
KGSL_LOG_DUMP("IB2: base:%8.8X count:%d\n",
cp_ib2_base, ib_size);
- dump_ib(device, "IB2: ", pt_base, ib_offset,
+ dump_ib(device, "IB2: ", cur_pt_base, ib_offset,
ib_list.bases[i], ib_size, 1);
}
}

0 comments on commit 2fa1c28

Please sign in to comment.