Commit 8c2699fa authored by Andi Shyti's avatar Andi Shyti Committed by Matt Roper

drm/i915/selftests: Use to_gt() helper

Use to_gt() helper consistently throughout the codebase.
Pure mechanical s/i915->gt/to_gt(i915). No functional changes.
Signed-off-by: default avatarAndi Shyti <andi.shyti@linux.intel.com>
Cc: Michał Winiarski <michal.winiarski@intel.com>
Reviewed-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211214193346.21231-8-andi.shyti@linux.intel.com
parent 93b76b13
...@@ -254,7 +254,7 @@ int i915_active_live_selftests(struct drm_i915_private *i915) ...@@ -254,7 +254,7 @@ int i915_active_live_selftests(struct drm_i915_private *i915)
SUBTEST(live_active_barrier), SUBTEST(live_active_barrier),
}; };
if (intel_gt_is_wedged(&i915->gt)) if (intel_gt_is_wedged(to_gt(i915)))
return 0; return 0;
return i915_subtests(tests, i915); return i915_subtests(tests, i915);
......
...@@ -248,7 +248,7 @@ int i915_gem_live_selftests(struct drm_i915_private *i915) ...@@ -248,7 +248,7 @@ int i915_gem_live_selftests(struct drm_i915_private *i915)
SUBTEST(igt_gem_ww_ctx), SUBTEST(igt_gem_ww_ctx),
}; };
if (intel_gt_is_wedged(&i915->gt)) if (intel_gt_is_wedged(to_gt(i915)))
return 0; return 0;
return i915_live_subtests(tests, i915); return i915_live_subtests(tests, i915);
......
...@@ -545,7 +545,7 @@ int i915_gem_evict_mock_selftests(void) ...@@ -545,7 +545,7 @@ int i915_gem_evict_mock_selftests(void)
return -ENOMEM; return -ENOMEM;
with_intel_runtime_pm(&i915->runtime_pm, wakeref) 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); mock_destroy_device(i915);
return err; return err;
...@@ -557,8 +557,8 @@ int i915_gem_evict_live_selftests(struct drm_i915_private *i915) ...@@ -557,8 +557,8 @@ int i915_gem_evict_live_selftests(struct drm_i915_private *i915)
SUBTEST(igt_evict_contexts), SUBTEST(igt_evict_contexts),
}; };
if (intel_gt_is_wedged(&i915->gt)) if (intel_gt_is_wedged(to_gt(i915)))
return 0; return 0;
return intel_gt_live_subtests(tests, &i915->gt); return intel_gt_live_subtests(tests, to_gt(i915));
} }
...@@ -155,7 +155,7 @@ static int igt_ppgtt_alloc(void *arg) ...@@ -155,7 +155,7 @@ static int igt_ppgtt_alloc(void *arg)
if (!HAS_PPGTT(dev_priv)) if (!HAS_PPGTT(dev_priv))
return 0; return 0;
ppgtt = i915_ppgtt_create(&dev_priv->gt, 0); ppgtt = i915_ppgtt_create(to_gt(dev_priv), 0);
if (IS_ERR(ppgtt)) if (IS_ERR(ppgtt))
return PTR_ERR(ppgtt); return PTR_ERR(ppgtt);
...@@ -1053,7 +1053,7 @@ static int exercise_ppgtt(struct drm_i915_private *dev_priv, ...@@ -1053,7 +1053,7 @@ static int exercise_ppgtt(struct drm_i915_private *dev_priv,
if (IS_ERR(file)) if (IS_ERR(file))
return PTR_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)) { if (IS_ERR(ppgtt)) {
err = PTR_ERR(ppgtt); err = PTR_ERR(ppgtt);
goto out_free; goto out_free;
......
...@@ -424,7 +424,7 @@ int i915_perf_live_selftests(struct drm_i915_private *i915) ...@@ -424,7 +424,7 @@ int i915_perf_live_selftests(struct drm_i915_private *i915)
if (!perf->metrics_kobj || !perf->ops.enable_metric_set) if (!perf->metrics_kobj || !perf->ops.enable_metric_set)
return 0; return 0;
if (intel_gt_is_wedged(&i915->gt)) if (intel_gt_is_wedged(to_gt(i915)))
return 0; return 0;
err = alloc_empty_config(&i915->perf); err = alloc_empty_config(&i915->perf);
......
...@@ -841,7 +841,7 @@ static struct i915_vma *empty_batch(struct drm_i915_private *i915) ...@@ -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_flush_map(obj, 0, 64);
i915_gem_object_unpin_map(obj); 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); vma = i915_vma_instance(obj, &i915->ggtt.vm, NULL);
if (IS_ERR(vma)) { if (IS_ERR(vma)) {
...@@ -982,7 +982,7 @@ static struct i915_vma *recursive_batch(struct drm_i915_private *i915) ...@@ -982,7 +982,7 @@ static struct i915_vma *recursive_batch(struct drm_i915_private *i915)
if (IS_ERR(obj)) if (IS_ERR(obj))
return ERR_CAST(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)) { if (IS_ERR(vma)) {
err = PTR_ERR(vma); err = PTR_ERR(vma);
goto err; goto err;
...@@ -1014,7 +1014,7 @@ static struct i915_vma *recursive_batch(struct drm_i915_private *i915) ...@@ -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_flush_map(obj, 0, 64);
i915_gem_object_unpin_map(obj); i915_gem_object_unpin_map(obj);
intel_gt_chipset_flush(&i915->gt); intel_gt_chipset_flush(to_gt(i915));
return vma; return vma;
...@@ -1700,7 +1700,7 @@ int i915_request_live_selftests(struct drm_i915_private *i915) ...@@ -1700,7 +1700,7 @@ int i915_request_live_selftests(struct drm_i915_private *i915)
SUBTEST(live_breadcrumbs_smoketest), SUBTEST(live_breadcrumbs_smoketest),
}; };
if (intel_gt_is_wedged(&i915->gt)) if (intel_gt_is_wedged(to_gt(i915)))
return 0; return 0;
return i915_subtests(tests, i915); return i915_subtests(tests, i915);
...@@ -3091,7 +3091,7 @@ int i915_request_perf_selftests(struct drm_i915_private *i915) ...@@ -3091,7 +3091,7 @@ int i915_request_perf_selftests(struct drm_i915_private *i915)
SUBTEST(perf_parallel_engines), SUBTEST(perf_parallel_engines),
}; };
if (intel_gt_is_wedged(&i915->gt)) if (intel_gt_is_wedged(to_gt(i915)))
return 0; return 0;
return i915_subtests(tests, i915); return i915_subtests(tests, i915);
......
...@@ -298,10 +298,10 @@ int __i915_live_setup(void *data) ...@@ -298,10 +298,10 @@ int __i915_live_setup(void *data)
struct drm_i915_private *i915 = data; struct drm_i915_private *i915 = data;
/* The selftests expect an idle system */ /* 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 -EIO;
return intel_gt_terminally_wedged(&i915->gt); return intel_gt_terminally_wedged(to_gt(i915));
} }
int __i915_live_teardown(int err, void *data) int __i915_live_teardown(int err, void *data)
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
int igt_flush_test(struct drm_i915_private *i915) 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; int ret = intel_gt_is_wedged(gt) ? -EIO : 0;
cond_resched(); cond_resched();
......
...@@ -16,7 +16,7 @@ int igt_live_test_begin(struct igt_live_test *t, ...@@ -16,7 +16,7 @@ int igt_live_test_begin(struct igt_live_test *t,
const char *func, const char *func,
const char *name) const char *name)
{ {
struct intel_gt *gt = &i915->gt; struct intel_gt *gt = to_gt(i915);
struct intel_engine_cs *engine; struct intel_engine_cs *engine;
enum intel_engine_id id; enum intel_engine_id id;
int err; int err;
...@@ -57,7 +57,7 @@ int igt_live_test_end(struct igt_live_test *t) ...@@ -57,7 +57,7 @@ int igt_live_test_end(struct igt_live_test *t)
return -EIO; return -EIO;
} }
for_each_engine(engine, &i915->gt, id) { for_each_engine(engine, to_gt(i915), id) {
if (t->reset_engine[id] == if (t->reset_engine[id] ==
i915_reset_engine_count(&i915->gpu_error, engine)) i915_reset_engine_count(&i915->gpu_error, engine))
continue; continue;
......
...@@ -1217,7 +1217,7 @@ int intel_memory_region_live_selftests(struct drm_i915_private *i915) ...@@ -1217,7 +1217,7 @@ int intel_memory_region_live_selftests(struct drm_i915_private *i915)
return 0; return 0;
} }
if (intel_gt_is_wedged(&i915->gt)) if (intel_gt_is_wedged(to_gt(i915)))
return 0; return 0;
return i915_live_subtests(tests, i915); return i915_live_subtests(tests, i915);
...@@ -1229,7 +1229,7 @@ int intel_memory_region_perf_selftests(struct drm_i915_private *i915) ...@@ -1229,7 +1229,7 @@ int intel_memory_region_perf_selftests(struct drm_i915_private *i915)
SUBTEST(perf_memcpy), SUBTEST(perf_memcpy),
}; };
if (intel_gt_is_wedged(&i915->gt)) if (intel_gt_is_wedged(to_gt(i915)))
return 0; return 0;
return i915_live_subtests(tests, i915); return i915_live_subtests(tests, i915);
......
...@@ -344,5 +344,5 @@ int intel_uncore_live_selftests(struct drm_i915_private *i915) ...@@ -344,5 +344,5 @@ int intel_uncore_live_selftests(struct drm_i915_private *i915)
SUBTEST(live_forcewake_domains), SUBTEST(live_forcewake_domains),
}; };
return intel_gt_live_subtests(tests, &i915->gt); return intel_gt_live_subtests(tests, to_gt(i915));
} }
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
void mock_device_flush(struct drm_i915_private *i915) 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; struct intel_engine_cs *engine;
enum intel_engine_id id; enum intel_engine_id id;
...@@ -64,7 +64,7 @@ static void mock_device_release(struct drm_device *dev) ...@@ -64,7 +64,7 @@ static void mock_device_release(struct drm_device *dev)
goto out; goto out;
mock_device_flush(i915); 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_workqueue(i915);
i915_gem_drain_freed_objects(i915); i915_gem_drain_freed_objects(i915);
...@@ -73,7 +73,7 @@ static void mock_device_release(struct drm_device *dev) ...@@ -73,7 +73,7 @@ static void mock_device_release(struct drm_device *dev)
destroy_workqueue(i915->wq); destroy_workqueue(i915->wq);
intel_region_ttm_device_fini(i915); 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); intel_memory_regions_driver_release(i915);
drm_mode_config_cleanup(&i915->drm); drm_mode_config_cleanup(&i915->drm);
...@@ -178,11 +178,11 @@ struct drm_i915_private *mock_gem_device(void) ...@@ -178,11 +178,11 @@ struct drm_i915_private *mock_gem_device(void)
spin_lock_init(&i915->gpu_error.lock); spin_lock_init(&i915->gpu_error.lock);
i915_gem_init__mm(i915); i915_gem_init__mm(i915);
intel_gt_init_early(&i915->gt, i915); intel_gt_init_early(to_gt(i915), i915);
__intel_gt_init_early(&i915->gt, i915); __intel_gt_init_early(to_gt(i915), i915);
mock_uncore_init(&i915->uncore, i915); mock_uncore_init(&i915->uncore, i915);
atomic_inc(&i915->gt.wakeref.count); /* disable; no hw support */ atomic_inc(&to_gt(i915)->wakeref.count); /* disable; no hw support */
i915->gt.awake = -ENODEV; to_gt(i915)->awake = -ENODEV;
ret = intel_region_ttm_device_init(i915); ret = intel_region_ttm_device_init(i915);
if (ret) if (ret)
...@@ -195,19 +195,19 @@ struct drm_i915_private *mock_gem_device(void) ...@@ -195,19 +195,19 @@ struct drm_i915_private *mock_gem_device(void)
mock_init_contexts(i915); mock_init_contexts(i915);
mock_init_ggtt(i915, &i915->ggtt); 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); 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); to_gt(i915)->engine[RCS0] = mock_engine(i915, "mock", RCS0);
if (!i915->gt.engine[RCS0]) if (!to_gt(i915)->engine[RCS0])
goto err_unlock; goto err_unlock;
if (mock_engine_init(i915->gt.engine[RCS0])) if (mock_engine_init(to_gt(i915)->engine[RCS0]))
goto err_context; 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); intel_engines_driver_register(i915);
i915->do_release = true; i915->do_release = true;
...@@ -216,13 +216,13 @@ struct drm_i915_private *mock_gem_device(void) ...@@ -216,13 +216,13 @@ struct drm_i915_private *mock_gem_device(void)
return i915; return i915;
err_context: err_context:
intel_gt_driver_remove(&i915->gt); intel_gt_driver_remove(to_gt(i915));
err_unlock: err_unlock:
destroy_workqueue(i915->wq); destroy_workqueue(i915->wq);
err_drv: err_drv:
intel_region_ttm_device_fini(i915); intel_region_ttm_device_fini(i915);
err_ttm: err_ttm:
intel_gt_driver_late_release(&i915->gt); intel_gt_driver_late_release(to_gt(i915));
intel_memory_regions_driver_release(i915); intel_memory_regions_driver_release(i915);
drm_mode_config_cleanup(&i915->drm); drm_mode_config_cleanup(&i915->drm);
mock_destroy_device(i915); mock_destroy_device(i915);
......
...@@ -70,7 +70,7 @@ struct i915_ppgtt *mock_ppgtt(struct drm_i915_private *i915, const char *name) ...@@ -70,7 +70,7 @@ struct i915_ppgtt *mock_ppgtt(struct drm_i915_private *i915, const char *name)
if (!ppgtt) if (!ppgtt)
return NULL; return NULL;
ppgtt->vm.gt = &i915->gt; ppgtt->vm.gt = to_gt(i915);
ppgtt->vm.i915 = i915; ppgtt->vm.i915 = i915;
ppgtt->vm.total = round_down(U64_MAX, PAGE_SIZE); ppgtt->vm.total = round_down(U64_MAX, PAGE_SIZE);
ppgtt->vm.dma = i915->drm.dev; ppgtt->vm.dma = i915->drm.dev;
...@@ -110,7 +110,7 @@ void mock_init_ggtt(struct drm_i915_private *i915, struct i915_ggtt *ggtt) ...@@ -110,7 +110,7 @@ void mock_init_ggtt(struct drm_i915_private *i915, struct i915_ggtt *ggtt)
{ {
memset(ggtt, 0, sizeof(*ggtt)); memset(ggtt, 0, sizeof(*ggtt));
ggtt->vm.gt = &i915->gt; ggtt->vm.gt = to_gt(i915);
ggtt->vm.i915 = i915; ggtt->vm.i915 = i915;
ggtt->vm.is_ggtt = true; ggtt->vm.is_ggtt = true;
...@@ -132,7 +132,7 @@ void mock_init_ggtt(struct drm_i915_private *i915, struct i915_ggtt *ggtt) ...@@ -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; ggtt->vm.vma_ops.clear_pages = clear_pages;
i915_address_space_init(&ggtt->vm, VM_CLASS_GGTT); 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) void mock_fini_ggtt(struct i915_ggtt *ggtt)
......
...@@ -42,7 +42,7 @@ __nop_read(64) ...@@ -42,7 +42,7 @@ __nop_read(64)
void mock_uncore_init(struct intel_uncore *uncore, void mock_uncore_init(struct intel_uncore *uncore,
struct drm_i915_private *i915) 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_WRITE_MMIO_VFUNCS(uncore, nop);
ASSIGN_RAW_READ_MMIO_VFUNCS(uncore, nop); ASSIGN_RAW_READ_MMIO_VFUNCS(uncore, nop);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment