[Intel-gfx] [PATCH] drm/i915: Treat ringbuffer vaddress type properly when vmapped

Mika Kuoppala mika.kuoppala at linux.intel.com
Fri Oct 30 04:39:24 PDT 2015

commit def0c5f6b0cd ("drm/i915: Map the ringbuffer using WB on LLC machines")
enhanced ringbuffer access by vmapping the object instead of doing ioremap.

The address space annotations however have been and should
remain to be __iomem, in order to get warnings if we
dereference the virtual addresses directly instead of using
proper accessors.

To keep sparse happy, use explicit casts to __iomem and back
when we are wb capable.

Cc: Chris Wilson <chris at chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
 drivers/gpu/drm/i915/intel_ringbuffer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index c9b081f..97b5654 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -1997,14 +1997,14 @@ static int init_phys_status_page(struct intel_engine_cs *ring)
 void intel_unpin_ringbuffer_obj(struct intel_ringbuffer *ringbuf)
 	if (HAS_LLC(ringbuf->obj->base.dev) && !ringbuf->obj->stolen)
-		vunmap(ringbuf->virtual_start);
+		vunmap((void __force *)ringbuf->virtual_start);
 	ringbuf->virtual_start = NULL;
-static u32 *vmap_obj(struct drm_i915_gem_object *obj)
+static void *vmap_obj(struct drm_i915_gem_object *obj)
 	struct sg_page_iter sg_iter;
 	struct page **pages;
@@ -2043,7 +2043,7 @@ int intel_pin_and_map_ringbuffer_obj(struct drm_device *dev,
 			return ret;
-		ringbuf->virtual_start = vmap_obj(obj);
+		ringbuf->virtual_start = (void __iomem *)vmap_obj(obj);
 		if (ringbuf->virtual_start == NULL) {
 			return -ENOMEM;

More information about the Intel-gfx mailing list