Skip to contentSkip to conversation

drm/i915: Treat ringbuffer vaddress type properly when vmapped

PATCH In review Mika Kuoppala 2 participants 3 messages Oct 30, 2015

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

PATCH 1/1 drm/i915: Treat ringbuffer vaddress type properly when vmapped

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.

---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +3 -3
index c9b081f..97b5654 100644
@@ -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);
 	else
 		iounmap(ringbuf->virtual_start);
 	ringbuf->virtual_start = NULL;
 	i915_gem_object_ggtt_unpin(ringbuf->obj);
 }
 
-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) {
 			i915_gem_object_ggtt_unpin(obj);
 			return -ENOMEM;
Signature · 6 lines
2.5.0

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

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.

Or you could review the patch on list to remove the incorrect iomem. -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 9 lines · Chris Wilson
Quoted 8 lines · Mika Kuoppala

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.

Quoted 4 lines
Quoted 2 lines

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

Or you could review the patch on list to remove the incorrect iomem.

Yes, ignore this patch.

Quoted 4 lines

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre

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