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
6868 dma_addr_t dma_addr, unsigned long attrs);
6969 struct page *__dma_direct_alloc_pages(struct device *dev, size_t size,
7070 gfp_t gfp, unsigned long attrs);
71+int 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);
74+bool dma_direct_can_mmap(struct device *dev);
75+int 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);
7178 int dma_direct_supported(struct device *dev, u64 mask);
7279 #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
4141 gfp_t gfp, unsigned long attrs);
4242 void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
4343 dma_addr_t dma_addr, unsigned long attrs);
44−long arch_dma_coherent_to_pfn(struct device *dev, void *cpu_addr,
45− dma_addr_t dma_addr);
4644
4745 #ifdef CONFIG_MMU
4846 /*

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