>From: Gilles Chanteperdrix [mailto:[email protected]]
>Sent: Wednesday, January 12, 2011 8:35 AM
>To: Herrera-Bendezu, Luis
>Cc: [email protected]
>Subject: Re: [Xenomai-help] [Xenomai -help] User space access to DMA memory
>
>Herrera-Bendezu, Luis wrote:
>>> -----Original Message-----
>>> From: Gilles Chanteperdrix [mailto:[email protected]]
>>> Sent: Tuesday, January 11, 2011 6:28 PM
>>> To: Herrera-Bendezu, Luis
>>> Cc: [email protected]
>>> Subject: Re: [Xenomai-help] [Xenomai -help] User space access to DMA memory
>>>
>>> Gilles Chanteperdrix wrote:
>>>> Herrera-Bendezu, Luis wrote:
>>>>> On 01/05/2011 5:29 PM Gilles Chanteperdrix wrote:
>>>>>> Steven A. Falco wrote:
>>>>>>> On 01/05/2011 04:33 PM, Gilles Chanteperdrix wrote:
>>>>>> Ok. Could you try to do the same operation with the native API? You just
>>>>>> have to pass H_SHARED | H_DMA | H_NONCACHED as flags to rt_heap_create
>>>>>> to get the same effect as pci_dma_alloc_coherent.
>>>>>>
>>>>>> Just to see if the error lies in RTDM implementation or in Xenomai
>>>>>> generic code.
>>>>>>
>>>>>>
>>>> (...)
>>>> What about the other thing I asked you to test?
>>>>
>>> Ping? Any news about this test?
>>
>> rt_heap_create() with flags H_SHARED | H_DMA | H_NONCACHED report -EINVAL.
>> Documentation indicates that H_NONCACHE is not compatible with H_DMA.
>
>Right, supporting H_NONCACHED | H_DMA would mean that we would have to
>use kmalloc/get_free_pages then establish a non-cached mapping in
>kernel-space with vm_map_ram.
>
>Could you try with H_NONCACHED, but without H_DMA? Of course, the
>mapping can not be used for DMA, as it will probably not be physically
>contiguous, but at least you can try whether accessing in user-space a
>non-cached mapping works.
It does work but unless an external unit writes to heap memory it would
be difficult to verify that the non-cached memory actually works, i.e.
access from user space gets expected value(s).
>
>In any case, we see a defect in the RTDM interface here: we can not ask
>the mapping to be mapped non-cacheable, which somewhat defeats the
>purpose of pci_alloc_consistent. I do not know enough the powerpc
>architecture to know whether this could be the cause of your issue (the
>same physical area mapped twice, once cached, once non-cached). However,
>on the ARM architecture, for instance, it is bad.
>
Let me summarize the ideas discussed so far to allocate consistent memory
suitable for DMA and corresponding mapping to user space:
* rt_heap cannot be created with both H_NONCACHED and H_DMA. But it is
automatically mapped to user space with rt_heap_bind().
A solution can be to allocate heap with H_SHARED | H_DMA, somehow
get bus address of single block of memory (rt_heap { sba } ?) to
used for DMA operations.
* RTDM interface rtdm_mmap/unmap cannot handle non-cacheable memory.
A solution can be to allocate GFP_DMA memory with kmalloc(), use
rtdm_mmap to map to user space. Programmatically make memory
consistent before/after DMA transfer to/from external unit, e.g.
dma_sync_single_for_device()/dma_sync_single_for_cpu(). This is
similar to what streaming DMA mappings do.
* Ideally, it should be possible to take memory allocated from
dma_alloc_coherent()/pci_alloc_consistent() and mapped it to
user space using rtdm_mmap().
Luis
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help