[Intel-gfx] [PATCH] magic-clflush-fix

Chris Wilson chris at chris-wilson.co.uk
Mon Jan 18 00:58:01 PST 2016


---
 drivers/gpu/drm/i915/i915_gem.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 6b37cdd7d2e3..cbcbb0c2b8e3 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -767,8 +767,11 @@ shmem_pread_fast(struct page *page, int shmem_page_offset, int page_length,
 		return -EINVAL;
 
 	vaddr = kmap_atomic(page);
-	if (needs_clflush)
+	if (needs_clflush) {
 		clflush_cache_range(vaddr + shmem_page_offset, page_length);
+		clflush(vaddr + shmem_page_offset);
+		mb();
+	}
 	ret = __copy_to_user_inatomic(user_data,
 				      vaddr + shmem_page_offset,
 				      page_length);
@@ -810,10 +813,13 @@ shmem_pread_slow(struct page *page, int shmem_page_offset, int page_length,
 	int ret;
 
 	vaddr = kmap(page);
-	if (needs_clflush)
+	if (needs_clflush) {
 		shmem_clflush_swizzled_range(vaddr + shmem_page_offset,
 					     page_length,
 					     page_do_bit17_swizzling);
+		clflush(vaddr + shmem_page_offset);
+		mb();
+	}
 
 	if (page_do_bit17_swizzling)
 		ret = __copy_to_user_swizzled(user_data,
-- 
2.7.0.rc3



More information about the Intel-gfx mailing list