Skip to content

Commit 028402d

Browse files
Jordan Crouserobclark
authored andcommitted
drm/msm: Make sure to detach the MMU during GPU cleanup
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 <[email protected]> Signed-off-by: Rob Clark <[email protected]>
1 parent d322a69 commit 028402d

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

drivers/gpu/drm/msm/adreno/adreno_gpu.c

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -418,18 +418,27 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,
418418
return 0;
419419
}
420420

421-
void adreno_gpu_cleanup(struct adreno_gpu *gpu)
421+
void adreno_gpu_cleanup(struct adreno_gpu *adreno_gpu)
422422
{
423-
if (gpu->memptrs_bo) {
424-
if (gpu->memptrs)
425-
msm_gem_put_vaddr(gpu->memptrs_bo);
423+
struct msm_gpu *gpu = &adreno_gpu->base;
424+
425+
if (adreno_gpu->memptrs_bo) {
426+
if (adreno_gpu->memptrs)
427+
msm_gem_put_vaddr(adreno_gpu->memptrs_bo);
428+
429+
if (adreno_gpu->memptrs_iova)
430+
msm_gem_put_iova(adreno_gpu->memptrs_bo, gpu->id);
431+
432+
drm_gem_object_unreference_unlocked(adreno_gpu->memptrs_bo);
433+
}
434+
release_firmware(adreno_gpu->pm4);
435+
release_firmware(adreno_gpu->pfp);
426436

427-
if (gpu->memptrs_iova)
428-
msm_gem_put_iova(gpu->memptrs_bo, gpu->base.id);
437+
msm_gpu_cleanup(gpu);
429438

430-
drm_gem_object_unreference_unlocked(gpu->memptrs_bo);
439+
if (gpu->aspace) {
440+
gpu->aspace->mmu->funcs->detach(gpu->aspace->mmu,
441+
iommu_ports, ARRAY_SIZE(iommu_ports));
442+
msm_gem_address_space_destroy(gpu->aspace);
431443
}
432-
release_firmware(gpu->pm4);
433-
release_firmware(gpu->pfp);
434-
msm_gpu_cleanup(&gpu->base);
435444
}

drivers/gpu/drm/msm/msm_gpu.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,6 @@ void msm_gpu_cleanup(struct msm_gpu *gpu)
706706
msm_ringbuffer_destroy(gpu->rb);
707707
}
708708

709-
if (gpu->aspace)
710-
msm_gem_address_space_destroy(gpu->aspace);
711-
712709
if (gpu->fctx)
713710
msm_fence_context_free(gpu->fctx);
714711
}

0 commit comments

Comments
 (0)