Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0d30e3c9 authored by Lynus Vaz's avatar Lynus Vaz Committed by Gerrit - the friendly Code Review server
Browse files

msm: kgsl: Free A6x per-context preemption buffer at detach time



preemption_context_destroy() will try to take the iommu mutex when
unmapping the buffer. Since the context can be destroyed from atomic
context for example, fence callbacks, taking the mutex will lead to a
kernel panic. Move the function from context destroy to context
detach. Detached contexts can no longer submit cmdbatches, so the
buffer can be safely released at this point after waiting for all
context cmdbatches already in flight to retire.

Change-Id: Ic48fa4638336a93e78e037bfc331037d611b40a3
Signed-off-by: default avatarLynus Vaz <lvaz@codeaurora.org>
parent 4c25b27d
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -464,6 +464,7 @@ void adreno_drawctxt_detach(struct kgsl_context *context)
{
	struct kgsl_device *device;
	struct adreno_device *adreno_dev;
	struct adreno_gpudev *gpudev;
	struct adreno_context *drawctxt;
	struct adreno_ringbuffer *rb;
	int ret, count, i;
@@ -474,6 +475,7 @@ void adreno_drawctxt_detach(struct kgsl_context *context)

	device = context->device;
	adreno_dev = ADRENO_DEVICE(device);
	gpudev = ADRENO_GPU_DEVICE(adreno_dev);
	drawctxt = ADRENO_CONTEXT(context);
	rb = drawctxt->rb;

@@ -554,6 +556,9 @@ void adreno_drawctxt_detach(struct kgsl_context *context)

	mutex_unlock(&device->mutex);

	if (gpudev->preemption_context_destroy)
		gpudev->preemption_context_destroy(context);

	/* wake threads waiting to submit commands from this context */
	wake_up_all(&drawctxt->waiting);
	wake_up_all(&drawctxt->wq);
@@ -562,18 +567,10 @@ void adreno_drawctxt_detach(struct kgsl_context *context)
void adreno_drawctxt_destroy(struct kgsl_context *context)
{
	struct adreno_context *drawctxt;
	struct adreno_device *adreno_dev;
	struct adreno_gpudev *gpudev;

	if (context == NULL)
		return;

	adreno_dev = ADRENO_DEVICE(context->device);
	gpudev = ADRENO_GPU_DEVICE(adreno_dev);

	if (gpudev->preemption_context_destroy)
		gpudev->preemption_context_destroy(context);

	drawctxt = ADRENO_CONTEXT(context);
	kfree(drawctxt);
}