<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    I am trying to use dma_mmap_attrs
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    . However I keep getting the following error:<br>
    <br>
    <blockquote>mmap:6420 map pfn RAM range req uncached-minus for [mem
      0xfd0000000-0xfd0000fff], got write-back<br>
    </blockquote>
    <br>
    Assuming that dma_common_map is used
    (<a class="moz-txt-link-freetext" href="http://lxr.free-electrons.com/source/drivers/base/dma-mapping.c#L246">http://lxr.free-electrons.com/source/drivers/base/dma-mapping.c#L246</a>)
    I tracked the error source to be comming from: remap_pfn_range<br>
    After struding the codeflow I think that this macro is the culprit:<br>
    <br>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    12 #define
    pgprot_noncached(prot)                                          \<br>
     13         ((boot_cpu_data.x86 &gt;
    3)                                        \<br>
     14          ? (__pgprot(pgprot_val(prot)
    |                                 \<br>
     15                     
    cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS)))     \<br>
     16          : (prot))<br>
    <br>
    since the "got write-back" is calculated from the memory address I
    assume I can not change that bit.<br>
    Could anyone explain to me, why the page protection depends on
    boot_cpu_data?<br>
    <br>
    Googling turned up further hints
    <a class="moz-txt-link-freetext" href="http://comments.gmane.org/gmane.linux.kernel.mm/125059">http://comments.gmane.org/gmane.linux.kernel.mm/125059</a>. Is this a
    Bug or am I missing something?<br>
    How do I correctly use dma_mmap_attrs? Currently I try:<br>
    <br>
    <br>
    mmap function:<br>
    <blockquote>return dma_mmap_attrs(&amp;pcidev-&gt;dev, vma,
      buffer-&gt;memoryAddress, buffer-&gt;dmaAddress, BUF_SIZE, 0); <br>
    </blockquote>
    <br>
    testfile:<br>
    <blockquote>    char* fpath = "/proc/myDevice";<br>
          uint64_t* buffer;<br>
          int filepointer = open(fpath, O_RDWR);<br>
      <br>
          if(filepointer &lt; 0) {<br>
              printf("Could not open %s.\n", fpath);<br>
              return -1;<br>
          }<br>
      <br>
          buffer = (uint64_t*) mmap(0, 4096, PROT_READ | PROT_WRITE,
      MAP_PRIVATE, filepointer, 0);<br>
      <br>
    </blockquote>
    Thanks for any help,<br>
    Malte<br>
  </body>
</html>