Skip to content

Commit 72e2777

Browse files
committed
drm/i915: Remove i915_gem_context_create_gvt()
As we are phasing out using the GEM context for internal clients that need to manipulate logical context state directly, remove the constructor for the GVT context. We are not using it for anything other than default setup and allocation of an i915_ppgtt. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190809182518.20486-1-chris@chris-wilson.co.uk
1 parent 3148310 commit 72e2777

File tree

3 files changed

+17
-54
lines changed

3 files changed

+17
-54
lines changed

drivers/gpu/drm/i915/gem/i915_gem_context.c

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -529,53 +529,6 @@ i915_gem_create_context(struct drm_i915_private *dev_priv, unsigned int flags)
529529
return ctx;
530530
}
531531

532-
/**
533-
* i915_gem_context_create_gvt - create a GVT GEM context
534-
* @dev: drm device *
535-
*
536-
* This function is used to create a GVT specific GEM context.
537-
*
538-
* Returns:
539-
* pointer to i915_gem_context on success, error pointer if failed
540-
*
541-
*/
542-
struct i915_gem_context *
543-
i915_gem_context_create_gvt(struct drm_device *dev)
544-
{
545-
struct i915_gem_context *ctx;
546-
int ret;
547-
548-
if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
549-
return ERR_PTR(-ENODEV);
550-
551-
ret = i915_mutex_lock_interruptible(dev);
552-
if (ret)
553-
return ERR_PTR(ret);
554-
555-
ctx = i915_gem_create_context(to_i915(dev), 0);
556-
if (IS_ERR(ctx))
557-
goto out;
558-
559-
ret = i915_gem_context_pin_hw_id(ctx);
560-
if (ret) {
561-
context_close(ctx);
562-
ctx = ERR_PTR(ret);
563-
goto out;
564-
}
565-
566-
ctx->file_priv = ERR_PTR(-EBADF);
567-
i915_gem_context_set_closed(ctx); /* not user accessible */
568-
i915_gem_context_clear_bannable(ctx);
569-
i915_gem_context_set_force_single_submission(ctx);
570-
if (!USES_GUC_SUBMISSION(to_i915(dev)))
571-
ctx->ring_size = 512 * PAGE_SIZE; /* Max ring buffer size */
572-
573-
GEM_BUG_ON(i915_gem_context_is_kernel(ctx));
574-
out:
575-
mutex_unlock(&dev->struct_mutex);
576-
return ctx;
577-
}
578-
579532
static void
580533
destroy_kernel_context(struct i915_gem_context **ctxp)
581534
{

drivers/gpu/drm/i915/gem/i915_gem_context.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,6 @@ int i915_gem_context_open(struct drm_i915_private *i915,
141141
void i915_gem_context_close(struct drm_file *file);
142142

143143
void i915_gem_context_release(struct kref *ctx_ref);
144-
struct i915_gem_context *
145-
i915_gem_context_create_gvt(struct drm_device *dev);
146144

147145
int i915_gem_vm_create_ioctl(struct drm_device *dev, void *data,
148146
struct drm_file *file);

drivers/gpu/drm/i915/gvt/scheduler.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,19 +1211,28 @@ i915_context_ppgtt_root_save(struct intel_vgpu_submission *s,
12111211
*/
12121212
int intel_vgpu_setup_submission(struct intel_vgpu *vgpu)
12131213
{
1214+
struct drm_i915_private *i915 = vgpu->gvt->dev_priv;
12141215
struct intel_vgpu_submission *s = &vgpu->submission;
12151216
struct intel_engine_cs *engine;
12161217
struct i915_gem_context *ctx;
12171218
enum intel_engine_id i;
12181219
int ret;
12191220

1220-
ctx = i915_gem_context_create_gvt(&vgpu->gvt->dev_priv->drm);
1221-
if (IS_ERR(ctx))
1222-
return PTR_ERR(ctx);
1221+
mutex_lock(&i915->drm.struct_mutex);
1222+
1223+
ctx = i915_gem_context_create_kernel(i915, I915_PRIORITY_MAX);
1224+
if (IS_ERR(ctx)) {
1225+
ret = PTR_ERR(ctx);
1226+
goto out_unlock;
1227+
}
1228+
1229+
i915_gem_context_set_force_single_submission(ctx);
1230+
if (!USES_GUC_SUBMISSION(i915))
1231+
ctx->ring_size = 512 * PAGE_SIZE; /* Max ring buffer size */
12231232

12241233
i915_context_ppgtt_root_save(s, i915_vm_to_ppgtt(ctx->vm));
12251234

1226-
for_each_engine(engine, vgpu->gvt->dev_priv, i) {
1235+
for_each_engine(engine, i915, i) {
12271236
struct intel_context *ce;
12281237

12291238
INIT_LIST_HEAD(&s->workload_q_head[i]);
@@ -1261,18 +1270,21 @@ int intel_vgpu_setup_submission(struct intel_vgpu *vgpu)
12611270
bitmap_zero(s->tlb_handle_pending, I915_NUM_ENGINES);
12621271

12631272
i915_gem_context_put(ctx);
1273+
mutex_unlock(&i915->drm.struct_mutex);
12641274
return 0;
12651275

12661276
out_shadow_ctx:
12671277
i915_context_ppgtt_root_restore(s, i915_vm_to_ppgtt(ctx->vm));
1268-
for_each_engine(engine, vgpu->gvt->dev_priv, i) {
1278+
for_each_engine(engine, i915, i) {
12691279
if (IS_ERR(s->shadow[i]))
12701280
break;
12711281

12721282
intel_context_unpin(s->shadow[i]);
12731283
intel_context_put(s->shadow[i]);
12741284
}
12751285
i915_gem_context_put(ctx);
1286+
out_unlock:
1287+
mutex_unlock(&i915->drm.struct_mutex);
12761288
return ret;
12771289
}
12781290

0 commit comments

Comments
 (0)