All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sylwester Nawrocki <sylvester.nawrocki-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	Michal Nazarewicz
	<mina86-deATy8a+UHjQT0dZR+AlfA@public.gmane.org>,
	linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw@public.gmane.org,
	Kyungmin Park
	<kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Marek Szyprowski
	<m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Subject: Re: [PATCH 0/2] Device Tree support for CMA (Contiguous Memory Allocator)
Date: Mon, 18 Feb 2013 23:25:03 +0100	[thread overview]
Message-ID: <5122AA3F.8030001@gmail.com> (raw)
In-Reply-To: <20130215083304.GK1906-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

On 02/15/2013 09:33 AM, Sascha Hauer wrote:
> On Thu, Feb 14, 2013 at 11:08:54PM +0100, Sylwester Nawrocki wrote:
>> On 02/14/2013 10:30 PM, Sascha Hauer wrote:
>>> On Thu, Feb 14, 2013 at 01:45:26PM +0100, Marek Szyprowski wrote:
>> ...
>>>> Here is my initial proposal for device tree integration for Contiguous
>>>> Memory Allocator. The code is quite straightforward, however I expect
>>>> that the memory bindings require some discussion.
>>>>
>>>> The proposed bindings allows to define contiguous memory regions of
>>>> specified base address and size. Then, the defined regions can be
>>>> assigned to the given device(s) by adding a property with a phanle to
>>>> the defined contiguous memory region. From the device tree perspective
>>>> that's all. Once the bindings are added, all the memory allocations from
>>>> dma-mapping subsystem will be served from the defined contiguous memory
>>>> regions.
>>>>
>>>
>>> I think CMA regions should not be described in the devicetre at all. The
>>> devicetree is about hardware description and it should be OS agnostic,
>>> but CMA is only a Linux specific implementation detail. It's not even
>>> specific to a particular board, it's specific to a particular usecase of
>>> a board.
>>
>> I disagree. For example, in a multiprocessor system describing the memory
>> regions this way allows to assign memory to each subsystem, e.g. shared
>> memory, so that the memory region constraints are satisfied.
>>
>> CMA just happens to be an implementation of a method of assigning memory
>> to each device in Linux. The constraints on the memory are real hardware
>> constraints, resulting from a particular subsystem architecture.
>
> If you are talking about DMA controllers which can only access a certain
> memory area, then yes, that's a hardware constraint, I'm not sure though
> if describing this as CMA in the devicetree is the way to go.

My context was a multiprocessor SoC, where one of the processors is somehow
application specific (e.g. camera ISP) and can be considered as a slave
subsystem, running it's firmware and sharing system memory with the main
processor.

The slave subsystem can have insane constraints on the memory region where
its firmware is located and which it also uses as its generic purpose RAM.

While the region assigned to such a slave device would also likely include
a memory for its DMA buffers, the main concern here was an allocation of
a working memory for the slave processor.

Perhaps the device tree is not a perfect place for defining exact memory
regions. If we happen to decide against it, then I guess some set of
properties would be needed, that would allow CMA to assign appropriate
memory region(s) to a device.

> If you are talking about 'on this board I want to have 128MiB for this
> device because I'm doing 1080p while on another board 64MiB are enough
> because I'm doing 720p', then this is not a hardware constraint.

No, that's not something I was referring to.

> There may be valid scenarios for putting CMA into the devicetrees, but
> doing this also opens the door for abuse of this binding. I for once
> don't want to find areas being allocated for CMA in the devicetree for
> devices I don't care about. I know I can always exchange a devicetree,
> but I think the device tree should be seen as firmware to a certain
> degree.

I agree. You're likely aware of it, I just want to remind that the CMA
memory can be used by the OS in a normal way, until a device driver
actually allocates and uses it.

WARNING: multiple messages have this Message-ID (diff)
From: sylvester.nawrocki@gmail.com (Sylwester Nawrocki)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 0/2] Device Tree support for CMA (Contiguous Memory Allocator)
Date: Mon, 18 Feb 2013 23:25:03 +0100	[thread overview]
Message-ID: <5122AA3F.8030001@gmail.com> (raw)
In-Reply-To: <20130215083304.GK1906@pengutronix.de>

On 02/15/2013 09:33 AM, Sascha Hauer wrote:
> On Thu, Feb 14, 2013 at 11:08:54PM +0100, Sylwester Nawrocki wrote:
>> On 02/14/2013 10:30 PM, Sascha Hauer wrote:
>>> On Thu, Feb 14, 2013 at 01:45:26PM +0100, Marek Szyprowski wrote:
>> ...
>>>> Here is my initial proposal for device tree integration for Contiguous
>>>> Memory Allocator. The code is quite straightforward, however I expect
>>>> that the memory bindings require some discussion.
>>>>
>>>> The proposed bindings allows to define contiguous memory regions of
>>>> specified base address and size. Then, the defined regions can be
>>>> assigned to the given device(s) by adding a property with a phanle to
>>>> the defined contiguous memory region. From the device tree perspective
>>>> that's all. Once the bindings are added, all the memory allocations from
>>>> dma-mapping subsystem will be served from the defined contiguous memory
>>>> regions.
>>>>
>>>
>>> I think CMA regions should not be described in the devicetre at all. The
>>> devicetree is about hardware description and it should be OS agnostic,
>>> but CMA is only a Linux specific implementation detail. It's not even
>>> specific to a particular board, it's specific to a particular usecase of
>>> a board.
>>
>> I disagree. For example, in a multiprocessor system describing the memory
>> regions this way allows to assign memory to each subsystem, e.g. shared
>> memory, so that the memory region constraints are satisfied.
>>
>> CMA just happens to be an implementation of a method of assigning memory
>> to each device in Linux. The constraints on the memory are real hardware
>> constraints, resulting from a particular subsystem architecture.
>
> If you are talking about DMA controllers which can only access a certain
> memory area, then yes, that's a hardware constraint, I'm not sure though
> if describing this as CMA in the devicetree is the way to go.

