Commit 17190a34 authored by Michał Winiarski's avatar Michał Winiarski Committed by Matt Roper

drm/i915/selftests: Use to_gt() helper for GGTT accesses

GGTT is currently available both through i915->ggtt and gt->ggtt, and we
eventually want to get rid of the i915->ggtt one.
Use to_gt() for all i915->ggtt accesses to help with the future
refactoring.
Signed-off-by: default avatarMichał Winiarski <michal.winiarski@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: default avatarAndi Shyti <andi.shyti@linux.intel.com>
Reviewed-by: default avatarSujaritha Sundaresan <sujaritha.sundaresan@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/20211219212500.61432-6-andi.shyti@linux.intel.com
parent 59dc4632
...@@ -41,7 +41,7 @@ static int switch_to_context(struct i915_gem_context *ctx) ...@@ -41,7 +41,7 @@ static int switch_to_context(struct i915_gem_context *ctx)
static void trash_stolen(struct drm_i915_private *i915) static void trash_stolen(struct drm_i915_private *i915)
{ {
struct i915_ggtt *ggtt = &i915->ggtt; struct i915_ggtt *ggtt = to_gt(i915)->ggtt;
const u64 slot = ggtt->error_capture.start; const u64 slot = ggtt->error_capture.start;
const resource_size_t size = resource_size(&i915->dsm); const resource_size_t size = resource_size(&i915->dsm);
unsigned long page; unsigned long page;
...@@ -99,7 +99,7 @@ static void igt_pm_suspend(struct drm_i915_private *i915) ...@@ -99,7 +99,7 @@ static void igt_pm_suspend(struct drm_i915_private *i915)
intel_wakeref_t wakeref; intel_wakeref_t wakeref;
with_intel_runtime_pm(&i915->runtime_pm, wakeref) { with_intel_runtime_pm(&i915->runtime_pm, wakeref) {
i915_ggtt_suspend(&i915->ggtt); i915_ggtt_suspend(to_gt(i915)->ggtt);
i915_gem_suspend_late(i915); i915_gem_suspend_late(i915);
} }
} }
...@@ -109,7 +109,7 @@ static void igt_pm_hibernate(struct drm_i915_private *i915) ...@@ -109,7 +109,7 @@ static void igt_pm_hibernate(struct drm_i915_private *i915)
intel_wakeref_t wakeref; intel_wakeref_t wakeref;
with_intel_runtime_pm(&i915->runtime_pm, wakeref) { with_intel_runtime_pm(&i915->runtime_pm, wakeref) {
i915_ggtt_suspend(&i915->ggtt); i915_ggtt_suspend(to_gt(i915)->ggtt);
i915_gem_freeze(i915); i915_gem_freeze(i915);
i915_gem_freeze_late(i915); i915_gem_freeze_late(i915);
...@@ -125,7 +125,7 @@ static void igt_pm_resume(struct drm_i915_private *i915) ...@@ -125,7 +125,7 @@ static void igt_pm_resume(struct drm_i915_private *i915)
* that runtime-pm just works. * that runtime-pm just works.
*/ */
with_intel_runtime_pm(&i915->runtime_pm, wakeref) { with_intel_runtime_pm(&i915->runtime_pm, wakeref) {
i915_ggtt_resume(&i915->ggtt); i915_ggtt_resume(to_gt(i915)->ggtt);
i915_gem_resume(i915); i915_gem_resume(i915);
} }
} }
......
...@@ -1122,7 +1122,7 @@ static int exercise_ggtt(struct drm_i915_private *i915, ...@@ -1122,7 +1122,7 @@ static int exercise_ggtt(struct drm_i915_private *i915,
u64 hole_start, u64 hole_end, u64 hole_start, u64 hole_end,
unsigned long end_time)) unsigned long end_time))
{ {
struct i915_ggtt *ggtt = &i915->ggtt; struct i915_ggtt *ggtt = to_gt(i915)->ggtt;
u64 hole_start, hole_end, last = 0; u64 hole_start, hole_end, last = 0;
struct drm_mm_node *node; struct drm_mm_node *node;
IGT_TIMEOUT(end_time); IGT_TIMEOUT(end_time);
...@@ -1182,7 +1182,7 @@ static int igt_ggtt_page(void *arg) ...@@ -1182,7 +1182,7 @@ static int igt_ggtt_page(void *arg)
const unsigned int count = PAGE_SIZE/sizeof(u32); const unsigned int count = PAGE_SIZE/sizeof(u32);
I915_RND_STATE(prng); I915_RND_STATE(prng);
struct drm_i915_private *i915 = arg; struct drm_i915_private *i915 = arg;
struct i915_ggtt *ggtt = &i915->ggtt; struct i915_ggtt *ggtt = to_gt(i915)->ggtt;
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
intel_wakeref_t wakeref; intel_wakeref_t wakeref;
struct drm_mm_node tmp; struct drm_mm_node tmp;
...@@ -2114,7 +2114,7 @@ int i915_gem_gtt_live_selftests(struct drm_i915_private *i915) ...@@ -2114,7 +2114,7 @@ int i915_gem_gtt_live_selftests(struct drm_i915_private *i915)
SUBTEST(igt_cs_tlb), SUBTEST(igt_cs_tlb),
}; };
GEM_BUG_ON(offset_in_page(i915->ggtt.vm.total)); GEM_BUG_ON(offset_in_page(to_gt(i915)->ggtt->vm.total));
return i915_subtests(tests, i915); return i915_subtests(tests, i915);
} }
...@@ -843,7 +843,7 @@ static struct i915_vma *empty_batch(struct drm_i915_private *i915) ...@@ -843,7 +843,7 @@ static struct i915_vma *empty_batch(struct drm_i915_private *i915)
intel_gt_chipset_flush(to_gt(i915)); intel_gt_chipset_flush(to_gt(i915));
vma = i915_vma_instance(obj, &i915->ggtt.vm, NULL); vma = i915_vma_instance(obj, &to_gt(i915)->ggtt->vm, NULL);
if (IS_ERR(vma)) { if (IS_ERR(vma)) {
err = PTR_ERR(vma); err = PTR_ERR(vma);
goto err; goto err;
......
...@@ -982,7 +982,7 @@ static int igt_vma_remapped_gtt(void *arg) ...@@ -982,7 +982,7 @@ static int igt_vma_remapped_gtt(void *arg)
intel_wakeref_t wakeref; intel_wakeref_t wakeref;
int err = 0; int err = 0;
if (!i915_ggtt_has_aperture(&i915->ggtt)) if (!i915_ggtt_has_aperture(to_gt(i915)->ggtt))
return 0; return 0;
obj = i915_gem_object_create_internal(i915, 10 * 10 * PAGE_SIZE); obj = i915_gem_object_create_internal(i915, 10 * 10 * PAGE_SIZE);
......
...@@ -69,7 +69,7 @@ static void mock_device_release(struct drm_device *dev) ...@@ -69,7 +69,7 @@ static void mock_device_release(struct drm_device *dev)
i915_gem_drain_workqueue(i915); i915_gem_drain_workqueue(i915);
i915_gem_drain_freed_objects(i915); i915_gem_drain_freed_objects(i915);
mock_fini_ggtt(&i915->ggtt); mock_fini_ggtt(to_gt(i915)->ggtt);
destroy_workqueue(i915->wq); destroy_workqueue(i915->wq);
intel_region_ttm_device_fini(i915); intel_region_ttm_device_fini(i915);
......
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