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

Commit 9c0d1dc8 authored by Sushmita Susheelendra's avatar Sushmita Susheelendra
Browse files

drm/msm: Separate locking of buffer resources from struct_mutex



Buffer object specific resources like pages, domains, sg list
need not be protected with struct_mutex. They can be protected
with a buffer object level lock. This simplifies locking and
makes it easier to avoid potential recursive locking scenarios
for SVM involving mmap_sem and struct_mutex. This also removes
unnecessary serialization when creating buffer objects, and also
between buffer object creation and GPU command submission.

Change-Id: I40cb437d0186c3d9aac365c9baba0aa4792f0aa1
Signed-off-by: default avatarSushmita Susheelendra <ssusheel@codeaurora.org>
parent 9f47a21e
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -481,10 +481,8 @@ static struct drm_gem_object *a5xx_ucode_load_bo(struct msm_gpu *gpu,
	struct drm_gem_object *bo;
	void *ptr;

	mutex_lock(&drm->struct_mutex);
	bo = msm_gem_new(drm, fw->size - 4,
		MSM_BO_UNCACHED | MSM_BO_GPU_READONLY);
	mutex_unlock(&drm->struct_mutex);

	if (IS_ERR(bo))
		return bo;
+0 −2
Original line number Diff line number Diff line
@@ -458,10 +458,8 @@ void a5xx_gpmu_ucode_init(struct msm_gpu *gpu)
	 */
	bosize = (cmds_size + (cmds_size / TYPE4_MAX_PAYLOAD) + 1) << 2;

	mutex_lock(&drm->struct_mutex);
	a5xx_gpu->gpmu_bo = msm_gem_new(drm, bosize,
		MSM_BO_UNCACHED | MSM_BO_GPU_READONLY);
	mutex_unlock(&drm->struct_mutex);

	if (IS_ERR(a5xx_gpu->gpmu_bo))
		goto err;
+0 −2
Original line number Diff line number Diff line
@@ -24,9 +24,7 @@ static void *alloc_kernel_bo(struct drm_device *drm, struct msm_gpu *gpu,
	void *ptr;
	int ret;

	mutex_lock(&drm->struct_mutex);
	_bo = msm_gem_new(drm, size, flags);
	mutex_unlock(&drm->struct_mutex);

	if (IS_ERR(_bo))
		return _bo;
+4 −3
Original line number Diff line number Diff line
@@ -217,18 +217,19 @@ static int crashdump_init(struct msm_gpu *gpu, struct crashdump *crashdump)
	struct drm_device *drm = gpu->dev;
	int ret = -ENOMEM;

	crashdump->bo = msm_gem_new(drm, CRASHDUMP_BO_SIZE, MSM_BO_UNCACHED);
	crashdump->bo = msm_gem_new_locked(drm, CRASHDUMP_BO_SIZE,
			MSM_BO_UNCACHED);
	if (IS_ERR(crashdump->bo)) {
		ret = PTR_ERR(crashdump->bo);
		crashdump->bo = NULL;
		return ret;
	}

	crashdump->ptr = msm_gem_vaddr_locked(crashdump->bo);
	crashdump->ptr = msm_gem_vaddr(crashdump->bo);
	if (!crashdump->ptr)
		goto out;

	ret = msm_gem_get_iova_locked(crashdump->bo, gpu->aspace,
	ret = msm_gem_get_iova(crashdump->bo, gpu->aspace,
		&crashdump->iova);

out:
+0 −2
Original line number Diff line number Diff line
@@ -563,10 +563,8 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,
		}
	}

	mutex_lock(&drm->struct_mutex);
	adreno_gpu->memptrs_bo = msm_gem_new(drm, sizeof(*adreno_gpu->memptrs),
			MSM_BO_UNCACHED);
	mutex_unlock(&drm->struct_mutex);
	if (IS_ERR(adreno_gpu->memptrs_bo)) {
		ret = PTR_ERR(adreno_gpu->memptrs_bo);
		adreno_gpu->memptrs_bo = NULL;
Loading