diff options
author | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2014-11-20 05:41:35 -0500 |
---|---|---|
committer | David Vrabel <david.vrabel@citrix.com> | 2014-12-04 07:41:49 -0500 |
commit | de7ee503f279c1b454941802972bb9467e3e5749 (patch) | |
tree | 0cd6e810e848dfdc10e3107c0965de374efa656a /arch/arm64/include | |
parent | 2f91fc331ad495a3e602f3d0e7fd6211b1d91204 (diff) |
arm64: introduce is_device_dma_coherent
Introduce a boolean flag and an accessor function to check whether a
device is dma_coherent. Set the flag from set_arch_dma_coherent_ops.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/include')
-rw-r--r-- | arch/arm64/include/asm/device.h | 1 | ||||
-rw-r--r-- | arch/arm64/include/asm/dma-mapping.h | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/device.h b/arch/arm64/include/asm/device.h index cf98b362094b..243ef256b8c9 100644 --- a/arch/arm64/include/asm/device.h +++ b/arch/arm64/include/asm/device.h | |||
@@ -21,6 +21,7 @@ struct dev_archdata { | |||
21 | #ifdef CONFIG_IOMMU_API | 21 | #ifdef CONFIG_IOMMU_API |
22 | void *iommu; /* private IOMMU data */ | 22 | void *iommu; /* private IOMMU data */ |
23 | #endif | 23 | #endif |
24 | bool dma_coherent; | ||
24 | }; | 25 | }; |
25 | 26 | ||
26 | struct pdev_archdata { | 27 | struct pdev_archdata { |
diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h index adeae3f6f0fc..d34189bceff7 100644 --- a/arch/arm64/include/asm/dma-mapping.h +++ b/arch/arm64/include/asm/dma-mapping.h | |||
@@ -54,11 +54,18 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops) | |||
54 | 54 | ||
55 | static inline int set_arch_dma_coherent_ops(struct device *dev) | 55 | static inline int set_arch_dma_coherent_ops(struct device *dev) |
56 | { | 56 | { |
57 | dev->archdata.dma_coherent = true; | ||
57 | set_dma_ops(dev, &coherent_swiotlb_dma_ops); | 58 | set_dma_ops(dev, &coherent_swiotlb_dma_ops); |
58 | return 0; | 59 | return 0; |
59 | } | 60 | } |
60 | #define set_arch_dma_coherent_ops set_arch_dma_coherent_ops | 61 | #define set_arch_dma_coherent_ops set_arch_dma_coherent_ops |
61 | 62 | ||
63 | /* do not use this function in a driver */ | ||
64 | static inline bool is_device_dma_coherent(struct device *dev) | ||
65 | { | ||
66 | return dev->archdata.dma_coherent; | ||
67 | } | ||
68 | |||
62 | #include <asm-generic/dma-mapping-common.h> | 69 | #include <asm-generic/dma-mapping-common.h> |
63 | 70 | ||
64 | static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) | 71 | static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) |