]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/selftests: Use to_gt() helper
authorAndi Shyti <andi.shyti@linux.intel.com>
Tue, 14 Dec 2021 19:33:37 +0000 (21:33 +0200)
committerMatt Roper <matthew.d.roper@intel.com>
Sat, 18 Dec 2021 05:51:00 +0000 (21:51 -0800)
Use to_gt() helper consistently throughout the codebase.
Pure mechanical s/i915->gt/to_gt(i915). No functional changes.

Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Cc: MichaƂ Winiarski <michal.winiarski@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211214193346.21231-8-andi.shyti@linux.intel.com
14 files changed:
drivers/gpu/drm/i915/selftests/i915_active.c
drivers/gpu/drm/i915/selftests/i915_gem.c
drivers/gpu/drm/i915/selftests/i915_gem_evict.c
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
drivers/gpu/drm/i915/selftests/i915_perf.c
drivers/gpu/drm/i915/selftests/i915_request.c
drivers/gpu/drm/i915/selftests/i915_selftest.c
drivers/gpu/drm/i915/selftests/igt_flush_test.c
drivers/gpu/drm/i915/selftests/igt_live_test.c
drivers/gpu/drm/i915/selftests/intel_memory_region.c
drivers/gpu/drm/i915/selftests/intel_uncore.c
drivers/gpu/drm/i915/selftests/mock_gem_device.c
drivers/gpu/drm/i915/selftests/mock_gtt.c
drivers/gpu/drm/i915/selftests/mock_uncore.c

index 61bf4560d8af3a278a3973c755c6ce9163d89ea9..2dac9be1de5875c4b009382f5cfd005dfa97154c 100644 (file)
@@ -254,7 +254,7 @@ int i915_active_live_selftests(struct drm_i915_private *i915)
                SUBTEST(live_active_barrier),
        };
 
-       if (intel_gt_is_wedged(&i915->gt))
+       if (intel_gt_is_wedged(to_gt(i915)))
                return 0;
 
        return i915_subtests(tests, i915);
index 152d9ab135b1d4a6dddd0a92dd75a6eb15b10f7d..b5576888cd78e3fcd87ea1de5551398253eaadcd 100644 (file)
@@ -248,7 +248,7 @@ int i915_gem_live_selftests(struct drm_i915_private *i915)
                SUBTEST(igt_gem_ww_ctx),
        };
 
-       if (intel_gt_is_wedged(&i915->gt))
+       if (intel_gt_is_wedged(to_gt(i915)))
                return 0;
 
        return i915_live_subtests(tests, i915);
index 7e0658a77659393c2d11a82f6f4afb3e165604d0..75b709c26dd3c7c1803275e9f22ebb7c9aba88a5 100644 (file)
@@ -545,7 +545,7 @@ int i915_gem_evict_mock_selftests(void)
                return -ENOMEM;
 
        with_intel_runtime_pm(&i915->runtime_pm, wakeref)
-               err = i915_subtests(tests, &i915->gt);
+               err = i915_subtests(tests, to_gt(i915));
 
        mock_destroy_device(i915);
        return err;
@@ -557,8 +557,8 @@ int i915_gem_evict_live_selftests(struct drm_i915_private *i915)
                SUBTEST(igt_evict_contexts),
        };
 
-       if (intel_gt_is_wedged(&i915->gt))
+       if (intel_gt_is_wedged(to_gt(i915)))
                return 0;
 
-       return intel_gt_live_subtests(tests, &i915->gt);
+       return intel_gt_live_subtests(tests, to_gt(i915));
 }
index 46f4236039a9e53e46f8f5be3af5a8ffc0c58da2..48123c3e1ff0972c0d7975c53e4ec8905785e54b 100644 (file)
@@ -155,7 +155,7 @@ static int igt_ppgtt_alloc(void *arg)
        if (!HAS_PPGTT(dev_priv))
                return 0;
 
-       ppgtt = i915_ppgtt_create(&dev_priv->gt, 0);
+       ppgtt = i915_ppgtt_create(to_gt(dev_priv), 0);
        if (IS_ERR(ppgtt))
                return PTR_ERR(ppgtt);
 
