Skip to content

Commit b3107e7

Browse files
Pranjal Ramajor Asha Kanojiyaquic-jhugo
authored andcommitted
accel/qaic: Undo slicing setup done in qaic_attach_slicing_bo()
qaic_attach_slicing_bo() updates slicing config on BO. Use the existing function qaic_free_slices_bo() to remove slicing config done in qaic_attach_slicing_bo(). Use qaic_free_slices_bo() to cleanup release_dbc() This would be helpful when we introduce a new IOCTL to detach slicing configuration onto a BO. Signed-off-by: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230901172247.11410-5-quic_jhugo@quicinc.com
1 parent 77f71e1 commit b3107e7

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

drivers/accel/qaic/qaic_data.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ static void free_slice(struct kref *kref)
154154
{
155155
struct bo_slice *slice = container_of(kref, struct bo_slice, ref_count);
156156

157+
slice->bo->total_slice_nents -= slice->nents;
157158
list_del(&slice->slice);
158159
drm_gem_object_put(&slice->bo->base);
159160
sg_free_table(slice->sgt);
@@ -890,6 +891,9 @@ static void qaic_free_slices_bo(struct qaic_bo *bo)
890891

891892
list_for_each_entry_safe(slice, temp, &bo->slices, slice)
892893
kref_put(&slice->ref_count, free_slice);
894+
if (WARN_ON_ONCE(bo->total_slice_nents != 0))
895+
bo->total_slice_nents = 0;
896+
bo->nr_slice = 0;
893897
}
894898

895899
static int qaic_attach_slicing_bo(struct qaic_device *qdev, struct qaic_bo *bo,
@@ -1851,7 +1855,6 @@ void wakeup_dbc(struct qaic_device *qdev, u32 dbc_id)
18511855

18521856
void release_dbc(struct qaic_device *qdev, u32 dbc_id)
18531857
{
1854-
struct bo_slice *slice, *slice_temp;
18551858
struct qaic_bo *bo, *bo_temp;
18561859
struct dma_bridge_chan *dbc;
18571860

@@ -1869,12 +1872,10 @@ void release_dbc(struct qaic_device *qdev, u32 dbc_id)
18691872
dbc->usr = NULL;
18701873

18711874
list_for_each_entry_safe(bo, bo_temp, &dbc->bo_lists, bo_list) {
1875+
qaic_free_slices_bo(bo);
18721876
qaic_unprepare_bo(qdev, bo);
1873-
list_for_each_entry_safe(slice, slice_temp, &bo->slices, slice)
1874-
kref_put(&slice->ref_count, free_slice);
18751877
bo->sliced = false;
18761878
INIT_LIST_HEAD(&bo->slices);
1877-
bo->total_slice_nents = 0;
18781879
bo->nr_slice_xfer_done = 0;
18791880
bo->queued = false;
18801881
bo->req_id = 0;

0 commit comments

Comments
 (0)