@@ -195,15 +195,34 @@ void gen6_ggtt_invalidate(struct i915_ggtt *ggtt)
195
195
spin_unlock_irq (& uncore -> lock );
196
196
}
197
197
198
+ static bool needs_wc_ggtt_mapping (struct drm_i915_private * i915 )
199
+ {
200
+ /*
201
+ * On BXT+/ICL+ writes larger than 64 bit to the GTT pagetable range
202
+ * will be dropped. For WC mappings in general we have 64 byte burst
203
+ * writes when the WC buffer is flushed, so we can't use it, but have to
204
+ * resort to an uncached mapping. The WC issue is easily caught by the
205
+ * readback check when writing GTT PTE entries.
206
+ */
207
+ if (!IS_GEN9_LP (i915 ) && GRAPHICS_VER (i915 ) < 11 )
208
+ return true;
209
+
210
+ return false;
211
+ }
212
+
198
213
static void gen8_ggtt_invalidate (struct i915_ggtt * ggtt )
199
214
{
200
215
struct intel_uncore * uncore = ggtt -> vm .gt -> uncore ;
201
216
202
217
/*
203
218
* Note that as an uncached mmio write, this will flush the
204
219
* WCB of the writes into the GGTT before it triggers the invalidate.
220
+ *
221
+ * Only perform this when GGTT is mapped as WC, see ggtt_probe_common().
205
222
*/
206
- intel_uncore_write_fw (uncore , GFX_FLSH_CNTL_GEN6 , GFX_FLSH_CNTL_EN );
223
+ if (needs_wc_ggtt_mapping (ggtt -> vm .i915 ))
224
+ intel_uncore_write_fw (uncore , GFX_FLSH_CNTL_GEN6 ,
225
+ GFX_FLSH_CNTL_EN );
207
226
}
208
227
209
228
static void guc_ggtt_ct_invalidate (struct intel_gt * gt )
@@ -1140,17 +1159,11 @@ static int ggtt_probe_common(struct i915_ggtt *ggtt, u64 size)
1140
1159
GEM_WARN_ON (pci_resource_len (pdev , GEN4_GTTMMADR_BAR ) != gen6_gttmmadr_size (i915 ));
1141
1160
phys_addr = pci_resource_start (pdev , GEN4_GTTMMADR_BAR ) + gen6_gttadr_offset (i915 );
1142
1161
1143
- /*
1144
- * On BXT+/ICL+ writes larger than 64 bit to the GTT pagetable range
1145
- * will be dropped. For WC mappings in general we have 64 byte burst
1146
- * writes when the WC buffer is flushed, so we can't use it, but have to
1147
- * resort to an uncached mapping. The WC issue is easily caught by the
1148
- * readback check when writing GTT PTE entries.
1149
- */
1150
- if (IS_GEN9_LP (i915 ) || GRAPHICS_VER (i915 ) >= 11 )
1151
- ggtt -> gsm = ioremap (phys_addr , size );
1152
- else
1162
+ if (needs_wc_ggtt_mapping (i915 ))
1153
1163
ggtt -> gsm = ioremap_wc (phys_addr , size );
1164
+ else
1165
+ ggtt -> gsm = ioremap (phys_addr , size );
1166
+
1154
1167
if (!ggtt -> gsm ) {
1155
1168
drm_err (& i915 -> drm , "Failed to map the ggtt page table\n" );
1156
1169
return - ENOMEM ;
0 commit comments