[Intel-gfx] [PATCH 6/9] drm/i915: [sparse] __iomem fixes for ringbuffer

Ben Widawsky ben at bwidawsk.net
Mon Apr 16 23:07:45 CEST 2012


Only one case of a "forced" casting where we use ring->map.handle and
cast it to __iomem. As with other patches, this should be safe always.

Signed-off-by: Ben Widawsky <benjamin.widawsky at intel.com>
---
 drivers/gpu/drm/i915/intel_ringbuffer.c |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index caec699..62e11c5 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -875,7 +875,7 @@ static int init_status_page(struct intel_ring_buffer *ring)
 		goto err_unpin;
 	}
 	ring->status_page.obj = obj;
-	memset(ring->status_page.page_addr, 0, PAGE_SIZE);
+	memset_io(ring->status_page.page_addr, 0, PAGE_SIZE);
 
 	intel_ring_setup_status_page(ring);
 	DRM_DEBUG_DRIVER("%s hws offset: 0x%08x\n",
@@ -938,7 +938,7 @@ static int intel_init_ring_buffer(struct drm_device *dev,
 		goto err_unpin;
 	}
 
-	ring->virtual_start = ring->map.handle;
+	ring->virtual_start = (void __iomem *)ring->map.handle;
 	ret = ring->init(ring);
 	if (ret)
 		goto err_unmap;
@@ -996,7 +996,7 @@ void intel_cleanup_ring_buffer(struct intel_ring_buffer *ring)
 
 static int intel_wrap_ring_buffer(struct intel_ring_buffer *ring)
 {
-	unsigned int *virt;
+	void __iomem *virt;
 	int rem = ring->size - ring->tail;
 
 	if (ring->space < rem) {
@@ -1005,11 +1005,13 @@ static int intel_wrap_ring_buffer(struct intel_ring_buffer *ring)
 			return ret;
 	}
 
-	virt = (unsigned int *)(ring->virtual_start + ring->tail);
+	virt = ring->virtual_start + ring->tail;
 	rem /= 8;
 	while (rem--) {
-		*virt++ = MI_NOOP;
-		*virt++ = MI_NOOP;
+		iowrite32(MI_NOOP, virt);
+		virt+=4;
+		iowrite32(MI_NOOP, virt);
+		virt+=4;
 	}
 
 	ring->tail = 0;
@@ -1308,7 +1310,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev)
 
 	if (!I915_NEED_GFX_HWS(dev)) {
 		ring->status_page.page_addr = dev_priv->status_page_dmah->vaddr;
-		memset(ring->status_page.page_addr, 0, PAGE_SIZE);
+		memset_io(ring->status_page.page_addr, 0, PAGE_SIZE);
 	}
 
 	return intel_init_ring_buffer(dev, ring);
-- 
1.7.10




More information about the Intel-gfx mailing list