kgsl_mmu_put_gpuaddr(pagetable, &entry->memdesc);
}
+/* Commit the entry to the process so it can be accessed by other operations */
+static void kgsl_mem_entry_commit_process(struct kgsl_mem_entry *entry)
+{
+ if (!entry)
+ return;
+
+ spin_lock(&entry->priv->mem_lock);
+ idr_replace(&entry->priv->mem_idr, entry, entry->id);
+ spin_unlock(&entry->priv->mem_lock);
+}
+
/**
* kgsl_mem_entry_attach_process - Attach a mem_entry to its owner process
* @entry: the memory entry
idr_preload(GFP_KERNEL);
spin_lock(&process->mem_lock);
- id = idr_alloc(&process->mem_idr, entry, 1, 0, GFP_NOWAIT);
+ /* Allocate the ID but don't attach the pointer just yet */
+ id = idr_alloc(&process->mem_idr, NULL, 1, 0, GFP_NOWAIT);
spin_unlock(&process->mem_lock);
idr_preload_end();
trace_kgsl_mem_map(entry, fd);
+ kgsl_mem_entry_commit_process(entry);
return 0;
unmap:
trace_kgsl_mem_map(entry, param->fd);
+ kgsl_mem_entry_commit_process(entry);
return result;
error_attach:
entry->memdesc.size);
trace_kgsl_mem_alloc(entry);
+ kgsl_mem_entry_commit_process(entry);
return entry;
err:
kfree(entry);