From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Cc: linux-arm-kernel@lists.arm.linux.org.uk,
linux-omap@vger.kernel.org, h-kanigeri2@ti.com,
omar.ramirez@ti.com, sakari.ailus@maxwell.research.nokia.com,
tony@atomide.com
Subject: Re: [PATCH 4/6] omap iommu: simple virtual address space management
Date: Sat, 16 May 2009 10:22:48 +0100 [thread overview]
Message-ID: <20090516092248.GE15328@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20090505124705.4583.28674.stgit@oreo.research.nokia.com>
On Tue, May 05, 2009 at 03:47:06PM +0300, Hiroshi DOYU wrote:
> +int ioremap_page(unsigned long virt, unsigned long phys, unsigned int mtype)
> +{
> + const struct mem_type *type;
> +
> + type = get_mem_type(mtype);
> + if (!type)
> + return -EINVAL;
I think it would make more sense to move this lookup into the caller
for this - you're going to be making quite a lot of calls into
ioremap_page() so you really don't want to be doing the same lookup
every time.
> +/* map 'sglist' to a contiguous mpu virtual area and return 'va' */
> +static void *vmap_sg(const struct sg_table *sgt)
> +{
> + u32 va;
> + size_t total;
> + unsigned int i;
> + struct scatterlist *sg;
> + struct vm_struct *new;
> +
> + total = sgtable_len(sgt);
> + if (!total)
> + return ERR_PTR(-EINVAL);
> +
> + new = __get_vm_area(total, VM_IOREMAP, VMALLOC_START, VMALLOC_END);
> + if (!new)
> + return ERR_PTR(-ENOMEM);
> + va = (u32)new->addr;
In other words, move it here.
> +
> + for_each_sg(sgt->sgl, sg, sgt->nents, i) {
> + size_t bytes;
> + u32 pa;
> + int err;
> +
> + pa = sg_phys(sg);
> + bytes = sg_dma_len(sg);
> +
> + BUG_ON(bytes != PAGE_SIZE);
> +
> + err = ioremap_page(va, pa, MT_DEVICE);
> + if (err)
> + goto err_out;
> +
> + va += bytes;
> + }
> +
> + flush_cache_vmap(new->addr, total);
> + return new->addr;
> +
> +err_out:
> + WARN_ON(1); /* FIXME: cleanup some mpu mappings */
> + vunmap(new->addr);
> + return ERR_PTR(-EAGAIN);
> +}
next prev parent reply other threads:[~2009-05-16 9:22 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-05 12:46 [PATCH 0/6] Initial support for omap iommu driver Hiroshi DOYU
2009-05-05 12:46 ` [PATCH 1/6] omap iommu: tlb and pagetable primitives Hiroshi DOYU
2009-05-05 20:19 ` Kanigeri, Hari
2009-05-06 5:56 ` Hiroshi DOYU
2009-05-05 12:46 ` [PATCH 2/6] omap iommu: omap2 architecture specific functions Hiroshi DOYU
2009-05-06 14:31 ` Kanigeri, Hari
2009-05-07 5:12 ` Hiroshi DOYU
2009-05-07 14:40 ` Kanigeri, Hari
2009-05-05 12:47 ` [PATCH 3/6] omap iommu: omap3 iommu device registration Hiroshi DOYU
2009-05-05 19:32 ` Felipe Contreras
2009-05-06 6:00 ` Hiroshi DOYU
2009-05-07 20:02 ` Felipe Contreras
2009-05-07 20:11 ` [RFC/PATCH 0/3] omap3-iommu: cleanups and remote registration Felipe Contreras
2009-05-07 20:11 ` [RFC/PATCH 1/3] omap3-iommu: reorganize Felipe Contreras
2009-05-07 20:11 ` [RFC/PATCH 2/3] omap3-iommu: split init function into omap_iommu_add Felipe Contreras
2009-05-07 20:11 ` [RFC/PATCH 3/3] omap3-iommu: remote registration Felipe Contreras
2009-05-07 21:14 ` [RFC/PATCH 1/3] omap3-iommu: reorganize Felipe Balbi
2009-05-07 22:16 ` Felipe Contreras
2009-05-08 4:15 ` Hiroshi DOYU
2009-05-07 20:28 ` [RFC/PATCH 0/3] omap3-iommu: cleanups and remote registration Kanigeri, Hari
2009-05-07 20:39 ` Felipe Contreras
2009-05-07 20:54 ` Kanigeri, Hari
2009-05-08 4:14 ` Hiroshi DOYU
2009-05-08 8:04 ` Felipe Contreras
2009-05-07 20:05 ` [PATCH 3/6] omap iommu: omap3 iommu device registration Felipe Contreras
2009-05-08 4:10 ` Hiroshi DOYU
2009-05-08 7:32 ` Felipe Contreras
2009-05-08 17:21 ` Aguirre Rodriguez, Sergio Alberto
2009-05-08 22:27 ` Felipe Contreras
2009-05-16 9:20 ` Russell King - ARM Linux
2009-05-16 9:38 ` Felipe Contreras
2009-05-16 9:54 ` Russell King - ARM Linux
2009-05-16 9:56 ` Felipe Contreras
2009-05-16 9:55 ` Russell King - ARM Linux
2009-05-18 5:36 ` Hiroshi DOYU
2009-05-18 9:39 ` Hiroshi DOYU
2009-05-18 14:26 ` Hiroshi DOYU
2009-05-18 16:43 ` [PATCH] omap3-iommu: reorganize Felipe Contreras
2009-05-19 6:03 ` Hiroshi DOYU
2009-05-19 9:43 ` Felipe Contreras
2009-05-18 5:22 ` [PATCH 3/6] omap iommu: omap3 iommu device registration Hiroshi DOYU
2009-05-05 12:47 ` [PATCH 4/6] omap iommu: simple virtual address space management Hiroshi DOYU
2009-05-16 9:22 ` Russell King - ARM Linux [this message]
2009-05-18 6:31 ` Hiroshi DOYU
2009-05-18 13:10 ` Russell King - ARM Linux
2009-05-05 12:47 ` [PATCH 5/6] omap iommu: entries for Kconfig and Makefile Hiroshi DOYU
2009-05-18 13:36 ` Russell King - ARM Linux
2009-05-05 12:47 ` [PATCH 6/6] omap2 " Hiroshi DOYU
-- strict thread matches above, loose matches on Subject: below --
2009-01-16 8:37 [PATCH 0/6] arm: omap iommu: add initial support Hiroshi DOYU
2009-01-16 8:37 ` [PATCH 4/6] omap iommu: simple virtual address space management Hiroshi DOYU
2009-01-17 16:57 ` Russell King - ARM Linux
2009-01-27 21:29 ` Hiroshi DOYU
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=20090516092248.GE15328@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=Hiroshi.DOYU@nokia.com \
--cc=h-kanigeri2@ti.com \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-omap@vger.kernel.org \
--cc=omar.ramirez@ti.com \
--cc=sakari.ailus@maxwell.research.nokia.com \
--cc=tony@atomide.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