drm/etnaviv: fix dumping of active MMU context
authorLucas Stach <l.stach@pengutronix.de>
Fri, 14 Apr 2023 14:38:10 +0000 (16:38 +0200)
committerJaehoon Chung <jh80.chung@samsung.com>
Wed, 13 Mar 2024 06:58:53 +0000 (15:58 +0900)
[ Upstream commit 20faf2005ec85fa1a6acc9a74ff27de667f90576 ]

gpu->mmu_context is the MMU context of the last job in the HW queue, which
isn't necessarily the same as the context from the bad job. Dump the MMU
context from the scheduler determined bad submit to make it work as intended.

Fixes: 17e4660ae3d7 ("drm/etnaviv: implement per-process address spaces on MMUv2")
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit b6d74c35607f991e8b418d595aa21a179aba2aa3)
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
drivers/gpu/drm/etnaviv/etnaviv_dump.c

index 706af0304ca4c85655b55c7194e445fc48cb8559..7b57d01ba865b49e393e03a1196f9c479f6e6950 100644 (file)
@@ -125,9 +125,9 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit)
                return;
        etnaviv_dump_core = false;
 
-       mutex_lock(&gpu->mmu_context->lock);
+       mutex_lock(&submit->mmu_context->lock);
 
-       mmu_size = etnaviv_iommu_dump_size(gpu->mmu_context);
+       mmu_size = etnaviv_iommu_dump_size(submit->mmu_context);
 
        /* We always dump registers, mmu, ring, hanging cmdbuf and end marker */
        n_obj = 5;
@@ -157,7 +157,7 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit)
        iter.start = __vmalloc(file_size, GFP_KERNEL | __GFP_NOWARN |
                        __GFP_NORETRY);
        if (!iter.start) {
-               mutex_unlock(&gpu->mmu_context->lock);
+               mutex_unlock(&submit->mmu_context->lock);
                dev_warn(gpu->dev, "failed to allocate devcoredump file\n");
                return;
        }
@@ -169,18 +169,18 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit)
        memset(iter.hdr, 0, iter.data - iter.start);
 
        etnaviv_core_dump_registers(&iter, gpu);
-       etnaviv_core_dump_mmu(&iter, gpu->mmu_context, mmu_size);
+       etnaviv_core_dump_mmu(&iter, submit->mmu_context, mmu_size);
        etnaviv_core_dump_mem(&iter, ETDUMP_BUF_RING, gpu->buffer.vaddr,
                              gpu->buffer.size,
                              etnaviv_cmdbuf_get_va(&gpu->buffer,
-                                       &gpu->mmu_context->cmdbuf_mapping));
+                                       &submit->mmu_context->cmdbuf_mapping));
 
        etnaviv_core_dump_mem(&iter, ETDUMP_BUF_CMD,
                              submit->cmdbuf.vaddr, submit->cmdbuf.size,
                              etnaviv_cmdbuf_get_va(&submit->cmdbuf,
-                                       &gpu->mmu_context->cmdbuf_mapping));
+                                       &submit->mmu_context->cmdbuf_mapping));
 
-       mutex_unlock(&gpu->mmu_context->lock);
+       mutex_unlock(&submit->mmu_context->lock);
 
        /* Reserve space for the bomap */
        if (n_bomap_pages) {