History

dma-direct: provide mmap and get_sgtable method overrides

For dma-direct we know that the DMA address is an encoding of the physical address that we can trivially decode. Use that fact to provide implementations that do not need the arch_dma_coherent_to_pfn architecture hook. Note that we still can only support mmap of non-coherent memory only if the architecture provides a way to set an uncached bit in the page tables. This must be true for architectures that use the generic remap helpers, but other architectures can also manually select it.

Christoph Hellwig committed 7 years ago

Commit 34dc0ea1 parent 4e1003a16 files · +85 −75Browse files

Showing the changes to include/linux (2 of 16 files). Show all

Unified · Split

2 files
  1. include/linux/dma-direct.h +7 −0
  2. include/linux/dma-noncoherent.h +0 −2
include/linux/dma-direct.h+7−0
@@ -68,5 +68,12 @@ void dma_direct_free_pages(struct device *dev, size_t size, void *cpu_addr, · 67 unmodified lines
68 dma_addr_t dma_addr, unsigned long attrs);68 dma_addr_t dma_addr, unsigned long attrs);
69struct page *__dma_direct_alloc_pages(struct device *dev, size_t size,69struct page *__dma_direct_alloc_pages(struct device *dev, size_t size,
70 gfp_t gfp, unsigned long attrs);70 gfp_t gfp, unsigned long attrs);
71int dma_direct_get_sgtable(struct device *dev, struct sg_table *sgt,
72 void *cpu_addr, dma_addr_t dma_addr, size_t size,
73 unsigned long attrs);
74bool dma_direct_can_mmap(struct device *dev);
75int dma_direct_mmap(struct device *dev, struct vm_area_struct *vma,
76 void *cpu_addr, dma_addr_t dma_addr, size_t size,
77 unsigned long attrs);
71int dma_direct_supported(struct device *dev, u64 mask);78int dma_direct_supported(struct device *dev, u64 mask);
72#endif /* _LINUX_DMA_DIRECT_H */79#endif /* _LINUX_DMA_DIRECT_H */
include/linux/dma-noncoherent.h+0−2
@@ -41,8 +41,6 @@ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, · 40 unmodified lines
41 gfp_t gfp, unsigned long attrs);41 gfp_t gfp, unsigned long attrs);
42void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,42void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
43 dma_addr_t dma_addr, unsigned long attrs);43 dma_addr_t dma_addr, unsigned long attrs);
44long arch_dma_coherent_to_pfn(struct device *dev, void *cpu_addr,
45 dma_addr_t dma_addr);
46 44
47#ifdef CONFIG_MMU45#ifdef CONFIG_MMU
48/*46/*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t