Skip to content

Commit

Permalink
drm/msm: Make sure to detach the MMU during GPU cleanup
Browse files Browse the repository at this point in the history
We should be detaching the MMU before destroying the address
space. To do this cleanly, the detach has to happen in
adreno_gpu_cleanup() because it needs access to structs
in adreno_gpu.c.  Plus it is better symmetry to have
the attach and detach at the same code level.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
  • Loading branch information
Jordan Crouse authored and Rob Clark committed Apr 8, 2017
1 parent 3a88214 commit 9873ef0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
29 changes: 19 additions & 10 deletions drivers/gpu/drm/msm/adreno/adreno_gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,18 +417,27 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,
return 0;
}

void adreno_gpu_cleanup(struct adreno_gpu *gpu)
void adreno_gpu_cleanup(struct adreno_gpu *adreno_gpu)
{
if (gpu->memptrs_bo) {
if (gpu->memptrs)
msm_gem_put_vaddr(gpu->memptrs_bo);
struct msm_gpu *gpu = &adreno_gpu->base;

if (adreno_gpu->memptrs_bo) {
if (adreno_gpu->memptrs)
msm_gem_put_vaddr(adreno_gpu->memptrs_bo);

if (adreno_gpu->memptrs_iova)
msm_gem_put_iova(adreno_gpu->memptrs_bo, gpu->id);

drm_gem_object_unreference_unlocked(adreno_gpu->memptrs_bo);
}
release_firmware(adreno_gpu->pm4);
release_firmware(adreno_gpu->pfp);

if (gpu->memptrs_iova)
msm_gem_put_iova(gpu->memptrs_bo, gpu->base.id);
msm_gpu_cleanup(gpu);

drm_gem_object_unreference_unlocked(gpu->memptrs_bo);
if (gpu->aspace) {
gpu->aspace->mmu->funcs->detach(gpu->aspace->mmu,
iommu_ports, ARRAY_SIZE(iommu_ports));
msm_gem_address_space_destroy(gpu->aspace);
}
release_firmware(gpu->pm4);
release_firmware(gpu->pfp);
msm_gpu_cleanup(&gpu->base);
}
3 changes: 0 additions & 3 deletions drivers/gpu/drm/msm/msm_gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,6 @@ void msm_gpu_cleanup(struct msm_gpu *gpu)
msm_ringbuffer_destroy(gpu->rb);
}

if (gpu->aspace)
msm_gem_address_space_destroy(gpu->aspace);

if (gpu->fctx)
msm_fence_context_free(gpu->fctx);
}

0 comments on commit 9873ef0

Please sign in to comment.