Skip to content

Commit d5f384d

Browse files
icklejnikula
authored andcommitted
drm/i915: Move Braswell stop_machine GGTT insertion workaround
There was a silent conflict between commit 0a87871 Author: Daniel Vetter <[email protected]> Date: Thu Oct 15 14:23:01 2015 +0200 drm/i915: restore ggtt double-bind avoidance and commit 5bab6f6 Author: Chris Wilson <[email protected]> Date: Fri Oct 23 18:43:32 2015 +0100 drm/i915: Serialise updates to GGTT with access through GGTT on Braswell thankfully caught by the extra WARN safegaurd in 0a87871. Since we now override the GGTT insert_pages callback when installing the aliasing ppgtt, we assert that the callback is the original ggtt routine. However, on Braswell we now use a different insertion routine to serialise access through the GGTT with updating the PTE and hence the conflict. To avoid the conflict, move the custom insertion routine for Braswell down a level. Reported-by: Ville Syrjälä <[email protected] Signed-off-by: Chris Wilson <[email protected]> Cc: Ville Syrjälä <[email protected] Cc: Daniel Vetter <[email protected]> Cc: Michel Thierry <[email protected]> Cc: Mika Kuoppala <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Ville Syrjälä <[email protected]> Tested-by: Ville Syrjälä <[email protected]> Cc: [email protected] Signed-off-by: Daniel Vetter <[email protected]> (cherry picked from commit c140330) Signed-off-by: Jani Nikula <[email protected]>
1 parent 7447a2b commit d5f384d

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

drivers/gpu/drm/i915/i915_gem_gtt.c

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,6 +2384,32 @@ static void gen8_ggtt_insert_entries(struct i915_address_space *vm,
23842384
assert_rpm_atomic_end(dev_priv, rpm_atomic_seq);
23852385
}
23862386

2387+
struct insert_entries {
2388+
struct i915_address_space *vm;
2389+
struct sg_table *st;
2390+
uint64_t start;
2391+
enum i915_cache_level level;
2392+
u32 flags;
2393+
};
2394+
2395+
static int gen8_ggtt_insert_entries__cb(void *_arg)
2396+
{
2397+
struct insert_entries *arg = _arg;
2398+
gen8_ggtt_insert_entries(arg->vm, arg->st,
2399+
arg->start, arg->level, arg->flags);
2400+
return 0;
2401+
}
2402+
2403+
static void gen8_ggtt_insert_entries__BKL(struct i915_address_space *vm,
2404+
struct sg_table *st,
2405+
uint64_t start,
2406+
enum i915_cache_level level,
2407+
u32 flags)
2408+
{
2409+
struct insert_entries arg = { vm, st, start, level, flags };
2410+
stop_machine(gen8_ggtt_insert_entries__cb, &arg, NULL);
2411+
}
2412+
23872413
/*
23882414
* Binds an object into the global gtt with the specified cache level. The object
23892415
* will be accessible to the GPU via commands whose operands reference offsets
@@ -2560,26 +2586,6 @@ static int ggtt_bind_vma(struct i915_vma *vma,
25602586
return 0;
25612587
}
25622588

2563-
struct ggtt_bind_vma__cb {
2564-
struct i915_vma *vma;
2565-
enum i915_cache_level cache_level;
2566-
u32 flags;
2567-
};
2568-
2569-
static int ggtt_bind_vma__cb(void *_arg)
2570-
{
2571-
struct ggtt_bind_vma__cb *arg = _arg;
2572-
return ggtt_bind_vma(arg->vma, arg->cache_level, arg->flags);
2573-
}
2574-
2575-
static int ggtt_bind_vma__BKL(struct i915_vma *vma,
2576-
enum i915_cache_level cache_level,
2577-
u32 flags)
2578-
{
2579-
struct ggtt_bind_vma__cb arg = { vma, cache_level, flags };
2580-
return stop_machine(ggtt_bind_vma__cb, &arg, NULL);
2581-
}
2582-
25832589
static int aliasing_gtt_bind_vma(struct i915_vma *vma,
25842590
enum i915_cache_level cache_level,
25852591
u32 flags)
@@ -3048,8 +3054,8 @@ static int gen8_gmch_probe(struct drm_device *dev,
30483054
dev_priv->gtt.base.bind_vma = ggtt_bind_vma;
30493055
dev_priv->gtt.base.unbind_vma = ggtt_unbind_vma;
30503056

3051-
if (IS_CHERRYVIEW(dev))
3052-
dev_priv->gtt.base.bind_vma = ggtt_bind_vma__BKL;
3057+
if (IS_CHERRYVIEW(dev_priv))
3058+
dev_priv->gtt.base.insert_entries = gen8_ggtt_insert_entries__BKL;
30533059

30543060
return ret;
30553061
}

0 commit comments

Comments
 (0)