Stelian Pop wrote:
> Hi,
> 
> I need to be able to map an IO memory buffer to userspace from a RTDM
> driver.
> 
> rtdm_mmap_to_user() seems to do what I need, but it doesn't work. Its
> code thinks that all virtual addresses between VMALLOC_START and
> VMALLOC_END are obtained through vmalloc() and tries to call
> xnarch_remap_vm_page() on them, which fails.

Ok, interesting (one never stops learning).

> 
> Virtual addresses coming from ioremap() need to go through
> xnarch_remap_io_page_range(), and their physical address cannot be
> obtained with a simple virt_to_phys().
> 
> A working patch is attached below, but there might (should ?) be a
> better way to do it. Some of the code may also belong to
> asm-generic/system.h instead of the RTDM skin.
> 
> Note that you may also need to EXPORT_SYMBOL(vmlist and vmlist_lock) in
> mm/vmalloc.c if you want to build the RTDM skin as a module.
> 
> Comments ?

In case no one comes up with an easy, portable way to detect remapped
memory as well: What about some flags the caller of rtdm_mmap_to_user
has to pass, telling what kind of memory it is? Would simplify the RTDM
part, and the user normally knows quite well where the memory came from.
And I love to break APIs. :)

I'm CC'ing the first users of this service to ask for some feedback from
their POV. Hope gna does not -once again- mangles the CCs.

Jan

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to