From: Grant Likely <grant.likely@secretlab.ca>
To: Kumar Gala <galak@codeaurora.org>,
Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
devicetree@vger.kernel.org, Laura Abbott <lauraa@codeaurora.org>,
Pawel Moll <pawel.moll@arm.com>, Arnd Bergmann <arnd@arndb.de>,
Stephen Warren <swarren@wwwdotorg.org>,
Tomasz Figa <t.figa@samsung.com>,
Tomasz Figa <tomasz.figa@gmail.com>,
Michal Nazarewicz <mina86@mina86.com>,
linaro-mm-sig@lists.linaro.org, Marc <marc.ceeeee@gmail.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Olof Johansson <olof@lixom.net>,
Nishanth Peethambaran <nishanth.p@gmail.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
linux-arm-kernel@lists.infradead.org,
Ian Campbell <ian.campbell@citrix.com>
Subject: Re: [PATCH v7 3/4] drivers: of: add initialization code for dma reserved memory
Date: Mon, 09 Sep 2013 17:01:54 +0100 [thread overview]
Message-ID: <20130909160154.8D7183E0F23@localhost> (raw)
In-Reply-To: <DAF223EB-C84C-4E82-A24A-ACD0A3A0559F@codeaurora.org>
On Fri, 30 Aug 2013 15:26:24 -0500, Kumar Gala <galak@codeaurora.org> wrote:
> On Aug 30, 2013, at 7:39 AM, Marek Szyprowski wrote:
> > On 8/30/2013 12:46 AM, Grant Likely wrote:
> >> On Mon, 26 Aug 2013 16:39:18 +0200, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
> >> > + - "reserved-memory-region" - compatibility is defined, given
> >> > + region is assigned for exclusive usage for by the respective
> >> > + devices.
> >>
> >> BTW, just so you're aware there is already a binding for marking regions
> >> as reserved. It was recently added to arch/powerpc/kernel/prom.c.
> >> Unfortunately it doesn't look like it got documented. Search for
> >> "reserved-ranges". However, I don't think it blocks your work here. That
> >> binding doesn't provide any way for matching devices to reserved ranges.
> >> It is only for telling the kernel "hands of that memory".
> >
> > ok, good to know.
>
> So I think the most generic compatible should effectively be the same
> as 'reserved-ranges', ie this region shouldn't be touched by the
> kernel.
>
> Than we can build on top of that with more specific compatibles.
>
> I have examples from FSL networking SoCs where we would carve out
> memory for backing storage managed completely by the HW and Linux
> wouldn't need to touch it, however we might have a
> "fsl,qman-backing-store" compat encase we might want some debug code
> in linux to look at the region of memory.
>
> I've got examples at qualcomm where we have shared data structures in
> specific memory regions between different processors that aren't cache
> coherent, so want the memory not to be marked as cacheable by Linux
> when it accesses it. Again we'd have a "qcom,smem" prop on top of the
> "reserved-memory-region".
I think that is a reasonable approach, and works really well for regions
associated with specific hardware because the hardware driver can be
responsible for wiring it up to CMA or manage the region directly.
Whatever the driver desires to do.
It still remains what to do for generic regions that any device can use.
As I've previously said, I don't like calling out "CMA" specifically in
the compatible property because that happens to be a Linux
implementation specific details. Two years from now someone may propose
a new allocator that should take over what used to be handled by CMA
(kind of like how CMA may end up taking over from ION)....
Alright, I've thought about it some more and it probably does make sense
to use an additional compatible string. Marek originally suggested
"linux,contiguous-memory-region". I later suggested "shareable-memory-region",
but that's actually a worse name because it doesn't have any reference
to what the region is for (I was fixating on the kernel being able to
use unallocated pages; but that is also an implementation detail). I
exercise my right to change my mind and agree that contiguous is
appropriate here. But instead of calling out the contiguous allocator,
the binding should specifically lay out the usage model for these
regions. I would change the contiguous-memory binding to state the
following:
Contiguous-memory is a region of general purpose memory from
which large buffers of contiguous memory can be allocated.
Contiguous buffers are often used for DMA buffers. The operating
system may use the memory for any purpose, but must immediately
release the pages if a contiguous buffer is required.
So the way I read things, the current proposal would be:
The generic form for do-not-touch memory:
compatible = "reserved-memory";
- I've dropped '-region' because I think it is redundant
- The kernel will not make use of this memory except for when a driver picks it up
For contiguous memory:
compatible = "contiguous-memory", "reserved-memory"
For contiguous memory that Linux will use by default if a specific
region isn't specified.
compatible = "contiguous-memory", "reserved-memory"
linux,default-contiguous-region;
- I stuck with a linux, prefix here because I haven't come up with a
non-linux way to describe this.
Memory that specific hardware can pick up:
compatible = "qcom,smem", "reserved-memory"
Nodes with a 'size' property and without a 'reg' property need to have a
region allocated and reserved. The allocated region needs to be cached
somewhere. We could create a data structure for tracking the reserved
regions, or could write it in directly. While I shudder at the thought of
modifying the device tree at runtime by the kernel, it might just be the
sanest implementation at this time. I'd like to see what the
implementation looks like. (Since this is potentially controversial, I
would recommend implementing the exact regions in on patch, and add
dynamically allocated regions as a follow-up patch)
As far as proper implementation is concerned, I think it should be
explicit in the binding that the kernel should automatically exclude
anything under the reserved-memory node, regardless of the compatible
value. Merely being a child of the reserved-memory node immediately
means that it is a reserved memory region.
g.
next prev parent reply other threads:[~2013-09-09 16:01 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-26 14:39 [PATCH v7 0/4] Device Tree support for CMA (Contiguous Memory Allocator) Marek Szyprowski
2013-08-26 14:39 ` [PATCH v7 1/4] drivers: dma-contiguous: clean source code and prepare for device tree Marek Szyprowski
2013-08-26 14:39 ` [PATCH v7 2/4] drivers: of: add function to scan fdt nodes given by path Marek Szyprowski
2013-08-29 21:40 ` Grant Likely
2013-08-30 10:42 ` Marek Szyprowski
2013-08-30 10:46 ` Grant Likely
2013-08-26 14:39 ` [PATCH v7 3/4] drivers: of: add initialization code for dma reserved memory Marek Szyprowski
2013-08-29 22:46 ` Grant Likely
2013-08-30 12:39 ` Marek Szyprowski
2013-08-30 20:26 ` Kumar Gala
2013-09-09 16:01 ` Grant Likely [this message]
2013-09-10 19:53 ` Kumar Gala
[not found] ` <BA65D7E3-8C15-4B44-95E2-E5DC862DDDE0-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2013-09-15 12:48 ` Grant Likely
2013-09-12 18:22 ` Kumar Gala
[not found] ` <13185491-534E-4547-8412-5704346EA2DC-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2013-09-15 12:50 ` Grant Likely
2013-09-16 7:12 ` Marek Szyprowski
2013-09-16 7:25 ` Benjamin Herrenschmidt
2013-09-16 13:43 ` Grant Likely
[not found] ` <CACxGe6s_JY7GpjXN7gwADV0oE+BnQfJX4AaXTZURumfepa3NiA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-09-18 3:48 ` Grant Likely
[not found] ` <20130918034848.A8E76C42CF4-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-09-18 11:07 ` Marek Szyprowski
[not found] ` <5236AF64.80607-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-09-16 8:17 ` Marek Szyprowski
2013-09-09 13:05 ` Grant Likely
2013-08-29 22:48 ` Grant Likely
[not found] ` <1377527959-5080-4-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-09-27 15:47 ` Kumar Gala
2013-09-27 17:06 ` Matt Sealey
2013-08-26 14:39 ` [PATCH v7 4/4] ARM: init: add support for reserved memory defined by device tree Marek Szyprowski
2013-08-29 22:49 ` Grant Likely
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=20130909160154.8D7183E0F23@localhost \
--to=grant.likely@secretlab.ca \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=ian.campbell@citrix.com \
--cc=kyungmin.park@samsung.com \
--cc=lauraa@codeaurora.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=m.szyprowski@samsung.com \
--cc=marc.ceeeee@gmail.com \
--cc=mark.rutland@arm.com \
--cc=mina86@mina86.com \
--cc=nishanth.p@gmail.com \
--cc=olof@lixom.net \
--cc=pawel.moll@arm.com \
--cc=s.hauer@pengutronix.de \
--cc=s.nawrocki@samsung.com \
--cc=swarren@wwwdotorg.org \
--cc=t.figa@samsung.com \
--cc=tomasz.figa@gmail.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).