@@ -183,13 +183,11 @@ static int gen6_alloc_va_range(struct i915_address_space *vm,
183
183
struct gen6_ppgtt * ppgtt = to_gen6_ppgtt (i915_vm_to_ppgtt (vm ));
184
184
struct i915_page_directory * const pd = ppgtt -> base .pd ;
185
185
struct i915_page_table * pt , * alloc = NULL ;
186
- intel_wakeref_t wakeref ;
186
+ bool flush = false ;
187
187
u64 from = start ;
188
188
unsigned int pde ;
189
189
int ret = 0 ;
190
190
191
- wakeref = intel_runtime_pm_get (& vm -> i915 -> runtime_pm );
192
-
193
191
spin_lock (& pd -> lock );
194
192
gen6_for_each_pde (pt , pd , start , length , pde ) {
195
193
const unsigned int count = gen6_pte_count (start , length );
@@ -214,14 +212,20 @@ static int gen6_alloc_va_range(struct i915_address_space *vm,
214
212
alloc = pt ;
215
213
pt = pd -> entry [pde ];
216
214
}
215
+
216
+ flush = true;
217
217
}
218
218
219
219
atomic_add (count , & pt -> used );
220
220
}
221
221
spin_unlock (& pd -> lock );
222
222
223
- if (i915_vma_is_bound (ppgtt -> vma , I915_VMA_GLOBAL_BIND ))
224
- gen6_flush_pd (ppgtt , from , start );
223
+ if (flush && i915_vma_is_bound (ppgtt -> vma , I915_VMA_GLOBAL_BIND )) {
224
+ intel_wakeref_t wakeref ;
225
+
226
+ with_intel_runtime_pm (& vm -> i915 -> runtime_pm , wakeref )
227
+ gen6_flush_pd (ppgtt , from , start );
228
+ }
225
229
226
230
goto out ;
227
231
@@ -230,7 +234,6 @@ static int gen6_alloc_va_range(struct i915_address_space *vm,
230
234
out :
231
235
if (alloc )
232
236
free_px (vm , alloc );
233
- intel_runtime_pm_put (& vm -> i915 -> runtime_pm , wakeref );
234
237
return ret ;
235
238
}
236
239
0 commit comments