msm: kgsl: Calculate size of the MMU map region from the scatterlist
The GPUMMU and IOMMU functions operate on a scatter-gather list of
pages but still use the memdesc->size to determine the overall size
of the region. Enforce a single authoratiative source for all the
mapping data and calculate the size from the sglist.
Change-Id: Ic0dedbad6ffae842b65c5a88e7d56f834501e9d3
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
diff --git a/drivers/gpu/msm/kgsl_sharedmem.h b/drivers/gpu/msm/kgsl_sharedmem.h
index fb8dd95..034ade4 100644
--- a/drivers/gpu/msm/kgsl_sharedmem.h
+++ b/drivers/gpu/msm/kgsl_sharedmem.h
@@ -157,4 +157,15 @@
return ret;
}
+static inline int kgsl_sg_size(struct scatterlist *sg, int sglen)
+{
+ int i, size = 0;
+ struct scatterlist *s;
+
+ for_each_sg(sg, s, sglen, i) {
+ size += s->length;
+ }
+
+ return size;
+}
#endif /* __KGSL_SHAREDMEM_H */