dma/ia64: update ia64 machvecs
PATCH 2/4 dma/ia64: update ia64 machvecs
Change all ia64 machvecs to use the new dma_{un}map_*_attrs() interfaces. Implement the old dma_{un}map_*() interfaces in terms of the corresponding new interfaces. For ia64/sn, make use of one dma attribute, DMA_ATTR_BARRIER.
--
arch/ia64/hp/common/hwsw_iommu.c | 60 ++++++++++++------------ arch/ia64/hp/common/sba_iommu.c | 62 ++++++++++++++---------- arch/ia64/sn/pci/pci_dma.c | 77 ++++++++++++++++++++----------- include/asm-ia64/dma-mapping.h | 28 +++++++++-- include/asm-ia64/machvec.h | 52 ++++++++++++-------- include/asm-ia64/machvec_hpzx1.h | 16 +++--- include/asm-ia64/machvec_hpzx1_swiotlb.h | 16 +++--- include/asm-ia64/machvec_sn2.h | 16 +++--- include/linux/dma-attrs.h | 48 +++++++++++++++++++ lib/swiotlb.c | 50 ++++++++++++++++---- 10 files changed, 289 insertions(+), 136 deletions(-)
arch/ia64/hp/common/hwsw_iommu.c +32 -28
@@ -20,10 +20,10 @@extern int swiotlb_late_init_with_default_size (size_t size);extern ia64_mv_dma_alloc_coherent swiotlb_alloc_coherent;extern ia64_mv_dma_free_coherent swiotlb_free_coherent; -extern ia64_mv_dma_map_single swiotlb_map_single; -extern ia64_mv_dma_unmap_single swiotlb_unmap_single; -extern ia64_mv_dma_map_sg swiotlb_map_sg; -extern ia64_mv_dma_unmap_sg swiotlb_unmap_sg; +extern ia64_mv_dma_map_single_attrs swiotlb_map_single_attrs; +extern ia64_mv_dma_unmap_single_attrs swiotlb_unmap_single_attrs; +extern ia64_mv_dma_map_sg_attrs swiotlb_map_sg_attrs; +extern ia64_mv_dma_unmap_sg_attrs swiotlb_unmap_sg_attrs;extern ia64_mv_dma_supported swiotlb_dma_supported;extern ia64_mv_dma_mapping_error swiotlb_dma_mapping_error;
@@ -31,19 +31,19 @@ extern ia64_mv_dma_mapping_error swiotlb_dma_mapping_error;extern ia64_mv_dma_alloc_coherent sba_alloc_coherent;extern ia64_mv_dma_free_coherent sba_free_coherent; -extern ia64_mv_dma_map_single sba_map_single; -extern ia64_mv_dma_unmap_single sba_unmap_single; -extern ia64_mv_dma_map_sg sba_map_sg; -extern ia64_mv_dma_unmap_sg sba_unmap_sg; +extern ia64_mv_dma_map_single_attrs sba_map_single_attrs; +extern ia64_mv_dma_unmap_single_attrs sba_unmap_single_attrs; +extern ia64_mv_dma_map_sg_attrs sba_map_sg_attrs; +extern ia64_mv_dma_unmap_sg_attrs sba_unmap_sg_attrs;extern ia64_mv_dma_supported sba_dma_supported;extern ia64_mv_dma_mapping_error sba_dma_mapping_error;#define hwiommu_alloc_coherent sba_alloc_coherent#define hwiommu_free_coherent sba_free_coherent -#define hwiommu_map_single sba_map_single -#define hwiommu_unmap_single sba_unmap_single -#define hwiommu_map_sg sba_map_sg -#define hwiommu_unmap_sg sba_unmap_sg +#define hwiommu_map_single_attrs sba_map_single_attrs +#define hwiommu_unmap_single_attrs sba_unmap_single_attrs +#define hwiommu_map_sg_attrs sba_map_sg_attrs +#define hwiommu_unmap_sg_attrs sba_unmap_sg_attrs#define hwiommu_dma_supported sba_dma_supported#define hwiommu_dma_mapping_error sba_dma_mapping_error#define hwiommu_sync_single_for_cpu machvec_dma_sync_single
@@ -98,40 +98,44 @@ hwsw_free_coherent (struct device *dev, size_t size, void *vaddr, dma_addr_t dma }dma_addr_t -hwsw_map_single (struct device *dev,void *addr,size_t size,int dir) +hwsw_map_single_attrs (struct device *dev,void *addr,size_t size,int dir, +struct dma_attrs *attrs) {if (use_swiotlb (dev)) -return swiotlb_map_single (dev, addr, size, dir); +return swiotlb_map_single_attrs (dev, addr, size, dir, attrs);else -return hwiommu_map_single (dev, addr, size, dir); +return hwiommu_map_single_attrs (dev, addr, size, dir, attrs); }void -hwsw_unmap_single (struct device *dev,dma_addr_t iova,size_t size,int dir) +hwsw_unmap_single_attrs (struct device *dev,dma_addr_t iova,size_t size, +int dir,struct dma_attrs *attrs) {if (use_swiotlb (dev)) -return swiotlb_unmap_single (dev, iova, size, dir); +return swiotlb_unmap_single_attrs (dev, iova, size, dir, attrs);else -return hwiommu_unmap_single (dev, iova, size, dir); +return hwiommu_unmap_single_attrs (dev, iova, size, dir, attrs); }int -hwsw_map_sg (struct device *dev,struct scatterlist *sglist,int nents,int dir) +hwsw_map_sg_attrs (struct device *dev,struct scatterlist *sglist,int nents, +int dir,struct dma_attrs *attrs) {if (use_swiotlb (dev)) -return swiotlb_map_sg (dev, sglist, nents, dir); +return swiotlb_map_sg_attrs (dev, sglist, nents, dir, attrs);else -return hwiommu_map_sg (dev, sglist, nents, dir); +return hwiommu_map_sg_attrs (dev, sglist, nents, dir, attrs); }void -hwsw_unmap_sg (struct device *dev,struct scatterlist *sglist,int nents,int dir) +hwsw_unmap_sg_attrs (struct device *dev,struct scatterlist *sglist,int nents, +int dir,struct dma_attrs *attrs) {if (use_swiotlb (dev)) -return swiotlb_unmap_sg (dev, sglist, nents, dir); +return swiotlb_unmap_sg_attrs (dev, sglist, nents, dir, attrs);else -return hwiommu_unmap_sg (dev, sglist, nents, dir); +return hwiommu_unmap_sg_attrs (dev, sglist, nents, dir, attrs); }void
@@ -185,10 +189,10 @@ hwsw_dma_mapping_error (dma_addr_t dma_addr) }EXPORT_SYMBOL (hwsw_dma_mapping_error); -EXPORT_SYMBOL (hwsw_map_single); -EXPORT_SYMBOL (hwsw_unmap_single); -EXPORT_SYMBOL (hwsw_map_sg); -EXPORT_SYMBOL (hwsw_unmap_sg); +EXPORT_SYMBOL (hwsw_map_single_attrs); +EXPORT_SYMBOL (hwsw_unmap_single_attrs); +EXPORT_SYMBOL (hwsw_map_sg_attrs); +EXPORT_SYMBOL (hwsw_unmap_sg_attrs);EXPORT_SYMBOL (hwsw_dma_supported);EXPORT_SYMBOL (hwsw_alloc_coherent);EXPORT_SYMBOL (hwsw_free_coherent);
arch/ia64/hp/common/sba_iommu.c +36 -26
197 lines not on this page · raw message
arch/ia64/sn/pci/pci_dma.c +51 -26
177 lines not on this page · raw message
include/asm-ia64/dma-mapping.h +24 -4
@@ -23,10 +23,30 @@ dma_free_noncoherent(struct device *dev, size_t size, void *cpu_addr, {dma_free_coherent (dev, size, cpu_addr, dma_handle); } -#define dma_map_single platform_dma_map_single -#define dma_map_sg platform_dma_map_sg -#define dma_unmap_single platform_dma_unmap_single -#define dma_unmap_sg platform_dma_unmap_sg +#define dma_map_single_attrs platform_dma_map_single_attrs +static inline dma_addr_t dma_map_single (struct device * dev,void * cpu_addr, +size_t size,int dir) +{ +return dma_map_single_attrs (dev, cpu_addr, size, dir,NULL ); +} +#define dma_map_sg_attrs platform_dma_map_sg_attrs +static inline int dma_map_sg (struct device *dev,struct scatterlist *sgl, +int nents,int dir) +{ +return dma_map_sg_attrs (dev, sgl, nents, dir,NULL ); +} +#define dma_unmap_single_attrs platform_dma_unmap_single_attrs +static inline void dma_unmap_single (struct device * dev,dma_addr_t cpu_addr, +size_t size,int dir) +{ +return dma_unmap_single_attrs (dev, cpu_addr, size, dir,NULL ); +} +#define dma_unmap_sg_attrs platform_dma_unmap_sg_attrs +static inline void dma_unmap_sg (struct device *dev,struct scatterlist *sgl, +int nents,int dir) +{ +return dma_unmap_sg_attrs (dev, sgl, nents, dir,NULL ); +}#define dma_sync_single_for_cpu platform_dma_sync_single_for_cpu#define dma_sync_sg_for_cpu platform_dma_sync_sg_for_cpu#define dma_sync_single_for_device platform_dma_sync_single_for_device
include/asm-ia64/machvec.h +32 -20
100 lines not on this page · raw message
include/asm-ia64/machvec_hpzx1.h +8 -8
@@ -4,10 +4,10 @@extern ia64_mv_setup_t dig_setup;extern ia64_mv_dma_alloc_coherent sba_alloc_coherent;extern ia64_mv_dma_free_coherent sba_free_coherent; -extern ia64_mv_dma_map_single sba_map_single; -extern ia64_mv_dma_unmap_single sba_unmap_single; -extern ia64_mv_dma_map_sg sba_map_sg; -extern ia64_mv_dma_unmap_sg sba_unmap_sg; +extern ia64_mv_dma_map_single_attrs sba_map_single_attrs; +extern ia64_mv_dma_unmap_single_attrs sba_unmap_single_attrs; +extern ia64_mv_dma_map_sg_attrs sba_map_sg_attrs; +extern ia64_mv_dma_unmap_sg_attrs sba_unmap_sg_attrs;extern ia64_mv_dma_supported sba_dma_supported;extern ia64_mv_dma_mapping_error sba_dma_mapping_error;
@@ -23,10 +23,10 @@ extern ia64_mv_dma_mapping_error sba_dma_mapping_error;#define platform_dma_init machvec_noop#define platform_dma_alloc_coherent sba_alloc_coherent#define platform_dma_free_coherent sba_free_coherent -#define platform_dma_map_single sba_map_single -#define platform_dma_unmap_single sba_unmap_single -#define platform_dma_map_sg sba_map_sg -#define platform_dma_unmap_sg sba_unmap_sg +#define platform_dma_map_single_attrs sba_map_single_attrs +#define platform_dma_unmap_single_attrs sba_unmap_single_attrs +#define platform_dma_map_sg_attrs sba_map_sg_attrs +#define platform_dma_unmap_sg_attrs sba_unmap_sg_attrs#define platform_dma_sync_single_for_cpu machvec_dma_sync_single#define platform_dma_sync_sg_for_cpu machvec_dma_sync_sg#define platform_dma_sync_single_for_device machvec_dma_sync_single
include/asm-ia64/machvec_hpzx1_swiotlb.h +8 -8
@@ -4,10 +4,10 @@extern ia64_mv_setup_t dig_setup;extern ia64_mv_dma_alloc_coherent hwsw_alloc_coherent;extern ia64_mv_dma_free_coherent hwsw_free_coherent; -extern ia64_mv_dma_map_single hwsw_map_single; -extern ia64_mv_dma_unmap_single hwsw_unmap_single; -extern ia64_mv_dma_map_sg hwsw_map_sg; -extern ia64_mv_dma_unmap_sg hwsw_unmap_sg; +extern ia64_mv_dma_map_single_attrs hwsw_map_single_attrs; +extern ia64_mv_dma_unmap_single_attrs hwsw_unmap_single_attrs; +extern ia64_mv_dma_map_sg_attrs hwsw_map_sg_attrs; +extern ia64_mv_dma_unmap_sg_attrs hwsw_unmap_sg_attrs;extern ia64_mv_dma_supported hwsw_dma_supported;extern ia64_mv_dma_mapping_error hwsw_dma_mapping_error;extern ia64_mv_dma_sync_single_for_cpu hwsw_sync_single_for_cpu;
@@ -28,10 +28,10 @@ extern ia64_mv_dma_sync_sg_for_device hwsw_sync_sg_for_device;#define platform_dma_init machvec_noop#define platform_dma_alloc_coherent hwsw_alloc_coherent#define platform_dma_free_coherent hwsw_free_coherent -#define platform_dma_map_single hwsw_map_single -#define platform_dma_unmap_single hwsw_unmap_single -#define platform_dma_map_sg hwsw_map_sg -#define platform_dma_unmap_sg hwsw_unmap_sg +#define platform_dma_map_single_attrs hwsw_map_single_attrs +#define platform_dma_unmap_single_attrs hwsw_unmap_single_attrs +#define platform_dma_map_sg_attrs hwsw_map_sg_attrs +#define platform_dma_unmap_sg_attrs hwsw_unmap_sg_attrs#define platform_dma_supported hwsw_dma_supported#define platform_dma_mapping_error hwsw_dma_mapping_error#define platform_dma_sync_single_for_cpu hwsw_sync_single_for_cpu
include/asm-ia64/machvec_sn2.h +8 -8
@@ -57,10 +57,10 @@ extern ia64_mv_readl_t __sn_readl_relaxed;extern ia64_mv_readq_t __sn_readq_relaxed;extern ia64_mv_dma_alloc_coherent sn_dma_alloc_coherent;extern ia64_mv_dma_free_coherent sn_dma_free_coherent; -extern ia64_mv_dma_map_single sn_dma_map_single; -extern ia64_mv_dma_unmap_single sn_dma_unmap_single; -extern ia64_mv_dma_map_sg sn_dma_map_sg; -extern ia64_mv_dma_unmap_sg sn_dma_unmap_sg; +extern ia64_mv_dma_map_single_attrs sn_dma_map_single_attrs; +extern ia64_mv_dma_unmap_single_attrs sn_dma_unmap_single_attrs; +extern ia64_mv_dma_map_sg_attrs sn_dma_map_sg_attrs; +extern ia64_mv_dma_unmap_sg_attrs sn_dma_unmap_sg_attrs;extern ia64_mv_dma_sync_single_for_cpu sn_dma_sync_single_for_cpu;extern ia64_mv_dma_sync_sg_for_cpu sn_dma_sync_sg_for_cpu;extern ia64_mv_dma_sync_single_for_device sn_dma_sync_single_for_device;
@@ -113,10 +113,10 @@ extern ia64_mv_pci_fixup_bus_t sn_pci_fixup_bus;#define platform_dma_init machvec_noop#define platform_dma_alloc_coherent sn_dma_alloc_coherent#define platform_dma_free_coherent sn_dma_free_coherent -#define platform_dma_map_single sn_dma_map_single -#define platform_dma_unmap_single sn_dma_unmap_single -#define platform_dma_map_sg sn_dma_map_sg -#define platform_dma_unmap_sg sn_dma_unmap_sg +#define platform_dma_map_single_attrs sn_dma_map_single_attrs +#define platform_dma_unmap_single_attrs sn_dma_unmap_single_attrs +#define platform_dma_map_sg_attrs sn_dma_map_sg_attrs +#define platform_dma_unmap_sg_attrs sn_dma_unmap_sg_attrs#define platform_dma_sync_single_for_cpu sn_dma_sync_single_for_cpu#define platform_dma_sync_sg_for_cpu sn_dma_sync_sg_for_cpu#define platform_dma_sync_single_for_device sn_dma_sync_single_for_device
include/linux/dma-attrs.h +48 -0
48 lines not on this page · raw message
lib/swiotlb.c +42 -8
115 lines not on this page · raw message
In general, the patches look reasonable to me. Just an observation:
Quoted 6 lines · On Tue, 2008-01-29 at 21:52 -0800, [email protected] wrote:
include/linux/dma-attrs.h +1
-0@@ -0,0 +1,48 @@ +#ifndef _DMA_ATTR_H
include/linux/dma-attrs.h line 11
Quoted 10 lines
include/linux/dma-attrs.h +10
-0+#define _DMA_ATTR_H +#ifdef ARCH_USES_DMA_ATTRS + +enum dma_attr { +DMA_ATTR_BARRIER , +DMA_ATTR_FOO , +DMA_ATTR_GOO , +DMA_ATTR_MAX , +}; +
The attribute names (DMA_ATTR_...) are going to have to live somewhere outside of the #ifdef ARCH_USES_DMA_ATTRS otherwise we'll get compile failures of drivers using attributes on architectures that don't support them.
Secondly, DMA_ATTR_BARRIER doesn't quite sound right. What you're actually doing is trying to prescribe strict ordering, so shouldn't this be something like DMA_ATTR_STRICT_ORDERING (and perhaps with a corresponding DMA_ATTR_RELAXED_ORDERING for the PCIe case). also, strike the DMA_ATTR_FOO and DMA_ATTR_GOO since they have no plausible meaning.
James
Quoted 17 lines · James Bottomley
In general, the patches look reasonable to me. Just an observation:
Quoted 14 lines · On Tue, 2008-01-29 at 21:52 -0800, [email protected] wrote:
include/linux/dma-attrs.h +9
-0@@ -0,0 +1,48 @@ +#ifndef _DMA_ATTR_H +#define _DMA_ATTR_H +#ifdef ARCH_USES_DMA_ATTRS + +enum dma_attr { +DMA_ATTR_BARRIER , +DMA_ATTR_FOO , +DMA_ATTR_GOO , + DMA_ATTR_MAX,
Quoted 8 lines
include/linux/dma-attrs.h line 11
Quoted 2 lines
include/linux/dma-attrs.h +2
-0+}; +The attribute names (
DMA_ATTR_...) are going to have to live somewhere outside of the #ifdefARCH_USES_DMA_ATTRSotherwise we'll get compile failures of drivers using attributes on architectures that don't support them.
Right. Thanks for catching that.
Quoted 5 lines
Secondly,
DMA_ATTR_BARRIERdoesn't quite sound right. What you're actually doing is trying to prescribe strict ordering, so shouldn't this be something likeDMA_ATTR_STRICT_ORDERING(and perhaps with a correspondingDMA_ATTR_RELAXED_ORDERINGfor the PCIe case).
OK, I'll reconsider the names here.
Quoted 4 lines
... also,
strike theDMA_ATTR_FOOandDMA_ATTR_GOOsince they have no plausible meaning.
Yeah, I realized only after sending that I'd forgotten to remove these.
Signature · 1 line
Arthur