lkml.org 
[lkml]   [2019]   [Oct]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: dma coherent memory user-space maps
From
Date
On 10/8/19 2:34 PM, Thomas Hellström (VMware) wrote:
> Hi, Christoph,
>
> Following our previous discussion I wonder if something along the
> lines of the following could work / be acceptible
>
> typedef unsigned long dma_pfn_t /* Opaque pfn type. Arch dependent.
> This could if needed be a struct with a pointer and an offset */
>
> /* Similar to vmf_insert_mixed() */
> vm_fault_t dma_vmf_insert_mixed(struct device *dev,
>                 struct vm_area_struct *vma,
>                 unsigned long addr,
>                 dma_pfn_t dpfn,
>                 unsigned long attrs);
>
> /* Similar to vmf_insert_pfn_pmd() */
> vm_fault_t dma_vmf_insert_pfn_pmd(struct device *dev,
>                   struct vm_area_struct *vma,
>                   unsigned long addr,
>                   dma_pfn_t dpfn,
>                   unsigned long attrs);
>
> /* Like vmap, but takes struct dma_pfns. */
> extern void *dma_vmap(struct device *dev,
>               dma_pfn_t dpfns[],
>               unsigned int count, unsigned long flags,
>               unsigned long attrs);
>
> /* Obtain struct dma_pfn pointers from a dma coherent allocation */
> int dma_get_dpfns(struct device *dev, void *cpu_addr, dma_addr_t
> dma_addr,
>           pgoff_t offset, pgoff_t num, dma_pfn_t dpfns[]);
>
> I figure, for most if not all architectures we could use an ordinary
> pfn as dma_pfn_t, but the dma layer would still have control over how
> those pfns are obtained and how they are used in the kernel's mapping
> APIs.
>
> If so, I could start looking at this, time permitting,  for the cases
> where the pfn can be obtained from the kernel address or from
> arch_dma_coherent_to_pfn(), and also the needed work to have a
> tailored vmap_pfn().
>
> Thanks,
> /Thomas
>
>
Ping?

Thanks,

Thomas


\
 
 \ /
  Last update: 2019-10-21 14:27    [W:0.306 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site