All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laura Abbott <lauraa@codeaurora.org>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: linaro-mm-sig@lists.linaro.org,
	Kyungmin Park <kyungmin.park@samsung.com>,
	devicetree-discuss@lists.ozlabs.org,
	Michal Nazarewicz <mina86@mina86.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] drivers: dma-contiguous: clean source code and prepare for device tree
Date: Thu, 14 Feb 2013 13:37:45 -0800	[thread overview]
Message-ID: <511D5929.6060004@codeaurora.org> (raw)
In-Reply-To: <1360845928-8107-2-git-send-email-m.szyprowski@samsung.com>

Hi,

On 2/14/2013 4:45 AM, Marek Szyprowski wrote:
> This patch cleans the initialization of dma contiguous framework. The
> all-in-one dma_declare_contiguous() function is now separated into
> dma_contiguous_reserve_area() which only steals the the memory from
> memblock allocator and dma_contiguous_add_device() function, which
> assigns given device to the specified reserved memory area. This improves
> the flexibility in defining contiguous memory areas and assigning device
> to them, because now it is possible to assign more than one device to
> the given contiguous memory area. This split in initialization is also
> required for upcoming device tree support.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>   drivers/base/dma-contiguous.c        |  210 +++++++++++++++++++++-------------
>   include/asm-generic/dma-contiguous.h |    4 +-
>   include/linux/dma-contiguous.h       |   32 +++++-
>   3 files changed, 161 insertions(+), 85 deletions(-)
>
> diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c
> index 0ca5442..085389c 100644
> --- a/drivers/base/dma-contiguous.c
> +++ b/drivers/base/dma-contiguous.c
> @@ -39,7 +39,33 @@ struct cma {
>   	unsigned long	*bitmap;
>   };
>
> -struct cma *dma_contiguous_default_area;
> +static DEFINE_MUTEX(cma_mutex);
> +
> +struct cma *dma_contiguous_def_area;
> +phys_addr_t dma_contiguous_def_base;
> +
> +static struct cma_area {
> +	phys_addr_t base;
> +	unsigned long size;
> +	struct cma *cma;
> +} cma_areas[MAX_CMA_AREAS] __initdata;
> +static unsigned cma_area_count __initdata;
> +

cma_areas and cma_area_count are accessed from cma_get_area which gets 
called from cma_assign_device_from_dt. You need to drop the __initdata 
since the notifier can be called at anytime.

Thanks,
Laura

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

WARNING: multiple messages have this Message-ID (diff)
From: lauraa@codeaurora.org (Laura Abbott)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] drivers: dma-contiguous: clean source code and prepare for device tree
Date: Thu, 14 Feb 2013 13:37:45 -0800	[thread overview]
Message-ID: <511D5929.6060004@codeaurora.org> (raw)
In-Reply-To: <1360845928-8107-2-git-send-email-m.szyprowski@samsung.com>

Hi,

On 2/14/2013 4:45 AM, Marek Szyprowski wrote:
> This patch cleans the initialization of dma contiguous framework. The
> all-in-one dma_declare_contiguous() function is now separated into
> dma_contiguous_reserve_area() which only steals the the memory from
> memblock allocator and dma_contiguous_add_device() function, which
> assigns given device to the specified reserved memory area. This improves
> the flexibility in defining contiguous memory areas and assigning device
> to them, because now it is possible to assign more than one device to
> the given contiguous memory area. This split in initialization is also
> required for upcoming device tree support.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>   drivers/base/dma-contiguous.c        |  210 +++++++++++++++++++++-------------
>   include/asm-generic/dma-contiguous.h |    4 +-
>   include/linux/dma-contiguous.h       |   32 +++++-
>   3 files changed, 161 insertions(+), 85 deletions(-)
>
> diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c
> index 0ca5442..085389c 100644
> --- a/drivers/base/dma-contiguous.c
> +++ b/drivers/base/dma-contiguous.c
> @@ -39,7 +39,33 @@ struct cma {
>   	unsigned long	*bitmap;
>   };
>
> -struct cma *dma_contiguous_default_area;
> +static DEFINE_MUTEX(cma_mutex);
> +
> +struct cma *dma_contiguous_def_area;
> +phys_addr_t dma_contiguous_def_base;
> +
> +static struct cma_area {
> +	phys_addr_t base;
> +	unsigned long size;
> +	struct cma *cma;
> +} cma_areas[MAX_CMA_AREAS] __initdata;
> +static unsigned cma_area_count __initdata;
> +

cma_areas and cma_area_count are accessed from cma_get_area which gets 
called from cma_assign_device_from_dt. You need to drop the __initdata 
since the notifier can be called at anytime.

Thanks,
Laura

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

  reply	other threads:[~2013-02-14 21:37 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 [this message]
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
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=511D5929.6060004@codeaurora.org \
    --to=lauraa@codeaurora.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mina86@mina86.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.