My context was a multiprocessor SoC, where one of the processors is somehow
application specific (e.g. camera ISP) and can be considered as a slave
subsystem, running it's firmware and sharing system memory with the main
processor.

The slave subsystem can have insane constraints on the memory region where
its firmware is located and which it also uses as its generic purpose RAM.

While the region assigned to such a slave device would also likely include
a memory for its DMA buffers, the main concern here was an allocation of
a working memory for the slave processor.

Perhaps the device tree is not a perfect place for defining exact memory
regions. If we happen to decide against it, then I guess some set of
properties would be needed, that would allow CMA to assign appropriate
memory region(s) to a device.

> If you are talking about 'on this board I want to have 128MiB for this
> device because I'm doing 1080p while on another board 64MiB are enough
> because I'm doing 720p', then this is not a hardware constraint.

No, that's not something I was referring to.

> There may be valid scenarios for putting CMA into the devicetrees, but
> doing this also opens the door for abuse of this binding. I for once
> don't want to find areas being allocated for CMA in the devicetree for
> devices I don't care about. I know I can always exchange a devicetree,
> but I think the device tree should be seen as firmware to a certain
> degree.

I agree. You're likely aware of it, I just want to remind that the CMA
memory can be used by the OS in a normal way, until a device driver
actually allocates and uses it.

  parent reply	other threads:[~2013-02-18 22:25 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-14 12:45 [PATCH 0/2] Device Tree support for CMA (Contiguous Memory Allocator) Marek Szyprowski
2013-02-14 12:45 ` Marek Szyprowski
     [not found] ` <1360845928-8107-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-02-14 12:45   ` [PATCH 1/2] drivers: dma-contiguous: clean source code and prepare for device tree Marek Szyprowski
2013-02-14 12:45     ` Marek Szyprowski
2013-02-14 21:37     ` Laura Abbott
2013-02-14 21:37       ` Laura Abbott
2013-02-14 12:45   ` [PATCH 2/2] drivers: dma-contiguous: add initialization from " Marek Szyprowski
2013-02-14 12:45     ` Marek Szyprowski
2013-02-14 21:34     ` [Linaro-mm-sig] " Laura Abbott
2013-02-14 21:34       ` Laura Abbott
2013-02-15 16:12       ` Nishanth Peethambaran
2013-02-15 16:12         ` Nishanth Peethambaran
     [not found]       ` <511D586A.5060902-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2013-03-15 15:21         ` Marek Szyprowski
2013-03-15 15:21           ` Marek Szyprowski
     [not found]           ` <51433C8B.20607-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-03-19 17:54             ` Laura Abbott
2013-03-19 17:54               ` Laura Abbott
2013-02-14 21:30   ` [PATCH 0/2] Device Tree support for CMA (Contiguous Memory Allocator) Sascha Hauer
2013-02-14 21:30     ` Sascha Hauer
     [not found]     ` <20130214213013.GG1906-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-02-14 22:08       ` Sylwester Nawrocki
2013-02-14 22:08         ` Sylwester Nawrocki
     [not found]         ` <511D6076.9090503-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-02-15  8:33           ` Sascha Hauer
2013-02-15  8:33             ` Sascha Hauer
     [not found]             ` <20130215083304.GK1906-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-02-15 16:24               ` Rob Herring
2013-02-15 16:24                 ` Rob Herring
2013-02-17  5:18                 ` [Linaro-mm-sig] " Nishanth Peethambaran
2013-02-17  5:18                   ` Nishanth Peethambaran
     [not found]                   ` <CAMcxFTQAOjmzy77eB8nj3JDZ-6mwoMpm8yabtQj04tcLw-giLg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-18 21:58                     ` Rob Herring
2013-02-18 21:58                       ` Rob Herring
2013-02-19  9:29                       ` Nishanth Peethambaran
2013-02-19  9:29                         ` Nishanth Peethambaran
2013-02-18 22:25               ` Sylwester Nawrocki [this message]
2013-02-18 22:25                 ` Sylwester Nawrocki
     [not found]                 ` <5122AA3F.8030001-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-02-19  5:03                   ` Olof Johansson
2013-02-19  5:03                     ` Olof Johansson
2013-03-15 15:05     ` Marek Szyprowski
2013-03-15 15:05       ` Marek Szyprowski

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=5122AA3F.8030001@gmail.com \
    --to=sylvester.nawrocki-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=mina86-deATy8a+UHjQT0dZR+AlfA@public.gmane.org \
    --cc=s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.