From 0145b4df7d0dfd888edfd4164bc64b65c97f52df Mon Sep 17 00:00:00 2001 From: Shubhraprakash Das Date: Wed, 30 May 2012 17:26:54 -0600 Subject: [PATCH] msm: kgsl: During postmortem check for IOMMU table change When performing postmortem, check for IOMMU pagetable change commands which will allow us to find the IB from the correct pagetable. Change-Id: I411f4c78632d1673d49d5557da435e2a9d31d420 Signed-off-by: Shubhraprakash Das --- drivers/gpu/msm/adreno_postmortem.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/msm/adreno_postmortem.c b/drivers/gpu/msm/adreno_postmortem.c index 7bb65ca8640..3cc4bcf5135 100644 --- a/drivers/gpu/msm/adreno_postmortem.c +++ b/drivers/gpu/msm/adreno_postmortem.c @@ -699,6 +699,10 @@ static int adreno_dump(struct kgsl_device *device) struct adreno_device *adreno_dev = ADRENO_DEVICE(device); + struct kgsl_memdesc **reg_map; + void *reg_map_array; + int num_iommu_units = 0; + mb(); if (adreno_is_a2xx(adreno_dev)) @@ -780,6 +784,10 @@ static int adreno_dump(struct kgsl_device *device) /* extract the latest ib commands from the buffer */ ib_list.count = 0; i = 0; + /* get the register mapped array in case we are using IOMMU */ + num_iommu_units = kgsl_mmu_get_reg_map_desc(&device->mmu, + ®_map_array); + reg_map = reg_map_array; for (read_idx = 0; read_idx < num_item; ) { uint32_t this_cmd = rb_copy[read_idx++]; if (adreno_cmd_is_ib(this_cmd)) { @@ -792,7 +800,10 @@ static int adreno_dump(struct kgsl_device *device) ib_list.offsets[i], ib_list.bases[i], ib_list.sizes[i], 0); - } else if (this_cmd == cp_type0_packet(MH_MMU_PT_BASE, 1)) { + } else if (this_cmd == cp_type0_packet(MH_MMU_PT_BASE, 1) || + (num_iommu_units && this_cmd == (reg_map[0]->gpuaddr + + (KGSL_IOMMU_CONTEXT_USER << KGSL_IOMMU_CTX_SHIFT) + + KGSL_IOMMU_TTBR0))) { KGSL_LOG_DUMP(device, "Current pagetable: %x\t" "pagetable base: %x\n", @@ -808,6 +819,8 @@ static int adreno_dump(struct kgsl_device *device) cur_pt_base); } } + if (num_iommu_units) + kfree(reg_map_array); /* Restore cur_pt_base back to the pt_base of the process in whose context the GPU hung */