]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/gvt: Do not allocate initial ring scan buffer
authorZhi Wang <zhi.a.wang@intel.com>
Sun, 10 Sep 2017 14:01:10 +0000 (22:01 +0800)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Thu, 16 Nov 2017 03:46:51 +0000 (11:46 +0800)
Theoretically, the largest bulk of commands in the ring buffer of an
engine might be the first submission, which usually contains a lot
of commands to initialize the HW. After removing the initial allocation
of the ring scan buffer and let krealloc() do everything we need, we
still have a big chance to get the buffer of suitable size in the first
submission.

Tested on my SKL NUC.

Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>
drivers/gpu/drm/i915/gvt/execlist.c
drivers/gpu/drm/i915/gvt/gvt.h

index 7c7ab63a7bb8a3b0fa981b78219d87a282a8e7a5..adf7668f8cc1c84a266f2308532677e581bbb22c 100644 (file)
@@ -872,36 +872,15 @@ void intel_vgpu_clean_execlist(struct intel_vgpu *vgpu)
        }
 }
 
-#define RESERVE_RING_BUFFER_SIZE               ((1 * PAGE_SIZE)/8)
 int intel_vgpu_init_execlist(struct intel_vgpu *vgpu)
 {
-       struct intel_vgpu_submission *s = &vgpu->submission;
        enum intel_engine_id i;
        struct intel_engine_cs *engine;
 
        for_each_engine(engine, vgpu->gvt->dev_priv, i)
                init_vgpu_execlist(vgpu, i);
 
-       /* each ring has a shadow ring buffer until vgpu destroyed */
-       for_each_engine(engine, vgpu->gvt->dev_priv, i) {
-               s->ring_scan_buffer[i] =
-                       kmalloc(RESERVE_RING_BUFFER_SIZE, GFP_KERNEL);
-               if (!s->ring_scan_buffer[i]) {
-                       gvt_vgpu_err("fail to alloc ring scan buffer\n");
-                       goto out;
-               }
-               s->ring_scan_buffer_size[i] = RESERVE_RING_BUFFER_SIZE;
-       }
        return 0;
-out:
-       for_each_engine(engine, vgpu->gvt->dev_priv, i) {
-               if (s->ring_scan_buffer_size[i]) {
-                       kfree(s->ring_scan_buffer[i]);
-                       s->ring_scan_buffer[i] = NULL;
-                       s->ring_scan_buffer_size[i] = 0;
-               }
-       }
-       return -ENOMEM;
 }
 
 void intel_vgpu_reset_execlist(struct intel_vgpu *vgpu,
index 49fe5487000036695e6eec153bd48130a2504261..7a770b1c99d6a66ea42bc90259f566e4e10576c4 100644 (file)
@@ -150,7 +150,6 @@ struct intel_vgpu_submission {
        struct i915_gem_context *shadow_ctx;
        DECLARE_BITMAP(shadow_ctx_desc_updated, I915_NUM_ENGINES);
        DECLARE_BITMAP(tlb_handle_pending, I915_NUM_ENGINES);
-       /* 1/2K for each engine */
        void *ring_scan_buffer[I915_NUM_ENGINES];
        int ring_scan_buffer_size[I915_NUM_ENGINES];
 };