magic-clflush-fix
diff mbox

Message ID 1453107481-18147-1-git-send-email-chris@chris-wilson.co.uk
State New
Headers show

Commit Message

Chris Wilson Jan. 18, 2016, 8:58 a.m. UTC
---
 drivers/gpu/drm/i915/i915_gem.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Chris Wilson Jan. 18, 2016, 9:02 a.m. UTC | #1
On Mon, Jan 18, 2016 at 08:58:01AM +0000, Chris Wilson wrote:

Nothing to see here, please move along.
-Chris

Patch
diff mbox

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,