@@ -1053,7 +1053,7 @@ static int exercise_ppgtt(struct drm_i915_private *dev_priv,
        if (IS_ERR(file))
                return PTR_ERR(file);
 
-       ppgtt = i915_ppgtt_create(&dev_priv->gt, 0);
+       ppgtt = i915_ppgtt_create(to_gt(dev_priv), 0);
        if (IS_ERR(ppgtt)) {
                err = PTR_ERR(ppgtt);
                goto out_free;
index 9e9a6cb1d9e59f347f226d85ad7e6d8f92c52746..88db2e3d81d0bc7204e977c824ddfeedc57049fe 100644 (file)
@@ -424,7 +424,7 @@ int i915_perf_live_selftests(struct drm_i915_private *i915)
        if (!perf->metrics_kobj || !perf->ops.enable_metric_set)
                return 0;
 
-       if (intel_gt_is_wedged(&i915->gt))
+       if (intel_gt_is_wedged(to_gt(i915)))
                return 0;
 
        err = alloc_empty_config(&i915->perf);
index 9979ef9197cd0e41df36ec5a81b43c20d87496b1..92a859b341904939c4d697f78b04698ef51b2d83 100644 (file)
@@ -841,7 +841,7 @@ static struct i915_vma *empty_batch(struct drm_i915_private *i915)
        __i915_gem_object_flush_map(obj, 0, 64);
        i915_gem_object_unpin_map(obj);
 
-       intel_gt_chipset_flush(&i915->gt);
+       intel_gt_chipset_flush(to_gt(i915));
 
        vma = i915_vma_instance(obj, &i915->ggtt.vm, NULL);
        if (IS_ERR(vma)) {
@@ -982,7 +982,7 @@ static struct i915_vma *recursive_batch(struct drm_i915_private *i915)
        if (IS_ERR(obj))
                return ERR_CAST(obj);
 
-       vma = i915_vma_instance(obj, i915->gt.vm, NULL);
+       vma = i915_vma_instance(obj, to_gt(i915)->vm, NULL);
        if (IS_ERR(vma)) {
                err = PTR_ERR(vma);
                goto err;
@@ -1014,7 +1014,7 @@ static struct i915_vma *recursive_batch(struct drm_i915_private *i915)
        __i915_gem_object_flush_map(obj, 0, 64);
        i915_gem_object_unpin_map(obj);
 
-       intel_gt_chipset_flush(&i915->gt);
+       intel_gt_chipset_flush(to_gt(i915));
 
        return vma;
 
@@ -1700,7 +1700,7 @@ int i915_request_live_selftests(struct drm_i915_private *i915)
                SUBTEST(live_breadcrumbs_smoketest),
        };
 
-       if (intel_gt_is_wedged(&i915->gt))
+       if (intel_gt_is_wedged(to_gt(i915)))
                return 0;
 
        return i915_subtests(tests, i915);
@@ -3091,7 +3091,7 @@ int i915_request_perf_selftests(struct drm_i915_private *i915)
                SUBTEST(perf_parallel_engines),
        };
 
-       if (intel_gt_is_wedged(&i915->gt))
+       if (intel_gt_is_wedged(to_gt(i915)))
                return 0;
 
        return i915_subtests(tests, i915);
index 484759c9409c053eebf7626a3aad5ad107c73793..2d6d7bd13c3c771f547b74442ac3d72ad85bc269 100644 (file)
@@ -298,10 +298,10 @@ int __i915_live_setup(void *data)
        struct drm_i915_private *i915 = data;
 
        /* The selftests expect an idle system */
-       if (intel_gt_pm_wait_for_idle(&i915->gt))
+       if (intel_gt_pm_wait_for_idle(to_gt(i915)))
                return -EIO;
 
-       return intel_gt_terminally_wedged(&i915->gt);
+       return intel_gt_terminally_wedged(to_gt(i915));
 }
 
 int __i915_live_teardown(int err, void *data)
index a6c71fca61aac9c217c64c63b40c8aeb5db014c1..b84594601d30cc8cb8e27bf19c0c87e823d1932d 100644 (file)
@@ -14,7 +14,7 @@
 
 int igt_flush_test(struct drm_i915_private *i915)
 {
-       struct intel_gt *gt = &i915->gt;
+       struct intel_gt *gt = to_gt(i915);
        int ret = intel_gt_is_wedged(gt) ? -EIO : 0;
 
        cond_resched();
index 1c721542e277c8b0a480403f8f81fff9bc4d6c63..72b58b66692ad2cbde1d9fcbf0bd1a6c999e8c3f 100644 (file)
@@ -16,7 +16,7 @@ int igt_live_test_begin(struct igt_live_test *t,
                        const char *func,
                        const char *name)
 {
-       struct intel_gt *gt = &i915->gt;
+       struct intel_gt *gt = to_gt(i915);
        struct intel_engine_cs *engine;
        enum intel_engine_id id;
        int err;
@@ -57,7 +57,7 @@ int igt_live_test_end(struct igt_live_test *t)
                return -EIO;
        }
 
-       for_each_engine(engine, &i915->gt, id) {
+       for_each_engine(engine, to_gt(i915), id) {
                if (t->reset_engine[id] ==
                    i915_reset_engine_count(&i915->gpu_error, engine))
                        continue;
index 0d5df0dc721229ad9f3f4dc123a3bcea2f3dbd31..8255561ff853d1b3e8250c06500fad26dc1dfa74 100644 (file)
@@ -1217,7 +1217,7 @@ int intel_memory_region_live_selftests(struct drm_i915_private *i915)
                return 0;
        }
 
-       if (intel_gt_is_wedged(&i915->gt))
+       if (intel_gt_is_wedged(to_gt(i915)))
                return 0;
 
        return i915_live_subtests(tests, i915);
@@ -1229,7 +1229,7 @@ int intel_memory_region_perf_selftests(struct drm_i915_private *i915)
                SUBTEST(perf_memcpy),
        };
 
-       if (intel_gt_is_wedged(&i915->gt))
+       if (intel_gt_is_wedged(to_gt(i915)))
                return 0;
 
        return i915_live_subtests(tests, i915);
index bc8128170a99af256384c3a1e8eba7362314bd47..cdd196783535af05263c437f793bafe03bff0df1 100644 (file)
@@ -344,5 +344,5 @@ int intel_uncore_live_selftests(struct drm_i915_private *i915)
                SUBTEST(live_forcewake_domains),
        };
 
-       return intel_gt_live_subtests(tests, &i915->gt);
+       return intel_gt_live_subtests(tests, to_gt(i915));
 }
