From: lauraa@codeaurora.org (Laura Abbott)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC][PATCH] arm64: Add atomic pool for dma mapping
Date: Tue, 22 Apr 2014 15:50:07 -0700 [thread overview]
Message-ID: <5356F21F.1060001@codeaurora.org> (raw)
In-Reply-To: <20140422100201.GB7484@arm.com>
On 4/22/2014 3:02 AM, Will Deacon wrote:
> Hi Laura,
>
> On Thu, Apr 17, 2014 at 09:02:21PM +0100, Laura Abbott wrote:
>> Neither CMA nor noncoherent allocations support atomic allocations.
>> Add a dedicated atomic pool to support this.
>>
>> Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
>> ---
>> arch/arm64/mm/dma-mapping.c | 186 +++++++++++++++++++++++++++++++++++++++++++-
>> 1 file changed, 184 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
>> index 0ba347e..c67a3ff 100644
>> --- a/arch/arm64/mm/dma-mapping.c
>> +++ b/arch/arm64/mm/dma-mapping.c
>> @@ -38,6 +38,110 @@ static pgprot_t __get_dma_pgprot(struct dma_attrs *attrs, pgprot_t prot,
>> return prot;
>> }
>>
>> +#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_256K
>> +
>> +struct dma_pool {
>> + size_t size;
>> + spinlock_t lock;
>> + void *coherent_vaddr;
>> + void *noncoherent_vaddr;
>> + unsigned long *bitmap;
>> + unsigned long nr_pages;
>> + struct page **pages;
>> +};
>> +
>> +static struct dma_pool atomic_pool = {
>> + .size = DEFAULT_DMA_COHERENT_POOL_SIZE,
>> +};
>> +
>> +static int __init early_coherent_pool(char *p)
>> +{
>> + atomic_pool.size = memparse(p, &p);
>> + return 0;
>> +}
>> +early_param("coherent_pool", early_coherent_pool);
>
> What happened to the device-tree bindings we discussed in Edinburgh with
> Grant and Ben? This looks like a good opportunity to make use of those,
> rather than use the command-line as we do for arch/arm.
>
The current point of the coherent command line option is to override the
default size. Going with DT would mean that if the node is specified in
DT, the memory is allocated via that framework. If there is no node, then
fallback to allocating the memory as normal. This asymmetry seems a bit
odd to me.
> Will
>
Thanks,
Laura
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
next prev parent reply other threads:[~2014-04-22 22:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-17 20:02 [RFC][PATCH] arm64: Add atomic pool for dma mapping Laura Abbott
2014-04-22 10:02 ` Will Deacon
2014-04-22 22:50 ` Laura Abbott [this message]
2014-05-30 2:38 ` David Riley
2014-05-31 21:42 ` Laura Abbott
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=5356F21F.1060001@codeaurora.org \
--to=lauraa@codeaurora.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).