linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nommu: allow mmap when !CONFIG_MMU
@ 2016-12-01 13:48 Benjamin Gaignard
  2016-12-09 15:27 ` Benjamin Gaignard
  2016-12-09 20:02 ` Russell King - ARM Linux
  0 siblings, 2 replies; 5+ messages in thread
From: Benjamin Gaignard @ 2016-12-01 13:48 UTC (permalink / raw)
  To: linux-arm-kernel

commit ab6494f0c96f ("nommu: Add noMMU support to the DMA API") have
add CONFIG_MMU compilation flag but that prohibit to use dma_mmap_wc()
when the platform doesn't have MMU.

This patch call vm_iomap_memory() in noMMU case to test if addresses
are correct and set wma->vm_flags rather than all return an error.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: arnd at arndb.de
---
 arch/arm/mm/dma-mapping.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index ab4f745..230875e 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -868,6 +868,9 @@ static int __arm_dma_mmap(struct device *dev, struct vm_area_struct *vma,
 				      vma->vm_end - vma->vm_start,
 				      vma->vm_page_prot);
 	}
+#else
+	ret = vm_iomap_memory(vma, vma->vm_start,
+			      (vma->vm_end - vma->vm_start));
 #endif	/* CONFIG_MMU */
 
 	return ret;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] nommu: allow mmap when !CONFIG_MMU
  2016-12-01 13:48 [PATCH] nommu: allow mmap when !CONFIG_MMU Benjamin Gaignard
@ 2016-12-09 15:27 ` Benjamin Gaignard
  2016-12-09 15:36   ` Vladimir Murzin
  2016-12-09 20:02 ` Russell King - ARM Linux
  1 sibling, 1 reply; 5+ messages in thread
From: Benjamin Gaignard @ 2016-12-09 15:27 UTC (permalink / raw)
  To: linux-arm-kernel

+ Vladimir

2016-12-01 14:48 GMT+01:00 Benjamin Gaignard <benjamin.gaignard@linaro.org>:
> commit ab6494f0c96f ("nommu: Add noMMU support to the DMA API") have
> add CONFIG_MMU compilation flag but that prohibit to use dma_mmap_wc()
> when the platform doesn't have MMU.
>
> This patch call vm_iomap_memory() in noMMU case to test if addresses
> are correct and set wma->vm_flags rather than all return an error.
>
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: arnd at arndb.de
> ---
>  arch/arm/mm/dma-mapping.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
> index ab4f745..230875e 100644
> --- a/arch/arm/mm/dma-mapping.c
> +++ b/arch/arm/mm/dma-mapping.c
> @@ -868,6 +868,9 @@ static int __arm_dma_mmap(struct device *dev, struct vm_area_struct *vma,
>                                       vma->vm_end - vma->vm_start,
>                                       vma->vm_page_prot);
>         }
> +#else
> +       ret = vm_iomap_memory(vma, vma->vm_start,
> +                             (vma->vm_end - vma->vm_start));
>  #endif /* CONFIG_MMU */
>
>         return ret;
> --
> 1.9.1
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] nommu: allow mmap when !CONFIG_MMU
  2016-12-09 15:27 ` Benjamin Gaignard
@ 2016-12-09 15:36   ` Vladimir Murzin
  2016-12-09 15:47     ` Benjamin Gaignard
  0 siblings, 1 reply; 5+ messages in thread
From: Vladimir Murzin @ 2016-12-09 15:36 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/12/16 15:27, Benjamin Gaignard wrote:
> + Vladimir

I'm not in DMA, but I can see that with your patch it deviates from
dma_common_mmap(), can you give more context, please?

Cheers
Vladimir

> 
> 2016-12-01 14:48 GMT+01:00 Benjamin Gaignard <benjamin.gaignard@linaro.org>:
>> commit ab6494f0c96f ("nommu: Add noMMU support to the DMA API") have
>> add CONFIG_MMU compilation flag but that prohibit to use dma_mmap_wc()
>> when the platform doesn't have MMU.
>>
>> This patch call vm_iomap_memory() in noMMU case to test if addresses
>> are correct and set wma->vm_flags rather than all return an error.
>>
>> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: arnd at arndb.de
>> ---
>>  arch/arm/mm/dma-mapping.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
>> index ab4f745..230875e 100644
>> --- a/arch/arm/mm/dma-mapping.c
>> +++ b/arch/arm/mm/dma-mapping.c
>> @@ -868,6 +868,9 @@ static int __arm_dma_mmap(struct device *dev, struct vm_area_struct *vma,
>>                                       vma->vm_end - vma->vm_start,
>>                                       vma->vm_page_prot);
>>         }
>> +#else
>> +       ret = vm_iomap_memory(vma, vma->vm_start,
>> +                             (vma->vm_end - vma->vm_start));
>>  #endif /* CONFIG_MMU */
>>
>>         return ret;
>> --
>> 1.9.1
>>
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] nommu: allow mmap when !CONFIG_MMU
  2016-12-09 15:36   ` Vladimir Murzin
@ 2016-12-09 15:47     ` Benjamin Gaignard
  0 siblings, 0 replies; 5+ messages in thread
