From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [RESEND] [PATCH 1/2] OMAP1: allow reserving memory for camera
Date: Wed, 8 Jun 2011 23:13:30 +0100 [thread overview]
Message-ID: <20110608221330.GA13246@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <201106082354.10985.jkrzyszt@tis.icnet.pl>
On Wed, Jun 08, 2011 at 11:53:49PM +0200, Janusz Krzysztofik wrote:
> On Fri 10 Dec 2010 at 22:03:52 Janusz Krzysztofik wrote:
> > Friday 10 December 2010 18:03:56 Russell King - ARM Linux napisa?(a):
> > > On Fri, Dec 10, 2010 at 12:03:07PM +0100, Janusz Krzysztofik wrote:
> > > > void __init omap1_camera_init(void *info)
> > > > {
> > > >
> > > > struct platform_device *dev = &omap1_camera_device;
> > > >
> > > > + dma_addr_t paddr = omap1_camera_phys_mempool_base;
> > > > + dma_addr_t size = omap1_camera_phys_mempool_size;
> > > >
> > > > int ret;
> > > >
> > > > dev->dev.platform_data = info;
> > > >
> > > > + if (paddr) {
> > > > + if (dma_declare_coherent_memory(&dev->dev, paddr, paddr, size,
> > > > + DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE))
> > >
> > > Although this works, you're ending up with SDRAM being mapped via
> > > ioremap, which uses MT_DEVICE - so what is SDRAM ends up being
> > > mapped as if it were a device.
> > >
> > > For OMAP1, which is ARMv5 or lower, device memory becomes
> > > 'uncacheable, unbufferable' which is luckily what is used for the
> > > DMA coherent memory on those platforms - so no technical problem
> > > here.
> > >
> > > However, on ARMv6 and later, ioremapped memory is device memory,
> > > which has different ordering wrt normal memory mappings, and may
> > > appear on different busses on the CPU's interface. So, this is
> > > something I don't encourage as it's unclear that the hardware will
> > > work.
> > >
> > > Essentially, dma_declare_coherent_memory() on ARM with main SDRAM
> > > should be viewed as a 'it might work, it might not, and it might
> > > stop working in the future' kind of interface. In other words,
> > > there is no guarantee that this kind of thing will be supported in
> > > the future.
> >
> > I was affraid of an unswer of this kind. I'm not capable of comming
> > out with any better, alternative solutions. Any hints other than
> > giving up with that old videobuf-contig, coherent memory based
> > interface? Or can we agree on that 'luckily uncacheable,
> > unbufferable, SDRAM based DMA coherent memory' solution for now?
>
> Russell, Tony,
>
> Sorry for getting back to this old thread, but since my previous
> attempts to provide[1] or support[2] a possibly better solution to the
> problem all failed on one hand, and I can see patches not very different
> from mine[3] being accepted for arch/arm/mach-{mx3,imx} during this and
> previous merge windows[4][5][6] on the other, is there any chance for the
> 'dma_declare_coherent_memory() over a memblock_alloc()->free()->remove()
> obtained area' based solution being accepted for omap1_camera as well if
> I resend it refreshed?
I stand by my answer to your patches quoted above from a technical point
of view; we should not be mapping SDRAM using device mappings.
That ioremap() inside dma_declare_coherent_memory() needs to die, but
it seems that those who now look after the DMA API really aren't
interested in the technical details of this being wrong for some
architecture - just like they're not really interested in the details
of devices using dma-engines for their DMA support.
I'm afraid that the DMA support in Linux sucks because of this, and I
have no real desire to participate in discussions with brick walls over
this.
Certainly the memblock_alloc()+free()+remove() is the right way to
reserve the memory, but as it stands dma_declare_coherent_memory()
should not be used on ARMv6 or higher CPUs to pass that memory to the
device driver.
next prev parent reply other threads:[~2011-06-08 22:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <201012051929.07220.jkrzyszt@tis.icnet.pl>
2010-12-10 10:59 ` [RESEND] [PATCH 0/2] OMAP1: amsdelta: reserve memory for videobuf_contig Janusz Krzysztofik
2010-12-10 11:03 ` [RESEND] [PATCH 1/2] OMAP1: allow reserving memory for camera Janusz Krzysztofik
2010-12-10 17:03 ` Russell King - ARM Linux
2010-12-10 21:03 ` Janusz Krzysztofik
2011-06-08 21:53 ` Janusz Krzysztofik
2011-06-08 22:13 ` Russell King - ARM Linux [this message]
2011-06-08 22:44 ` Janusz Krzysztofik
2011-07-12 9:53 ` Janusz Krzysztofik
2010-12-13 15:52 ` Catalin Marinas
2010-12-13 16:29 ` Russell King - ARM Linux
2010-12-15 12:39 ` Catalin Marinas
2010-12-15 17:01 ` Russell King - ARM Linux
2010-12-19 11:46 ` Janusz Krzysztofik
2010-12-10 11:05 ` [PATCH 2/2] OMAP1: Amstrad Delta: reserve " Janusz Krzysztofik
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=20110608221330.GA13246@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/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).