From: lauraa@codeaurora.org (Laura Abbott)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] of: Set the DMA mask to 64 bits on ARM LPAE systems
Date: Thu, 25 Apr 2013 10:09:57 -0700 [thread overview]
Message-ID: <51796365.5030405@codeaurora.org> (raw)
In-Reply-To: <20130425133315.GA7157@localhost.cambridge.arm.com>
On 4/25/2013 6:33 AM, Catalin Marinas wrote:
> On Wed, Apr 24, 2013 at 01:50:49AM +0100, Laura Abbott wrote:
>> By default on ARM systems, the coherent DMA mask (lowest
>> address) is set to ~0 or 0xFFFFFFFFFFFFFFFF. Currently,
>> of_platform_device_create_pdata sets the coherent DMA mask to
>> 32 bits. This prevents coherent dma allocations from working by default
>> without clients setting the DMA mask. Rather than make every client
>> on an LPAE system set the mask, set the mask to a 64 bit value on
>> ARM LPAE systems.
>>
>> Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
>> ---
>> drivers/of/platform.c | 4 ++++
>> 1 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
>> index 0970505..18b69c1 100644
>> --- a/drivers/of/platform.c
>> +++ b/drivers/of/platform.c
>> @@ -214,7 +214,11 @@ struct platform_device *of_platform_device_create_pdata(
>> #if defined(CONFIG_MICROBLAZE)
>> dev->archdata.dma_mask = 0xffffffffUL;
>> #endif
>> +#ifdef CONFIG_ARM_LPAE
>> + dev->dev.coherent_dma_mask = DMA_BIT_MASK(64);
>> +#else
>> dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
>> +#endif
>
> I wouldn't add CONFIG_ARM_LPAE checks in here, you can use
> CONFIG_ARCH_DMA_ADDR_T_64BIT (types.h uses this for the dma_addr_t
> definition).
>
I thought about this as well but in arch/arm/mm/mm.h:
#ifdef CONFIG_ZONE_DMA
extern phys_addr_t arm_dma_limit;
#else
#define arm_dma_limit ((phys_addr_t)~0)
#endif
arm_dma_limit is explicitly cast to phys_addr_t, which means that
arm_dma_limit will be always be sizeof(phys_addr_t) regardless of
sizeof(dma_addr_t). Is it safe to assume that
CONFIG_ARCH_DMA_ADDR_T_64BIT will always be selected if
sizeof(phys_addr_t) == 8? If not, we've defeated the point of the patch.
Alternatively, should the type of arm_dma_limit be dma_addr_t instead of
phys_addr_t?
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: Laura Abbott <lauraa@codeaurora.org>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: "devicetree-discuss@lists.ozlabs.org"
<devicetree-discuss@lists.ozlabs.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] of: Set the DMA mask to 64 bits on ARM LPAE systems
Date: Thu, 25 Apr 2013 10:09:57 -0700 [thread overview]
Message-ID: <51796365.5030405@codeaurora.org> (raw)
In-Reply-To: <20130425133315.GA7157@localhost.cambridge.arm.com>
On 4/25/2013 6:33 AM, Catalin Marinas wrote:
> On Wed, Apr 24, 2013 at 01:50:49AM +0100, Laura Abbott wrote:
>> By default on ARM systems, the coherent DMA mask (lowest
>> address) is set to ~0 or 0xFFFFFFFFFFFFFFFF. Currently,
>> of_platform_device_create_pdata sets the coherent DMA mask to
>> 32 bits. This prevents coherent dma allocations from working by default
>> without clients setting the DMA mask. Rather than make every client
>> on an LPAE system set the mask, set the mask to a 64 bit value on
>> ARM LPAE systems.
>>
>> Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
>> ---
>> drivers/of/platform.c | 4 ++++
>> 1 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
>> index 0970505..18b69c1 100644
>> --- a/drivers/of/platform.c
>> +++ b/drivers/of/platform.c
>> @@ -214,7 +214,11 @@ struct platform_device *of_platform_device_create_pdata(
>> #if defined(CONFIG_MICROBLAZE)
>> dev->archdata.dma_mask = 0xffffffffUL;
>> #endif
>> +#ifdef CONFIG_ARM_LPAE
>> + dev->dev.coherent_dma_mask = DMA_BIT_MASK(64);
>> +#else
>> dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
>> +#endif
>
> I wouldn't add CONFIG_ARM_LPAE checks in here, you can use
> CONFIG_ARCH_DMA_ADDR_T_64BIT (types.h uses this for the dma_addr_t
> definition).
>
I thought about this as well but in arch/arm/mm/mm.h:
#ifdef CONFIG_ZONE_DMA
extern phys_addr_t arm_dma_limit;
#else
#define arm_dma_limit ((phys_addr_t)~0)
#endif
arm_dma_limit is explicitly cast to phys_addr_t, which means that
arm_dma_limit will be always be sizeof(phys_addr_t) regardless of
sizeof(dma_addr_t). Is it safe to assume that
CONFIG_ARCH_DMA_ADDR_T_64BIT will always be selected if
sizeof(phys_addr_t) == 8? If not, we've defeated the point of the patch.
Alternatively, should the type of arm_dma_limit be dma_addr_t instead of
phys_addr_t?
Thanks,
Laura
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
next prev parent reply other threads:[~2013-04-25 17:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-24 0:50 [PATCH] of: Set the DMA mask to 64 bits on ARM LPAE systems Laura Abbott
2013-04-24 0:50 ` Laura Abbott
2013-04-25 13:33 ` Catalin Marinas
2013-04-25 13:33 ` Catalin Marinas
2013-04-25 17:09 ` Laura Abbott [this message]
2013-04-25 17:09 ` Laura Abbott
2013-04-25 17:58 ` Russell King - ARM Linux
2013-04-25 17:58 ` Russell King - ARM Linux
2013-04-26 10:00 ` Catalin Marinas
2013-04-26 10:00 ` Catalin Marinas
2013-04-26 16:58 ` Laura Abbott
2013-04-26 16:58 ` 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=51796365.5030405@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 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.