From: Benjamin Gaignard @ 2016-12-09 15:47 UTC (permalink / raw)
  To: linux-arm-kernel

2016-12-09 16:36 GMT+01:00 Vladimir Murzin <vladimir.murzin@arm.com>:
> On 09/12/16 15:27, Benjamin Gaignard wrote:
>> + Vladimir
>
> I'm not in DMA, but I can see that with your patch it deviates from
> dma_common_mmap(), can you give more context, please?

I'm working on ARM platform with MMU (stm32f4) to enable display driver.
Framebuffer is allocated with dma_alloc_wc() and when userland try to mmap
drm/kms fraemwork calls dma_mmap_wc().
All this is in drivers/gpu/drm/drm_gem_cma_helper.c

dma_mmap_wc() call failed because __arm_dma_mmap() always return an
error if CONFIG_MMU
isn't defined.
That what I try to solve with this patch.

> Cheers
> Vladimir
>
>>
>> 2016-12-01 14:48 GMT+01:00 Benjamin Gaignard <benjamin.gaignard@linaro.org>:
>>> commit ab6494f0c96f ("nommu: Add noMMU support to the DMA API") have
>>> add CONFIG_MMU compilation flag but that prohibit to use dma_mmap_wc()
>>> when the platform doesn't have MMU.
>>>
>>> This patch call vm_iomap_memory() in noMMU case to test if addresses
>>> are correct and set wma->vm_flags rather than all return an error.
>>>
>>> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
>>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>>> Cc: arnd at arndb.de
>>> ---
>>>  arch/arm/mm/dma-mapping.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
>>> index ab4f745..230875e 100644
>>> --- a/arch/arm/mm/dma-mapping.c
>>> +++ b/arch/arm/mm/dma-mapping.c
>>> @@ -868,6 +868,9 @@ static int __arm_dma_mmap(struct device *dev, struct vm_area_struct *vma,
>>>                                       vma->vm_end - vma->vm_start,
>>>                                       vma->vm_page_prot);
>>>         }
>>> +#else
>>> +       ret = vm_iomap_memory(vma, vma->vm_start,
>>> +                             (vma->vm_end - vma->vm_start));
>>>  #endif /* CONFIG_MMU */
>>>
>>>         return ret;
>>> --
>>> 1.9.1
>>>
>>
>



-- 
Benjamin Gaignard

Graphic Study Group

Linaro.org ? Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] nommu: allow mmap when !CONFIG_MMU
  2016-12-01 13:48 [PATCH] nommu: allow mmap when !CONFIG_MMU Benjamin Gaignard
  2016-12-09 15:27 ` Benjamin Gaignard
@ 2016-12-09 20:02 ` Russell King - ARM Linux
  1 sibling, 0 replies; 5+ messages in thread
From: Russell King - ARM Linux @ 2016-12-09 20:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Dec 01, 2016 at 02:48:00PM +0100, Benjamin Gaignard wrote:
> commit ab6494f0c96f ("nommu: Add noMMU support to the DMA API") have
> add CONFIG_MMU compilation flag but that prohibit to use dma_mmap_wc()
> when the platform doesn't have MMU.
> 
> This patch call vm_iomap_memory() in noMMU case to test if addresses
> are correct and set wma->vm_flags rather than all return an error.

ITYM vma.

I think this is fine, but I've no way to know as I don't run nommu here...
I've been hoping that others working on nommu would at least give an
ack or something, but I guess not.

So, please put it in the patch system, thanks.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-12-09 20:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-01 13:48 [PATCH] nommu: allow mmap when !CONFIG_MMU Benjamin Gaignard
2016-12-09 15:27 ` Benjamin Gaignard
2016-12-09 15:36   ` Vladimir Murzin
2016-12-09 15:47     ` Benjamin Gaignard
2016-12-09 20:02 ` Russell King - ARM Linux

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).