index eeb632aac4a7bf116845566223dfc0d3d38c3943..8aa7b1d338659c2c249fe6e21b7f91fd0427f174 100644 (file)
@@ -45,7 +45,7 @@
 
 void mock_device_flush(struct drm_i915_private *i915)
 {
-       struct intel_gt *gt = &i915->gt;
+       struct intel_gt *gt = to_gt(i915);
        struct intel_engine_cs *engine;
        enum intel_engine_id id;
 
@@ -64,7 +64,7 @@ static void mock_device_release(struct drm_device *dev)
                goto out;
 
        mock_device_flush(i915);
-       intel_gt_driver_remove(&i915->gt);
+       intel_gt_driver_remove(to_gt(i915));
 
        i915_gem_drain_workqueue(i915);
        i915_gem_drain_freed_objects(i915);
@@ -73,7 +73,7 @@ static void mock_device_release(struct drm_device *dev)
        destroy_workqueue(i915->wq);
 
        intel_region_ttm_device_fini(i915);
-       intel_gt_driver_late_release(&i915->gt);
+       intel_gt_driver_late_release(to_gt(i915));
        intel_memory_regions_driver_release(i915);
 
        drm_mode_config_cleanup(&i915->drm);
@@ -178,11 +178,11 @@ struct drm_i915_private *mock_gem_device(void)
        spin_lock_init(&i915->gpu_error.lock);
 
        i915_gem_init__mm(i915);
-       intel_gt_init_early(&i915->gt, i915);
-       __intel_gt_init_early(&i915->gt, i915);
+       intel_gt_init_early(to_gt(i915), i915);
+       __intel_gt_init_early(to_gt(i915), i915);
        mock_uncore_init(&i915->uncore, i915);
-       atomic_inc(&i915->gt.wakeref.count); /* disable; no hw support */
-       i915->gt.awake = -ENODEV;
+       atomic_inc(&to_gt(i915)->wakeref.count); /* disable; no hw support */
+       to_gt(i915)->awake = -ENODEV;
 
        ret = intel_region_ttm_device_init(i915);
        if (ret)
@@ -195,19 +195,19 @@ struct drm_i915_private *mock_gem_device(void)
        mock_init_contexts(i915);
 
        mock_init_ggtt(i915, &i915->ggtt);
-       i915->gt.vm = i915_vm_get(&i915->ggtt.vm);
+       to_gt(i915)->vm = i915_vm_get(&i915->ggtt.vm);
 
        mkwrite_device_info(i915)->platform_engine_mask = BIT(0);
-       i915->gt.info.engine_mask = BIT(0);
+       to_gt(i915)->info.engine_mask = BIT(0);
 
-       i915->gt.engine[RCS0] = mock_engine(i915, "mock", RCS0);
-       if (!i915->gt.engine[RCS0])
+       to_gt(i915)->engine[RCS0] = mock_engine(i915, "mock", RCS0);
+       if (!to_gt(i915)->engine[RCS0])
                goto err_unlock;
 
-       if (mock_engine_init(i915->gt.engine[RCS0]))
+       if (mock_engine_init(to_gt(i915)->engine[RCS0]))
                goto err_context;
 
-       __clear_bit(I915_WEDGED, &i915->gt.reset.flags);
+       __clear_bit(I915_WEDGED, &to_gt(i915)->reset.flags);
        intel_engines_driver_register(i915);
 
        i915->do_release = true;
@@ -216,13 +216,13 @@ struct drm_i915_private *mock_gem_device(void)
        return i915;
 
 err_context:
-       intel_gt_driver_remove(&i915->gt);
+       intel_gt_driver_remove(to_gt(i915));
 err_unlock:
        destroy_workqueue(i915->wq);
 err_drv:
        intel_region_ttm_device_fini(i915);
 err_ttm:
-       intel_gt_driver_late_release(&i915->gt);
+       intel_gt_driver_late_release(to_gt(i915));
        intel_memory_regions_driver_release(i915);
        drm_mode_config_cleanup(&i915->drm);
        mock_destroy_device(i915);
index 32ca8962d0abdedfce78f2865030d9fe2f14cec4..13bb0c3c3f0d4375d0789d9cc72e8b605479b1e7 100644 (file)
@@ -70,7 +70,7 @@ struct i915_ppgtt *mock_ppgtt(struct drm_i915_private *i915, const char *name)
        if (!ppgtt)
                return NULL;
 
-       ppgtt->vm.gt = &i915->gt;
+       ppgtt->vm.gt = to_gt(i915);
        ppgtt->vm.i915 = i915;
        ppgtt->vm.total = round_down(U64_MAX, PAGE_SIZE);
        ppgtt->vm.dma = i915->drm.dev;
@@ -110,7 +110,7 @@ void mock_init_ggtt(struct drm_i915_private *i915, struct i915_ggtt *ggtt)
 {
        memset(ggtt, 0, sizeof(*ggtt));
 
-       ggtt->vm.gt = &i915->gt;
+       ggtt->vm.gt = to_gt(i915);
        ggtt->vm.i915 = i915;
        ggtt->vm.is_ggtt = true;
 
@@ -132,7 +132,7 @@ void mock_init_ggtt(struct drm_i915_private *i915, struct i915_ggtt *ggtt)
        ggtt->vm.vma_ops.clear_pages = clear_pages;
 
        i915_address_space_init(&ggtt->vm, VM_CLASS_GGTT);
-       i915->gt.ggtt = ggtt;
+       to_gt(i915)->ggtt = ggtt;
 }
 
 void mock_fini_ggtt(struct i915_ggtt *ggtt)
index b3790ef137e41b40eb19ab5521dbb7ba48857d5d..f2d6be5e12309e29c773893a68a029fe536f169c 100644 (file)
@@ -42,7 +42,7 @@ __nop_read(64)
 void mock_uncore_init(struct intel_uncore *uncore,
                      struct drm_i915_private *i915)
 {
-       intel_uncore_init_early(uncore, &i915->gt);
+       intel_uncore_init_early(uncore, to_gt(i915));
 
        ASSIGN_RAW_WRITE_MMIO_VFUNCS(uncore, nop);
        ASSIGN_RAW_READ_MMIO_VFUNCS(uncore, nop);