7682ab677e9b7b6d8268ff90f313a902603454d3
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-4.19 / 950-0498-drm-v3d-Invalidate-the-caches-from-the-outside-in.patch
1 From 514653cd51ff6bc14268dc0f98ebb37daa8f0e88 Mon Sep 17 00:00:00 2001
2 From: Eric Anholt <eric@anholt.net>
3 Date: Mon, 3 Dec 2018 14:24:38 -0800
4 Subject: [PATCH] drm/v3d: Invalidate the caches from the outside in.
5
6 This would be a fairly obscure race, but let's make sure we don't ever
7 lose it.
8
9 Signed-off-by: Eric Anholt <eric@anholt.net>
10 Link: https://patchwork.freedesktop.org/patch/msgid/20181203222438.25417-6-eric@anholt.net
11 Reviewed-by: Dave Emett <david.emett@broadcom.com>
12 (cherry picked from commit aa5beec32e8b78bfcf621e3c3daebfb1644b6365)
13 ---
14 drivers/gpu/drm/v3d/v3d_gem.c | 8 ++++++--
15 1 file changed, 6 insertions(+), 2 deletions(-)
16
17 --- a/drivers/gpu/drm/v3d/v3d_gem.c
18 +++ b/drivers/gpu/drm/v3d/v3d_gem.c
19 @@ -171,11 +171,15 @@ v3d_invalidate_slices(struct v3d_dev *v3
20 void
21 v3d_invalidate_caches(struct v3d_dev *v3d)
22 {
23 + /* Invalidate the caches from the outside in. That way if
24 + * another CL's concurrent use of nearby memory were to pull
25 + * an invalidated cacheline back in, we wouldn't leave stale
26 + * data in the inner cache.
27 + */
28 v3d_flush_l3(v3d);
29 -
30 v3d_invalidate_l2c(v3d, 0);
31 - v3d_invalidate_slices(v3d, 0);
32 v3d_flush_l2t(v3d, 0);
33 + v3d_invalidate_slices(v3d, 0);
34 }
35
36 static void