mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* dma coherent memory user-space maps
@ 2019-10-08 12:34 Thomas Hellström (VMware)
  2019-10-21 12:26 ` Thomas Hellström (VMware)
  2019-10-31 21:54 ` Christoph Hellwig
  0 siblings, 2 replies; 7+ messages in thread
From: Thomas Hellström (VMware) @ 2019-10-08 12:34 UTC (permalink / raw)
  To: Christoph Hellwig, Christian König; +Cc: linux-kernel

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



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-11-04 11:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08 12:34 dma coherent memory user-space maps Thomas Hellström (VMware)
2019-10-21 12:26 ` Thomas Hellström (VMware)
2019-10-23  4:04   ` Christoph Hellwig
2019-10-31 21:54 ` Christoph Hellwig
2019-11-04  6:38   ` Thomas Hellström (VMware)
2019-11-04  6:58     ` Thomas Hellström (VMware)
2019-11-04 11:29       ` Koenig, Christian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome