mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
drm/etnaviv: return context from etnaviv_iommu_context_get
commit 78edefc05e upstream.
Being able to have the refcount manipulation in an assignment makes
it much easier to parse the code.
Cc: stable@vger.kernel.org # 5.4
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Tested-by: Michael Walle <michael@walle.cc>
Tested-by: Marek Vasut <marex@denx.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
dc1fd142dc
commit
3ea21946ba
@@ -397,8 +397,7 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
|
|||||||
if (switch_mmu_context) {
|
if (switch_mmu_context) {
|
||||||
struct etnaviv_iommu_context *old_context = gpu->mmu_context;
|
struct etnaviv_iommu_context *old_context = gpu->mmu_context;
|
||||||
|
|
||||||
etnaviv_iommu_context_get(mmu_context);
|
gpu->mmu_context = etnaviv_iommu_context_get(mmu_context);
|
||||||
gpu->mmu_context = mmu_context;
|
|
||||||
etnaviv_iommu_context_put(old_context);
|
etnaviv_iommu_context_put(old_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -303,8 +303,7 @@ struct etnaviv_vram_mapping *etnaviv_gem_mapping_get(
|
|||||||
list_del(&mapping->obj_node);
|
list_del(&mapping->obj_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
etnaviv_iommu_context_get(mmu_context);
|
mapping->context = etnaviv_iommu_context_get(mmu_context);
|
||||||
mapping->context = mmu_context;
|
|
||||||
mapping->use = 1;
|
mapping->use = 1;
|
||||||
|
|
||||||
ret = etnaviv_iommu_map_gem(mmu_context, etnaviv_obj,
|
ret = etnaviv_iommu_map_gem(mmu_context, etnaviv_obj,
|
||||||
|
|||||||
@@ -532,8 +532,7 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
|
|||||||
goto err_submit_objects;
|
goto err_submit_objects;
|
||||||
|
|
||||||
submit->ctx = file->driver_priv;
|
submit->ctx = file->driver_priv;
|
||||||
etnaviv_iommu_context_get(submit->ctx->mmu);
|
submit->mmu_context = etnaviv_iommu_context_get(submit->ctx->mmu);
|
||||||
submit->mmu_context = submit->ctx->mmu;
|
|
||||||
submit->exec_state = args->exec_state;
|
submit->exec_state = args->exec_state;
|
||||||
submit->flags = args->flags;
|
submit->flags = args->flags;
|
||||||
|
|
||||||
|
|||||||
@@ -1365,12 +1365,10 @@ struct dma_fence *etnaviv_gpu_submit(struct etnaviv_gem_submit *submit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!gpu->mmu_context) {
|
if (!gpu->mmu_context) {
|
||||||
etnaviv_iommu_context_get(submit->mmu_context);
|
gpu->mmu_context = etnaviv_iommu_context_get(submit->mmu_context);
|
||||||
gpu->mmu_context = submit->mmu_context;
|
|
||||||
etnaviv_gpu_start_fe_idleloop(gpu);
|
etnaviv_gpu_start_fe_idleloop(gpu);
|
||||||
} else {
|
} else {
|
||||||
etnaviv_iommu_context_get(gpu->mmu_context);
|
submit->prev_mmu_context = etnaviv_iommu_context_get(gpu->mmu_context);
|
||||||
submit->prev_mmu_context = gpu->mmu_context;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (submit->nr_pmrs) {
|
if (submit->nr_pmrs) {
|
||||||
|
|||||||
@@ -105,9 +105,11 @@ void etnaviv_iommu_dump(struct etnaviv_iommu_context *ctx, void *buf);
|
|||||||
struct etnaviv_iommu_context *
|
struct etnaviv_iommu_context *
|
||||||
etnaviv_iommu_context_init(struct etnaviv_iommu_global *global,
|
etnaviv_iommu_context_init(struct etnaviv_iommu_global *global,
|
||||||
struct etnaviv_cmdbuf_suballoc *suballoc);
|
struct etnaviv_cmdbuf_suballoc *suballoc);
|
||||||
static inline void etnaviv_iommu_context_get(struct etnaviv_iommu_context *ctx)
|
static inline struct etnaviv_iommu_context *
|
||||||
|
etnaviv_iommu_context_get(struct etnaviv_iommu_context *ctx)
|
||||||
{
|
{
|
||||||
kref_get(&ctx->refcount);
|
kref_get(&ctx->refcount);
|
||||||
|
return ctx;
|
||||||
}
|
}
|
||||||
void etnaviv_iommu_context_put(struct etnaviv_iommu_context *ctx);
|
void etnaviv_iommu_context_put(struct etnaviv_iommu_context *ctx);
|
||||||
void etnaviv_iommu_restore(struct etnaviv_gpu *gpu,
|
void etnaviv_iommu_restore(struct etnaviv_gpu *gpu,
|
||||||
|
|||||||
Reference in New Issue
Block a user