From: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: quic_jhugo@quicinc.com,
Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Subject: [PATCH 07/10] accel/ivpu: Free buffer sgt on unbind
Date: Fri, 5 Jan 2024 12:22:15 +0100 [thread overview]
Message-ID: <20240105112218.351265-8-jacek.lawrynowicz@linux.intel.com> (raw)
In-Reply-To: <20240105112218.351265-1-jacek.lawrynowicz@linux.intel.com>
Call dma_unmap() on all buffers before to VPU is unbinded to avoid
"device driver has pending DMA allocations while released from device"
warning when DMA-API debug is enabled.
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_gem.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_gem.c b/drivers/accel/ivpu/ivpu_gem.c
index 6890d33cf352..4de454bfbf91 100644
--- a/drivers/accel/ivpu/ivpu_gem.c
+++ b/drivers/accel/ivpu/ivpu_gem.c
@@ -112,8 +112,6 @@ static void ivpu_bo_unbind_locked(struct ivpu_bo *bo)
ivpu_dbg_bo(vdev, bo, "unbind");
- /* TODO: dma_unmap */
-
if (bo->mmu_mapped) {
drm_WARN_ON(&vdev->drm, !bo->ctx);
drm_WARN_ON(&vdev->drm, !bo->vpu_addr);
@@ -127,6 +125,18 @@ static void ivpu_bo_unbind_locked(struct ivpu_bo *bo)
bo->vpu_addr = 0;
bo->ctx = NULL;
}
+
+ if (bo->base.base.import_attach)
+ return;
+
+ dma_resv_lock(bo->base.base.resv, NULL);
+ if (bo->base.sgt) {
+ dma_unmap_sgtable(vdev->drm.dev, bo->base.sgt, DMA_BIDIRECTIONAL, 0);
+ sg_free_table(bo->base.sgt);
+ kfree(bo->base.sgt);
+ bo->base.sgt = NULL;
+ }
+ dma_resv_unlock(bo->base.base.resv);
}
static void ivpu_bo_unbind(struct ivpu_bo *bo)
--
2.43.0
next prev parent reply other threads:[~2024-01-05 11:22 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-05 11:22 [PATCH 00/10] accel/ivpu fixes for 6.8 Jacek Lawrynowicz
2024-01-05 11:22 ` [PATCH 01/10] accel/ivpu: Dump MMU events in case of VPU boot timeout Jacek Lawrynowicz
2024-01-05 15:11 ` Jeffrey Hugo
2024-01-05 11:22 ` [PATCH 02/10] accel/ivpu: Call diagnose failure in ivpu_mmu_cmdq_sync() Jacek Lawrynowicz
2024-01-05 15:12 ` Jeffrey Hugo
2024-01-05 11:22 ` [PATCH 03/10] accel/ivpu: Add debug prints for MMU map/unmap operations Jacek Lawrynowicz
2024-01-05 15:32 ` Jeffrey Hugo
2024-01-09 12:50 ` Jacek Lawrynowicz
2024-01-05 11:22 ` [PATCH 04/10] accel/ivpu: Add diagnostic messages when VPU fails to boot or suspend Jacek Lawrynowicz
2024-01-05 15:41 ` Jeffrey Hugo
2024-01-05 11:22 ` [PATCH 05/10] accel/ivpu: Fix potential infinite loops in IRQ handlers Jacek Lawrynowicz
2024-01-05 16:35 ` Jeffrey Hugo
2024-01-09 12:34 ` Jacek Lawrynowicz
2024-01-05 11:22 ` [PATCH 06/10] accel/ivpu: Fix for missing lock around drm_gem_shmem_vmap() Jacek Lawrynowicz
2024-01-05 16:36 ` Jeffrey Hugo
2024-01-09 12:51 ` Jacek Lawrynowicz
2024-01-05 11:22 ` Jacek Lawrynowicz [this message]
2024-01-05 16:37 ` [PATCH 07/10] accel/ivpu: Free buffer sgt on unbind Jeffrey Hugo
2024-01-05 11:22 ` [PATCH 08/10] accel/ivpu: Disable buffer sharing among VPU contexts Jacek Lawrynowicz
2024-01-05 16:46 ` Jeffrey Hugo
2024-01-10 10:53 ` Jacek Lawrynowicz
2024-01-05 22:34 ` Carl Vanderlip
2024-01-10 10:54 ` Jacek Lawrynowicz
2024-01-05 11:22 ` [PATCH 09/10] accel/ivpu: Improve buffer object debug logs Jacek Lawrynowicz
2024-01-05 17:03 ` Jeffrey Hugo
2024-01-10 11:08 ` Jacek Lawrynowicz
2024-01-05 11:22 ` [PATCH 10/10] accel/ivpu: Remove deprecated DRM_IVPU_PARAM_CONTEXT_PRIORITY Jacek Lawrynowicz
2024-01-05 17:29 ` Jeffrey Hugo
2024-01-10 14:33 ` Jacek Lawrynowicz
2024-01-11 21:03 ` Jeffrey Hugo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240105112218.351265-8-jacek.lawrynowicz@linux.intel.com \
--to=jacek.lawrynowicz@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=quic_jhugo@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.