Skip to contentSkip to conversation

accel/ivpu: Test for imported buffers with drm_gem_is_imported()

PATCH In review Thomas Zimmermann 2 participants 3 messages Feb 27 – Mar 9

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 accel/ivpu: Test for imported buffers with drm_gem_is_imported()

Instead of testing import_attach for imported GEM buffers, invoke drm_gem_is_imported() to do the test. The test itself does not change.

Cc Maciej Falkowski <[email protected]>
Cc Karol Wachowski <[email protected]>
Cc Oded Gabbay <[email protected]>
---
 drivers/accel/ivpu/ivpu_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/accel/ivpu/ivpu_gem.c +1 -1
index 98b9ce26962b..9e2f1b60f632 100644
@@ -157,7 +157,7 @@ static void ivpu_bo_unbind_locked(struct ivpu_bo *bo)
 	}
 
 	if (bo->base.sgt) {
-		if (bo->base.base.import_attach) {
+		if (drm_gem_is_imported(&bo->base.base)) {
 			dma_buf_unmap_attachment(bo->base.base.import_attach,
 						 bo->base.sgt, DMA_BIDIRECTIONAL);
 		} else {
Signature · 1 line
2.52.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Thomas Zimmermann

Instead of testing import_attach for imported GEM buffers, invoke drm_gem_is_imported() to do the test. The test itself does not change.

Thank you for spotting this.

There's also another place in drivers/accel/ivpu/ivpu_gem.c:51 drm_WARN_ON(&vdev->drm, !bo->base.base.import_attach);

We will push a patch for that.

Quoted 14 lines
Cc Maciej Falkowski <[email protected]>
Cc Karol Wachowski <[email protected]>
Cc Oded Gabbay <[email protected]>
---
 drivers/accel/ivpu/ivpu_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/accel/ivpu/ivpu_gem.c +0 -0
index 98b9ce26962b..9e2f1b60f632 100644

drivers/accel/ivpu/ivpu_gem.c static void ivpu_bo_unbind_locked(struct ivpu_bo *bo) · line 163

Quoted 8 lines
drivers/accel/ivpu/ivpu_gem.c +1 -1
@@ -157,7 +157,7 @@ static void ivpu_bo_unbind_locked(struct ivpu_bo *bo)
 	}
 
 	if (bo->base.sgt) {
-		if (bo->base.base.import_attach) {
+		if (drm_gem_is_imported(&bo->base.base)) {
 			dma_buf_unmap_attachment(bo->base.base.import_attach,
 						 bo->base.sgt, DMA_BIDIRECTIONAL);
 		} else {
maintainer
#2 lore raw
Quoted 10 lines · Karol Wachowski
Quoted 2 lines · Thomas Zimmermann

Instead of testing import_attach for imported GEM buffers, invoke drm_gem_is_imported() to do the test. The test itself does not change.

Thank you for spotting this.

There's also another place in drivers/accel/ivpu/ivpu_gem.c:51 drm_WARN_ON(&vdev->drm, !bo->base.base.import_attach);

We will push a patch for that.

I've sent a patch that covers both cases in a single commit. Thanks. Karol

Quoted 24 lines
Quoted 15 lines
Cc Maciej Falkowski <[email protected]>
Cc Karol Wachowski <[email protected]>
Cc Oded Gabbay <[email protected]>
---
 drivers/accel/ivpu/ivpu_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/accel/ivpu/ivpu_gem.c +0 -0
index 98b9ce26962b..9e2f1b60f632 100644

drivers/accel/ivpu/ivpu_gem.c static void ivpu_bo_unbind_locked(struct ivpu_bo *bo) · line 163

Quoted 8 lines
drivers/accel/ivpu/ivpu_gem.c +1 -1
@@ -157,7 +157,7 @@ static void ivpu_bo_unbind_locked(struct ivpu_bo *bo)
 	}
 
 	if (bo->base.sgt) {
-		if (bo->base.base.import_attach) {
+		if (drm_gem_is_imported(&bo->base.base)) {
 			dma_buf_unmap_attachment(bo->base.base.import_attach,
 						 bo->base.sgt, DMA_BIDIRECTIONAL);
 		} else {