From patchwork Thu Sep 1 11:47:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ohad Ben Cohen X-Patchwork-Id: 1118962 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p81BlpoE004003 for ; Thu, 1 Sep 2011 11:47:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757230Ab1IALru (ORCPT ); Thu, 1 Sep 2011 07:47:50 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:64266 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753055Ab1IALru (ORCPT ); Thu, 1 Sep 2011 07:47:50 -0400 Received: by wyh22 with SMTP id 22so897953wyh.19 for ; Thu, 01 Sep 2011 04:47:46 -0700 (PDT) Received: by 10.216.167.5 with SMTP id h5mr66616wel.96.1314877666142; Thu, 01 Sep 2011 04:47:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.47.138 with HTTP; Thu, 1 Sep 2011 04:47:26 -0700 (PDT) X-Originating-IP: [93.173.174.182] In-Reply-To: References: <1314646569-16738-1-git-send-email-ohad@wizery.com> From: Ohad Ben-Cohen Date: Thu, 1 Sep 2011 14:47:26 +0300 Message-ID: Subject: Re: [PATCH] iommu: omap_iovmm: support non page-aligned buffers in iommu_vmap To: Laurent Pinchart , Hiroshi DOYU Cc: linux-omap@vger.kernel.org, Arnd Bergmann , Tony Lindgren , linux-arm , Joerg Roedel , iommu@lists.linux-foundation.org Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 01 Sep 2011 11:47:51 +0000 (UTC) On Wed, Aug 31, 2011 at 1:52 PM, Ohad Ben-Cohen wrote: > From: Laurent Pinchart > > 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: --- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);