[Intel-gfx] [CI 1/1] drm/i915: Disable pread/pwrite ioctl's for IGT testing

Ashutosh Dixit ashutosh.dixit at intel.com
Thu Jan 21 20:09:22 UTC 2021


FOR CI ONLY. PLEASE DON'T REVIEW.

The upstream guidance at this time is to start phasing out
pread/pwrite ioctl's, the rationale being (a) the functionality can be
done entirely in userspace with a combination of mmap + memcpy, and
(b) no existing user mode clients actually use the pread/pwrite
interface.

The plan is to phase out these ioctls for _new_ Gen12+ platforms. However,
since this patch is actually for CI and the real changes which need to be
validated are in IGT, in this patch we are disabling pread/pwrite for
existing Gen11 and Gen12 platforms. This will be changed once IGT changes
are validated and finalized.

Signed-off-by: Ashutosh Dixit <ashutosh.dixit at intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 9b04dff5eb32..1c799d0006c8 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -366,6 +366,18 @@ i915_gem_gtt_pread(struct drm_i915_gem_object *obj,
 	return ret;
 }
 
+static bool gem_has_pread_pwrite(struct drm_device *dev)
+{
+	/*
+	 * FIXME: Finally we only want to enable this for _new_ Gen12+
+	 * platforms but for now for CI purposes declare pread/pwrite are
+	 * unavailable for all Gen11 and Gen12 platforms so that the IGT
+	 * changes which handle absence of pread/pwrite ioctl's can be
+	 * validated.
+	*/
+	return INTEL_GEN(to_i915(dev)) < 11;
+}
+
 /**
  * Reads data from the object referenced by handle.
  * @dev: drm device pointer
@@ -382,6 +394,9 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
 	struct drm_i915_gem_object *obj;
 	int ret;
 
+	if (!gem_has_pread_pwrite(dev))
+		return -EOPNOTSUPP;
+
 	if (args->size == 0)
 		return 0;
 
@@ -687,6 +702,9 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
 	struct drm_i915_gem_object *obj;
 	int ret;
 
+	if (!gem_has_pread_pwrite(dev))
+		return -EOPNOTSUPP;
+
 	if (args->size == 0)
 		return 0;
 
-- 
2.29.2



More information about the Intel-gfx mailing list