[PATCH] iommu: omap_iovmm: support non page-aligned buffers in iommu_vmap

Ohad Ben-Cohen ohad at wizery.com
Thu Sep 1 07:47:26 EDT 2011


On Wed, Aug 31, 2011 at 1:52 PM, Ohad Ben-Cohen <ohad at wizery.com> wrote:
> From: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
>
> omap_iovmm requires page-aligned buffers, and that sometimes causes
> omap3isp failures (i.e. whenever the buffer passed from userspace is not
> page-aligned).
>
> Remove this limitation by rounding the address of the first page entry
> down, and adding the offset back to the device address.

Seems like the unmap paths were skipped (need to adjust the sizes in
the unmap path too).

Laurent, if it looks good to you, I'll just squash it to the original
patch and repost:

diff --git a/drivers/iommu/omap-iovmm.c b/drivers/iommu/omap-iovmm.c
index d28a256..39bdb92 100644
--- a/drivers/iommu/omap-iovmm.c
+++ b/drivers/iommu/omap-iovmm.c
@@ -447,7 +447,7 @@ err_out:
        for_each_sg(sgt->sgl, sg, i, j) {
                size_t bytes;

-               bytes = sg->length;
+               bytes = sg->length + sg->offset;
                order = get_order(bytes);

                /* ignore failures.. we're already handling one */
@@ -476,7 +476,7 @@ static void unmap_iovm_area(struct iommu_domain *domain, str
                size_t bytes;
                int order;

-               bytes = sg->length;
+               bytes = sg->length + sg->offset;
                order = get_order(bytes);

                err = iommu_unmap(domain, start, order);



More information about the linux-arm-kernel mailing list