Skip to contentSkip to conversation

drm/i915: Use masked write for Context Status Buffer Pointer

PATCH In review Mika Kuoppala 3 participants 4 messages Aug 6, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Use masked write for Context Status Buffer Pointer

This register needs to be updated with masked writes.

---
 drivers/gpu/drm/i915/intel_lrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +1 -1
index 99bba8e..29347e7 100644
@@ -521,7 +521,7 @@ void intel_lrc_irq_handler(struct intel_engine_cs *ring)
 	ring->next_context_status_buffer = write_pointer % 6;
 
 	I915_WRITE(RING_CONTEXT_STATUS_PTR(ring),
-		   ((u32)ring->next_context_status_buffer & 0x07) << 8);
+		   _MASKED_FIELD(0x07 << 8, ((u32)ring->next_context_status_buffer & 0x07) << 8));
 }
 
 static int execlists_context_queue(struct drm_i915_gem_request *request)
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 21 lines · Mika Kuoppala

This register needs to be updated with masked writes.

---
  drivers/gpu/drm/i915/intel_lrc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +1 -2
index 99bba8e..29347e7 100644
@@ -521,7 +521,7 @@ void intel_lrc_irq_handler(struct intel_engine_cs *ring)
         ring->next_context_status_buffer = write_pointer % 6;
 
         I915_WRITE(RING_CONTEXT_STATUS_PTR(ring),
-                  ((u32)ring->next_context_status_buffer & 0x07) << 8);
+                  _MASKED_FIELD(0x07 << 8, ((u32)ring->next_context_status_buffer & 0x07) << 8));
  }
 
  static int execlists_context_queue(struct drm_i915_gem_request *request)
--
Quoted 2 lines

2.1.4

bspec agrees... but I remember seeing these bits being written without the mask in gen8.

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
Quoted 20 lines · Michel Thierry
Quoted 19 lines · Mika Kuoppala

This register needs to be updated with masked writes.

---
 drivers/gpu/drm/i915/intel_lrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +1 -1
index 99bba8e..29347e7 100644
@@ -521,7 +521,7 @@ void intel_lrc_irq_handler(struct intel_engine_cs *ring)
        ring->next_context_status_buffer = write_pointer % 6;
 
        I915_WRITE(RING_CONTEXT_STATUS_PTR(ring),
-                  ((u32)ring->next_context_status_buffer & 0x07) << 8);
+                  _MASKED_FIELD(0x07 << 8, ((u32)ring->next_context_status_buffer & 0x07) << 8));
 }
 
Quoted 7 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_lrc.c +0 -1
 static int execlists_context_queue(struct drm_i915_gem_request *request)
--

2.1.4

bspec agrees... but I remember seeing these bits being written without the mask in gen8.

Impact? Do I need this for -fixes with cc: stable? lrc is shipping as released code, please be a bit more elaborate in your commit messages.

Thanks, Daniel

Quoted 5 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 29 lines · Daniel Vetter
Quoted 20 lines · Michel Thierry
Quoted 19 lines · Mika Kuoppala

This register needs to be updated with masked writes.

---
  drivers/gpu/drm/i915/intel_lrc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +1 -1
index 99bba8e..29347e7 100644
@@ -521,7 +521,7 @@ void intel_lrc_irq_handler(struct intel_engine_cs *ring)
         ring->next_context_status_buffer = write_pointer % 6;
 
         I915_WRITE(RING_CONTEXT_STATUS_PTR(ring),
-                  ((u32)ring->next_context_status_buffer & 0x07) << 8);
+                  _MASKED_FIELD(0x07 << 8, ((u32)ring->next_context_status_buffer & 0x07) << 8));
  }
 
Quoted 7 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_lrc.c +0 -1
  static int execlists_context_queue(struct drm_i915_gem_request *request)
--

2.1.4

bspec agrees... but I remember seeing these bits being written without the mask in gen8.

Quoted 2 lines

Impact? Do I need this for -fixes with cc: stable? lrc is shipping as released code, please be a bit more elaborate in your commit messages.

I'll let Mika give more details, but it looks inoffensive to me. The lrc irq handler relies on bits[3:0] only (the read pointer, which is read-only and is updated by the hw automatically), and never reads the write pointer back.

It would only impact us when reading the register directly, e.g. while debugging another issue.

-Michel

Quoted 9 lines

Thanks, Daniel

Quoted 5 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx