mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-08-14 06:22:34 +02:00
Commit adefb2ccea ("drm/v3d: create a dedicated lock for dma fence")
split `fence_lock` from `queue_lock` because v3d_job_update_stats() was
taking `queue_lock` to protect `job->file_priv` during stats collection
in the IRQ handler. Using the same lock for both DMA fence signaling and
stats protection in a IRQ context caused issues on PREEMPT_RT.
Since then, the stats infrastructure has been reworked: v3d_stats is now
refcounted and jobs hold their own references to stats objects, so
v3d_job_update_stats() no longer takes `queue_lock` at all.
With the original reason for the split gone, merge `fence_lock` back
into `queue_lock` to simplify the locking scheme.
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Link: https://patch.msgid.link/20260306-v3d-reset-locking-improv-v3-6-49864fe00692@igalia.com
Signed-off-by: Maíra Canal <mcanal@igalia.com>
51 lines
1.1 KiB
C
51 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/* Copyright (C) 2017-2018 Broadcom */
|
|
|
|
#include "v3d_drv.h"
|
|
|
|
struct dma_fence *v3d_fence_create(struct v3d_dev *v3d, enum v3d_queue q)
|
|
{
|
|
struct v3d_queue_state *queue = &v3d->queue[q];
|
|
struct v3d_fence *fence;
|
|
|
|
fence = kzalloc_obj(*fence);
|
|
if (!fence)
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
fence->dev = &v3d->drm;
|
|
fence->queue = q;
|
|
fence->seqno = ++queue->emit_seqno;
|
|
dma_fence_init(&fence->base, &v3d_fence_ops, &queue->queue_lock,
|
|
queue->fence_context, fence->seqno);
|
|
|
|
return &fence->base;
|
|
}
|
|
|
|
static const char *v3d_fence_get_driver_name(struct dma_fence *fence)
|
|
{
|
|
return "v3d";
|
|
}
|
|
|
|
static const char *v3d_fence_get_timeline_name(struct dma_fence *fence)
|
|
{
|
|
struct v3d_fence *f = to_v3d_fence(fence);
|
|
|
|
switch (f->queue) {
|
|
case V3D_BIN:
|
|
return "v3d-bin";
|
|
case V3D_RENDER:
|
|
return "v3d-render";
|
|
case V3D_TFU:
|
|
return "v3d-tfu";
|
|
case V3D_CSD:
|
|
return "v3d-csd";
|
|
default:
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
const struct dma_fence_ops v3d_fence_ops = {
|
|
.get_driver_name = v3d_fence_get_driver_name,
|
|
.get_timeline_name = v3d_fence_get_timeline_name,
|
|
};
|