aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-04-04 20:13:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-04-04 20:13:43 -0400
commit58bca4a8fa90fcf9069379653b396b2cec642f7f (patch)
tree483c535136b5b168f36326956453e80ce5aa6543 /drivers/iommu
parent64ebe987311853ea857a244439de5b947a4b1b07 (diff)
parent64d70fe5d3640e1a89790ed21120921278f8cb86 (diff)
Merge branch 'for-linus' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping
Pull DMA mapping branch from Marek Szyprowski: "Short summary for the whole series: A few limitations have been identified in the current dma-mapping design and its implementations for various architectures. There exist more than one function for allocating and freeing the buffers: currently these 3 are used dma_{alloc, free}_coherent, dma_{alloc,free}_writecombine, dma_{alloc,free}_noncoherent. For most of the systems these calls are almost equivalent and can be interchanged. For others, especially the truly non-coherent ones (like ARM), the difference can be easily noticed in overall driver performance. Sadly not all architectures provide implementations for all of them, so the drivers might need to be adapted and cannot be easily shared between different architectures. The provided patches unify all these functions and hide the differences under the already existing dma attributes concept. The thread with more references is available here: http://www.spinics.net/lists/linux-sh/msg09777.html These patches are also a prerequisite for unifying DMA-mapping implementation on ARM architecture with the common one provided by dma_map_ops structure and extending it with IOMMU support. More information is available in the following thread: http://thread.gmane.org/gmane.linux.kernel.cross-arch/12819 More works on dma-mapping framework are planned, especially in the area of buffer sharing and managing the shared mappings (together with the recently introduced dma_buf interface: commit d15bd7ee445d "dma-buf: Introduce dma buffer sharing mechanism"). The patches in the current set introduce a new alloc/free methods (with support for memory attributes) in dma_map_ops structure, which will later replace dma_alloc_coherent and dma_alloc_writecombine functions." People finally started piping up with support for merging this, so I'm merging it as the last of the pending stuff from the merge window. Looks like pohmelfs is going to wait for 3.5 and more external support for merging. * 'for-linus' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping: common: DMA-mapping: add NON-CONSISTENT attribute common: DMA-mapping: add WRITE_COMBINE attribute common: dma-mapping: introduce mmap method common: dma-mapping: remove old alloc_coherent and free_coherent methods Hexagon: adapt for dma_map_ops changes Unicore32: adapt for dma_map_ops changes Microblaze: adapt for dma_map_ops changes SH: adapt for dma_map_ops changes Alpha: adapt for dma_map_ops changes SPARC: adapt for dma_map_ops changes PowerPC: adapt for dma_map_ops changes MIPS: adapt for dma_map_ops changes X86 & IA64: adapt for dma_map_ops changes common: dma-mapping: introduce generic alloc() and free() methods
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/amd_iommu.c10
-rw-r--r--drivers/iommu/intel-iommu.c9
2 files changed, 11 insertions, 8 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index ae2ec929e52f..a5bee8e2dfce 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2707,7 +2707,8 @@ static void unmap_sg(struct device *dev, struct scatterlist *sglist,
2707 * The exported alloc_coherent function for dma_ops. 2707 * The exported alloc_coherent function for dma_ops.
2708 */ 2708 */
2709static void *alloc_coherent(struct device *dev, size_t size, 2709static void *alloc_coherent(struct device *dev, size_t size,
2710 dma_addr_t *dma_addr, gfp_t flag) 2710 dma_addr_t *dma_addr, gfp_t flag,
2711 struct dma_attrs *attrs)
2711{ 2712{
2712 unsigned long flags; 2713 unsigned long flags;
2713 void *virt_addr; 2714 void *virt_addr;
@@ -2765,7 +2766,8 @@ out_free:
2765 * The exported free_coherent function for dma_ops. 2766 * The exported free_coherent function for dma_ops.
2766 */ 2767 */
2767static void free_coherent(struct device *dev, size_t size, 2768static void free_coherent(struct device *dev, size_t size,
2768 void *virt_addr, dma_addr_t dma_addr) 2769 void *virt_addr, dma_addr_t dma_addr,
2770 struct dma_attrs *attrs)
2769{ 2771{
2770 unsigned long flags; 2772 unsigned long flags;
2771 struct protection_domain *domain; 2773 struct protection_domain *domain;
@@ -2846,8 +2848,8 @@ static void __init prealloc_protection_domains(void)
2846} 2848}
2847 2849
2848static struct dma_map_ops amd_iommu_dma_ops = { 2850static struct dma_map_ops amd_iommu_dma_ops = {
2849 .alloc_coherent = alloc_coherent, 2851 .alloc = alloc_coherent,
2850 .free_coherent = free_coherent, 2852 .free = free_coherent,
2851 .map_page = map_page, 2853 .map_page = map_page,
2852 .unmap_page = unmap_page, 2854 .unmap_page = unmap_page,
2853 .map_sg = map_sg, 2855 .map_sg = map_sg,
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 132f93b05154..f93d5ac8f81c 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2949,7 +2949,8 @@ static void intel_unmap_page(struct device *dev, dma_addr_t dev_addr,
2949} 2949}
2950 2950
2951static void *intel_alloc_coherent(struct device *hwdev, size_t size, 2951static void *intel_alloc_coherent(struct device *hwdev, size_t size,
2952 dma_addr_t *dma_handle, gfp_t flags) 2952 dma_addr_t *dma_handle, gfp_t flags,
2953 struct dma_attrs *attrs)
2953{ 2954{
2954 void *vaddr; 2955 void *vaddr;
2955 int order; 2956 int order;
@@ -2981,7 +2982,7 @@ static void *intel_alloc_coherent(struct device *hwdev, size_t size,
2981} 2982}
2982 2983
2983static void intel_free_coherent(struct device *hwdev, size_t size, void *vaddr, 2984static void intel_free_coherent(struct device *hwdev, size_t size, void *vaddr,
2984 dma_addr_t dma_handle) 2985 dma_addr_t dma_handle, struct dma_attrs *attrs)
2985{ 2986{
2986 int order; 2987 int order;
2987 2988
@@ -3126,8 +3127,8 @@ static int intel_mapping_error(struct device *dev, dma_addr_t dma_addr)
3126} 3127}
3127 3128
3128struct dma_map_ops intel_dma_ops = { 3129struct dma_map_ops intel_dma_ops = {
3129 .alloc_coherent = intel_alloc_coherent, 3130 .alloc = intel_alloc_coherent,
3130 .free_coherent = intel_free_coherent, 3131 .free = intel_free_coherent,
3131 .map_sg = intel_map_sg, 3132 .map_sg = intel_map_sg,
3132 .unmap_sg = intel_unmap_sg, 3133 .unmap_sg = intel_unmap_sg,
3133 .map_page = intel_map_page, 3134 .map_page = intel_map_page,