public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: swarren@wwwdotorg•org (Stephen Warren)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH v5 2/3] drivers: of: add initialization code for dma reserved memory
Date: Tue, 13 Aug 2013 14:08:44 -0600	[thread overview]
Message-ID: <520A924C.6070309@wwwdotorg.org> (raw)
In-Reply-To: <1376049119-12655-3-git-send-email-m.szyprowski@samsung.com>

On 08/09/2013 05:51 AM, Marek Szyprowski wrote:
> Add device tree support for contiguous and reserved memory regions
> defined in device tree. Initialization is done in 2 steps. First, the
> memory is reserved, what happens very early when only flattened device
> tree is available. Then on device initialization the corresponding cma
> and reserved regions are assigned to each device structure.

Hmmm. This seems an awful lot like putting SW configuration/policy
information into DT rather than HW description. This feels like a
slippery slope... Isn't this kind of thing better handled by a kernel
command-line option to set up the CMA size?

> diff --git a/Documentation/devicetree/bindings/memory.txt b/Documentation/devicetree/bindings/memory.txt

> +*** Memory binding ***
> +
> +The /memory node provides basic information about the address and size
> +of the physical memory. This node is usually filled or updated by the
> +bootloader, depending on the actual memory configuration of the given
> +hardware.
> +
> +The memory layout is described by the folllowing node:
> +
> +memory {
> +	device_type = "memory";
> +	reg =  <(baseaddr1) (size1)
> +		(baseaddr2) (size2)
> +		...
> +		(baseaddrN) (sizeN)>;
> +};
> +
> +baseaddrX:	the base address of the defined memory bank
> +sizeX:		the size of the defined memory bank

You probably want to mention that baseaddrX is #address-cells long and
sizeX is #size-cells long. Same for the reserved regions below.

> +*** Reserved memory regions ***
...
> +Parameters for each memory region can be encoded into the device tree
> +wit the following convention:
> +
> +[(label):] (name)@(address) {

That line is DT syntax nothing to do with this binding. I would re-write
this in the more typical DT binding style where the documentation only
specifies the content of the node, not the node itself.

In particular, there's no requirement for a node name to include the
unit address (@address) if it's already unique.

> +	compatible = "contiguous-memory-region", "reserved-memory-region";
> +	reg = <(address) (size)>;
> +	(linux,default-contiguous-region);

(...) isn't a syntax typically used in DT bindings. You'd usually put
that in a a list of "Optional Properties:".

> +Each defined region must use unique name.

Well, DT nodes are supposed to be names based on the type of object they
represent, not by the name/identity of the object they represent.

> +*** Device node's properties ***
> +
> +Once the regions in the /memory/reserved-memory node are defined, they
> +can be assigned to device nodes to enable drivers for their special use.
> +The following properties are defined:
> +
> +memory-region = <&phandle_to_defined_region>;
> +
> +This property indicates that the device driver should use the
> +memory region pointed by the given phandle.

That's quite scary. This is essentially forcing a memory-region property
into every single binding that ever exists. I guess that's not too much
worse than e.g. interrupts/clocks/..., but I think it's worth somehow
requiring bindings to "opt-in" to allowing this property to be part of
their binding rather than just definining the property globally.

  parent reply	other threads:[~2013-08-13 20:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09 11:51 [PATCH v5 0/3] Device Tree support for CMA (Contiguous Memory Allocator) Marek Szyprowski
2013-08-09 11:51 ` [PATCH v5 1/3] drivers: dma-contiguous: clean source code and prepare for device tree Marek Szyprowski
2013-08-09 11:51 ` [PATCH v5 2/3] drivers: of: add initialization code for dma reserved memory Marek Szyprowski
2013-08-10 17:33   ` Rob Herring
2013-08-12  8:34     ` Marek Szyprowski
2013-08-13 13:00       ` Rob Herring
2013-08-19 14:47         ` Marek Szyprowski
2013-08-19 19:36           ` Rob Herring
2013-08-13 20:08   ` Stephen Warren [this message]
2013-08-16  5:25     ` Olof Johansson
2013-08-16 16:06       ` Stephen Warren
2013-08-16  5:32   ` Olof Johansson
2013-08-09 11:51 ` [PATCH v5 3/3] ARM: init: add support for reserved memory defined by device tree Marek Szyprowski
2013-08-09 13:19 ` [PATCH v5 0/3] Device Tree support for CMA (Contiguous Memory Allocator) Tomasz Figa

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=520A924C.6070309@wwwdotorg.org \
    --to=swarren@wwwdotorg$(echo .)org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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