drm/msm: Fix wrong size calculation
Subsystems (4)
PATCH 1/1 drm/msm: Fix wrong size calculation
For example, memory-region in .dts as below,
reg = <0x0 0x50000000 0x0 0x20000000>
We can get below values,
struct resource r;
r.start = 0x50000000;
r.end = 0x6fffffff;
So the size should be:
size = r.end - r.start + 1 = 0x20000000
Signed-off-by Xianting Tian <[email protected]>
--- drivers/gpu/drm/msm/msm_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_drv.c +1 -1
@@ -466,7 +466,7 @@ static int msm_init_vram(struct drm_device *dev)of_node_put (node);if (ret)return ret; - size = r.end - r.start; + size = r.end - r.start +1 ;DRM_INFO ("using VRAM carveout: %lx@%pa\n" , size, &r.start);/* if we have no IOMMU, then we need to use carveout allocator.
Signature · 1 line
2.17.1
Quoted 8 lines · Xianting Tian
For example, memory-region in .dts as below,
reg = <0x0 0x50000000 0x0 0x20000000>We can get below values,
struct resource r;
r.start =0x50000000;
r.end =0x6fffffff;
Quoted 4 lines
So the size should be:
size = r.end - r.start + 1 =0x20000000Signed-off-by Xianting Tian <[email protected]>
Fixes 072f1f9168ed ("drm/msm: add support for "stolen" mem")
Reviewed-by Dmitry Baryshkov <[email protected]>
Quoted 17 lines
--- drivers/gpu/drm/msm/msm_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/msm/msm_drv.c +1
-1@@ -466,7 +466,7 @@ static int msm_init_vram(struct drm_device *dev)of_node_put (node);if (ret)return ret; - size = r.end - r.start; + size = r.end - r.start +1 ;DRM_INFO ("using VRAM carveout: %lx@%pa\n" , size, &r.start);/* if we have no IOMMU, then we need to use carveout allocator.
Signature · 2 lines
With best wishes Dmitry