Skip to content

Commit

Permalink
Merge branch 'etnaviv/fixes' of https://git.pengutronix.de/git/lst/linux
Browse files Browse the repository at this point in the history
 into drm-fixes

One memory corruption fix in the MMUv2 GPU coredump code, a deadlock
fix also in the coredump code and reintroduction of a helpful message,
which got dropped by accident in this cycle.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Lucas Stach <l.stach@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/b0d640267662e3ce5e0089d0afedc1baba55058d.camel@pengutronix.de
  • Loading branch information
Dave Airlie committed Nov 1, 2019
2 parents d6d5df1 + a2f10d4 commit 6f96621
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
4 changes: 2 additions & 2 deletions drivers/gpu/drm/etnaviv/etnaviv_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit)
etnaviv_cmdbuf_get_va(&submit->cmdbuf,
&gpu->mmu_context->cmdbuf_mapping));

mutex_unlock(&gpu->mmu_context->lock);

/* Reserve space for the bomap */
if (n_bomap_pages) {
bomap_start = bomap = iter.data;
Expand Down Expand Up @@ -221,8 +223,6 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit)
obj->base.size);
}

mutex_unlock(&gpu->mmu_context->lock);

etnaviv_core_dump_header(&iter, ETDUMP_BUF_END, iter.data);

dev_coredumpv(gpu->dev, iter.start, iter.data - iter.start, GFP_KERNEL);
Expand Down
6 changes: 4 additions & 2 deletions drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,11 @@ static void etnaviv_iommuv2_dump(struct etnaviv_iommu_context *context, void *bu

memcpy(buf, v2_context->mtlb_cpu, SZ_4K);
buf += SZ_4K;
for (i = 0; i < MMUv2_MAX_STLB_ENTRIES; i++, buf += SZ_4K)
if (v2_context->mtlb_cpu[i] & MMUv2_PTE_PRESENT)
for (i = 0; i < MMUv2_MAX_STLB_ENTRIES; i++)
if (v2_context->mtlb_cpu[i] & MMUv2_PTE_PRESENT) {
memcpy(buf, v2_context->stlb_cpu[i], SZ_4K);
buf += SZ_4K;
}
}

static void etnaviv_iommuv2_restore_nonsec(struct etnaviv_gpu *gpu,
Expand Down
17 changes: 14 additions & 3 deletions drivers/gpu/drm/etnaviv/etnaviv_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,12 +328,23 @@ etnaviv_iommu_context_init(struct etnaviv_iommu_global *global,

ret = etnaviv_cmdbuf_suballoc_map(suballoc, ctx, &ctx->cmdbuf_mapping,
global->memory_base);
if (ret) {
global->ops->free(ctx);
return NULL;
if (ret)
goto out_free;

if (global->version == ETNAVIV_IOMMU_V1 &&
ctx->cmdbuf_mapping.iova > 0x80000000) {
dev_err(global->dev,
"command buffer outside valid memory window\n");
goto out_unmap;
}

return ctx;

out_unmap:
etnaviv_cmdbuf_suballoc_unmap(ctx, &ctx->cmdbuf_mapping);
out_free:
global->ops->free(ctx);
return NULL;
}

void etnaviv_iommu_restore(struct etnaviv_gpu *gpu,
Expand Down

0 comments on commit 6f96621

Please sign in to comment.