From: m.szyprowski@samsung.com (Marek Szyprowski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] drivers: dma-contiguous: add initialization from device tree
Date: Mon, 07 Jul 2014 12:36:40 +0200 [thread overview]
Message-ID: <53BA7838.7000706@samsung.com> (raw)
In-Reply-To: <00b501cf974c$2db1a800$8914f800$@lge.com>
Hello,
On 2014-07-04 07:52, Joonsoo Kim wrote:
>> -----Original Message-----
>> From: Marek Szyprowski [mailto:m.szyprowski at samsung.com]
>> Sent: Wednesday, July 02, 2014 7:49 PM
>>
>> Subject: [PATCH 4/4] drivers: dma-contiguous: add initialization from
>> device tree
>>
>> Add a code to create CMA region from reserved memory and add support for
>> handling 'shared-dma-pool' reserved-memory device tree nodes.
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> ---
>> drivers/base/dma-contiguous.c | 67
>> +++++++++++++++++++++++++++++++++++++++++
>> include/linux/cma.h | 3 ++
>> mm/cma.c | 69
> ++++++++++++++++++++++++++++++++-----------
>> 3 files changed, 122 insertions(+), 17 deletions(-)
>>
...
>> +/**
>> * cma_declare_contiguous() - reserve custom contiguous area
>> * @base: Base address of the reserved area optional, use 0 for any
>> * @size: Size of the reserved area (in bytes),
>> @@ -162,18 +210,12 @@ int __init cma_declare_contiguous(phys_addr_t base,
>> phys_addr_t alignment, unsigned int order_per_bit,
>> bool fixed, struct cma **res_cma)
>> {
>> - struct cma *cma;
>> - int ret = 0;
>> + int ret;
>>
>> pr_debug("%s(size %lx, base %08lx, limit %08lx alignment %08lx)\n",
>> __func__, (unsigned long)size, (unsigned long)base,
>> (unsigned long)limit, (unsigned long)alignment);
>>
>> - if (cma_area_count == ARRAY_SIZE(cma_areas)) {
>> - pr_err("Not enough slots for CMA reserved regions!\n");
>> - return -ENOSPC;
>> - }
>> -
> Hello, Marek.
>
> After this change, if we have not enough cma_areas, memory will leak.
> I think that we need separate function to check constraint and this
> function should be called before reserving memory in
> cma_declare_contiguous().
Well, I will leave this check to avoid memory leak then.
> BTW, this mail doesn't appear in LKML. What happens? :)
I have no idea, I will send second version then.
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
WARNING: multiple messages have this Message-ID (diff)
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Joonsoo Kim <iamjoonsoo.kim@lge.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linaro-mm-sig@lists.linaro.org, devicetree@vger.kernel.org,
linux-doc@vger.kernel.org
Cc: 'Benjamin Herrenschmidt' <benh@kernel.crashing.org>,
'Arnd Bergmann' <arnd@arndb.de>,
'Michal Nazarewicz' <mina86@mina86.com>,
'Grant Likely' <grant.likely@linaro.org>,
'Tomasz Figa' <t.figa@samsung.com>,
'Sascha Hauer' <s.hauer@pengutronix.de>,
'Laura Abbott' <lauraa@codeaurora.org>,
'Rob Herring' <robh+dt@kernel.org>,
'Olof Johansson' <olof@lixom.net>,
'Pawel Moll' <pawel.moll@arm.com>,
'Mark Rutland' <mark.rutland@arm.com>,
'Stephen Warren' <swarren@wwwdotorg.org>,
'Ian Campbell' <ian.campbell@citrix.com>,
'Tomasz Figa' <tomasz.figa@gmail.com>,
'Kumar Gala' <galak@codeaurora.org>,
'Nishanth Peethambaran' <nishanth.p@gmail.com>,
'Marc' <marc.ceeeee@gmail.com>,
'Josh Cartwright' <joshc@codeaurora.org>,
'Catalin Marinas' <catalin.marinas@arm.com>,
'Will Deacon' <will.deacon@arm.com>,
'Paul Mackerras' <paulus@samba.org>,
'Jon Medhurst' <tixy@linaro.org>,
'Aneesh
Subject: Re: [PATCH 4/4] drivers: dma-contiguous: add initialization from device tree
Date: Mon, 07 Jul 2014 12:36:40 +0200 [thread overview]
Message-ID: <53BA7838.7000706@samsung.com> (raw)
In-Reply-To: <00b501cf974c$2db1a800$8914f800$@lge.com>
Hello,
On 2014-07-04 07:52, Joonsoo Kim wrote:
>> -----Original Message-----
>> From: Marek Szyprowski [mailto:m.szyprowski@samsung.com]
>> Sent: Wednesday, July 02, 2014 7:49 PM
>>
>> Subject: [PATCH 4/4] drivers: dma-contiguous: add initialization from
>> device tree
>>
>> Add a code to create CMA region from reserved memory and add support for
>> handling 'shared-dma-pool' reserved-memory device tree nodes.
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> ---
>> drivers/base/dma-contiguous.c | 67
>> +++++++++++++++++++++++++++++++++++++++++
>> include/linux/cma.h | 3 ++
>> mm/cma.c | 69
> ++++++++++++++++++++++++++++++++-----------
>> 3 files changed, 122 insertions(+), 17 deletions(-)
>>
...
>> +/**
>> * cma_declare_contiguous() - reserve custom contiguous area
>> * @base: Base address of the reserved area optional, use 0 for any
>> * @size: Size of the reserved area (in bytes),
>> @@ -162,18 +210,12 @@ int __init cma_declare_contiguous(phys_addr_t base,
>> phys_addr_t alignment, unsigned int order_per_bit,
>> bool fixed, struct cma **res_cma)
>> {
>> - struct cma *cma;
>> - int ret = 0;
>> + int ret;
>>
>> pr_debug("%s(size %lx, base %08lx, limit %08lx alignment %08lx)\n",
>> __func__, (unsigned long)size, (unsigned long)base,
>> (unsigned long)limit, (unsigned long)alignment);
>>
>> - if (cma_area_count == ARRAY_SIZE(cma_areas)) {
>> - pr_err("Not enough slots for CMA reserved regions!\n");
>> - return -ENOSPC;
>> - }
>> -
> Hello, Marek.
>
> After this change, if we have not enough cma_areas, memory will leak.
> I think that we need separate function to check constraint and this
> function should be called before reserving memory in
> cma_declare_contiguous().
Well, I will leave this check to avoid memory leak then.
> BTW, this mail doesn't appear in LKML. What happens? :)
I have no idea, I will send second version then.
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
WARNING: multiple messages have this Message-ID (diff)
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Joonsoo Kim <iamjoonsoo.kim@lge.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linaro-mm-sig@lists.linaro.org, devicetree@vger.kernel.org,
linux-doc@vger.kernel.org
Cc: "'Benjamin Herrenschmidt'" <benh@kernel.crashing.org>,
"'Arnd Bergmann'" <arnd@arndb.de>,
"'Michal Nazarewicz'" <mina86@mina86.com>,
"'Grant Likely'" <grant.likely@linaro.org>,
"'Tomasz Figa'" <t.figa@samsung.com>,
"'Sascha Hauer'" <s.hauer@pengutronix.de>,
"'Laura Abbott'" <lauraa@codeaurora.org>,
"'Rob Herring'" <robh+dt@kernel.org>,
"'Olof Johansson'" <olof@lixom.net>,
"'Pawel Moll'" <pawel.moll@arm.com>,
"'Mark Rutland'" <mark.rutland@arm.com>,
"'Stephen Warren'" <swarren@wwwdotorg.org>,
"'Ian Campbell'" <ian.campbell@citrix.com>,
"'Tomasz Figa'" <tomasz.figa@gmail.com>,
"'Kumar Gala'" <galak@codeaurora.org>,
"'Nishanth Peethambaran'" <nishanth.p@gmail.com>,
"'Marc'" <marc.ceeeee@gmail.com>,
"'Josh Cartwright'" <joshc@codeaurora.org>,
"'Catalin Marinas'" <catalin.marinas@arm.com>,
"'Will Deacon'" <will.deacon@arm.com>,
"'Paul Mackerras'" <paulus@samba.org>,
"'Jon Medhurst'" <tixy@linaro.org>,
"'Aneesh Kumar K.V.'" <aneesh.kumar@linux.vnet.ibm.com>,
"'Andrew Morton'" <akpm@linux-foundation.org>
Subject: Re: [PATCH 4/4] drivers: dma-contiguous: add initialization from device tree
Date: Mon, 07 Jul 2014 12:36:40 +0200 [thread overview]
Message-ID: <53BA7838.7000706@samsung.com> (raw)
In-Reply-To: <00b501cf974c$2db1a800$8914f800$@lge.com>
Hello,
On 2014-07-04 07:52, Joonsoo Kim wrote:
>> -----Original Message-----
>> From: Marek Szyprowski [mailto:m.szyprowski@samsung.com]
>> Sent: Wednesday, July 02, 2014 7:49 PM
>>
>> Subject: [PATCH 4/4] drivers: dma-contiguous: add initialization from
>> device tree
>>
>> Add a code to create CMA region from reserved memory and add support for
>> handling 'shared-dma-pool' reserved-memory device tree nodes.
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> ---
>> drivers/base/dma-contiguous.c | 67
>> +++++++++++++++++++++++++++++++++++++++++
>> include/linux/cma.h | 3 ++
>> mm/cma.c | 69
> ++++++++++++++++++++++++++++++++-----------
>> 3 files changed, 122 insertions(+), 17 deletions(-)
>>
...
>> +/**
>> * cma_declare_contiguous() - reserve custom contiguous area
>> * @base: Base address of the reserved area optional, use 0 for any
>> * @size: Size of the reserved area (in bytes),
>> @@ -162,18 +210,12 @@ int __init cma_declare_contiguous(phys_addr_t base,
>> phys_addr_t alignment, unsigned int order_per_bit,
>> bool fixed, struct cma **res_cma)
>> {
>> - struct cma *cma;
>> - int ret = 0;
>> + int ret;
>>
>> pr_debug("%s(size %lx, base %08lx, limit %08lx alignment %08lx)\n",
>> __func__, (unsigned long)size, (unsigned long)base,
>> (unsigned long)limit, (unsigned long)alignment);
>>
>> - if (cma_area_count == ARRAY_SIZE(cma_areas)) {
>> - pr_err("Not enough slots for CMA reserved regions!\n");
>> - return -ENOSPC;
>> - }
>> -
> Hello, Marek.
>
> After this change, if we have not enough cma_areas, memory will leak.
> I think that we need separate function to check constraint and this
> function should be called before reserving memory in
> cma_declare_contiguous().
Well, I will leave this check to avoid memory leak then.
> BTW, this mail doesn't appear in LKML. What happens? :)
I have no idea, I will send second version then.
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
next prev parent reply other threads:[~2014-07-07 10:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-02 10:48 [PATCH 0/4] CMA & device tree, once again Marek Szyprowski
2014-07-02 10:48 ` Marek Szyprowski
2014-07-02 10:48 ` [PATCH 1/4] drivers: of: add automated assignment of reserved regions to client devices Marek Szyprowski
2014-07-02 10:48 ` Marek Szyprowski
2014-07-02 10:48 ` [PATCH 2/4] drivers: of: initialize and assign reserved memory to newly created devices Marek Szyprowski
2014-07-02 10:48 ` Marek Szyprowski
2014-07-02 10:48 ` [PATCH 3/4] drivers: dma-coherent: add initialization from device tree Marek Szyprowski
2014-07-02 10:48 ` Marek Szyprowski
2014-07-02 10:48 ` [PATCH 4/4] drivers: dma-contiguous: " Marek Szyprowski
2014-07-02 10:48 ` Marek Szyprowski
2014-07-04 5:52 ` Joonsoo Kim
2014-07-04 5:52 ` Joonsoo Kim
2014-07-07 10:36 ` Marek Szyprowski [this message]
2014-07-07 10:36 ` Marek Szyprowski
2014-07-07 10:36 ` 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=53BA7838.7000706@samsung.com \
--to=m.szyprowski@samsung.com \
--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 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.