drm/i915: Replace manual barrier() with READ_ONCE() in HWS accessor
authorChris Wilson <chris@chris-wilson.co.uk>
Sat, 9 Apr 2016 09:57:57 +0000 (10:57 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Sat, 9 Apr 2016 11:09:59 +0000 (12:09 +0100)
When reading from the HWS page, we use barrier() to prevent the compiler
optimising away the read from the volatile (may be updated by the GPU)
memory address. This is more suited to READ_ONCE(); make it so.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1460195877-20520-5-git-send-email-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/intel_ringbuffer.h

index 9d7b7bf9ed14a49f802f5cfdec7a3162222e5a3e..78dc46864a1021d95567a496b45f5dfd5a0a6fd6 100644 (file)
@@ -391,12 +391,10 @@ intel_flush_status_page(struct intel_engine_cs *engine, int reg)
 }
 
 static inline u32
-intel_read_status_page(struct intel_engine_cs *engine,
-                      int reg)
+intel_read_status_page(struct intel_engine_cs *engine, int reg)
 {
        /* Ensure that the compiler doesn't optimize away the load. */
-       barrier();
-       return engine->status_page.page_addr[reg];
+       return READ_ONCE(engine->status_page.page_addr[reg]);
 }
 
 static inline void