drm/i915: Fix the offset issue for the stolen GEM objects
Subsystems (2)
PATCH 1/7 drm/i915: Fix the offset issue for the stolen GEM objects
From: Akash Goel <[email protected]>
The 'offset' field of the 'scatterlist' structure was wrongly programmed with the offset value from the base of stolen area, whereas this field indicates the offset from where the interested data starts within the first PAGE pointed to by 'scattterlist' structure. As a result when a new GEM object allocated from stolen area is mapped to GTT, it could lead to an overwrite of GTT entries as the page count calculation will go wrong, refer the function 'sg_page_count'.
v2: Modified the commit message. (Chris)
--- drivers/gpu/drm/i915/i915_gem_stolen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +1 -1
@@ -250,7 +250,7 @@ i915_pages_create_for_stolen(struct drm_device *dev, } sg = st->sgl; - sg->offset = offset; + sg->offset =0 ; sg->length = size;sg_dma_address (sg) = (dma_addr_t )dev_priv->mm.stolen_base + offset;
Signature · 1 line
1.8.5.2
Quoted 23 lines · On Mon, 13 Jan 2014 16:24:45 +0530 [email protected] wrote:
From: Akash Goel <[email protected]>
The 'offset' field of the 'scatterlist' structure was wrongly programmed with the offset value from the base of stolen area, whereas this field indicates the offset from where the interested data starts within the first PAGE pointed to by 'scattterlist' structure. As a result when a new GEM object allocated from stolen area is mapped to GTT, it could lead to an overwrite of GTT entries as the page count calculation will go wrong, refer the function '
sg_page_count'.v2: Modified the commit message. (Chris)
Signed-off-by Akash Goel <[email protected]>--- drivers/gpu/drm/i915/i915_gem_stolen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/i915_gem_stolen.c +0
-0
drivers/gpu/drm/i915/i915_gem_stolen.c i915_pages_create_for_stolen(struct drm_device *dev, · line 256
Quoted 8 lines
drivers/gpu/drm/i915/i915_gem_stolen.c +1
-1@@ -250,7 +250,7 @@ i915_pages_create_for_stolen(struct drm_device *dev, } sg = st->sgl; - sg->offset = offset; + sg->offset =0 ; sg->length = size;sg_dma_address (sg) = (dma_addr_t )dev_priv->mm.stolen_base + offset;
Let's get this upstream and cc stable.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Quoted 33 lines · Jesse Barnes
Quoted 30 lines · On Mon, 13 Jan 2014 16:24:45 +0530 [email protected] wrote:
From: Akash Goel <[email protected]>
The 'offset' field of the 'scatterlist' structure was wrongly programmed with the offset value from the base of stolen area, whereas this field indicates the offset from where the interested data starts within the first PAGE pointed to by 'scattterlist' structure. As a result when a new GEM object allocated from stolen area is mapped to GTT, it could lead to an overwrite of GTT entries as the page count calculation will go wrong, refer the function '
sg_page_count'.v2: Modified the commit message. (Chris)
Signed-off-by Akash Goel <[email protected]>--- drivers/gpu/drm/i915/i915_gem_stolen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/i915_gem_stolen.c +1
-1@@ -250,7 +250,7 @@ i915_pages_create_for_stolen(struct drm_device *dev, } sg = st->sgl; - sg->offset = offset; + sg->offset =0 ; sg->length = size;
Quoted 5 lines
drivers/gpu/drm/i915/i915_gem_stolen.c i915_pages_create_for_stolen(struct drm_device *dev, · line 256
Quoted 1 line
drivers/gpu/drm/i915/i915_gem_stolen.c +0
-0sg_dma_address (sg) = (dma_addr_t )dev_priv->mm.stolen_base + offset;Let's get this upstream and cc stable.
Reviewed-by Jesse Barnes <[email protected]>
Indeed this slipped through the cracks. Patch authors: Please poke me per mail (cc mailing lists still) or on irc if a patch seems to linger for 1-2 weeks. Merged to -fixes, thanks.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch