diff mbox

drm/i915: Treat ringbuffer vaddress type properly when vmapped

Message ID 1446205164-31130-1-git-send-email-mika.kuoppala@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kuoppala Oct. 30, 2015, 11:39 a.m. UTC
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@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Chris Wilson Oct. 30, 2015, 11:42 a.m. UTC | #1
On Fri, Oct 30, 2015 at 01:39:24PM +0200, Mika Kuoppala wrote:
> 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
Mika Kuoppala Oct. 30, 2015, 12:28 p.m. UTC | #2
Chris Wilson <chris@chris-wilson.co.uk> writes:

> On Fri, Oct 30, 2015 at 01:39:24PM +0200, Mika Kuoppala wrote:
>> 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.

Yes, ignore this patch.

> -Chris
>
> -- 
> Chris Wilson, Intel Open Source Technology Centre
diff mbox

Patch

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);
 	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;