Message ID | 1381176948-2754-2-git-send-email-rodrigo.vivi@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Oct 07, 2013 at 05:15:45PM -0300, Rodrigo Vivi wrote: > From: Daniel Vetter <daniel.vetter@ffwll.ch> > > In truly crazy circumstances shmem might give us the wrong type of > page. So be a bit paranoid and double check this. > > Reviewer: Damien Lespiau <damien.lespiau@intel.com> > Cc: Rob Clark <robdclark@gmail.com> > References: http://lkml.org/lkml/2011/7/11/238 > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com> > --- > drivers/gpu/drm/i915/i915_gem.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c > index 19ecfa8..692ebf7 100644 > --- a/drivers/gpu/drm/i915/i915_gem.c > +++ b/drivers/gpu/drm/i915/i915_gem.c > @@ -1903,6 +1903,9 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj) > sg->length += PAGE_SIZE; > } > last_pfn = page_to_pfn(page); > + > + /* Check that the i965g/gm workaround works. */ > + WARN_ON((gfp & __GFP_DMA32) && (last_pfn >= 0x00100000UL)); I guess we could have something like last_pfn >= (GB(4) >> PAGE_SHIFT) but in any case: Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
On Tue, Oct 08, 2013 at 12:06:24PM +0100, Damien Lespiau wrote: > On Mon, Oct 07, 2013 at 05:15:45PM -0300, Rodrigo Vivi wrote: > > From: Daniel Vetter <daniel.vetter@ffwll.ch> > > > > In truly crazy circumstances shmem might give us the wrong type of > > page. So be a bit paranoid and double check this. > > > > Reviewer: Damien Lespiau <damien.lespiau@intel.com> > > Cc: Rob Clark <robdclark@gmail.com> > > References: http://lkml.org/lkml/2011/7/11/238 > > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> > > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com> > > --- > > drivers/gpu/drm/i915/i915_gem.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c > > index 19ecfa8..692ebf7 100644 > > --- a/drivers/gpu/drm/i915/i915_gem.c > > +++ b/drivers/gpu/drm/i915/i915_gem.c > > @@ -1903,6 +1903,9 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj) > > sg->length += PAGE_SIZE; > > } > > last_pfn = page_to_pfn(page); > > + > > + /* Check that the i965g/gm workaround works. */ > > + WARN_ON((gfp & __GFP_DMA32) && (last_pfn >= 0x00100000UL)); > > I guess we could have something like last_pfn >= (GB(4) >> PAGE_SHIFT) > but in any case: I was lazy - this is copypasta from gma500 ... > > Reviewed-by: Damien Lespiau <damien.lespiau@intel.com> Queued for -next, thanks for the review. -Daniel
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 19ecfa8..692ebf7 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -1903,6 +1903,9 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj) sg->length += PAGE_SIZE; } last_pfn = page_to_pfn(page); + + /* Check that the i965g/gm workaround works. */ + WARN_ON((gfp & __GFP_DMA32) && (last_pfn >= 0x00100000UL)); } #ifdef CONFIG_SWIOTLB if (!swiotlb_nr_tbl())