[Intel-gfx] [PATCH] drm/i915: Return -EPERM when i915_gem_mmap_ioctl handling prime objects

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Tue Aug 15 13:37:02 UTC 2017


On Tue, 2017-08-15 at 16:42 +0800, Tina Zhang wrote:
> Prime objects have no backing filp to GEM mmap pages from. So, for Prime
> objects, such operation is not permitted.
> 
> v1:
> - Separate this patch from dma-buf patch set. (Joonas)
> 
> Signed-off-by: Tina Zhang <tina.zhang at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 0628fb1..bb9d5ed 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1704,7 +1704,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
>  	 */
>  	if (!obj->base.filp) {
>  		i915_gem_object_put(obj);
> -		return -EINVAL;
> +		return -EPERM;

+ Daniel (in case he wants to explain in more detail)

The existing usecases in the driver for -EPERM are all conditional to
not being privileged user or DRM master, so we should rather stick to
"-EINVAL" and augment with DRM_DEBUG_DRIVER in case the developer may
want to know read more about the -EINVAL.

Lets stick to that convention here and in the GVT dma-buf patches.

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation


More information about the Intel-gfx mailing list