/* * snapshot_freeze_obj_list() - Take a list of ib objects and freeze their * memory for snapshot * @device: Device being snapshotted * @ptbase: The pagetable base of the process to which IB belongs * @ib_obj_list: List of the IB objects * * Returns 0 on success else error code */ static int snapshot_freeze_obj_list(struct kgsl_device *device, phys_addr_t ptbase, struct adreno_ib_object_list *ib_obj_list) { int ret = 0; struct adreno_ib_object *ib_objs; unsigned int ib2base; struct adreno_device *adreno_dev = ADRENO_DEVICE(device); int i; adreno_readreg(adreno_dev, ADRENO_REG_CP_IB2_BASE, &ib2base); for (i = 0; i < ib_obj_list->num_objs; i++) { int temp_ret; int index; int freeze = 1; ib_objs = &(ib_obj_list->obj_list[i]); /* Make sure this object is not going to be saved statically */ for (index = 0; index < objbufptr; index++) { if ((objbuf[index].gpuaddr <= ib_objs->gpuaddr) && ((objbuf[index].gpuaddr + (objbuf[index].dwords << 2)) >= (ib_objs->gpuaddr + ib_objs->size)) && (objbuf[index].ptbase == ptbase)) { freeze = 0; break; } } if (freeze) { /* Save current IB2 statically */ if (ib2base == ib_objs->gpuaddr) { push_object(device, SNAPSHOT_OBJ_TYPE_IB, ptbase, ib_objs->gpuaddr, ib_objs->size >> 2); } else { temp_ret = kgsl_snapshot_get_object(device, ptbase, ib_objs->gpuaddr, ib_objs->size, ib_objs->snapshot_obj_type); if (temp_ret < 0) { if (ret >= 0) ret = temp_ret; } else { snapshot_frozen_objsize += temp_ret; } } }
/* * snapshot_freeze_obj_list() - Take a list of ib objects and freeze their * memory for snapshot * @snapshot: The snapshot data. * @process: The process to which the IB belongs * @ib_obj_list: List of the IB objects * @ib2base: IB2 base address at time of the fault * * Returns 0 on success else error code */ static int snapshot_freeze_obj_list(struct kgsl_snapshot *snapshot, struct kgsl_process_private *process, struct adreno_ib_object_list *ib_obj_list, uint64_t ib2base) { int ret = 0; struct adreno_ib_object *ib_objs; int i; for (i = 0; i < ib_obj_list->num_objs; i++) { int temp_ret; int index; int freeze = 1; ib_objs = &(ib_obj_list->obj_list[i]); /* Make sure this object is not going to be saved statically */ for (index = 0; index < objbufptr; index++) { if ((objbuf[index].gpuaddr <= ib_objs->gpuaddr) && ((objbuf[index].gpuaddr + (objbuf[index].size)) >= (ib_objs->gpuaddr + ib_objs->size)) && (objbuf[index].entry->priv == process)) { freeze = 0; break; } } if (freeze) { /* Save current IB2 statically */ if (ib2base == ib_objs->gpuaddr) { push_object(SNAPSHOT_OBJ_TYPE_IB, process, ib_objs->gpuaddr, ib_objs->size >> 2); } else { temp_ret = kgsl_snapshot_get_object(snapshot, process, ib_objs->gpuaddr, ib_objs->size, ib_objs->snapshot_obj_type); if (temp_ret < 0) { if (ret >= 0) ret = temp_ret; } else { snapshot_frozen_objsize += temp_ret; } } }