[Intel-gfx] [CI 2/4] drm/i915: Create/destroy VM (ppGTT) for use with contexts

Jordan Justen jordan.l.justen at intel.com
Sat Mar 30 09:46:49 UTC 2019


On 2019-03-22 02:23:23, Chris Wilson wrote:
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> index 00dec72f6875..d0a56c8d0bb9 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
<snip>
> +
> +static int set_ppgtt(struct i915_gem_context *ctx,
> +                    struct drm_i915_gem_context_param *args)
> +{
> +       struct drm_i915_file_private *file_priv = ctx->file_priv;
> +       struct i915_hw_ppgtt *ppgtt, *old;
> +       int err;
> +
> +       if (args->size)
> +               return -EINVAL;
> +
> +       if (!ctx->ppgtt)
> +               return -ENODEV;
> +
> +       if (upper_32_bits(args->value))
> +               return -ENOENT;
> +
> +       err = mutex_lock_interruptible(&file_priv->vm_idr_lock);
> +       if (err)
> +               return err;
> +
> +       ppgtt = idr_find(&file_priv->vm_idr, args->value);

I tried using I915_CONTEXT_CREATE_EXT_SETPARAM with
I915_CONTEXT_PARAM_VM, but this line was segfaulting (file_priv was
NULL).

I think it was because in i915_gem_context_create_ioctl, we process
the I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS flag before we call
gem_context_register. (gem_context_register sets ctx->file_priv) If I
move the gem_context_register call before the
I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS handling, the segfault goes
away.

-Jordan


More information about the Intel-gfx mailing list