drm/i915/gt: 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.

During the probe of i915 the early intiialization of the gt
(intel_gt_init_hw_early()) is moved prior to any access to the
ggtt. This because it's in that moment we assign the ggtt to the
gt and we want to do that before using it.

Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Reviewed-by: Sujaritha Sundaresan <sujaritha.sundaresan@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/20211221195946.3180-1-andi.shyti@linux.intel.com
This commit is contained in:
Michał Winiarski 2021-12-21 21:59:46 +02:00 committed by Matt Roper
parent 816e3be74f
commit 848915c35e
5 changed files with 15 additions and 15 deletions

View File

@ -84,7 +84,7 @@ int i915_ggtt_init_hw(struct drm_i915_private *i915)
* beyond the end of the batch buffer, across the page boundary, * beyond the end of the batch buffer, across the page boundary,
* and beyond the end of the GTT if we do not provide a guard. * and beyond the end of the GTT if we do not provide a guard.
*/ */
ret = ggtt_init_hw(&i915->ggtt); ret = ggtt_init_hw(to_gt(i915)->ggtt);
if (ret) if (ret)
return ret; return ret;
@ -705,14 +705,14 @@ int i915_init_ggtt(struct drm_i915_private *i915)
{ {
int ret; int ret;
ret = init_ggtt(&i915->ggtt); ret = init_ggtt(to_gt(i915)->ggtt);
if (ret) if (ret)
return ret; return ret;
if (INTEL_PPGTT(i915) == INTEL_PPGTT_ALIASING) { if (INTEL_PPGTT(i915) == INTEL_PPGTT_ALIASING) {
ret = init_aliasing_ppgtt(&i915->ggtt); ret = init_aliasing_ppgtt(to_gt(i915)->ggtt);
if (ret) if (ret)
cleanup_init_ggtt(&i915->ggtt); cleanup_init_ggtt(to_gt(i915)->ggtt);
} }
return 0; return 0;
@ -755,7 +755,7 @@ static void ggtt_cleanup_hw(struct i915_ggtt *ggtt)
*/ */
void i915_ggtt_driver_release(struct drm_i915_private *i915) void i915_ggtt_driver_release(struct drm_i915_private *i915)
{ {
struct i915_ggtt *ggtt = &i915->ggtt; struct i915_ggtt *ggtt = to_gt(i915)->ggtt;
fini_aliasing_ppgtt(ggtt); fini_aliasing_ppgtt(ggtt);
@ -770,7 +770,7 @@ void i915_ggtt_driver_release(struct drm_i915_private *i915)
*/ */
void i915_ggtt_driver_late_release(struct drm_i915_private *i915) void i915_ggtt_driver_late_release(struct drm_i915_private *i915)
{ {
struct i915_ggtt *ggtt = &i915->ggtt; struct i915_ggtt *ggtt = to_gt(i915)->ggtt;
GEM_WARN_ON(kref_read(&ggtt->vm.resv_ref) != 1); GEM_WARN_ON(kref_read(&ggtt->vm.resv_ref) != 1);
dma_resv_fini(&ggtt->vm._resv); dma_resv_fini(&ggtt->vm._resv);
@ -1191,7 +1191,7 @@ int i915_ggtt_probe_hw(struct drm_i915_private *i915)
{ {
int ret; int ret;
ret = ggtt_probe_hw(&i915->ggtt, to_gt(i915)); ret = ggtt_probe_hw(to_gt(i915)->ggtt, to_gt(i915));
if (ret) if (ret)
return ret; return ret;

View File

@ -728,8 +728,8 @@ static void detect_bit_6_swizzle(struct i915_ggtt *ggtt)
swizzle_y = I915_BIT_6_SWIZZLE_NONE; swizzle_y = I915_BIT_6_SWIZZLE_NONE;
} }
i915->ggtt.bit_6_swizzle_x = swizzle_x; to_gt(i915)->ggtt->bit_6_swizzle_x = swizzle_x;
i915->ggtt.bit_6_swizzle_y = swizzle_y; to_gt(i915)->ggtt->bit_6_swizzle_y = swizzle_y;
} }
/* /*
@ -896,7 +896,7 @@ void intel_gt_init_swizzling(struct intel_gt *gt)
struct intel_uncore *uncore = gt->uncore; struct intel_uncore *uncore = gt->uncore;
if (GRAPHICS_VER(i915) < 5 || if (GRAPHICS_VER(i915) < 5 ||
i915->ggtt.bit_6_swizzle_x == I915_BIT_6_SWIZZLE_NONE) to_gt(i915)->ggtt->bit_6_swizzle_x == I915_BIT_6_SWIZZLE_NONE)
return; return;
intel_uncore_rmw(uncore, DISP_ARB_CTL, 0, DISP_TILE_SURFACE_SWIZZLING); intel_uncore_rmw(uncore, DISP_ARB_CTL, 0, DISP_TILE_SURFACE_SWIZZLING);

View File

@ -15,7 +15,7 @@
static int init_fake_lmem_bar(struct intel_memory_region *mem) static int init_fake_lmem_bar(struct intel_memory_region *mem)
{ {
struct drm_i915_private *i915 = mem->i915; struct drm_i915_private *i915 = mem->i915;
struct i915_ggtt *ggtt = &i915->ggtt; struct i915_ggtt *ggtt = to_gt(i915)->ggtt;
unsigned long n; unsigned long n;
int ret; int ret;
@ -131,7 +131,7 @@ intel_gt_setup_fake_lmem(struct intel_gt *gt)
if (!i915->params.fake_lmem_start) if (!i915->params.fake_lmem_start)
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
GEM_BUG_ON(i915_ggtt_has_aperture(&i915->ggtt)); GEM_BUG_ON(i915_ggtt_has_aperture(to_gt(i915)->ggtt));
/* Your mappable aperture belongs to me now! */ /* Your mappable aperture belongs to me now! */
mappable_end = pci_resource_len(pdev, 2); mappable_end = pci_resource_len(pdev, 2);

View File

@ -19,7 +19,7 @@ __igt_reset_stolen(struct intel_gt *gt,
intel_engine_mask_t mask, intel_engine_mask_t mask,
const char *msg) const char *msg)
{ {
struct i915_ggtt *ggtt = &gt->i915->ggtt; struct i915_ggtt *ggtt = gt->ggtt;
const struct resource *dsm = &gt->i915->dsm; const struct resource *dsm = &gt->i915->dsm;
resource_size_t num_pages, page; resource_size_t num_pages, page;
struct intel_engine_cs *engine; struct intel_engine_cs *engine;

View File

@ -569,6 +569,8 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
i915_perf_init(dev_priv); i915_perf_init(dev_priv);
intel_gt_init_hw_early(to_gt(dev_priv), &dev_priv->ggtt);
ret = i915_ggtt_probe_hw(dev_priv); ret = i915_ggtt_probe_hw(dev_priv);
if (ret) if (ret)
goto err_perf; goto err_perf;
@ -585,8 +587,6 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
if (ret) if (ret)
goto err_ggtt; goto err_ggtt;
intel_gt_init_hw_early(to_gt(dev_priv), &dev_priv->ggtt);
ret = intel_gt_probe_lmem(to_gt(dev_priv)); ret = intel_gt_probe_lmem(to_gt(dev_priv));
if (ret) if (ret)
goto err_mem_regions; goto err_mem_regions;