Commit 2c9a4915 authored by Tvrtko Ursulin's avatar Tvrtko Ursulin

drm/i915: Convert PAT setup to uncore mmio

One more thing which relied on implicit dev_priv can be covnerted to use
the new mmio accessors.
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20191024093440.32280-1-tvrtko.ursulin@linux.intel.com
parent 7f47211e
...@@ -2922,35 +2922,51 @@ static int ggtt_probe_common(struct i915_ggtt *ggtt, u64 size) ...@@ -2922,35 +2922,51 @@ static int ggtt_probe_common(struct i915_ggtt *ggtt, u64 size)
return 0; return 0;
} }
static void tgl_setup_private_ppat(struct drm_i915_private *dev_priv) static void tgl_setup_private_ppat(struct intel_uncore *uncore)
{ {
/* TGL doesn't support LLC or AGE settings */ /* TGL doesn't support LLC or AGE settings */
I915_WRITE(GEN12_PAT_INDEX(0), GEN8_PPAT_WB); intel_uncore_write(uncore, GEN12_PAT_INDEX(0), GEN8_PPAT_WB);
I915_WRITE(GEN12_PAT_INDEX(1), GEN8_PPAT_WC); intel_uncore_write(uncore, GEN12_PAT_INDEX(1), GEN8_PPAT_WC);
I915_WRITE(GEN12_PAT_INDEX(2), GEN8_PPAT_WT); intel_uncore_write(uncore, GEN12_PAT_INDEX(2), GEN8_PPAT_WT);
I915_WRITE(GEN12_PAT_INDEX(3), GEN8_PPAT_UC); intel_uncore_write(uncore, GEN12_PAT_INDEX(3), GEN8_PPAT_UC);
I915_WRITE(GEN12_PAT_INDEX(4), GEN8_PPAT_WB); intel_uncore_write(uncore, GEN12_PAT_INDEX(4), GEN8_PPAT_WB);
I915_WRITE(GEN12_PAT_INDEX(5), GEN8_PPAT_WB); intel_uncore_write(uncore, GEN12_PAT_INDEX(5), GEN8_PPAT_WB);
I915_WRITE(GEN12_PAT_INDEX(6), GEN8_PPAT_WB); intel_uncore_write(uncore, GEN12_PAT_INDEX(6), GEN8_PPAT_WB);
I915_WRITE(GEN12_PAT_INDEX(7), GEN8_PPAT_WB); intel_uncore_write(uncore, GEN12_PAT_INDEX(7), GEN8_PPAT_WB);
} }
static void cnl_setup_private_ppat(struct drm_i915_private *dev_priv) static void cnl_setup_private_ppat(struct intel_uncore *uncore)
{ {
I915_WRITE(GEN10_PAT_INDEX(0), GEN8_PPAT_WB | GEN8_PPAT_LLC); intel_uncore_write(uncore,
I915_WRITE(GEN10_PAT_INDEX(1), GEN8_PPAT_WC | GEN8_PPAT_LLCELLC); GEN10_PAT_INDEX(0),
I915_WRITE(GEN10_PAT_INDEX(2), GEN8_PPAT_WT | GEN8_PPAT_LLCELLC); GEN8_PPAT_WB | GEN8_PPAT_LLC);
I915_WRITE(GEN10_PAT_INDEX(3), GEN8_PPAT_UC); intel_uncore_write(uncore,
I915_WRITE(GEN10_PAT_INDEX(4), GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(0)); GEN10_PAT_INDEX(1),
I915_WRITE(GEN10_PAT_INDEX(5), GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(1)); GEN8_PPAT_WC | GEN8_PPAT_LLCELLC);
I915_WRITE(GEN10_PAT_INDEX(6), GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(2)); intel_uncore_write(uncore,
I915_WRITE(GEN10_PAT_INDEX(7), GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(3)); GEN10_PAT_INDEX(2),
GEN8_PPAT_WT | GEN8_PPAT_LLCELLC);
intel_uncore_write(uncore,
GEN10_PAT_INDEX(3),
GEN8_PPAT_UC);
intel_uncore_write(uncore,
GEN10_PAT_INDEX(4),
GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(0));
intel_uncore_write(uncore,
GEN10_PAT_INDEX(5),
GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(1));
intel_uncore_write(uncore,
GEN10_PAT_INDEX(6),
GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(2));
intel_uncore_write(uncore,
GEN10_PAT_INDEX(7),
GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(3));
} }
/* The GGTT and PPGTT need a private PPAT setup in order to handle cacheability /* The GGTT and PPGTT need a private PPAT setup in order to handle cacheability
* bits. When using advanced contexts each context stores its own PAT, but * bits. When using advanced contexts each context stores its own PAT, but
* writing this data shouldn't be harmful even in those cases. */ * writing this data shouldn't be harmful even in those cases. */
static void bdw_setup_private_ppat(struct drm_i915_private *dev_priv) static void bdw_setup_private_ppat(struct intel_uncore *uncore)
{ {
u64 pat; u64 pat;
...@@ -2963,11 +2979,11 @@ static void bdw_setup_private_ppat(struct drm_i915_private *dev_priv) ...@@ -2963,11 +2979,11 @@ static void bdw_setup_private_ppat(struct drm_i915_private *dev_priv)
GEN8_PPAT(6, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(2)) | GEN8_PPAT(6, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(2)) |
GEN8_PPAT(7, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(3)); GEN8_PPAT(7, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(3));
I915_WRITE(GEN8_PRIVATE_PAT_LO, lower_32_bits(pat)); intel_uncore_write(uncore, GEN8_PRIVATE_PAT_LO, lower_32_bits(pat));
I915_WRITE(GEN8_PRIVATE_PAT_HI, upper_32_bits(pat)); intel_uncore_write(uncore, GEN8_PRIVATE_PAT_HI, upper_32_bits(pat));
} }
static void chv_setup_private_ppat(struct drm_i915_private *dev_priv) static void chv_setup_private_ppat(struct intel_uncore *uncore)
{ {
u64 pat; u64 pat;
...@@ -2999,8 +3015,8 @@ static void chv_setup_private_ppat(struct drm_i915_private *dev_priv) ...@@ -2999,8 +3015,8 @@ static void chv_setup_private_ppat(struct drm_i915_private *dev_priv)
GEN8_PPAT(6, CHV_PPAT_SNOOP) | GEN8_PPAT(6, CHV_PPAT_SNOOP) |
GEN8_PPAT(7, CHV_PPAT_SNOOP); GEN8_PPAT(7, CHV_PPAT_SNOOP);
I915_WRITE(GEN8_PRIVATE_PAT_LO, lower_32_bits(pat)); intel_uncore_write(uncore, GEN8_PRIVATE_PAT_LO, lower_32_bits(pat));
I915_WRITE(GEN8_PRIVATE_PAT_HI, upper_32_bits(pat)); intel_uncore_write(uncore, GEN8_PRIVATE_PAT_HI, upper_32_bits(pat));
} }
static void gen6_gmch_remove(struct i915_address_space *vm) static void gen6_gmch_remove(struct i915_address_space *vm)
...@@ -3011,18 +3027,20 @@ static void gen6_gmch_remove(struct i915_address_space *vm) ...@@ -3011,18 +3027,20 @@ static void gen6_gmch_remove(struct i915_address_space *vm)
cleanup_scratch_page(vm); cleanup_scratch_page(vm);
} }
static void setup_private_pat(struct drm_i915_private *dev_priv) static void setup_private_pat(struct intel_uncore *uncore)
{ {
GEM_BUG_ON(INTEL_GEN(dev_priv) < 8); struct drm_i915_private *i915 = uncore->i915;
if (INTEL_GEN(dev_priv) >= 12) GEM_BUG_ON(INTEL_GEN(i915) < 8);
tgl_setup_private_ppat(dev_priv);
else if (INTEL_GEN(dev_priv) >= 10) if (INTEL_GEN(i915) >= 12)
cnl_setup_private_ppat(dev_priv); tgl_setup_private_ppat(uncore);
else if (IS_CHERRYVIEW(dev_priv) || IS_GEN9_LP(dev_priv)) else if (INTEL_GEN(i915) >= 10)
chv_setup_private_ppat(dev_priv); cnl_setup_private_ppat(uncore);
else if (IS_CHERRYVIEW(i915) || IS_GEN9_LP(i915))
chv_setup_private_ppat(uncore);
else else
bdw_setup_private_ppat(dev_priv); bdw_setup_private_ppat(uncore);
} }
static int gen8_gmch_probe(struct i915_ggtt *ggtt) static int gen8_gmch_probe(struct i915_ggtt *ggtt)
...@@ -3078,7 +3096,7 @@ static int gen8_gmch_probe(struct i915_ggtt *ggtt) ...@@ -3078,7 +3096,7 @@ static int gen8_gmch_probe(struct i915_ggtt *ggtt)
ggtt->vm.pte_encode = gen8_pte_encode; ggtt->vm.pte_encode = gen8_pte_encode;
setup_private_pat(dev_priv); setup_private_pat(ggtt->vm.gt->uncore);
return ggtt_probe_common(ggtt, size); return ggtt_probe_common(ggtt, size);
} }
...@@ -3382,10 +3400,12 @@ static void ggtt_restore_mappings(struct i915_ggtt *ggtt) ...@@ -3382,10 +3400,12 @@ static void ggtt_restore_mappings(struct i915_ggtt *ggtt)
void i915_gem_restore_gtt_mappings(struct drm_i915_private *i915) void i915_gem_restore_gtt_mappings(struct drm_i915_private *i915)
{ {
ggtt_restore_mappings(&i915->ggtt); struct i915_ggtt *ggtt = &i915->ggtt;
ggtt_restore_mappings(ggtt);
if (INTEL_GEN(i915) >= 8) if (INTEL_GEN(i915) >= 8)
setup_private_pat(i915); setup_private_pat(ggtt->vm.gt->uncore);
} }
static struct scatterlist * static struct scatterlist *
......
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