[RFC PATCH 079/162] drm/i915/dmabuf: Disallow LMEM objects from dma-buf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Michael J. Ruhl" <michael.j.ruhl@xxxxxxxxx>

The dma-buf interface for i915 does not currently support
LMEM backed objects.

Check imported objects to see if they are from i915 and if they
are LMEM.  If they are, reject the import.

This check is needed in two places, once on import, and then a
recheck in the mapping path in the off chance that an object
was migrated to LMEM after import.

Signed-off-by: Michael J. Ruhl <michael.j.ruhl@xxxxxxxxx>
---
 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
index c4b01e819786..018d02cc4af5 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
@@ -9,6 +9,7 @@
 #include <linux/dma-resv.h>
 
 #include "i915_drv.h"
+#include "i915_gem_lmem.h"
 #include "i915_gem_object.h"
 #include "i915_scatterlist.h"
 
@@ -25,6 +26,11 @@ static struct sg_table *i915_gem_map_dma_buf(struct dma_buf_attachment *attachme
 	struct scatterlist *src, *dst;
 	int ret, i;
 
+	if (i915_gem_object_is_lmem(obj)) {
+		ret = -ENOTSUPP;
+		goto err;
+	}
+
 	ret = i915_gem_object_pin_pages(obj);
 	if (ret)
 		goto err;
@@ -248,6 +254,10 @@ struct drm_gem_object *i915_gem_prime_import(struct drm_device *dev,
 			 */
 			return &i915_gem_object_get(obj)->base;
 		}
+
+		/* not our device, but still a i915 object? */
+		if (i915_gem_object_is_lmem(obj))
+			return ERR_PTR(-ENOTSUPP);
 	}
 
 	/* need to attach */
-- 
2.26.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux