From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: "Ohad Ben-Cohen" <ohad@wizery.com>
Cc: linux-media@vger.kernel.org, linux-omap@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, Hiroshi.DOYU@nokia.com,
arnd@arndb.de, davidb@codeaurora.org, Joerg.Roedel@amd.com
Subject: Re: [RFC 2/6] omap: iovmm: generic iommu api migration
Date: Tue, 7 Jun 2011 11:05:15 +0200 [thread overview]
Message-ID: <201106071105.16262.laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <1307053663-24572-3-git-send-email-ohad@wizery.com>
Hi Ohad,
Thanks for the patch.
On Friday 03 June 2011 00:27:39 Ohad Ben-Cohen wrote:
> Migrate omap's iovmm (virtual memory manager) to the generic iommu api.
>
> This brings iovmm a step forward towards being completely non
> omap-specific (it's still assuming omap's iommu page sizes, and also
> maintaining state inside omap's internal iommu structure, but it no
> longer calls omap-specific iommu map/unmap api).
>
> Further generalizing of iovmm (or complete removal) should take place
> together with broader plans of providing a generic virtual memory manager
> and allocation framework (de-coupled from specific mappers).
>
> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
[snip]
> diff --git a/arch/arm/plat-omap/iovmm.c b/arch/arm/plat-omap/iovmm.c
> index 51ef43e..80bb2b6 100644
> --- a/arch/arm/plat-omap/iovmm.c
> +++ b/arch/arm/plat-omap/iovmm.c
[snip]
> @@ -473,22 +475,22 @@ static int map_iovm_area(struct iommu *obj, struct
> iovm_struct *new, u32 pa;
> int pgsz;
> size_t bytes;
> - struct iotlb_entry e;
>
> pa = sg_phys(sg);
> bytes = sg_dma_len(sg);
>
> flags &= ~IOVMF_PGSZ_MASK;
> +
> pgsz = bytes_to_iopgsz(bytes);
> if (pgsz < 0)
> goto err_out;
> - flags |= pgsz;
pgsz isn't used anymore, you can remove it.
> +
> + order = get_order(bytes);
Does iommu_map() handle offsets correctly, or does it expect pa to be aligned
to an order (or other) boundary ? Same comment for iommu_unmap() in
unmap_iovm_area().
> pr_debug("%s: [%d] %08x %08x(%x)\n", __func__,
> i, da, pa, bytes);
>
> - iotlb_init_entry(&e, da, pa, flags);
> - err = iopgtable_store_entry(obj, &e);
> + err = iommu_map(domain, da, pa, order, flags);
> if (err)
> goto err_out;
>
> @@ -502,9 +504,11 @@ err_out:
> for_each_sg(sgt->sgl, sg, i, j) {
> size_t bytes;
>
> - bytes = iopgtable_clear_entry(obj, da);
> + bytes = sg_dma_len(sg);
As Russell pointed out, we should use sg->length instead of sg_dma_length(sg).
sg_dma_length(sg) is only valid after the scatter list has been DMA-mapped,
which doesn't happen in the iovmm driver. This applies to all sg_dma_len(sg)
calls.
> + order = get_order(bytes);
>
> - BUG_ON(!iopgsz_ok(bytes));
> + /* ignore failures.. we're already handling one */
> + iommu_unmap(domain, da, order);
>
> da += bytes;
> }
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2011-06-07 9:05 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-02 22:27 [RFC 0/6] iommu: generic api migration and grouping Ohad Ben-Cohen
2011-06-02 22:27 ` [RFC 1/6] omap: iommu: generic iommu api migration Ohad Ben-Cohen
2011-06-07 9:22 ` Laurent Pinchart
2011-06-07 11:19 ` Ohad Ben-Cohen
2011-06-07 11:40 ` Laurent Pinchart
2011-06-07 12:27 ` Ohad Ben-Cohen
2011-06-02 22:27 ` [RFC 2/6] omap: iovmm: " Ohad Ben-Cohen
2011-06-07 9:05 ` Laurent Pinchart [this message]
2011-06-07 10:28 ` Ohad Ben-Cohen
2011-06-07 11:26 ` Laurent Pinchart
2011-06-07 13:46 ` Ohad Ben-Cohen
2011-06-08 10:46 ` Laurent Pinchart
2011-06-09 6:42 ` Ohad Ben-Cohen
2011-06-02 22:27 ` [RFC 3/6] media: omap3isp: " Ohad Ben-Cohen
2011-06-02 22:27 ` [RFC 4/6] drivers: iommu: move to a dedicated folder Ohad Ben-Cohen
2011-06-02 22:27 ` [RFC 5/6] omap: iommu/iovmm: move to dedicated iommu folder Ohad Ben-Cohen
2011-06-02 22:27 ` [RFC 6/6] msm: iommu: move to dedicated iommu drivers folder Ohad Ben-Cohen
2011-06-02 23:57 ` [RFC 0/6] iommu: generic api migration and grouping Kyungmin Park
2011-06-05 19:43 ` Ohad Ben-Cohen
2011-06-03 15:53 ` Arnd Bergmann
2011-06-05 19:39 ` Ohad Ben-Cohen
2011-06-06 9:10 ` Arnd Bergmann
2011-06-06 15:17 ` Ohad Ben-Cohen
2011-06-06 10:09 ` Roedel, Joerg
2011-06-06 15:15 ` Ohad Ben-Cohen
2011-06-06 15:35 ` Roedel, Joerg
2011-06-06 16:36 ` Ohad Ben-Cohen
2011-06-06 19:20 ` Roedel, Joerg
2011-06-06 20:09 ` Ohad Ben-Cohen
2011-06-07 7:52 ` Roedel, Joerg
2011-06-07 9:22 ` Ohad Ben-Cohen
2011-06-07 9:58 ` Roedel, Joerg
2011-06-07 10:30 ` Ohad Ben-Cohen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201106071105.16262.laurent.pinchart@ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=Hiroshi.DOYU@nokia.com \
--cc=Joerg.Roedel@amd.com \
--cc=arnd@arndb.de \
--cc=davidb@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=ohad@wizery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®