Module: xenomai-forge
Branch: master
Commit: 03d5b0b0083ce839b81b5adb0813152d25e88480
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=03d5b0b0083ce839b81b5adb0813152d25e88480

Author: Wolfgang Grandegger <w...@denx.de>
Date:   Tue Jan 15 16:22:02 2013 +0100

cobalt/rtdm: fix caching and page fault issues with rtdm_iomap_to_user()

Pages mapped by rtdm_iomap_to_user() might be cached and may
page fault on the first write. At least that's the behaviour
we observed on an ARM mx6q system. This patch fixes these
issues.

Signed-off-by: Wolfgang Grandegger <w...@denx.de>

---

 kernel/cobalt/nucleus/heap.c |    4 ++--
 kernel/cobalt/rtdm/drvlib.c  |    7 +++----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/kernel/cobalt/nucleus/heap.c b/kernel/cobalt/nucleus/heap.c
index 59b4957..230c0d6 100644
--- a/kernel/cobalt/nucleus/heap.c
+++ b/kernel/cobalt/nucleus/heap.c
@@ -1477,9 +1477,9 @@ int xnheap_remap_io_page_range(struct file *filp,
 #ifdef __HAVE_PHYS_MEM_ACCESS_PROT
        prot = phys_mem_access_prot(filp, to >> PAGE_SHIFT, size, prot);
 #endif
-       vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+       vma->vm_page_prot = pgprot_noncached(prot);
        /* Sets VM_RESERVED | VM_IO | VM_PFNMAP on the vma. */
-       return remap_pfn_range(vma, from, to >> PAGE_SHIFT, size, prot);
+       return remap_pfn_range(vma, from, to >> PAGE_SHIFT, size, 
vma->vm_page_prot);
 }
 
 int xnheap_remap_kmem_page_range(struct vm_area_struct *vma,
diff --git a/kernel/cobalt/rtdm/drvlib.c b/kernel/cobalt/rtdm/drvlib.c
index 383eb22..34aa1af 100644
--- a/kernel/cobalt/rtdm/drvlib.c
+++ b/kernel/cobalt/rtdm/drvlib.c
@@ -1839,12 +1839,11 @@ static int rtdm_mmap_buffer(struct file *filp, struct 
vm_area_struct *vma)
        if (mmap_data->src_paddr)
                ret = xnheap_remap_io_page_range(filp, vma, maddr, paddr,
                                                 size, PAGE_SHARED);
-       else {
+       else
                ret = xnheap_remap_kmem_page_range(vma, maddr, paddr,
                                                   size, PAGE_SHARED);
-               if (ret == 0 && xnarch_machdesc.prefault)
-                       xnarch_machdesc.prefault(vma);
-       }
+       if (xnarch_machdesc.prefault && ret == 0)
+               xnarch_machdesc.prefault(vma);
 
        return ret;
 }


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to