All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Peethambaran <nishanth.p@gmail.com>
To: Laura Abbott <lauraa@codeaurora.org>
Cc: linaro-mm-sig@lists.linaro.org, Arnd Bergmann <arnd@arndb.de>,
	Tomasz Figa <t.figa@samsung.com>,
	Michal Nazarewicz <mina86@mina86.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	devicetree-discuss@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org,
	Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: [Linaro-mm-sig] [PATCH 2/2] drivers: dma-contiguous: add initialization from device tree
Date: Fri, 15 Feb 2013 21:42:12 +0530	[thread overview]
Message-ID: <CAMcxFTRq4-npcFw9UqfWa98hZaVocj43Tnzkh7aagqB6KW-uOA@mail.gmail.com> (raw)
In-Reply-To: <511D586A.5060902@codeaurora.org>

On Fri, Feb 15, 2013 at 3:04 AM, Laura Abbott <lauraa@codeaurora.org> wrote:
> Hi,
>
>
> On 2/14/2013 4:45 AM, Marek Szyprowski wrote:
> <snip>
>
>> +name:          an name given to the defined region.
>> +base-address:  the base address of the defined region.
>> +size:          the size of the memory region.
>> +linux,contiguous-region: property indicating that the defined memory
>> +               region is used for contiguous memory allocations,
>> +               Linux specific (optional)
>> +linux,default-contiguous-region: property indicating that the region
>> +               is the default region for all contiguous memory
>> +               allocations, Linux specific (optional)
>> +
>> +
>
>
> I don't see any code actually implementing the default-contiguous-region
> binding. Currently on ARM systems we will still setup the default region
> based on the Kconfig. Is this intentional?
>
>
>
>> diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c
>> index 085389c..5761f73 100644
>> --- a/drivers/base/dma-contiguous.c
>> +++ b/drivers/base/dma-contiguous.c
>> @@ -24,6 +24,9 @@
>>
>>   #include <linux/memblock.h>
>>   #include <linux/err.h>
>> +#include <linux/of.h>
>> +#include <linux/of_fdt.h>
>> +#include <linux/of_platform.h>
>>   #include <linux/mm.h>
>>   #include <linux/mutex.h>
>>   #include <linux/page-isolation.h>
>> @@ -177,6 +180,35 @@ no_mem:
>>         return ERR_PTR(ret);
>>   }
>>
>>
>> +/*****************************************************************************/
>> +
>> +#ifdef CONFIG_OF
>> +int __init cma_fdt_scan(unsigned long node, const char *uname,
>> +                               int depth, void *data)
>> +{
>> +       phys_addr_t base, size;
>> +       unsigned long len;
>> +       __be32 *prop;
>> +
>> +       if (strncmp(uname, "region@", 7) != 0 || depth != 2 ||
>> +           !of_get_flat_dt_prop(node, "contiguous-region", NULL))
>
>
> The documentation says "linux,contiguous-region"
>
>
>
>> +#ifdef CONFIG_OF
>> +static void cma_assign_device_from_dt(struct device *dev)
>> +{
>> +       struct device_node *node;
>> +       struct cma *cma;
>> +       u32 value;
>> +
>> +       node = of_parse_phandle(dev->of_node, "linux,contiguous-region",
>> 0);
>> +       if (!node)
>> +               return;
>> +       if (of_property_read_u32(node, "reg", &value) && !value)
>> +               return;
>> +       cma = cma_get_area(value);
>> +       if (!cma)
>> +               return;
>> +
>> +       dev_set_cma_area(dev, cma);
>> +       pr_info("Assigned CMA region at %lx to %s device\n", (unsigned
>> long)value, dev_name(dev));
>> +}
>> +
>
>
> This scheme of associating devices with CMA regions by base does not work if
> you want to let CMA figure out where to place the region (base = 0). Can we
> use the name to associate the device with the region? I had been working on
> something similar internally and that was the only solution I had come up
> with to associate arbitrary CMA nodes with devices.
>

The phandle for the region can also be used as a unique identifier.
cma_fdt_scan() can get the property(own phandle) and pass as an extra
parameter to dma_contiguous_reserve_area().
This could be stored as part of cma_area (extra field).
The devices get the cma area by passing the phandle to cma_get_area()
which should be matching criteria.

For non-DT cases, board file will have to assign a unique id while calling the
dma_declare_contiguous()

> Thanks,
> Laura
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> hosted by The Linux Foundation
>
>
> _______________________________________________
> Linaro-mm-sig mailing list
> Linaro-mm-sig@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/linaro-mm-sig



- Nishanth Peethambaran
  +91-9448074166

WARNING: multiple messages have this Message-ID (diff)
From: nishanth.p@gmail.com (Nishanth Peethambaran)
To: linux-arm-kernel@lists.infradead.org
Subject: [Linaro-mm-sig] [PATCH 2/2] drivers: dma-contiguous: add initialization from device tree
Date: Fri, 15 Feb 2013 21:42:12 +0530	[thread overview]
Message-ID: <CAMcxFTRq4-npcFw9UqfWa98hZaVocj43Tnzkh7aagqB6KW-uOA@mail.gmail.com> (raw)
In-Reply-To: <511D586A.5060902@codeaurora.org>

On Fri, Feb 15, 2013 at 3:04 AM, Laura Abbott <lauraa@codeaurora.org> wrote:
> Hi,
>
>
> On 2/14/2013 4:45 AM, Marek Szyprowski wrote:
> <snip>
>
>> +name:          an name given to the defined region.
>> +base-address:  the base address of the defined region.
>> +size:          the size of the memory region.
>> +linux,contiguous-region: property indicating that the defined memory
>> +               region is used for contiguous memory allocations,
>> +               Linux specific (optional)
>> +linux,default-contiguous-region: property indicating that the region
>> +               is the default region for all contiguous memory
>> +               allocations, Linux specific (optional)
>> +
>> +
>
>
> I don't see any code actually implementing the default-contiguous-region
> binding. Currently on ARM systems we will still setup the default region
> based on the Kconfig. Is this intentional?
>
>
>
>> diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c
>> index 085389c..5761f73 100644
>> --- a/drivers/base/dma-contiguous.c
>> +++ b/drivers/base/dma-contiguous.c
>> @@ -24,6 +24,9 @@
>>
>>   #include <linux/memblock.h>
>>   #include <linux/err.h>
>> +#include <linux/of.h>
>> +#include <linux/of_fdt.h>
>> +#include <linux/of_platform.h>
>>   #include <linux/mm.h>
>>   #include <linux/mutex.h>
>>   #include <linux/page-isolation.h>
>> @@ -177,6 +180,35 @@ no_mem:
>>         return ERR_PTR(ret);
>>   }
>>
>>
>> +/*****************************************************************************/
>> +
>> +#ifdef CONFIG_OF
>> +int __init cma_fdt_scan(unsigned long node, const char *uname,
>> +                               int depth, void *data)
>> +{
>> +       phys_addr_t base, size;
>> +       unsigned long len;
>> +       __be32 *prop;
>> +
>> +       if (strncmp(uname, "region@", 7) != 0 || depth != 2 ||
>> +           !of_get_flat_dt_prop(node, "contiguous-region", NULL))
>
>
> The documentation says "linux,contiguous-region"
>
>
>
>> +#ifdef CONFIG_OF
>> +static void cma_assign_device_from_dt(struct device *dev)
>> +{
>> +       struct device_node *node;
>> +       struct cma *cma;
>> +       u32 value;
>> +
>> +       node = of_parse_phandle(dev->of_node, "linux,contiguous-region",
>> 0);
>> +       if (!node)
>> +               return;
>> +       if (of_property_read_u32(node, "reg", &value) && !value)
>> +               return;
>> +       cma = cma_get_area(value);
>> +       if (!cma)
>> +               return;
>> +
>> +       dev_set_cma_area(dev, cma);
>> +       pr_info("Assigned CMA region at %lx to %s device\n", (unsigned
>> long)value, dev_name(dev));
>> +}
>> +
>
>
> This scheme of associating devices with CMA regions by base does not work if
> you want to let CMA figure out where to place the region (base = 0). Can we
> use the name to associate the device with the region? I had been working on
> something similar internally and that was the only solution I had come up
> with to associate arbitrary CMA nodes with devices.
>

The phandle for the region can also be used as a unique identifier.
cma_fdt_scan() can get the property(own phandle) and pass as an extra
parameter to dma_contiguous_reserve_area().
This could be stored as part of cma_area (extra field).
The devices get the cma area by passing the phandle to cma_get_area()
which should be matching criteria.

For non-DT cases, board file will have to assign a unique id while calling the
dma_declare_contiguous()

> Thanks,
> Laura
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> hosted by The Linux Foundation
>
>
> _______________________________________________
> Linaro-mm-sig mailing list
> Linaro-mm-sig at lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/linaro-mm-sig



- Nishanth Peethambaran
  +91-9448074166

  reply	other threads:[~2013-02-15 16:12 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 [this message]
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
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=CAMcxFTRq4-npcFw9UqfWa98hZaVocj43Tnzkh7aagqB6KW-uOA@mail.gmail.com \
    --to=nishanth.p@gmail.com \
    --cc=arnd@arndb.de \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --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=mina86@mina86.com \
    --cc=t.figa@samsung.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 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.