From: KyongHo Cho <pullip.cho@samsung.com>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Joerg Roedel <joro@8bytes.org>,
"Ramirez Luna, Omar" <omar.ramirez@ti.com>,
linux-arm-kernel@lists.infradead.org,
linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org,
Kyungmin Park <kyungmin.park@samsung.com>,
Russell King - ARM Linux <linux@arm.linux.org.uk>,
Arnd Bergmann <arnd@arndb.de>, Ohad Ben-Cohen <ohad@wizery.com>
Subject: Re: [RFC] ARM: dma_map|unmap_sg plus iommu
Date: Mon, 1 Aug 2011 09:57:46 +0900 [thread overview]
Message-ID: <CAHQjnOM58AReFuDpcSjHvNP2UZX1ZUeuWyfWCG6Ayxdfj4QE7w@mail.gmail.com> (raw)
In-Reply-To: <004201cc4dfb$47ee4770$d7cad650$%szyprowski@samsung.com>
Hi.
On Fri, Jul 29, 2011 at 11:24 PM, Marek Szyprowski
<m.szyprowski@samsung.com> wrote:
> Hello,
>
> On Friday, July 29, 2011 12:54 PM Joerg Roedel wrote:
>
>> On Fri, Jul 29, 2011 at 12:14:25PM +0200, Marek Szyprowski wrote:
>> > > This sounds rather hacky. How about partitioning the address space for
>> > > the device and give the dma-api only a part of it. The other parts can
>> > > be directly mapped using the iommu-api then.
>> >
>> > Well, I'm not convinced that iommu-api should be used by the device drivers
>> > directly. If possible we should rather extend dma-mapping than use such
> hacks.
>>
>> Building this into dma-api would turn it into an iommu-api. The line
>> between the apis are clear. The iommu-api provides direct mapping
>> of bus-addresses to system-addresses while the dma-api puts a memory
>> manager on-top which deals with bus-address allocation itself.
>> So if you want to map bus-addresses directly the iommu-api is the way to
>> go. This is in no way a hack.
>
> The problem starts when you want to use the same driver on two different
> systems:
> one with iommu and one without. Our driver depends only on dma-mapping and the
> fact
> that the first allocation starts from the right address. On systems without
> iommu,
> board code calls bootmem_reserve() and dma_declare_coherent() for the required
> memory range. Systems with IOMMU just sets up device io address space to start
> at the specified address. This works fine, because in our system each device has
> its own, private iommu controller and private address space.
>
> Right now I have no idea how to handle this better. Perhaps with should be
> possible
> to specify somehow the target dma_address when doing memory allocation, but I'm
> not
> really convinced yet if this is really required.
>
What about using 'dma_handle' argument of alloc_coherent callback of
dma_map_ops?
Although it is an output argument, I think we can convey a hint or
start address to map
to the IO memory manager that resides behind dma API.
Of course, it is unable to map a specific physical address with the
dma address with the idea.
I think the problem can be solved for some application
with overriding alloc_coherent callback in the machine initialization code.
Still the above idea cannot answer when a physical address is needed
to be mapped
to a specific dma address with 'dma_map_*()'.
DMA API is so abstract that it cannot cover all requirements by
various device drivers;;
Regards,
Cho KyongHo.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-08-01 0:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-28 21:09 [RFC] ARM: dma_map|unmap_sg plus iommu Ramirez Luna, Omar
2011-07-29 7:50 ` Marek Szyprowski
2011-07-29 9:35 ` 'Joerg Roedel'
2011-07-29 10:14 ` Marek Szyprowski
2011-07-29 10:54 ` 'Joerg Roedel'
2011-07-29 14:24 ` Marek Szyprowski
2011-08-01 0:57 ` KyongHo Cho [this message]
2011-08-08 15:21 ` Ramirez Luna, Omar
2011-08-08 15:29 ` Russell King - ARM Linux
2011-08-09 7:04 ` Marek Szyprowski
2011-08-08 15:04 ` Ramirez Luna, Omar
2011-08-09 6:51 ` Marek Szyprowski
2011-08-13 14:39 ` Ramirez Luna, Omar
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=CAHQjnOM58AReFuDpcSjHvNP2UZX1ZUeuWyfWCG6Ayxdfj4QE7w@mail.gmail.com \
--to=pullip.cho@samsung.com \
--cc=arnd@arndb.de \
--cc=joro@8bytes.org \
--cc=kyungmin.park@samsung.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mm@kvack.org \
--cc=linux@arm.linux.org.uk \
--cc=m.szyprowski@samsung.com \
--cc=ohad@wizery.com \
--cc=omar.ramirez@ti.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;
as well as URLs for NNTP newsgroup(s).