Skip to contentSkip to conversation

drm/i915: set dummy page for stolen objects

PATCH Applied Imre Deak 2 participants 2 messages Mar 22, 2013 – Mar 23, 2013

Subsystems (2)
lore
Share & tools
lore

Imre Deak

author
#0 lore raw

PATCH 1/1 drm/i915: set dummy page for stolen objects

This is needed since currently sg_for_each_page assumes that we have a valid page in each sg item. It is only a real problem for CONFIG_SPARSEMEM where the page is dereferenced, in other cases the iterator works ok with an invalid page pointer.

We can remove this workaround when we have fixed sg_page_iter to work on scatterlists without backing pages.

---
 drivers/gpu/drm/i915/i915_gem_stolen.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +2 -2
index 69d97cb..efaaba5 100644
@@ -222,8 +222,8 @@ i915_pages_create_for_stolen(struct drm_device *dev,
 	}
 
 	sg = st->sgl;
-	sg->offset = offset;
-	sg->length = size;
+	/* we set the dummy page here only to make for_each_sg_page work */
+	sg_set_page(sg, dev_priv->gtt.scratch_page, size, offset);
 
 	sg_dma_address(sg) = (dma_addr_t)dev_priv->mm.stolen_base + offset;
 	sg_dma_len(sg) = size;
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 9 lines · Imre Deak

This is needed since currently sg_for_each_page assumes that we have a valid page in each sg item. It is only a real problem for CONFIG_SPARSEMEM where the page is dereferenced, in other cases the iterator works ok with an invalid page pointer.

We can remove this workaround when we have fixed sg_page_iter to work on scatterlists without backing pages.

Queued for -next and pushed down with a rebase to avoid bisecting issues, thanks for the patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch