diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-03-27 09:00:08 -0400 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2017-03-27 10:03:21 -0400 |
commit | a91fdf1293044535a13fb9a434101f363dbe7e3c (patch) | |
tree | b1bea71298c2cafada228aeefd912c9e44c2ad77 /drivers/gpu/drm/i915/intel_ringbuffer.c | |
parent | 450362d3fe866b14304f309b5fffba0c33fbfbc3 (diff) |
drm/i915: Assert that the request->tail fits within the ring
In addition to being qword-aligned, the RING_TAIL offset must be within
the ring!
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170327130009.4678-2-chris@chris-wilson.co.uk
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_ringbuffer.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 4729ac7ac122..47921dcbedb3 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -775,6 +775,7 @@ static void i9xx_submit_request(struct drm_i915_gem_request *request) | |||
775 | i915_gem_request_submit(request); | 775 | i915_gem_request_submit(request); |
776 | 776 | ||
777 | GEM_BUG_ON(!IS_ALIGNED(request->tail, 8)); | 777 | GEM_BUG_ON(!IS_ALIGNED(request->tail, 8)); |
778 | GEM_BUG_ON(request->tail >= request->ring->size); | ||
778 | I915_WRITE_TAIL(request->engine, request->tail); | 779 | I915_WRITE_TAIL(request->engine, request->tail); |
779 | } | 780 | } |
780 | 781 | ||
@@ -787,6 +788,7 @@ static void i9xx_emit_breadcrumb(struct drm_i915_gem_request *req, u32 *cs) | |||
787 | 788 | ||
788 | req->tail = intel_ring_offset(req, cs); | 789 | req->tail = intel_ring_offset(req, cs); |
789 | GEM_BUG_ON(!IS_ALIGNED(req->tail, 8)); | 790 | GEM_BUG_ON(!IS_ALIGNED(req->tail, 8)); |
791 | GEM_BUG_ON(req->tail >= req->ring->size); | ||
790 | } | 792 | } |
791 | 793 | ||
792 | static const int i9xx_emit_breadcrumb_sz = 4; | 794 | static const int i9xx_emit_breadcrumb_sz = 4; |
@@ -826,6 +828,7 @@ static void gen8_render_emit_breadcrumb(struct drm_i915_gem_request *req, | |||
826 | 828 | ||
827 | req->tail = intel_ring_offset(req, cs); | 829 | req->tail = intel_ring_offset(req, cs); |
828 | GEM_BUG_ON(!IS_ALIGNED(req->tail, 8)); | 830 | GEM_BUG_ON(!IS_ALIGNED(req->tail, 8)); |
831 | GEM_BUG_ON(req->tail >= req->ring->size); | ||
829 | } | 832 | } |
830 | 833 | ||
831 | static const int gen8_render_emit_breadcrumb_sz = 8; | 834 | static const int gen8_render_emit_breadcrumb_sz = 8; |