drm/i915/gt: Pull timeline initialise to intel_gt_init_early
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 1 Nov 2019 13:04:06 +0000 (13:04 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 1 Nov 2019 14:47:36 +0000 (14:47 +0000)
Our timelines are currently contained within an intel_gt, and we only
need to perform list/spinlock initialisation, so we can pull the
intel_timelines_init() into our intel_gt_init_early().

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191101130406.4142-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gt/intel_gt.c
drivers/gpu/drm/i915/gt/intel_timeline.c
drivers/gpu/drm/i915/gt/intel_timeline.h
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/selftests/mock_gem_device.c

index 898662c158ad2892e29c71b8065db8938baffb53..15c0a0dfc4246d8cae862de6c8c7814c8f8121d5 100644 (file)
@@ -25,6 +25,7 @@ void intel_gt_init_early(struct intel_gt *gt, struct drm_i915_private *i915)
 
        intel_gt_init_reset(gt);
        intel_gt_init_requests(gt);
+       intel_gt_init_timelines(gt);
        intel_gt_pm_init_early(gt);
 
        intel_rps_init_early(&gt->rps);
@@ -395,4 +396,5 @@ void intel_gt_driver_late_release(struct intel_gt *gt)
 {
        intel_uc_driver_late_release(&gt->uc);
        intel_gt_fini_reset(gt);
+       intel_gt_fini_timelines(gt);
 }
index 14ad10acd548819dcdcdeebc8a965af9decbae3c..16a9e88d93de5854d50ce30e6ffac954d77140af 100644 (file)
@@ -262,7 +262,7 @@ int intel_timeline_init(struct intel_timeline *timeline,
        return 0;
 }
 
-static void timelines_init(struct intel_gt *gt)
+void intel_gt_init_timelines(struct intel_gt *gt)
 {
        struct intel_gt_timelines *timelines = &gt->timelines;
 
@@ -273,11 +273,6 @@ static void timelines_init(struct intel_gt *gt)
        INIT_LIST_HEAD(&timelines->hwsp_free_list);
 }
 
-void intel_timelines_init(struct drm_i915_private *i915)
-{
-       timelines_init(&i915->gt);
-}
-
 void intel_timeline_fini(struct intel_timeline *timeline)
 {
        GEM_BUG_ON(atomic_read(&timeline->pin_count));
@@ -562,7 +557,7 @@ void __intel_timeline_free(struct kref *kref)
        kfree_rcu(timeline, rcu);
 }
 
-static void timelines_fini(struct intel_gt *gt)
+void intel_gt_fini_timelines(struct intel_gt *gt)
 {
        struct intel_gt_timelines *timelines = &gt->timelines;
 
@@ -570,11 +565,6 @@ static void timelines_fini(struct intel_gt *gt)
        GEM_BUG_ON(!list_empty(&timelines->hwsp_free_list));
 }
 
-void intel_timelines_fini(struct drm_i915_private *i915)
-{
-       timelines_fini(&i915->gt);
-}
-
 #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
 #include "gt/selftests/mock_timeline.c"
 #include "gt/selftest_timeline.c"
index f583af1ba18dc073d035c813848788ac32a50c80..f5b7eade3809b41b220d9bfea5ac30cd556c38a9 100644 (file)
@@ -88,7 +88,7 @@ int intel_timeline_read_hwsp(struct i915_request *from,
                             struct i915_request *until,
                             u32 *hwsp_offset);
 
-void intel_timelines_init(struct drm_i915_private *i915);
-void intel_timelines_fini(struct drm_i915_private *i915);
+void intel_gt_init_timelines(struct intel_gt *gt);
+void intel_gt_fini_timelines(struct intel_gt *gt);
 
 #endif
index b1574ab104d7cbf62222c453b7d871adb2b1e74e..af2cdc8eddeb7d08ede0b01bd5fdd36143d83d25 100644 (file)
@@ -1227,8 +1227,6 @@ int i915_gem_init(struct drm_i915_private *dev_priv)
                mkwrite_device_info(dev_priv)->page_sizes =
                        I915_GTT_PAGE_SIZE_4K;
 
-       intel_timelines_init(dev_priv);
-
        ret = i915_gem_init_userptr(dev_priv);
        if (ret)
                return ret;
@@ -1342,7 +1340,6 @@ err_unlock:
        if (ret != -EIO) {
                intel_uc_cleanup_firmwares(&dev_priv->gt.uc);
                i915_gem_cleanup_userptr(dev_priv);
-               intel_timelines_fini(dev_priv);
        }
 
        if (ret == -EIO) {
@@ -1406,7 +1403,6 @@ void i915_gem_driver_release(struct drm_i915_private *dev_priv)
 
        intel_uc_cleanup_firmwares(&dev_priv->gt.uc);
        i915_gem_cleanup_userptr(dev_priv);
-       intel_timelines_fini(dev_priv);
 
        i915_gem_drain_freed_objects(dev_priv);
 
index a0da5944dd33fae5c3edfc63d8ac2a3b984f657f..01edc3c7eb2180de4637a6127c80eb8b2fe1b604 100644 (file)
@@ -65,8 +65,6 @@ static void mock_device_release(struct drm_device *dev)
                mock_engine_free(engine);
        i915_gem_driver_release__contexts(i915);
 
-       intel_timelines_fini(i915);
-
        drain_workqueue(i915->wq);
        i915_gem_drain_freed_objects(i915);
 
@@ -180,8 +178,6 @@ struct drm_i915_private *mock_gem_device(void)
 
        mock_init_contexts(i915);
 
-       intel_timelines_init(i915);
-
        mock_init_ggtt(i915, &i915->ggtt);
        i915->gt.ggtt = &i915->ggtt;
 
@@ -207,7 +203,6 @@ err_context:
 err_engine:
        mock_engine_free(i915->engine[RCS0]);
 err_unlock:
-       intel_timelines_fini(i915);
        destroy_workqueue(i915->wq);
 err_drv:
        intel_memory_regions_driver_release(i915);