summaryrefslogtreecommitdiff
path: root/drivers/accel/qaic/qaic_data.c
diff options
context:
space:
mode:
authorPranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>2023-09-01 20:22:44 +0300
committerJeffrey Hugo <quic_jhugo@quicinc.com>2023-09-22 18:56:54 +0300
commitb3107e75a96ee17a510deabf4b00b0c37d2351d4 (patch)
treea967c3a0445552df7c16d28be0822d23b092d618 /drivers/accel/qaic/qaic_data.c
parent77f71e153f09acef574dffc4298eac7822407665 (diff)
downloadlinux-b3107e75a96ee17a510deabf4b00b0c37d2351d4.tar.xz
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
Diffstat (limited to 'drivers/accel/qaic/qaic_data.c')
-rw-r--r--drivers/accel/qaic/qaic_data.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/accel/qaic/qaic_data.c b/drivers/accel/qaic/qaic_data.c
index 6a802497834c..c4b8b4bf0200 100644
--- a/drivers/accel/qaic/qaic_data.c
+++ b/drivers/accel/qaic/qaic_data.c
@@ -154,6 +154,7 @@ static void free_slice(struct kref *kref)
{
struct bo_slice *slice = container_of(kref, struct bo_slice, ref_count);
+ slice->bo->total_slice_nents -= slice->nents;
list_del(&slice->slice);
drm_gem_object_put(&slice->bo->base);
sg_free_table(slice->sgt);
@@ -890,6 +891,9 @@ static void qaic_free_slices_bo(struct qaic_bo *bo)
list_for_each_entry_safe(slice, temp, &bo->slices, slice)
kref_put(&slice->ref_count, free_slice);
+ if (WARN_ON_ONCE(bo->total_slice_nents != 0))
+ bo->total_slice_nents = 0;
+ bo->nr_slice = 0;
}
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)
void release_dbc(struct qaic_device *qdev, u32 dbc_id)
{
- struct bo_slice *slice, *slice_temp;
struct qaic_bo *bo, *bo_temp;
struct dma_bridge_chan *dbc;
@@ -1869,12 +1872,10 @@ void release_dbc(struct qaic_device *qdev, u32 dbc_id)
dbc->usr = NULL;
list_for_each_entry_safe(bo, bo_temp, &dbc->bo_lists, bo_list) {
+ qaic_free_slices_bo(bo);
qaic_unprepare_bo(qdev, bo);
- list_for_each_entry_safe(slice, slice_temp, &bo->slices, slice)
- kref_put(&slice->ref_count, free_slice);
bo->sliced = false;
INIT_LIST_HEAD(&bo->slices);
- bo->total_slice_nents = 0;
bo->nr_slice_xfer_done = 0;
bo->queued = false;
bo->req_id = 0;