diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-10 16:56:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-10 16:56:08 -0400 |
commit | 754c780953397dd5ee5191b7b3ca67e09088ce7a (patch) | |
tree | 8bdbf8407c8cd917f24a0d5a5c6a865db6366f3c /arch/s390 | |
parent | 40c43269cf8e88a0bdc306c717d1dd5446a6f3b8 (diff) | |
parent | b4bbb107d73bbc0d92c9ae7fd8e69580aa9381e7 (diff) |
Merge branch 'for-v3.18' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping
Pull dma-mapping update from Marek Szyprowski:
"Provide the dma write coherent api (available previously on ARM
architecture) for all other architectures, which use dma_ops-based dma
mapping implementation.
This lets one to use the same code in the device drivers regardless of
the selected architecture"
* 'for-v3.18' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping:
dma-mapping: Provide write-combine allocations
s390: Implement dma_{alloc,free}_attrs()
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/Kconfig | 5 | ||||
-rw-r--r-- | arch/s390/include/asm/dma-mapping.h | 31 |
2 files changed, 22 insertions, 14 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 05c78bb5f570..296391395b95 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -496,8 +496,8 @@ config QDIO | |||
496 | 496 | ||
497 | menuconfig PCI | 497 | menuconfig PCI |
498 | bool "PCI support" | 498 | bool "PCI support" |
499 | default n | ||
500 | depends on 64BIT | 499 | depends on 64BIT |
500 | select HAVE_DMA_ATTRS | ||
501 | select PCI_MSI | 501 | select PCI_MSI |
502 | help | 502 | help |
503 | Enable PCI support. | 503 | Enable PCI support. |
@@ -544,9 +544,6 @@ config HAS_DMA | |||
544 | config NEED_SG_DMA_LENGTH | 544 | config NEED_SG_DMA_LENGTH |
545 | def_bool PCI | 545 | def_bool PCI |
546 | 546 | ||
547 | config HAVE_DMA_ATTRS | ||
548 | def_bool PCI | ||
549 | |||
550 | config NEED_DMA_MAP_STATE | 547 | config NEED_DMA_MAP_STATE |
551 | def_bool PCI | 548 | def_bool PCI |
552 | 549 | ||
diff --git a/arch/s390/include/asm/dma-mapping.h b/arch/s390/include/asm/dma-mapping.h index 3fbc67d9e197..709955ddaa4d 100644 --- a/arch/s390/include/asm/dma-mapping.h +++ b/arch/s390/include/asm/dma-mapping.h | |||
@@ -56,24 +56,35 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | |||
56 | return dma_addr == DMA_ERROR_CODE; | 56 | return dma_addr == DMA_ERROR_CODE; |
57 | } | 57 | } |
58 | 58 | ||
59 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | 59 | #define dma_alloc_coherent(d, s, h, f) dma_alloc_attrs(d, s, h, f, NULL) |
60 | dma_addr_t *dma_handle, gfp_t flag) | 60 | |
61 | static inline void *dma_alloc_attrs(struct device *dev, size_t size, | ||
62 | dma_addr_t *dma_handle, gfp_t flags, | ||
63 | struct dma_attrs *attrs) | ||
61 | { | 64 | { |
62 | struct dma_map_ops *ops = get_dma_ops(dev); | 65 | struct dma_map_ops *ops = get_dma_ops(dev); |
63 | void *ret; | 66 | void *cpu_addr; |
67 | |||
68 | BUG_ON(!ops); | ||
64 | 69 | ||
65 | ret = ops->alloc(dev, size, dma_handle, flag, NULL); | 70 | cpu_addr = ops->alloc(dev, size, dma_handle, flags, attrs); |
66 | debug_dma_alloc_coherent(dev, size, *dma_handle, ret); | 71 | debug_dma_alloc_coherent(dev, size, *dma_handle, cpu_addr); |
67 | return ret; | 72 | |
73 | return cpu_addr; | ||
68 | } | 74 | } |
69 | 75 | ||
70 | static inline void dma_free_coherent(struct device *dev, size_t size, | 76 | #define dma_free_coherent(d, s, c, h) dma_free_attrs(d, s, c, h, NULL) |
71 | void *cpu_addr, dma_addr_t dma_handle) | 77 | |
78 | static inline void dma_free_attrs(struct device *dev, size_t size, | ||
79 | void *cpu_addr, dma_addr_t dma_handle, | ||
80 | struct dma_attrs *attrs) | ||
72 | { | 81 | { |
73 | struct dma_map_ops *dma_ops = get_dma_ops(dev); | 82 | struct dma_map_ops *ops = get_dma_ops(dev); |
83 | |||
84 | BUG_ON(!ops); | ||
74 | 85 | ||
75 | debug_dma_free_coherent(dev, size, cpu_addr, dma_handle); | 86 | debug_dma_free_coherent(dev, size, cpu_addr, dma_handle); |
76 | dma_ops->free(dev, size, cpu_addr, dma_handle, NULL); | 87 | ops->free(dev, size, cpu_addr, dma_handle, attrs); |
77 | } | 88 | } |
78 | 89 | ||
79 | #endif /* _ASM_S390_DMA_MAPPING_H */ | 90 | #endif /* _ASM_S390_DMA_MAPPING_H */ |