dma-mapping: Use unsigned long for dma_attrs
Subsystems (49)
v4 cover dma-mapping: Use unsigned long for dma_attrs
Hi,
This is fourth approach for replacing struct dma_attrs with unsigned long.
The main patch (1/44) doing the change is split into many subpatches for easier review (2-42). They should be squashed together when applying.
*Important:* Patchset is tested on my ARM platforms and *only* build tested on allyesconfigs: ARM, ARM64, i386, x86_64 and powerpc. Please kindly provide reviewes and tests for other platforms.
Rebased on next-20160607.
For easier testing the patchset is available here:
repo: https://github.com/krzk/linux branch: for-next/dma-attrs-const-v4
Changes since v3
================
1. Collect some acks.
2. Drop wrong patch 1/45 ("powerpc: dma-mapping: Don't hard-code the value of DMA_ATTR_WEAK_ORDERING").
3. Minor fix pointed out by Michael Ellerman.
Changes since v2
================
1. Follow Christoph Hellwig's comments (don't use BIT add documentation, remove dma_get_attr).
Rationale
=========
The dma-mapping core and the implementations do not change the DMA attributes passed by pointer. Thus the pointer can point to const data. However the attributes do not have to be a bitfield. Instead unsigned long will do fine:
1. This is just simpler. Both in terms of reading the code and setting attributes. Instead of initializing local attributes on the stack and passing pointer to it to dma_set_attr(), just set the bits.
2. It brings safeness and checking for const correctness because the attributes are passed by value.
Best regards,
Krzysztof
Krzysztof Kozlowski (44):
dma-mapping: Use unsigned long for dma_attrs
alpha: dma-mapping: Use unsigned long for dma_attrs
arc: dma-mapping: Use unsigned long for dma_attrs
ARM: dma-mapping: Use unsigned long for dma_attrs
arm64: dma-mapping: Use unsigned long for dma_attrs
avr32: dma-mapping: Use unsigned long for dma_attrs
blackfin: dma-mapping: Use unsigned long for dma_attrs
c6x: dma-mapping: Use unsigned long for dma_attrs
cris: dma-mapping: Use unsigned long for dma_attrs
frv: dma-mapping: Use unsigned long for dma_attrs drm/exynos: dma-mapping: Use unsigned long for dma_attrs drm/mediatek: dma-mapping: Use unsigned long for dma_attrs drm/msm: dma-mapping: Use unsigned long for dma_attrs drm/nouveau: dma-mapping: Use unsigned long for dma_attrs drm/rockship: dma-mapping: Use unsigned long for dma_attrs
infiniband: dma-mapping: Use unsigned long for dma_attrs
iommu: dma-mapping: Use unsigned long for dma_attrs [media] dma-mapping: Use unsigned long for dma_attrs
xen: dma-mapping: Use unsigned long for dma_attrs
swiotlb: dma-mapping: Use unsigned long for dma_attrs
powerpc: dma-mapping: Use unsigned long for dma_attrs
video: dma-mapping: Use unsigned long for dma_attrs
x86: dma-mapping: Use unsigned long for dma_attrs
iommu: intel: dma-mapping: Use unsigned long for dma_attrs
h8300: dma-mapping: Use unsigned long for dma_attrs
hexagon: dma-mapping: Use unsigned long for dma_attrs
ia64: dma-mapping: Use unsigned long for dma_attrs
m68k: dma-mapping: Use unsigned long for dma_attrs
metag: dma-mapping: Use unsigned long for dma_attrs
microblaze: dma-mapping: Use unsigned long for dma_attrs
mips: dma-mapping: Use unsigned long for dma_attrs
mn10300: dma-mapping: Use unsigned long for dma_attrs
nios2: dma-mapping: Use unsigned long for dma_attrs
openrisc: dma-mapping: Use unsigned long for dma_attrs
parisc: dma-mapping: Use unsigned long for dma_attrs
misc: mic: dma-mapping: Use unsigned long for dma_attrs
s390: dma-mapping: Use unsigned long for dma_attrs
sh: dma-mapping: Use unsigned long for dma_attrs
sparc: dma-mapping: Use unsigned long for dma_attrs
tile: dma-mapping: Use unsigned long for dma_attrs
unicore32: dma-mapping: Use unsigned long for dma_attrs
xtensa: dma-mapping: Use unsigned long for dma_attrs
dma-mapping: Remove dma_get_attr
dma-mapping: Document the DMA attributes next to the declaration
Documentation/DMA-API.txt | 33 +++--- Documentation/DMA-attributes.txt | 2 +- arch/alpha/include/asm/dma-mapping.h | 2 - arch/alpha/kernel/pci-noop.c | 2 +- arch/alpha/kernel/pci_iommu.c | 12 +- arch/arc/mm/dma.c | 12 +- arch/arm/common/dmabounce.c | 4 +- arch/arm/include/asm/dma-mapping.h | 13 +-- arch/arm/include/asm/xen/page-coherent.h | 16 +-- arch/arm/mm/dma-mapping.c | 121 ++++++++++--------- arch/arm/xen/mm.c | 8 +- arch/arm64/mm/dma-mapping.c | 67 +++++------ arch/avr32/mm/dma-coherent.c | 12 +- arch/blackfin/kernel/dma-mapping.c | 8 +- arch/c6x/include/asm/dma-mapping.h | 4 +- arch/c6x/kernel/dma.c | 9 +- arch/c6x/mm/dma-coherent.c | 4 +- arch/cris/arch-v32/drivers/pci/dma.c | 9 +- arch/frv/mb93090-mb00/pci-dma-nommu.c | 8 +- arch/frv/mb93090-mb00/pci-dma.c | 9 +- arch/h8300/kernel/dma.c | 8 +- arch/hexagon/include/asm/dma-mapping.h | 1 - arch/hexagon/kernel/dma.c | 8 +- arch/ia64/hp/common/sba_iommu.c | 22 ++-- arch/ia64/include/asm/machvec.h | 1 - arch/ia64/kernel/pci-swiotlb.c | 4 +- arch/ia64/sn/pci/pci_dma.c | 22 ++-- arch/m68k/kernel/dma.c | 12 +- arch/metag/kernel/dma.c | 16 +-- arch/microblaze/include/asm/dma-mapping.h | 1 - arch/microblaze/kernel/dma.c | 12 +- arch/mips/cavium-octeon/dma-octeon.c | 8 +- arch/mips/loongson64/common/dma-swiotlb.c | 10 +- arch/mips/mm/dma-default.c | 20 ++-- arch/mips/netlogic/common/nlm-dma.c | 4 +- arch/mn10300/mm/dma-alloc.c | 8 +- arch/nios2/mm/dma-mapping.c | 12 +- arch/openrisc/kernel/dma.c | 21 ++-- arch/parisc/kernel/pci-dma.c | 18 +-- arch/powerpc/include/asm/dma-mapping.h | 7 +- arch/powerpc/include/asm/iommu.h | 10 +- arch/powerpc/kernel/dma-iommu.c | 12 +- arch/powerpc/kernel/dma.c | 18 +-- arch/powerpc/kernel/ibmebus.c | 12 +- arch/powerpc/kernel/iommu.c | 12 +- arch/powerpc/kernel/vio.c | 12 +- arch/powerpc/platforms/cell/iommu.c | 28 ++--- arch/powerpc/platforms/pasemi/iommu.c | 2 +- arch/powerpc/platforms/powernv/npu-dma.c | 8 +- arch/powerpc/platforms/powernv/pci-ioda.c | 4 +- arch/powerpc/platforms/powernv/pci.c | 2 +- arch/powerpc/platforms/powernv/pci.h | 2 +- arch/powerpc/platforms/ps3/system-bus.c | 18 +-- arch/powerpc/platforms/pseries/iommu.c | 6 +- arch/powerpc/sysdev/dart_iommu.c | 2 +- arch/s390/include/asm/dma-mapping.h | 1 - arch/s390/pci/pci_dma.c | 23 ++-- arch/sh/include/asm/dma-mapping.h | 4 +- arch/sh/kernel/dma-nommu.c | 4 +- arch/sh/mm/consistent.c | 4 +- arch/sparc/kernel/iommu.c | 12 +- arch/sparc/kernel/ioport.c | 24 ++-- arch/sparc/kernel/pci_sun4v.c | 12 +- arch/tile/kernel/pci-dma.c | 28 ++--- arch/unicore32/mm/dma-swiotlb.c | 4 +- arch/x86/include/asm/dma-mapping.h | 5 +- arch/x86/include/asm/swiotlb.h | 4 +- arch/x86/include/asm/xen/page-coherent.h | 9 +- arch/x86/kernel/amd_gart_64.c | 20 ++-- arch/x86/kernel/pci-calgary_64.c | 14 +-- arch/x86/kernel/pci-dma.c | 4 +- arch/x86/kernel/pci-nommu.c | 4 +- arch/x86/kernel/pci-swiotlb.c | 4 +- arch/x86/pci/sta2x11-fixup.c | 2 +- arch/x86/pci/vmd.c | 16 +-- arch/xtensa/kernel/pci-dma.c | 12 +- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_g2d.c | 12 +- drivers/gpu/drm/exynos/exynos_drm_gem.c | 20 ++-- drivers/gpu/drm/exynos/exynos_drm_gem.h | 2 +- drivers/gpu/drm/mediatek/mtk_drm_gem.c | 13 +-- drivers/gpu/drm/mediatek/mtk_drm_gem.h | 2 +- drivers/gpu/drm/msm/msm_drv.c | 13 +-- .../gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c | 13 +-- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 17 ++- drivers/gpu/drm/rockchip/rockchip_drm_gem.h | 2 +- drivers/infiniband/core/umem.c | 7 +- drivers/iommu/amd_iommu.c | 12 +- drivers/iommu/dma-iommu.c | 8 +- drivers/iommu/intel-iommu.c | 12 +- drivers/media/platform/sti/bdisp/bdisp-hw.c | 26 ++--- drivers/media/v4l2-core/videobuf2-dma-contig.c | 30 ++--- drivers/media/v4l2-core/videobuf2-dma-sg.c | 19 +-- drivers/misc/mic/host/mic_boot.c | 20 ++-- drivers/parisc/ccio-dma.c | 16 +-- drivers/parisc/sba_iommu.c | 16 +-- drivers/video/fbdev/omap2/omapfb/omapfb-main.c | 12 +- drivers/video/fbdev/omap2/omapfb/omapfb.h | 3 +- drivers/xen/swiotlb-xen.c | 14 +-- include/linux/dma-attrs.h | 72 ------------ include/linux/dma-iommu.h | 6 +- include/linux/dma-mapping.h | 128 ++++++++++++++------- include/linux/swiotlb.h | 10 +- include/media/videobuf2-dma-contig.h | 7 +- include/rdma/ib_verbs.h | 8 +- include/xen/swiotlb-xen.h | 12 +- lib/dma-noop.c | 9 +- lib/swiotlb.c | 13 ++- 108 files changed, 691 insertions(+), 793 deletions(-) delete mode 100644 include/linux/dma-attrs.h
Signature · 1 line
1.9.1
PATCH v4 1/44 dma-mapping: Use unsigned long for dma_attrs
The dma-mapping core and the implementations do not change the DMA attributes passed by pointer. Thus the pointer can point to const data. However the attributes do not have to be a bitfield. Instead unsigned long will do fine:
1. This is just simpler. Both in terms of reading the code and setting attributes. Instead of initializing local attributes on the stack and passing pointer to it to dma_set_attr(), just set the bits.
2. It brings safeness and checking for const correctness because the attributes are passed by value.
Semantic patches for this change (at least most of them):
===
virtual patch
virtual context
@r@
identifier f, attrs;
@@
f(...,
- struct dma_attrs *attrs
+ unsigned long attrs
, ...)
{
...
}
@@
identifier r.f;
@@
f(...,
- NULL
+ 0
)
===
// Options: --all-includes
virtual patch
virtual context
@r@
identifier f, attrs;
type t;
@@
t f(..., struct dma_attrs *attrs);
@@
identifier r.f;
@@
f(...,
- NULL
+ 0
)
===
--- Documentation/DMA-API.txt | 29 +++++------ Documentation/DMA-attributes.txt | 2 +- include/linux/dma-attrs.h | 72 --------------------------- include/linux/dma-mapping.h | 105 +++++++++++++++++++++++---------------- lib/dma-noop.c | 9 ++-- 5 files changed, 80 insertions(+), 137 deletions(-) delete mode 100644 include/linux/dma-attrs.h
Documentation/DMA-API.txt +13 -16
@@ -369,35 +369,32 @@ See also dma_map_single(). dma_addr_t dma_map_single_attrs(struct device *dev, void *cpu_addr, size_t size, enum dma_data_direction dir, - struct dma_attrs *attrs) + unsigned long attrs) void dma_unmap_single_attrs(struct device *dev, dma_addr_t dma_addr, size_t size, enum dma_data_direction dir, - struct dma_attrs *attrs) + unsigned long attrs) int dma_map_sg_attrs(struct device *dev, struct scatterlist *sgl, int nents, enum dma_data_direction dir, - struct dma_attrs *attrs) + unsigned long attrs) void dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sgl, int nents, enum dma_data_direction dir, - struct dma_attrs *attrs) + unsigned long attrs) The four functions above are just like the counterpart functions without the _attrs suffixes, except that they pass an optional -struct dma_attrs*. - -struct dma_attrs encapsulates a set of "DMA attributes". For the -definition of struct dma_attrs see linux/dma-attrs.h. +dma_attrs. The interpretation of DMA attributes is architecture-specific, and each attribute should be documented in Documentation/DMA-attributes.txt. -If struct dma_attrs* is NULL, the semantics of each of these -functions is identical to those of the corresponding function +If dma_attrs are 0, the semantics of each of these functions +is identical to those of the corresponding function without the _attrs suffix. As a result dma_map_single_attrs() can generally replace dma_map_single(), etc.
@@ -405,15 +402,15 @@ As an example of the use of the *_attrs functions, here's how you could pass an attribute DMA_ATTR_FOO when mapping memory for DMA: -#include <linux/dma-attrs.h> -/* DMA_ATTR_FOO should be defined in linux/dma-attrs.h and +#include <linux/dma-mapping.h> +/* DMA_ATTR_FOO should be defined in linux/dma-mapping.h and * documented in Documentation/DMA-attributes.txt */ ... - DEFINE_DMA_ATTRS(attrs); - dma_set_attr(DMA_ATTR_FOO, &attrs); + unsigned long attr; + attr |= DMA_ATTR_FOO; .... - n = dma_map_sg_attrs(dev, sg, nents, DMA_TO_DEVICE, &attr); + n = dma_map_sg_attrs(dev, sg, nents, DMA_TO_DEVICE, attr); .... Architectures that care about DMA_ATTR_FOO would check for its
@@ -422,7 +419,7 @@ routines, e.g.: void whizco_dma_map_sg_attrs(struct device *dev, dma_addr_t dma_addr, size_t size, enum dma_data_direction dir, - struct dma_attrs *attrs) + unsigned long attrs) { .... int foo = dma_get_attr(DMA_ATTR_FOO, attrs);
Documentation/DMA-attributes.txt +1 -1
@@ -2,7 +2,7 @@ ============== This document describes the semantics of the DMA attributes that are -defined in linux/dma-attrs.h. +defined in linux/dma-mapping.h. DMA_ATTR_WRITE_BARRIER ----------------------
include/linux/dma-attrs.h deleted +0 -72
72 lines not on this page · raw message
include/linux/dma-mapping.h +61 -44
266 lines not on this page · raw message
lib/dma-noop.c +5 -4
@@ -10,7 +10,7 @@static void *dma_noop_alloc (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t gfp, -struct dma_attrs *attrs) +unsigned long attrs) {void *ret;
@@ -22,7 +22,7 @@ static void *dma_noop_alloc(struct device *dev, size_t size,static void dma_noop_free (struct device *dev,size_t size,void *cpu_addr,dma_addr_t dma_addr, -struct dma_attrs *attrs) +unsigned long attrs) {free_pages ((unsigned long )cpu_addr,get_order (size)); }
@@ -30,13 +30,14 @@ static void dma_noop_free(struct device *dev, size_t size,static dma_addr_t dma_noop_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {return page_to_phys (page) + offset; }static int dma_noop_map_sg (struct device *dev,struct scatterlist *sgl,int nents, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir, +unsigned long attrs) {int i;struct scatterlist *sg;
Signature · 1 line
1.9.1
Quoted 11 lines · Krzysztof Kozlowski
The dma-mapping core and the implementations do not change the DMA attributes passed by pointer. Thus the pointer can point to const data. However the attributes do not have to be a bitfield. Instead unsigned long will do fine:
1. This is just simpler. Both in terms of reading the code and setting attributes. Instead of initializing local attributes on the stack and passing pointer to it to
dma_set_attr(), just set the bits.2. It brings safeness and checking for const correctness because the attributes are passed by value.
Do we not expect the number of argument to grow ? This "cleanup" would do away with such possibilities, and then require adding the API later, and this requiring a full set of collateral evolutions again when this is needed. What was the original motivation for using this instead of the approach you are suggesting ?
If the concern is the const data, why not require const struct dma_attr for the APIs that we know can and should use const ?
Luis
Quoted 10 lines · Luis R. Rodriguez
Quoted 9 lines · Krzysztof Kozlowski
The dma-mapping core and the implementations do not change the DMA attributes passed by pointer. Thus the pointer can point to const data. However the attributes do not have to be a bitfield. Instead unsigned long will do fine:
1. This is just simpler. Both in terms of reading the code and setting attributes. Instead of initializing local attributes on the stack and passing pointer to it to
dma_set_attr(), just set the bits.
Quoted 8 lines
Quoted 2 lines
2. It brings safeness and checking for const correctness because the attributes are passed by value.
Do we not expect the number of argument to grow ? This "cleanup" would do away with such possibilities, and then require adding the API later, and this requiring a full set of collateral evolutions again when this is needed. What was the original motivation for using this instead of the approach you are suggesting ?
What do you mean by "possibilities of argument to grow"? Something like adding new members to "struct dma_attrs" and changing its meaning? I think such growth is still constrained - you cannot put there anything without changing the meaning of the argument.
However you are right that "unsigned long" removes that possibility completely.
The dma-attrs in current form were added around 2008 in 74bc7ceebfa1 ("dma: add dma_*map*_attrs() interfaces"), I think. Since that time, for example, the dma_map_*_attrs() did not change.
Quoted 2 lines
If the concern is the const data, why not require const struct
dma_attrfor the APIs that we know can and should use const ?
The const is one concern. Complicated (more than expected) usage of dma attributes by the caller is second.
Switching it to const would also reduce the possibilities of API extension.
Best regards,
Krzysztof
Quoted 14 lines · Krzysztof Kozlowski
Quoted 13 lines · Luis R. Rodriguez
Quoted 11 lines · Krzysztof Kozlowski
The dma-mapping core and the implementations do not change the DMA attributes passed by pointer. Thus the pointer can point to const data. However the attributes do not have to be a bitfield. Instead unsigned long will do fine:
1. This is just simpler. Both in terms of reading the code and setting attributes. Instead of initializing local attributes on the stack and passing pointer to it to
dma_set_attr(), just set the bits.2. It brings safeness and checking for const correctness because the attributes are passed by value.
Quoted 8 lines
Quoted 5 lines
Do we not expect the number of argument to grow ? This "cleanup" would do away with such possibilities, and then require adding the API later, and this requiring a full set of collateral evolutions again when this is needed. What was the original motivation for using this instead of the approach you are suggesting ?
What do you mean by "possibilities of argument to grow"? Something like adding new members to "struct
dma_attrs" and changing its meaning?
Yup that.
Quoted 2 lines
I think such growth is still constrained - you cannot put there anything without changing the meaning of the argument.
Obviously, however it would mean no needed collateral evolutions, just an extension to the struct and drivers that use the new member can make use of it.
Quoted 2 lines
However you are right that "unsigned long" removes that possibility completely.
This is the concern.
Quoted 3 lines
The dma-attrs in current form were added around 2008 in
74bc7ceebfa1("dma: add dma_*map*_attrs() interfaces"), I think. Since that time, for example, the dma_map_*_attrs() did not change.
So we don't expect this to change either?
Quoted 8 lines
Quoted 2 lines
If the concern is the const data, why not require const struct
dma_attrfor the APIs that we know can and should use const ?The const is one concern. Complicated (more than expected) usage of dma attributes by the caller is second.
Switching it to const would also reduce the possibilities of API extension.
My point was that const can be used for only APIs that we are sure of that need it.
Luis
Quoted 24 lines · Luis R. Rodriguez
Quoted 14 lines · Krzysztof Kozlowski
Quoted 13 lines · Luis R. Rodriguez
Quoted 11 lines · Krzysztof Kozlowski
The dma-mapping core and the implementations do not change the DMA attributes passed by pointer. Thus the pointer can point to const data. However the attributes do not have to be a bitfield. Instead unsigned long will do fine:
1. This is just simpler. Both in terms of reading the code and setting attributes. Instead of initializing local attributes on the stack and passing pointer to it to
dma_set_attr(), just set the bits.2. It brings safeness and checking for const correctness because the attributes are passed by value.
Quoted 8 lines
Quoted 5 lines
Do we not expect the number of argument to grow ? This "cleanup" would do away with such possibilities, and then require adding the API later, and this requiring a full set of collateral evolutions again when this is needed. What was the original motivation for using this instead of the approach you are suggesting ?
What do you mean by "possibilities of argument to grow"? Something like adding new members to "struct
dma_attrs" and changing its meaning?
Quoted 8 lines
Yup that.
Quoted 2 lines
I think such growth is still constrained - you cannot put there anything without changing the meaning of the argument.
Obviously, however it would mean no needed collateral evolutions, just an extension to the struct and drivers that use the new member can make use of it.
For parts of the API, there is still possibility of adding new layer of wrapping, just like it was done with dma_map_single_attrs():
#define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, NULL)
For the dma_map_ops not...
Quoted 5 lines
Quoted 3 lines
The dma-attrs in current form were added around 2008 in
74bc7ceebfa1("dma: add dma_*map*_attrs() interfaces"), I think. Since that time, for example, the dma_map_*_attrs() did not change.So we don't expect this to change either?
I do not know, I am not aware of planned changes to that.
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
If the concern is the const data, why not require const struct
dma_attrfor the APIs that we know can and should use const ?
Quoted 8 lines
Quoted 5 lines
The const is one concern. Complicated (more than expected) usage of dma attributes by the caller is second.
Switching it to const would also reduce the possibilities of API extension.
My point was that const can be used for only APIs that we are sure of that need it.
As of now, dma_attrs should be const everywhere. That would be almost the same patchset as current one. If you consider extending the dma_attrs to something new and not yet known, then how will differentiate between cases when 'const' is needed for sure?
I understand your concern. Sticking to current API for that reason might be a good defensive API programming... or might be way of keeping this function prototype for long...
Best regards,
Krzysztof
Quoted 9 lines · Krzysztof Kozlowski
Quoted 6 lines · Luis R. Rodriguez
Quoted 3 lines · Krzysztof Kozlowski
The dma-attrs in current form were added around 2008 in
74bc7ceebfa1("dma: add dma_*map*_attrs() interfaces"), I think. Since that time, for example, the dma_map_*_attrs() did not change.So we don't expect this to change either?
I do not know, I am not aware of planned changes to that.
If this will not change then I think this change is good.
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 2 lines
If the concern is the const data, why not require const struct
dma_attrfor the APIs that we know can and should use const ?The const is one concern. Complicated (more than expected) usage of dma attributes by the caller is second.
Switching it to const would also reduce the possibilities of API extension.
Quoted 7 lines
Quoted 2 lines
My point was that const can be used for only APIs that we are sure of that need it.
As of now,
dma_attrsshould be const everywhere. That would be almost the same patchset as current one. If you consider extending thedma_attrsto something new and not yet known, then how will differentiate between cases when 'const' is needed for sure?
Depends on the use case, but if it known it should always be const then great.
Quoted 3 lines
I understand your concern. Sticking to current API for that reason might be a good defensive API programming... or might be way of keeping this function prototype for long...
Since this hasn't changed for years at all I think your change is reasonable.
Luis
Quoted 5 lines · Luis R. Rodriguez
Do we not expect the number of argument to grow ? This "cleanup" would do away with such possibilities, and then require adding the API later, and this requiring a full set of collateral evolutions again when this is needed. What was the original motivation for using this instead of the approach you are suggesting ?
We still got plenty of space for attrs. If you're worried about running out of 32 flags we could do a dma_attrs_t typedef that we could swich to a u64. That would have another advantage in that we could add a __bitwise sparse annotation to avoid people passing the wrong kind of flags.
Quoted 7 lines · Christoph Hellwig
Quoted 5 lines · Luis R. Rodriguez
Do we not expect the number of argument to grow ? This "cleanup" would do away with such possibilities, and then require adding the API later, and this requiring a full set of collateral evolutions again when this is needed. What was the original motivation for using this instead of the approach you are suggesting ?
Quoted 5 lines
We still got plenty of space for attrs. If you're worried about running out of 32 flags we could do a
dma_attrs_ttypedef that we could swich to a u64. That would have another advantage in that we could add a__bitwisesparse annotation to avoid people passing the wrong kind of flags.
History shows only sparse use of extensions of these these attributes so I think the approach with a typedef is definitely more suitable for this API, and should last long enough. The added gain of the annotation is a nice bonus.
Luis
PATCH v4 2/44 alpha: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/alpha/include/asm/dma-mapping.h | 2 -- arch/alpha/kernel/pci-noop.c | 2 +- arch/alpha/kernel/pci_iommu.c | 12 ++++++------ 3 files changed, 7 insertions(+), 9 deletions(-)
arch/alpha/include/asm/dma-mapping.h +0 -2
@@ -1,8 +1,6 @@#ifndef _ALPHA_DMA_MAPPING_H#define _ALPHA_DMA_MAPPING_H -#include <linux/dma-attrs.h> -extern struct dma_map_ops *dma_ops;static inline struct dma_map_ops *get_dma_ops (struct device *dev)
arch/alpha/kernel/pci-noop.c +1 -1
@@ -109,7 +109,7 @@ sys_pciconfig_write(unsigned long bus, unsigned long dfn,static void *alpha_noop_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t gfp, -struct dma_attrs *attrs) +unsigned long attrs) {void *ret;
arch/alpha/kernel/pci_iommu.c +6 -6
@@ -349,7 +349,7 @@ static struct pci_dev *alpha_gendev_to_pci(struct device *dev)static dma_addr_t alpha_pci_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct pci_dev *pdev =alpha_gendev_to_pci (dev);int dac_allowed;
@@ -369,7 +369,7 @@ static dma_addr_t alpha_pci_map_page(struct device *dev, struct page *page,static void alpha_pci_unmap_page (struct device *dev,dma_addr_t dma_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {unsigned long flags;struct pci_dev *pdev =alpha_gendev_to_pci (dev);
@@ -433,7 +433,7 @@ static void alpha_pci_unmap_page(struct device *dev, dma_addr_t dma_addr,static void *alpha_pci_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_addrp,gfp_t gfp, -struct dma_attrs *attrs) +unsigned long attrs) {struct pci_dev *pdev =alpha_gendev_to_pci (dev);void *cpu_addr;
@@ -478,7 +478,7 @@ try_again:static void alpha_pci_free_coherent (struct device *dev,size_t size,void *cpu_addr,dma_addr_t dma_addr, -struct dma_attrs *attrs) +unsigned long attrs) {struct pci_dev *pdev =alpha_gendev_to_pci (dev);pci_unmap_single (pdev, dma_addr, size,PCI_DMA_BIDIRECTIONAL );
@@ -651,7 +651,7 @@ sg_fill(struct device *dev, struct scatterlist *leader, struct scatterlist *end,static int alpha_pci_map_sg (struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct pci_dev *pdev =alpha_gendev_to_pci (dev);struct scatterlist *start, *end, *out;
@@ -729,7 +729,7 @@ static int alpha_pci_map_sg(struct device *dev, struct scatterlist *sg,static void alpha_pci_unmap_sg (struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct pci_dev *pdev =alpha_gendev_to_pci (dev);unsigned long flags;
Signature · 1 line
1.9.1
PATCH v4 3/44 arc: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/arc/mm/dma.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arc/mm/dma.c +4 -4
@@ -22,7 +22,7 @@static void *arc_dma_alloc (struct device *dev,size_t size, -dma_addr_t *dma_handle,gfp_t gfp,struct dma_attrs *attrs) +dma_addr_t *dma_handle,gfp_t gfp,unsigned long attrs) {unsigned long order =get_order (size);struct page *page;
@@ -90,7 +90,7 @@ static void *arc_dma_alloc(struct device *dev, size_t size, }static void arc_dma_free (struct device *dev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) {struct page *page =virt_to_page (dma_handle);int is_non_coh =1 ;
@@ -129,7 +129,7 @@ static void _dma_cache_sync(phys_addr_t paddr, size_t size,static dma_addr_t arc_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {phys_addr_t paddr =page_to_phys (page) + offset;_dma_cache_sync (paddr, size, dir);
@@ -137,7 +137,7 @@ static dma_addr_t arc_dma_map_page(struct device *dev, struct page *page, }static int arc_dma_map_sg (struct device *dev,struct scatterlist *sg, -int nents,enum dma_data_direction dir,struct dma_attrs *attrs) +int nents,enum dma_data_direction dir,unsigned long attrs) {struct scatterlist *s;int i;
Signature · 1 line
1.9.1
Re: [PATCH v4 03/44] arc: dma-mapping: Use unsigned long for dma_attrs
Quoted 4 lines · Krzysztof Kozlowski
Split out subsystem specific changes for easier reviews. This will be squashed with main commit.
Signed-off-by Krzysztof Kozlowski <k.kozlowski at samsung.com>
PATCH v4 4/44 ARM: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/arm/common/dmabounce.c | 4 +- arch/arm/include/asm/dma-mapping.h | 13 +++-- arch/arm/include/asm/xen/page-coherent.h | 16 +++--- arch/arm/mm/dma-mapping.c | 85 +++++++++++++++----------------- arch/arm/xen/mm.c | 4 +- 5 files changed, 57 insertions(+), 65 deletions(-)
arch/arm/common/dmabounce.c +2 -2
@@ -310,7 +310,7 @@ static inline void unmap_single(struct device *dev, struct safe_buffer *buf,*/ static dma_addr_t dmabounce_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {dma_addr_t dma_addr;int ret;
@@ -344,7 +344,7 @@ static dma_addr_t dmabounce_map_page(struct device *dev, struct page *page,* should be) */ static void dmabounce_unmap_page (struct device *dev,dma_addr_t dma_addr,size_t size, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {struct safe_buffer *buf;
arch/arm/include/asm/dma-mapping.h +6 -7
@@ -5,7 +5,6 @@#include <linux/mm_types.h> #include <linux/scatterlist.h> -#include <linux/dma-attrs.h> #include <linux/dma-debug.h> #include <asm/memory.h>
@@ -174,7 +173,7 @@ static inline void dma_mark_clean(void *addr, size_t size) { }* to be the device-viewed address. */ extern void *arm_dma_alloc (struct device *dev,size_t size,dma_addr_t *handle, -gfp_t gfp,struct dma_attrs *attrs); +gfp_t gfp,unsigned long attrs);/** * arm_dma_free - free memory allocated by arm_dma_alloc
@@ -191,7 +190,7 @@ extern void *arm_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,* during and after this call executing are illegal. */ extern void arm_dma_free (struct device *dev,size_t size,void *cpu_addr, -dma_addr_t handle,struct dma_attrs *attrs); +dma_addr_t handle,unsigned long attrs);/** * arm_dma_mmap - map a coherent DMA allocation into user space
@@ -208,7 +207,7 @@ extern void arm_dma_free(struct device *dev, size_t size, void *cpu_addr,*/ extern int arm_dma_mmap (struct device *dev,struct vm_area_struct *vma,void *cpu_addr,dma_addr_t dma_addr,size_t size, -struct dma_attrs *attrs); +unsigned long attrs);/* * This can be called during early boot to increase the size of the atomic
@@ -262,16 +261,16 @@ extern void dmabounce_unregister_dev(struct device *);* The scatter list versions of the above methods. */ extern int arm_dma_map_sg (struct device *,struct scatterlist *,int , -enum dma_data_direction ,struct dma_attrs *attrs); +enum dma_data_direction ,unsigned long attrs);extern void arm_dma_unmap_sg (struct device *,struct scatterlist *,int , -enum dma_data_direction ,struct dma_attrs *attrs); +enum dma_data_direction ,unsigned long attrs);extern void arm_dma_sync_sg_for_cpu (struct device *,struct scatterlist *,int ,enum dma_data_direction );extern void arm_dma_sync_sg_for_device (struct device *,struct scatterlist *,int ,enum dma_data_direction );extern int arm_dma_get_sgtable (struct device *dev,struct sg_table *sgt,void *cpu_addr,dma_addr_t dma_addr,size_t size, -struct dma_attrs *attrs); +unsigned long attrs);#endif /* __KERNEL__ */ #endif
arch/arm/include/asm/xen/page-coherent.h +6 -10
@@ -2,15 +2,14 @@#define _ASM_ARM_XEN_PAGE_COHERENT_H#include <asm/page.h> -#include <linux/dma-attrs.h> #include <linux/dma-mapping.h> void __xen_dma_map_page (struct device *hwdev,struct page *page,dma_addr_t dev_addr,unsigned long offset,size_t size, -enum dma_data_direction dir,struct dma_attrs *attrs); +enum dma_data_direction dir,unsigned long attrs);void __xen_dma_unmap_page (struct device *hwdev,dma_addr_t handle,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs); +unsigned long attrs);void __xen_dma_sync_single_for_cpu (struct device *hwdev,dma_addr_t handle,size_t size,enum dma_data_direction dir);
@@ -18,22 +17,20 @@ void __xen_dma_sync_single_for_device(struct device *hwdev, dma_addr_t handle, size_t size, enum dma_data_direction dir);static inline void *xen_alloc_coherent_pages (struct device *hwdev,size_t size, -dma_addr_t *dma_handle,gfp_t flags, -struct dma_attrs *attrs) +dma_addr_t *dma_handle,gfp_t flags,unsigned long attrs) {return __generic_dma_ops (hwdev)->alloc (hwdev, size, dma_handle, flags, attrs); }static inline void xen_free_coherent_pages (struct device *hwdev,size_t size, -void *cpu_addr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +void *cpu_addr,dma_addr_t dma_handle,unsigned long attrs) {__generic_dma_ops (hwdev)->free (hwdev, size, cpu_addr, dma_handle, attrs); }static inline void xen_dma_map_page (struct device *hwdev,struct page *page,dma_addr_t dev_addr,unsigned long offset,size_t size, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {unsigned long page_pfn =page_to_xen_pfn (page);unsigned long dev_pfn =XEN_PFN_DOWN (dev_addr);
@@ -58,8 +55,7 @@ static inline void xen_dma_map_page(struct device *hwdev, struct page *page, }static inline void xen_dma_unmap_page (struct device *hwdev,dma_addr_t handle, -size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +size_t size,enum dma_data_direction dir,unsigned long attrs) {unsigned long pfn =PFN_DOWN (handle);/*
arch/arm/mm/dma-mapping.c +41 -44
297 lines not on this page · raw message
arch/arm/xen/mm.c +2 -2
@@ -98,7 +98,7 @@ static void __xen_dma_page_cpu_to_dev(struct device *hwdev, dma_addr_t handle,void __xen_dma_map_page (struct device *hwdev,struct page *page,dma_addr_t dev_addr,unsigned long offset,size_t size, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {if (is_device_dma_coherent (hwdev))return ;
@@ -110,7 +110,7 @@ void __xen_dma_map_page(struct device *hwdev, struct page *page,void __xen_dma_unmap_page (struct device *hwdev,dma_addr_t handle,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {if (is_device_dma_coherent (hwdev))
Signature · 1 line
1.9.1
PATCH v4 4/44 ARM: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/arm/common/dmabounce.c | 4 +- arch/arm/include/asm/dma-mapping.h | 13 +++-- arch/arm/include/asm/xen/page-coherent.h | 16 +++--- arch/arm/mm/dma-mapping.c | 85 +++++++++++++++----------------- arch/arm/xen/mm.c | 4 +- 5 files changed, 57 insertions(+), 65 deletions(-)
arch/arm/common/dmabounce.c +2 -2
@@ -310,7 +310,7 @@ static inline void unmap_single(struct device *dev, struct safe_buffer *buf,*/ static dma_addr_t dmabounce_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {dma_addr_t dma_addr;int ret;
@@ -344,7 +344,7 @@ static dma_addr_t dmabounce_map_page(struct device *dev, struct page *page,* should be) */ static void dmabounce_unmap_page (struct device *dev,dma_addr_t dma_addr,size_t size, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {struct safe_buffer *buf;
arch/arm/include/asm/dma-mapping.h +6 -7
@@ -5,7 +5,6 @@#include <linux/mm_types.h> #include <linux/scatterlist.h> -#include <linux/dma-attrs.h> #include <linux/dma-debug.h> #include <asm/memory.h>
@@ -174,7 +173,7 @@ static inline void dma_mark_clean(void *addr, size_t size) { }* to be the device-viewed address. */ extern void *arm_dma_alloc (struct device *dev,size_t size,dma_addr_t *handle, -gfp_t gfp,struct dma_attrs *attrs); +gfp_t gfp,unsigned long attrs);/** * arm_dma_free - free memory allocated by arm_dma_alloc
@@ -191,7 +190,7 @@ extern void *arm_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,* during and after this call executing are illegal. */ extern void arm_dma_free (struct device *dev,size_t size,void *cpu_addr, -dma_addr_t handle,struct dma_attrs *attrs); +dma_addr_t handle,unsigned long attrs);/** * arm_dma_mmap - map a coherent DMA allocation into user space
@@ -208,7 +207,7 @@ extern void arm_dma_free(struct device *dev, size_t size, void *cpu_addr,*/ extern int arm_dma_mmap (struct device *dev,struct vm_area_struct *vma,void *cpu_addr,dma_addr_t dma_addr,size_t size, -struct dma_attrs *attrs); +unsigned long attrs);/* * This can be called during early boot to increase the size of the atomic
@@ -262,16 +261,16 @@ extern void dmabounce_unregister_dev(struct device *);* The scatter list versions of the above methods. */ extern int arm_dma_map_sg (struct device *,struct scatterlist *,int , -enum dma_data_direction ,struct dma_attrs *attrs); +enum dma_data_direction ,unsigned long attrs);extern void arm_dma_unmap_sg (struct device *,struct scatterlist *,int , -enum dma_data_direction ,struct dma_attrs *attrs); +enum dma_data_direction ,unsigned long attrs);extern void arm_dma_sync_sg_for_cpu (struct device *,struct scatterlist *,int ,enum dma_data_direction );extern void arm_dma_sync_sg_for_device (struct device *,struct scatterlist *,int ,enum dma_data_direction );extern int arm_dma_get_sgtable (struct device *dev,struct sg_table *sgt,void *cpu_addr,dma_addr_t dma_addr,size_t size, -struct dma_attrs *attrs); +unsigned long attrs);#endif /* __KERNEL__ */ #endif
arch/arm/include/asm/xen/page-coherent.h +6 -10
@@ -2,15 +2,14 @@#define _ASM_ARM_XEN_PAGE_COHERENT_H#include <asm/page.h> -#include <linux/dma-attrs.h> #include <linux/dma-mapping.h> void __xen_dma_map_page (struct device *hwdev,struct page *page,dma_addr_t dev_addr,unsigned long offset,size_t size, -enum dma_data_direction dir,struct dma_attrs *attrs); +enum dma_data_direction dir,unsigned long attrs);void __xen_dma_unmap_page (struct device *hwdev,dma_addr_t handle,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs); +unsigned long attrs);void __xen_dma_sync_single_for_cpu (struct device *hwdev,dma_addr_t handle,size_t size,enum dma_data_direction dir);
@@ -18,22 +17,20 @@ void __xen_dma_sync_single_for_device(struct device *hwdev, dma_addr_t handle, size_t size, enum dma_data_direction dir);static inline void *xen_alloc_coherent_pages (struct device *hwdev,size_t size, -dma_addr_t *dma_handle,gfp_t flags, -struct dma_attrs *attrs) +dma_addr_t *dma_handle,gfp_t flags,unsigned long attrs) {return __generic_dma_ops (hwdev)->alloc (hwdev, size, dma_handle, flags, attrs); }static inline void xen_free_coherent_pages (struct device *hwdev,size_t size, -void *cpu_addr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +void *cpu_addr,dma_addr_t dma_handle,unsigned long attrs) {__generic_dma_ops (hwdev)->free (hwdev, size, cpu_addr, dma_handle, attrs); }static inline void xen_dma_map_page (struct device *hwdev,struct page *page,dma_addr_t dev_addr,unsigned long offset,size_t size, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {unsigned long page_pfn =page_to_xen_pfn (page);unsigned long dev_pfn =XEN_PFN_DOWN (dev_addr);
@@ -58,8 +55,7 @@ static inline void xen_dma_map_page(struct device *hwdev, struct page *page, }static inline void xen_dma_unmap_page (struct device *hwdev,dma_addr_t handle, -size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +size_t size,enum dma_data_direction dir,unsigned long attrs) {unsigned long pfn =PFN_DOWN (handle);/*
arch/arm/mm/dma-mapping.c +41 -44
297 lines not on this page · raw message
arch/arm/xen/mm.c +2 -2
@@ -98,7 +98,7 @@ static void __xen_dma_page_cpu_to_dev(struct device *hwdev, dma_addr_t handle,void __xen_dma_map_page (struct device *hwdev,struct page *page,dma_addr_t dev_addr,unsigned long offset,size_t size, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {if (is_device_dma_coherent (hwdev))return ;
@@ -110,7 +110,7 @@ void __xen_dma_map_page(struct device *hwdev, struct page *page,void __xen_dma_unmap_page (struct device *hwdev,dma_addr_t handle,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {if (is_device_dma_coherent (hwdev))
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH v4 5/44 arm64: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/arm64/mm/dma-mapping.c | 57 +++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 28 deletions(-)
arch/arm64/mm/dma-mapping.c +29 -28
@@ -29,7 +29,7 @@#include <asm/cacheflush.h> -static pgprot_t __get_dma_pgprot (const struct dma_attrs *attrs,pgprot_t prot, +static pgprot_t __get_dma_pgprot (unsigned long attrs,pgprot_t prot,bool coherent) {if (!coherent ||dma_get_attr (DMA_ATTR_WRITE_COMBINE , attrs))
@@ -88,7 +88,7 @@ static int __free_from_pool(void *start, size_t size)static void *__dma_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flags, -const struct dma_attrs *attrs) +unsigned long attrs) {if (dev ==NULL ) {WARN_ONCE (1 ,"Use an actual device structure for DMA allocation\n" );
@@ -118,7 +118,7 @@ static void *__dma_alloc_coherent(struct device *dev, size_t size,static void __dma_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -const struct dma_attrs *attrs) +unsigned long attrs) {bool freed;phys_addr_t paddr =dma_to_phys (dev, dma_handle);
@@ -137,7 +137,7 @@ static void __dma_free_coherent(struct device *dev, size_t size,static void *__dma_alloc (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flags, -struct dma_attrs *attrs) +unsigned long attrs) {struct page *page;void *ptr, *coherent_ptr;
@@ -185,7 +185,7 @@ no_mem:static void __dma_free (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) {void *swiotlb_addr =phys_to_virt (dma_to_phys (dev, dma_handle));
@@ -202,7 +202,7 @@ static void __dma_free(struct device *dev, size_t size,static dma_addr_t __swiotlb_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {dma_addr_t dev_addr;
@@ -216,7 +216,7 @@ static dma_addr_t __swiotlb_map_page(struct device *dev, struct page *page,static void __swiotlb_unmap_page (struct device *dev,dma_addr_t dev_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {if (!is_device_dma_coherent (dev))__dma_unmap_area (phys_to_virt (dma_to_phys (dev, dev_addr)), size, dir);
@@ -225,7 +225,7 @@ static void __swiotlb_unmap_page(struct device *dev, dma_addr_t dev_addr,static int __swiotlb_map_sg_attrs (struct device *dev,struct scatterlist *sgl,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int i, ret;
@@ -242,7 +242,7 @@ static int __swiotlb_map_sg_attrs(struct device *dev, struct scatterlist *sgl,static void __swiotlb_unmap_sg_attrs (struct device *dev,struct scatterlist *sgl,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int i;
@@ -303,7 +303,7 @@ static void __swiotlb_sync_sg_for_device(struct device *dev,static int __swiotlb_mmap (struct device *dev,struct vm_area_struct *vma,void *cpu_addr,dma_addr_t dma_addr,size_t size, -struct dma_attrs *attrs) +unsigned long attrs) {int ret = -ENXIO ; unsigned long nr_vma_pages = (vma->vm_end - vma->vm_start) >>
@@ -330,7 +330,7 @@ static int __swiotlb_mmap(struct device *dev,static int __swiotlb_get_sgtable (struct device *dev,struct sg_table *sgt,void *cpu_addr,dma_addr_t handle,size_t size, -struct dma_attrs *attrs) +unsigned long attrs) {int ret =sg_alloc_table (sgt,1 ,GFP_KERNEL );
@@ -425,21 +425,21 @@ out:static void *__dummy_alloc (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flags, -struct dma_attrs *attrs) +unsigned long attrs) {return NULL ; }static void __dummy_free (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) { }static int __dummy_mmap (struct device *dev,struct vm_area_struct *vma,void *cpu_addr,dma_addr_t dma_addr,size_t size, -struct dma_attrs *attrs) +unsigned long attrs) {return -ENXIO ; }
@@ -447,20 +447,20 @@ static int __dummy_mmap(struct device *dev,static dma_addr_t __dummy_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {return DMA_ERROR_CODE ; }static void __dummy_unmap_page (struct device *dev,dma_addr_t dev_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) { }static int __dummy_map_sg (struct device *dev,struct scatterlist *sgl,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {return 0 ; }
@@ -468,7 +468,7 @@ static int __dummy_map_sg(struct device *dev, struct scatterlist *sgl,static void __dummy_unmap_sg (struct device *dev,struct scatterlist *sgl,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) { }
@@ -540,7 +540,7 @@ static void flush_page(struct device *dev, const void *virt, phys_addr_t phys)static void *__iommu_alloc_attrs (struct device *dev,size_t size,dma_addr_t *handle,gfp_t gfp, -struct dma_attrs *attrs) +unsigned long attrs) {bool coherent =is_device_dma_coherent (dev);int ioprot =dma_direction_to_prot (DMA_BIDIRECTIONAL , coherent);
@@ -600,7 +600,8 @@ static void *__iommu_alloc_attrs(struct device *dev, size_t size, }static void __iommu_free_attrs (struct device *dev,size_t size,void *cpu_addr, -dma_addr_t handle,struct dma_attrs *attrs) +dma_addr_t handle, +unsigned long attrs) {size_t iosize = size;
@@ -616,7 +617,7 @@ static void __iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr,* Hence how dodgy the below logic looks... */ if (__in_atomic_pool (cpu_addr, size)) { -iommu_dma_unmap_page (dev, handle, iosize,0 ,NULL ); +iommu_dma_unmap_page (dev, handle, iosize,0 ,0 );__free_from_pool (cpu_addr, size); }else if (is_vmalloc_addr (cpu_addr)){struct vm_struct *area =find_vm_area (cpu_addr);
@@ -626,14 +627,14 @@ static void __iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr,iommu_dma_free (dev, area->pages, iosize, &handle);dma_common_free_remap (cpu_addr, size,VM_USERMAP ); }else { -iommu_dma_unmap_page (dev, handle, iosize,0 ,NULL ); +iommu_dma_unmap_page (dev, handle, iosize,0 ,0 );__free_pages (virt_to_page (cpu_addr),get_order (size)); } }static int __iommu_mmap_attrs (struct device *dev,struct vm_area_struct *vma,void *cpu_addr,dma_addr_t dma_addr,size_t size, -struct dma_attrs *attrs) +unsigned long attrs) {struct vm_struct *area;int ret;
@@ -653,7 +654,7 @@ static int __iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma,static int __iommu_get_sgtable (struct device *dev,struct sg_table *sgt,void *cpu_addr,dma_addr_t dma_addr, -size_t size,struct dma_attrs *attrs) +size_t size,unsigned long attrs) {unsigned int count =PAGE_ALIGN (size) >>PAGE_SHIFT ;struct vm_struct *area =find_vm_area (cpu_addr);
@@ -694,7 +695,7 @@ static void __iommu_sync_single_for_device(struct device *dev,static dma_addr_t __iommu_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {bool coherent =is_device_dma_coherent (dev);int prot =dma_direction_to_prot (dir, coherent);
@@ -709,7 +710,7 @@ static dma_addr_t __iommu_map_page(struct device *dev, struct page *page,static void __iommu_unmap_page (struct device *dev,dma_addr_t dev_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {if (!dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs))__iommu_sync_single_for_cpu (dev, dev_addr, size, dir);
@@ -747,7 +748,7 @@ static void __iommu_sync_sg_for_device(struct device *dev,static int __iommu_map_sg_attrs (struct device *dev,struct scatterlist *sgl,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {bool coherent =is_device_dma_coherent (dev);
@@ -761,7 +762,7 @@ static int __iommu_map_sg_attrs(struct device *dev, struct scatterlist *sgl,static void __iommu_unmap_sg_attrs (struct device *dev,struct scatterlist *sgl,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {if (!dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs))__iommu_sync_sg_for_cpu (dev, sgl, nelems, dir);
Signature · 1 line
1.9.1
Re: [PATCH v4 05/44] arm64: dma-mapping: Use unsigned long for dma_attrs
Hi Krzysztof,
Quoted 13 lines · Krzysztof Kozlowski
Split out subsystem specific changes for easier reviews. This will be squashed with main commit.
Signed-off-by Krzysztof Kozlowski <[email protected]>--- arch/arm64/mm/dma-mapping.c | 57 +++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 28 deletions(-)arch/arm64/mm/dma-mapping.c +0
-0
arch/arm64/mm/dma-mapping.c line 33
Quoted 6 lines
arch/arm64/mm/dma-mapping.c +1
-1@@ -29,7 +29,7 @@#include <asm/cacheflush.h> -static pgprot_t __get_dma_pgprot (const struct dma_attrs *attrs,pgprot_t prot, +static pgprot_t __get_dma_pgprot (unsigned long attrs,pgprot_t prot,bool coherent)
Is this series intended to replace the patches currently in -next adding that "const"? (I was momentarily puzzled why this wouldn't apply locally)
Quoted 160 lines
arch/arm64/mm/dma-mapping.c +18
-18{if (!coherent ||dma_get_attr (DMA_ATTR_WRITE_COMBINE , attrs))@@ -88,7 +88,7 @@ static int __free_from_pool(void *start, size_t size)static void *__dma_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flags, -const struct dma_attrs *attrs) +unsigned long attrs) {if (dev ==NULL ) {WARN_ONCE (1 ,"Use an actual device structure for DMA allocation\n" );@@ -118,7 +118,7 @@ static void *__dma_alloc_coherent(struct device *dev, size_t size,static void __dma_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -const struct dma_attrs *attrs) +unsigned long attrs) {bool freed;phys_addr_t paddr =dma_to_phys (dev, dma_handle);@@ -137,7 +137,7 @@ static void __dma_free_coherent(struct device *dev, size_t size,static void *__dma_alloc (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flags, -struct dma_attrs *attrs) +unsigned long attrs) {struct page *page;void *ptr, *coherent_ptr;@@ -185,7 +185,7 @@ no_mem:static void __dma_free (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) {void *swiotlb_addr =phys_to_virt (dma_to_phys (dev, dma_handle));@@ -202,7 +202,7 @@ static void __dma_free(struct device *dev, size_t size,static dma_addr_t __swiotlb_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {dma_addr_t dev_addr;@@ -216,7 +216,7 @@ static dma_addr_t __swiotlb_map_page(struct device *dev, struct page *page,static void __swiotlb_unmap_page (struct device *dev,dma_addr_t dev_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {if (!is_device_dma_coherent (dev))__dma_unmap_area (phys_to_virt (dma_to_phys (dev, dev_addr)), size, dir);@@ -225,7 +225,7 @@ static void __swiotlb_unmap_page(struct device *dev, dma_addr_t dev_addr,static int __swiotlb_map_sg_attrs (struct device *dev,struct scatterlist *sgl,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int i, ret;@@ -242,7 +242,7 @@ static int __swiotlb_map_sg_attrs(struct device *dev, struct scatterlist *sgl,static void __swiotlb_unmap_sg_attrs (struct device *dev,struct scatterlist *sgl,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int i;@@ -303,7 +303,7 @@ static void __swiotlb_sync_sg_for_device(struct device *dev,static int __swiotlb_mmap (struct device *dev,struct vm_area_struct *vma,void *cpu_addr,dma_addr_t dma_addr,size_t size, -struct dma_attrs *attrs) +unsigned long attrs) {int ret = -ENXIO ; unsigned long nr_vma_pages = (vma->vm_end - vma->vm_start) >>@@ -330,7 +330,7 @@ static int __swiotlb_mmap(struct device *dev,static int __swiotlb_get_sgtable (struct device *dev,struct sg_table *sgt,void *cpu_addr,dma_addr_t handle,size_t size, -struct dma_attrs *attrs) +unsigned long attrs) {int ret =sg_alloc_table (sgt,1 ,GFP_KERNEL );@@ -425,21 +425,21 @@ out:static void *__dummy_alloc (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flags, -struct dma_attrs *attrs) +unsigned long attrs) {return NULL ; }static void __dummy_free (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) { }static int __dummy_mmap (struct device *dev,struct vm_area_struct *vma,void *cpu_addr,dma_addr_t dma_addr,size_t size, -struct dma_attrs *attrs) +unsigned long attrs) {return -ENXIO ; }@@ -447,20 +447,20 @@ static int __dummy_mmap(struct device *dev,static dma_addr_t __dummy_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {return DMA_ERROR_CODE ; }static void __dummy_unmap_page (struct device *dev,dma_addr_t dev_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) { }static int __dummy_map_sg (struct device *dev,struct scatterlist *sgl,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {return 0 ; }@@ -468,7 +468,7 @@ static int __dummy_map_sg(struct device *dev, struct scatterlist *sgl,static void __dummy_unmap_sg (struct device *dev,struct scatterlist *sgl,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) { }@@ -540,7 +540,7 @@ static void flush_page(struct device *dev, const void *virt, phys_addr_t phys)static void *__iommu_alloc_attrs (struct device *dev,size_t size,dma_addr_t *handle,gfp_t gfp, -struct dma_attrs *attrs) +unsigned long attrs) {bool coherent =is_device_dma_coherent (dev);int ioprot =dma_direction_to_prot (DMA_BIDIRECTIONAL , coherent);
arch/arm64/mm/dma-mapping.c static void *__iommu_alloc_attrs(struct device *dev, size_t size, · line 604
Quoted 6 lines
arch/arm64/mm/dma-mapping.c +2
-1@@ -600,7 +600,8 @@ static void *__iommu_alloc_attrs(struct device *dev, size_t size, }static void __iommu_free_attrs (struct device *dev,size_t size,void *cpu_addr, -dma_addr_t handle,struct dma_attrs *attrs) +dma_addr_t handle, +unsigned long attrs)
Nit: unnecessary line break?
Otherwise, though, I'm all for the idea;
Quoted 75 lines
arch/arm64/mm/dma-mapping.c +8
-8{size_t iosize = size;@@ -616,7 +617,7 @@ static void __iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr,* Hence how dodgy the below logic looks... */ if (__in_atomic_pool (cpu_addr, size)) { -iommu_dma_unmap_page (dev, handle, iosize,0 ,NULL ); +iommu_dma_unmap_page (dev, handle, iosize,0 ,0 );__free_from_pool (cpu_addr, size); }else if (is_vmalloc_addr (cpu_addr)){struct vm_struct *area =find_vm_area (cpu_addr);@@ -626,14 +627,14 @@ static void __iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr,iommu_dma_free (dev, area->pages, iosize, &handle);dma_common_free_remap (cpu_addr, size,VM_USERMAP ); }else { -iommu_dma_unmap_page (dev, handle, iosize,0 ,NULL ); +iommu_dma_unmap_page (dev, handle, iosize,0 ,0 );__free_pages (virt_to_page (cpu_addr),get_order (size)); } }static int __iommu_mmap_attrs (struct device *dev,struct vm_area_struct *vma,void *cpu_addr,dma_addr_t dma_addr,size_t size, -struct dma_attrs *attrs) +unsigned long attrs) {struct vm_struct *area;int ret;@@ -653,7 +654,7 @@ static int __iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma,static int __iommu_get_sgtable (struct device *dev,struct sg_table *sgt,void *cpu_addr,dma_addr_t dma_addr, -size_t size,struct dma_attrs *attrs) +size_t size,unsigned long attrs) {unsigned int count =PAGE_ALIGN (size) >>PAGE_SHIFT ;struct vm_struct *area =find_vm_area (cpu_addr);@@ -694,7 +695,7 @@ static void __iommu_sync_single_for_device(struct device *dev,static dma_addr_t __iommu_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {bool coherent =is_device_dma_coherent (dev);int prot =dma_direction_to_prot (dir, coherent);@@ -709,7 +710,7 @@ static dma_addr_t __iommu_map_page(struct device *dev, struct page *page,static void __iommu_unmap_page (struct device *dev,dma_addr_t dev_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {if (!dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs))__iommu_sync_single_for_cpu (dev, dev_addr, size, dir);@@ -747,7 +748,7 @@ static void __iommu_sync_sg_for_device(struct device *dev,static int __iommu_map_sg_attrs (struct device *dev,struct scatterlist *sgl,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {bool coherent =is_device_dma_coherent (dev);@@ -761,7 +762,7 @@ static int __iommu_map_sg_attrs(struct device *dev, struct scatterlist *sgl,static void __iommu_unmap_sg_attrs (struct device *dev,struct scatterlist *sgl,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {if (!dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs))__iommu_sync_sg_for_cpu (dev, sgl, nelems, dir);
Re: [PATCH v4 05/44] arm64: dma-mapping: Use unsigned long for dma_attrs
Quoted 20 lines · Robin Murphy
Hi Krzysztof,
Quoted 17 lines · Krzysztof Kozlowski
Split out subsystem specific changes for easier reviews. This will be squashed with main commit.
Signed-off-by Krzysztof Kozlowski <[email protected]>--- arch/arm64/mm/dma-mapping.c | 57 +++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 28 deletions(-)arch/arm64/mm/dma-mapping.c +0
-0@@ -29,7 +29,7 @@#include <asm/cacheflush.h>
Quoted 7 lines
arch/arm64/mm/dma-mapping.c line 33
Quoted 4 lines
arch/arm64/mm/dma-mapping.c +1
-1-static pgprot_t __get_dma_pgprot (const struct dma_attrs *attrs,pgprot_t prot, +static pgprot_t __get_dma_pgprot(unsigned long attrs, pgprot_t prot,bool coherent)Is this series intended to replace the patches currently in -next adding that "const"? (I was momentarily puzzled why this wouldn't apply locally)
Yes, the series replace completely my previous const changes (applied by Andrew Morton).
I rebased the patchset on linux-next so I could grab all recent changes around dma_attrs. Probably that should be changed before applying - choose one tree to base on (Andrew's?).
If you would like to play with the entire series (on top of next):
https://github.com/krzk/linux/tree/for-next/dma-attrs-const-v4
Quoted 188 lines
Quoted 177 lines
arch/arm64/mm/dma-mapping.c +0
-0{if (!coherent || dma_get_attr(DMA_ATTR_WRITE_COMBINE, attrs))arch/arm64/mm/dma-mapping.c +1
-1@@ -88,7 +88,7 @@ static int __free_from_pool(void *start, size_t size)static void *__dma_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flags, -const struct dma_attrs *attrs) +unsigned long attrs) {if (dev ==NULL ) { WARN_ONCE(1, "Use an actual device structure for DMAallocation\n");
arch/arm64/mm/dma-mapping.c +1
-1@@ -118,7 +118,7 @@ static void *__dma_alloc_coherent(struct device *dev, size_t size, static void __dma_free_coherent(struct device *dev, size_t size,void *vaddr,dma_addr_t dma_handle, -const struct dma_attrs *attrs) +unsigned long attrs) {bool freed;phys_addr_t paddr = dma_to_phys(dev, dma_handle);arch/arm64/mm/dma-mapping.c +1
-1@@ -137,7 +137,7 @@ static void __dma_free_coherent(struct device *dev, size_t size, static void *__dma_alloc(struct device *dev, size_t size,dma_addr_t *dma_handle,gfp_t flags, -struct dma_attrs *attrs) +unsigned long attrs) {struct page *page;void *ptr, *coherent_ptr;arch/arm64/mm/dma-mapping.c +2
-2@@ -185,7 +185,7 @@ no_mem:static void __dma_free (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) {void *swiotlb_addr =phys_to_virt (dma_to_phys (dev, dma_handle));@@ -202,7 +202,7 @@ static void __dma_free(struct device *dev, size_t size, static dma_addr_t __swiotlb_map_page(struct device *dev, struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {dma_addr_t dev_addr;arch/arm64/mm/dma-mapping.c +1
-1@@ -216,7 +216,7 @@ static dma_addr_t __swiotlb_map_page(struct device *dev, struct page *page, static void __swiotlb_unmap_page(struct device *dev, dma_addr_t dev_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {if (!is_device_dma_coherent(dev)) __dma_unmap_area(phys_to_virt(dma_to_phys(dev, dev_addr)),size, dir);
arch/arm64/mm/dma-mapping.c +1
-1@@ -225,7 +225,7 @@ static void __swiotlb_unmap_page(struct device *dev, dma_addr_t dev_addr, static int __swiotlb_map_sg_attrs(struct device *dev, structscatterlist *sgl,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg; int i, ret;arch/arm64/mm/dma-mapping.c +1
-1@@ -242,7 +242,7 @@ static int __swiotlb_map_sg_attrs(struct device *dev, struct scatterlist *sgl, static void __swiotlb_unmap_sg_attrs(struct device *dev,struct scatterlist *sgl,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int i;arch/arm64/mm/dma-mapping.c +1
-1@@ -303,7 +303,7 @@ static void __swiotlb_sync_sg_for_device(structdevice *dev, static int __swiotlb_mmap(struct device *dev, struct vm_area_struct *vma, void *cpu_addr, dma_addr_t dma_addr, size_t size, - struct dma_attrs *attrs) + unsigned long attrs) { int ret = -ENXIO;unsigned long nr_vma_pages = (vma->vm_end - vma->vm_start) >>arch/arm64/mm/dma-mapping.c +7
-7@@ -330,7 +330,7 @@ static int __swiotlb_mmap(struct device *dev,static int __swiotlb_get_sgtable (struct device *dev,struct sg_table *sgt,void *cpu_addr,dma_addr_t handle,size_t size, -struct dma_attrs *attrs) +unsigned long attrs) {int ret =sg_alloc_table (sgt,1 ,GFP_KERNEL );@@ -425,21 +425,21 @@ out:static void *__dummy_alloc (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flags, -struct dma_attrs *attrs) +unsigned long attrs) {return NULL ; }static void __dummy_free (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) { }static int __dummy_mmap (struct device *dev,struct vm_area_struct *vma,void *cpu_addr,dma_addr_t dma_addr,size_t size, -struct dma_attrs *attrs) +unsigned long attrs) {return -ENXIO ; }@@ -447,20 +447,20 @@ static int __dummy_mmap(struct device *dev,static dma_addr_t __dummy_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {return DMA_ERROR_CODE ; }static void __dummy_unmap_page (struct device *dev,dma_addr_t dev_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) { }static int __dummy_map_sg (struct device *dev,struct scatterlist *sgl,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {return 0 ;}arch/arm64/mm/dma-mapping.c +2
-2@@ -468,7 +468,7 @@ static int __dummy_map_sg(struct device *dev, struct scatterlist *sgl, static void __dummy_unmap_sg(struct device *dev, struct scatterlist *sgl, int nelems, enum dma_data_direction dir, - struct dma_attrs *attrs) + unsigned long attrs) { }@@ -540,7 +540,7 @@ static void flush_page(struct device *dev, const void *virt, phys_addr_t phys)static void *__iommu_alloc_attrs (struct device *dev,size_t size,dma_addr_t *handle,gfp_t gfp, -struct dma_attrs *attrs) +unsigned long attrs) {bool coherent =is_device_dma_coherent (dev);int ioprot = dma_direction_to_prot(DMA_BIDIRECTIONAL, coherent);arch/arm64/mm/dma-mapping.c static void *__iommu_alloc_attrs(struct device · line 606
Quoted 8 lines
arch/arm64/mm/dma-mapping.c +2
-1@@ -600,7 +600,8 @@ static void *__iommu_alloc_attrs(struct device *dev, size_t size, }static void __iommu_free_attrs (struct device *dev,size_t size,void *cpu_addr, -dma_addr_t handle,struct dma_attrs *attrs) +dma_addr_t handle, +unsigned long attrs)Nit: unnecessary line break?
Quoted 3 lines
Otherwise, though, I'm all for the idea;
Acked-by Robin Murphy <[email protected]>
Right, thanks!
Best regards,
Krzysztof
PATCH v4 6/44 avr32: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/avr32/mm/dma-coherent.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/avr32/mm/dma-coherent.c +4 -4
@@ -99,7 +99,7 @@ static void __dma_free(struct device *dev, size_t size, }static void *avr32_dma_alloc (struct device *dev,size_t size, -dma_addr_t *handle,gfp_t gfp,struct dma_attrs *attrs) +dma_addr_t *handle,gfp_t gfp,unsigned long attrs) {struct page *page;dma_addr_t phys;
@@ -119,7 +119,7 @@ static void *avr32_dma_alloc(struct device *dev, size_t size, }static void avr32_dma_free (struct device *dev,size_t size, -void *cpu_addr,dma_addr_t handle,struct dma_attrs *attrs) +void *cpu_addr,dma_addr_t handle,unsigned long attrs) {struct page *page;
@@ -142,7 +142,7 @@ static void avr32_dma_free(struct device *dev, size_t size,static dma_addr_t avr32_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size, -enum dma_data_direction direction,struct dma_attrs *attrs) +enum dma_data_direction direction,unsigned long attrs) {void *cpu_addr =page_address (page) + offset;
@@ -152,7 +152,7 @@ static dma_addr_t avr32_dma_map_page(struct device *dev, struct page *page,static int avr32_dma_map_sg (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {int i;struct scatterlist *sg;
Signature · 1 line
1.9.1
PATCH v4 7/44 blackfin: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/blackfin/kernel/dma-mapping.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/blackfin/kernel/dma-mapping.c +4 -4
@@ -79,7 +79,7 @@ static void __free_dma_pages(unsigned long addr, unsigned int pages) }static void *bfin_dma_alloc (struct device *dev,size_t size, -dma_addr_t *dma_handle,gfp_t gfp,struct dma_attrs *attrs) +dma_addr_t *dma_handle,gfp_t gfp,unsigned long attrs) {void *ret;
@@ -94,7 +94,7 @@ static void *bfin_dma_alloc(struct device *dev, size_t size, }static void bfin_dma_free (struct device *dev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) {__free_dma_pages ((unsigned long )vaddr,get_pages (size)); }
@@ -111,7 +111,7 @@ EXPORT_SYMBOL(__dma_sync);static int bfin_dma_map_sg (struct device *dev,struct scatterlist *sg_list,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int i;
@@ -139,7 +139,7 @@ static void bfin_dma_sync_sg_for_device(struct device *dev,static dma_addr_t bfin_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {dma_addr_t handle = (dma_addr_t)(page_address (page) + offset);
Signature · 1 line
1.9.1
PATCH v4 8/44 c6x: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/c6x/include/asm/dma-mapping.h | 4 ++-- arch/c6x/kernel/dma.c | 9 ++++----- arch/c6x/mm/dma-coherent.c | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-)
arch/c6x/include/asm/dma-mapping.h +2 -2
@@ -26,8 +26,8 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)extern void coherent_mem_init (u32 start,u32 size);void *c6x_dma_alloc (struct device *dev,size_t size,dma_addr_t *handle, -gfp_t gfp,struct dma_attrs *attrs); +gfp_t gfp,unsigned long attrs);void c6x_dma_free (struct device *dev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs); +dma_addr_t dma_handle,unsigned long attrs);#endif /* _ASM_C6X_DMA_MAPPING_H */
arch/c6x/kernel/dma.c +4 -5
@@ -38,7 +38,7 @@ static void c6x_dma_sync(dma_addr_t handle, size_t size,static dma_addr_t c6x_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {dma_addr_t handle =virt_to_phys (page_address (page) + offset);
@@ -47,13 +47,13 @@ static dma_addr_t c6x_dma_map_page(struct device *dev, struct page *page, }static void c6x_dma_unmap_page (struct device *dev,dma_addr_t handle, -size_t size,enum dma_data_direction dir,struct dma_attrs *attrs) +size_t size,enum dma_data_direction dir,unsigned long attrs) {c6x_dma_sync (handle, size, dir); }static int c6x_dma_map_sg (struct device *dev,struct scatterlist *sglist, -int nents,enum dma_data_direction dir,struct dma_attrs *attrs) +int nents,enum dma_data_direction dir,unsigned long attrs) {struct scatterlist *sg;int i;
@@ -67,8 +67,7 @@ static int c6x_dma_map_sg(struct device *dev, struct scatterlist *sglist, }static void c6x_dma_unmap_sg (struct device *dev,struct scatterlist *sglist, -int nents,enum dma_data_direction dir, -struct dma_attrs *attrs) +int nents,enum dma_data_direction dir,unsigned long attrs) {struct scatterlist *sg;int i;
arch/c6x/mm/dma-coherent.c +2 -2
@@ -74,7 +74,7 @@ static void __free_dma_pages(u32 addr, int order)* virtual and DMA address for that space. */ void *c6x_dma_alloc (struct device *dev,size_t size,dma_addr_t *handle, -gfp_t gfp,struct dma_attrs *attrs) +gfp_t gfp,unsigned long attrs) {u32 paddr;int order;
@@ -99,7 +99,7 @@ void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,* Free DMA coherent memory as defined by the above mapping. */ void c6x_dma_free (struct device *dev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) {int order;
Signature · 1 line
1.9.1
PATCH v4 9/44 cris: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/cris/arch-v32/drivers/pci/dma.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
arch/cris/arch-v32/drivers/pci/dma.c +4 -5
@@ -17,7 +17,7 @@#include <asm/io.h> static void *v32_dma_alloc (struct device *dev,size_t size, -dma_addr_t *dma_handle,gfp_t gfp,struct dma_attrs *attrs) +dma_addr_t *dma_handle,gfp_t gfp,unsigned long attrs) {void *ret;
@@ -37,22 +37,21 @@ static void *v32_dma_alloc(struct device *dev, size_t size, }static void v32_dma_free (struct device *dev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) {free_pages ((unsigned long )vaddr,get_order (size)); }static inline dma_addr_t v32_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size, -enum dma_data_direction direction, -struct dma_attrs *attrs) +enum dma_data_direction direction,unsigned long attrs) {return page_to_phys (page) + offset; }static inline int v32_dma_map_sg (struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {printk ("Map sg\n" );return nents;
Signature · 1 line
1.9.1
PATCH v4 10/44 frv: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/frv/mb93090-mb00/pci-dma-nommu.c | 8 ++++---- arch/frv/mb93090-mb00/pci-dma.c | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-)
arch/frv/mb93090-mb00/pci-dma-nommu.c +4 -4
@@ -35,7 +35,7 @@ static DEFINE_SPINLOCK(dma_alloc_lock);static LIST_HEAD (dma_alloc_list);static void *frv_dma_alloc (struct device *hwdev,size_t size,dma_addr_t *dma_handle, -gfp_t gfp,struct dma_attrs *attrs) +gfp_t gfp,unsigned long attrs) {struct dma_alloc_record *new;struct list_head *this = &dma_alloc_list;
@@ -86,7 +86,7 @@ static void *frv_dma_alloc(struct device *hwdev, size_t size, dma_addr_t *dma_ha }static void frv_dma_free (struct device *hwdev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) {struct dma_alloc_record *rec;unsigned long flags;
@@ -107,7 +107,7 @@ static void frv_dma_free(struct device *hwdev, size_t size, void *vaddr,static int frv_dma_map_sg (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {int i;struct scatterlist *sg;
@@ -124,7 +124,7 @@ static int frv_dma_map_sg(struct device *dev, struct scatterlist *sglist,static dma_addr_t frv_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size, -enum dma_data_direction direction,struct dma_attrs *attrs) +enum dma_data_direction direction,unsigned long attrs) {BUG_ON (direction ==DMA_NONE );flush_dcache_page (page);
arch/frv/mb93090-mb00/pci-dma.c +4 -5
@@ -19,8 +19,7 @@#include <asm/io.h> static void *frv_dma_alloc (struct device *hwdev,size_t size, -dma_addr_t *dma_handle,gfp_t gfp, -struct dma_attrs *attrs) +dma_addr_t *dma_handle,gfp_t gfp,unsigned long attrs) {void *ret;
@@ -32,14 +31,14 @@ static void *frv_dma_alloc(struct device *hwdev, size_t size, }static void frv_dma_free (struct device *hwdev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) {consistent_free (vaddr); }static int frv_dma_map_sg (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {unsigned long dampr2;void *vaddr;
@@ -69,7 +68,7 @@ static int frv_dma_map_sg(struct device *dev, struct scatterlist *sglist,static dma_addr_t frv_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size, -enum dma_data_direction direction,struct dma_attrs *attrs) +enum dma_data_direction direction,unsigned long attrs) {flush_dcache_page (page);return (dma_addr_t )page_to_phys (page) + offset;
Signature · 1 line
1.9.1
PATCH v4 11/44 drm/exynos: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_g2d.c | 12 +++++------- drivers/gpu/drm/exynos/exynos_drm_gem.c | 20 ++++++++++---------- drivers/gpu/drm/exynos/exynos_drm_gem.h | 2 +- 4 files changed, 17 insertions(+), 19 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fbdev.c +1 -1
@@ -52,7 +52,7 @@ static int exynos_drm_fb_mmap(struct fb_info *info, ret =dma_mmap_attrs (to_dma_dev (helper->dev), vma, exynos_gem->cookie, exynos_gem->dma_addr, exynos_gem->size, - &exynos_gem->dma_attrs); + exynos_gem->dma_attrs);if (ret <0 ) {DRM_ERROR ("failed to mmap.\n" );return ret;
drivers/gpu/drm/exynos/exynos_drm_g2d.c +5 -7
@@ -17,7 +17,6 @@#include <linux/slab.h> #include <linux/workqueue.h> #include <linux/dma-mapping.h> -#include <linux/dma-attrs.h> #include <linux/of.h> #include <drm/drmP.h>
@@ -235,7 +234,7 @@ struct g2d_data {struct mutex cmdlist_mutex;dma_addr_t cmdlist_pool;void *cmdlist_pool_virt; -struct dma_attrs cmdlist_dma_attrs; +unsigned long cmdlist_dma_attrs;/* runqueue*/ struct g2d_runqueue_node *runqueue_node;
@@ -256,13 +255,12 @@ static int g2d_init_cmdlist(struct g2d_data *g2d)int ret;struct g2d_buf_info *buf_info; -init_dma_attrs (&g2d->cmdlist_dma_attrs); -dma_set_attr (DMA_ATTR_WRITE_COMBINE , &g2d->cmdlist_dma_attrs); + g2d->cmdlist_dma_attrs =DMA_ATTR_WRITE_COMBINE ; g2d->cmdlist_pool_virt =dma_alloc_attrs (to_dma_dev (subdrv->drm_dev),G2D_CMDLIST_POOL_SIZE , &g2d->cmdlist_pool,GFP_KERNEL , - &g2d->cmdlist_dma_attrs); + g2d->cmdlist_dma_attrs);if (!g2d->cmdlist_pool_virt) {dev_err (dev,"failed to allocate dma memory\n" );return -ENOMEM ;
@@ -295,7 +293,7 @@ static int g2d_init_cmdlist(struct g2d_data *g2d) err:dma_free_attrs (to_dma_dev (subdrv->drm_dev),G2D_CMDLIST_POOL_SIZE , g2d->cmdlist_pool_virt, - g2d->cmdlist_pool, &g2d->cmdlist_dma_attrs); + g2d->cmdlist_pool, g2d->cmdlist_dma_attrs);return ret; }
@@ -309,7 +307,7 @@ static void g2d_fini_cmdlist(struct g2d_data *g2d)dma_free_attrs (to_dma_dev (subdrv->drm_dev),G2D_CMDLIST_POOL_SIZE , g2d->cmdlist_pool_virt, - g2d->cmdlist_pool, &g2d->cmdlist_dma_attrs); + g2d->cmdlist_pool, g2d->cmdlist_dma_attrs); } }
drivers/gpu/drm/exynos/exynos_drm_gem.c +10 -10
@@ -24,7 +24,7 @@static int exynos_drm_alloc_buf (struct exynos_drm_gem *exynos_gem) {struct drm_device *dev = exynos_gem->base.dev; -enum dma_attr attr; +unsigned long attr;unsigned int nr_pages;struct sg_table sgt;int ret = -ENOMEM ;
@@ -34,7 +34,7 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem)return 0 ; } -init_dma_attrs (&exynos_gem->dma_attrs); + exynos_gem->dma_attrs =0 ;/* * if EXYNOS_BO_CONTIG, fully physically contiguous memory
@@ -42,7 +42,7 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem)* as possible. */ if (!(exynos_gem->flags &EXYNOS_BO_NONCONTIG )) -dma_set_attr (DMA_ATTR_FORCE_CONTIGUOUS , &exynos_gem->dma_attrs); + exynos_gem->dma_attrs |=DMA_ATTR_FORCE_CONTIGUOUS ;/* * if EXYNOS_BO_WC or EXYNOS_BO_NONCACHABLE, writecombine mapping
@@ -54,8 +54,8 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem)else attr =DMA_ATTR_NON_CONSISTENT ; -dma_set_attr (attr, &exynos_gem->dma_attrs); -dma_set_attr (DMA_ATTR_NO_KERNEL_MAPPING , &exynos_gem->dma_attrs); + exynos_gem->dma_attrs |= attr; + exynos_gem->dma_attrs |=DMA_ATTR_NO_KERNEL_MAPPING ; nr_pages = exynos_gem->size >>PAGE_SHIFT ;
@@ -67,7 +67,7 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem) exynos_gem->cookie =dma_alloc_attrs (to_dma_dev (dev), exynos_gem->size, &exynos_gem->dma_addr,GFP_KERNEL , - &exynos_gem->dma_attrs); + exynos_gem->dma_attrs);if (!exynos_gem->cookie) {DRM_ERROR ("failed to allocate buffer.\n" ); goto err_free;
@@ -75,7 +75,7 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem) ret =dma_get_sgtable_attrs (to_dma_dev (dev), &sgt, exynos_gem->cookie, exynos_gem->dma_addr, exynos_gem->size, - &exynos_gem->dma_attrs); + exynos_gem->dma_attrs);if (ret <0 ) {DRM_ERROR ("failed to get sgtable.\n" ); goto err_dma_free;
@@ -99,7 +99,7 @@ err_sgt_free:sg_free_table (&sgt); err_dma_free:dma_free_attrs (to_dma_dev (dev), exynos_gem->size, exynos_gem->cookie, - exynos_gem->dma_addr, &exynos_gem->dma_attrs); + exynos_gem->dma_addr, exynos_gem->dma_attrs); err_free:drm_free_large (exynos_gem->pages);
@@ -120,7 +120,7 @@ static void exynos_drm_free_buf(struct exynos_drm_gem *exynos_gem)dma_free_attrs (to_dma_dev (dev), exynos_gem->size, exynos_gem->cookie, (dma_addr_t )exynos_gem->dma_addr, - &exynos_gem->dma_attrs); + exynos_gem->dma_attrs);drm_free_large (exynos_gem->pages); }
@@ -346,7 +346,7 @@ static int exynos_drm_gem_mmap_buffer(struct exynos_drm_gem *exynos_gem, ret =dma_mmap_attrs (to_dma_dev (drm_dev), vma, exynos_gem->cookie, exynos_gem->dma_addr, exynos_gem->size, - &exynos_gem->dma_attrs); + exynos_gem->dma_attrs);if (ret <0 ) {DRM_ERROR ("failed to mmap.\n" );return ret;
drivers/gpu/drm/exynos/exynos_drm_gem.h +1 -1
@@ -50,7 +50,7 @@ struct exynos_drm_gem {void *cookie;void __iomem *kvaddr;dma_addr_t dma_addr; -struct dma_attrs dma_attrs; +unsigned long dma_attrs;struct page **pages;struct sg_table *sgt; };
Signature · 1 line
1.9.1
PATCH v4 12/44 drm/mediatek: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- drivers/gpu/drm/mediatek/mtk_drm_gem.c | 13 ++++++------- drivers/gpu/drm/mediatek/mtk_drm_gem.h | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_gem.c +6 -7
@@ -54,15 +54,14 @@ struct mtk_drm_gem_obj *mtk_drm_gem_create(struct drm_device *dev, obj = &mtk_gem->base; -init_dma_attrs (&mtk_gem->dma_attrs); -dma_set_attr (DMA_ATTR_WRITE_COMBINE , &mtk_gem->dma_attrs); + mtk_gem->dma_attrs =DMA_ATTR_WRITE_COMBINE ;if (!alloc_kmap) -dma_set_attr (DMA_ATTR_NO_KERNEL_MAPPING , &mtk_gem->dma_attrs); + mtk_gem->dma_attrs |=DMA_ATTR_NO_KERNEL_MAPPING ; mtk_gem->cookie =dma_alloc_attrs (priv->dma_dev, obj->size, &mtk_gem->dma_addr,GFP_KERNEL , - &mtk_gem->dma_attrs); + mtk_gem->dma_attrs);if (!mtk_gem->cookie) {DRM_ERROR ("failed to allocate %zx byte dma buffer" , obj->size); ret = -ENOMEM ;
@@ -93,7 +92,7 @@ void mtk_drm_gem_free_object(struct drm_gem_object *obj)drm_prime_gem_destroy (obj, mtk_gem->sg); else dma_free_attrs(priv->dma_dev, obj->size, mtk_gem->cookie, - mtk_gem->dma_addr, &mtk_gem->dma_attrs); + mtk_gem->dma_addr, mtk_gem->dma_attrs);/* release file pointer to gem object. */ drm_gem_object_release (obj);
@@ -173,7 +172,7 @@ static int mtk_drm_gem_object_mmap(struct drm_gem_object *obj, vma->vm_pgoff =0 ; ret =dma_mmap_attrs (priv->dma_dev, vma, mtk_gem->cookie, - mtk_gem->dma_addr, obj->size, &mtk_gem->dma_attrs); + mtk_gem->dma_addr, obj->size, mtk_gem->dma_attrs);if (ret)drm_gem_vm_close (vma);
@@ -224,7 +223,7 @@ struct sg_table *mtk_gem_prime_get_sg_table(struct drm_gem_object *obj) ret =dma_get_sgtable_attrs (priv->dma_dev, sgt, mtk_gem->cookie, mtk_gem->dma_addr, obj->size, - &mtk_gem->dma_attrs); + mtk_gem->dma_attrs);if (ret) {DRM_ERROR ("failed to allocate sgt, %d\n" , ret);kfree (sgt);
drivers/gpu/drm/mediatek/mtk_drm_gem.h +1 -1
@@ -35,7 +35,7 @@ struct mtk_drm_gem_obj {void *cookie;void *kvaddr;dma_addr_t dma_addr; -struct dma_attrs dma_attrs; +unsigned long dma_attrs;struct sg_table *sg; };
Signature · 1 line
1.9.1
PATCH v4 13/44 drm/msm: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- drivers/gpu/drm/msm/msm_drv.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/gpu/drm/msm/msm_drv.c +6 -7
@@ -230,11 +230,10 @@ static int msm_drm_uninit(struct device *dev) }if (priv->vram.paddr) { -DEFINE_DMA_ATTRS (attrs); -dma_set_attr (DMA_ATTR_NO_KERNEL_MAPPING , &attrs); +unsigned long attrs =DMA_ATTR_NO_KERNEL_MAPPING ;drm_mm_takedown (&priv->vram.mm);dma_free_attrs (dev, priv->vram.size,NULL , - priv->vram.paddr, &attrs); + priv->vram.paddr, attrs); }component_unbind_all (dev, ddev);
@@ -299,21 +298,21 @@ static int msm_init_vram(struct drm_device *dev) }if (size) { -DEFINE_DMA_ATTRS (attrs); +unsigned long attrs =0 ;void *p; priv->vram.size = size;drm_mm_init (&priv->vram.mm,0 , (size >>PAGE_SHIFT ) -1 ); -dma_set_attr (DMA_ATTR_NO_KERNEL_MAPPING , &attrs); -dma_set_attr (DMA_ATTR_WRITE_COMBINE , &attrs); + attrs |=DMA_ATTR_NO_KERNEL_MAPPING ; + attrs |=DMA_ATTR_WRITE_COMBINE ;/* note that for no-kernel-mapping, the vaddr returned * is bogus, but non-null if allocation succeeded: */ p =dma_alloc_attrs (dev->dev, size, - &priv->vram.paddr,GFP_KERNEL , &attrs); + &priv->vram.paddr,GFP_KERNEL , attrs);if (!p) {dev_err (dev->dev,"failed to allocate VRAM\n" ); priv->vram.paddr =0 ;
Signature · 6 lines
1.9.1 _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
PATCH v4 14/44 drm/nouveau: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c +6 -7
@@ -109,7 +109,7 @@ struct gk20a_instmem {u16 iommu_bit;/* Only used by DMA API */ -struct dma_attrs attrs; +unsigned long attrs; };#define gk20a_instmem (p) container_of((p), struct gk20a_instmem, base)
@@ -293,7 +293,7 @@ gk20a_instobj_dtor_dma(struct nvkm_memory *memory) goto out;dma_free_attrs (dev, node->base.mem.size <<PAGE_SHIFT , node->base.vaddr, - node->handle, &imem->attrs); + node->handle, imem->attrs); out:return node;
@@ -386,7 +386,7 @@ gk20a_instobj_ctor_dma(struct gk20a_instmem *imem, u32 npages, u32 align, node->base.vaddr =dma_alloc_attrs (dev, npages <<PAGE_SHIFT , &node->handle,GFP_KERNEL , - &imem->attrs); + imem->attrs);if (!node->base.vaddr) {nvkm_error (subdev,"cannot allocate DMA memory\n" );return -ENOMEM ;
@@ -597,10 +597,9 @@ gk20a_instmem_new(struct nvkm_device *device, int index,nvkm_info (&imem->base.subdev,"using IOMMU\n" ); }else { -init_dma_attrs (&imem->attrs); -dma_set_attr (DMA_ATTR_NON_CONSISTENT , &imem->attrs); -dma_set_attr (DMA_ATTR_WEAK_ORDERING , &imem->attrs); -dma_set_attr (DMA_ATTR_WRITE_COMBINE , &imem->attrs); + imem->attrs =DMA_ATTR_NON_CONSISTENT | +DMA_ATTR_WEAK_ORDERING | +DMA_ATTR_WRITE_COMBINE ;nvkm_info (&imem->base.subdev,"using DMA API\n" ); }
Signature · 6 lines
1.9.1 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH v4 15/44 drm/rockship: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 17 +++++++---------- drivers/gpu/drm/rockchip/rockchip_drm_gem.h | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_gem.c +7 -10
@@ -17,8 +17,6 @@#include <drm/drm_gem.h> #include <drm/drm_vma_manager.h> -#include <linux/dma-attrs.h> -#include "rockchip_drm_drv.h" #include "rockchip_drm_gem.h"
@@ -28,15 +26,14 @@ static int rockchip_gem_alloc_buf(struct rockchip_gem_object *rk_obj,struct drm_gem_object *obj = &rk_obj->base;struct drm_device *drm = obj->dev; -init_dma_attrs (&rk_obj->dma_attrs); -dma_set_attr (DMA_ATTR_WRITE_COMBINE , &rk_obj->dma_attrs); + rk_obj->dma_attrs =DMA_ATTR_WRITE_COMBINE ;if (!alloc_kmap) -dma_set_attr (DMA_ATTR_NO_KERNEL_MAPPING , &rk_obj->dma_attrs); + rk_obj->dma_attrs |=DMA_ATTR_NO_KERNEL_MAPPING ; rk_obj->kvaddr =dma_alloc_attrs (drm->dev, obj->size, &rk_obj->dma_addr,GFP_KERNEL , - &rk_obj->dma_attrs); + rk_obj->dma_attrs);if (!rk_obj->kvaddr) {DRM_ERROR ("failed to allocate %#x byte dma buffer" , obj->size);return -ENOMEM ;
@@ -51,7 +48,7 @@ static void rockchip_gem_free_buf(struct rockchip_gem_object *rk_obj)struct drm_device *drm = obj->dev;dma_free_attrs (drm->dev, obj->size, rk_obj->kvaddr, rk_obj->dma_addr, - &rk_obj->dma_attrs); + rk_obj->dma_attrs); } static int rockchip_drm_gem_object_mmap(struct drm_gem_object *obj,
@@ -70,7 +67,7 @@ static int rockchip_drm_gem_object_mmap(struct drm_gem_object *obj, vma->vm_pgoff =0 ; ret =dma_mmap_attrs (drm->dev, vma, rk_obj->kvaddr, rk_obj->dma_addr, - obj->size, &rk_obj->dma_attrs); + obj->size, rk_obj->dma_attrs);if (ret)drm_gem_vm_close (vma);
@@ -262,7 +259,7 @@ struct sg_table *rockchip_gem_prime_get_sg_table(struct drm_gem_object *obj) ret =dma_get_sgtable_attrs (drm->dev, sgt, rk_obj->kvaddr, rk_obj->dma_addr, obj->size, - &rk_obj->dma_attrs); + rk_obj->dma_attrs);if (ret) {DRM_ERROR ("failed to allocate sgt, %d\n" , ret);kfree (sgt);
@@ -276,7 +273,7 @@ void *rockchip_gem_prime_vmap(struct drm_gem_object *obj) {struct rockchip_gem_object *rk_obj =to_rockchip_obj (obj); -if (dma_get_attr (DMA_ATTR_NO_KERNEL_MAPPING , &rk_obj->dma_attrs)) +if (dma_get_attr (DMA_ATTR_NO_KERNEL_MAPPING , rk_obj->dma_attrs))return NULL ;return rk_obj->kvaddr;
drivers/gpu/drm/rockchip/rockchip_drm_gem.h +1 -1
@@ -23,7 +23,7 @@ struct rockchip_gem_object {void *kvaddr;dma_addr_t dma_addr; -struct dma_attrs dma_attrs; +unsigned long dma_attrs; };struct sg_table *rockchip_gem_prime_get_sg_table (struct drm_gem_object *obj);
Signature · 1 line
1.9.1
PATCH v4 16/44 infiniband: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- drivers/infiniband/core/umem.c | 7 +++---- include/rdma/ib_verbs.h | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-)
drivers/infiniband/core/umem.c +3 -4
@@ -37,7 +37,6 @@#include <linux/sched.h> #include <linux/export.h> #include <linux/hugetlb.h> -#include <linux/dma-attrs.h> #include <linux/slab.h> #include <rdma/ib_umem_odp.h>
@@ -92,12 +91,12 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,unsigned long npages;int ret;int i; -DEFINE_DMA_ATTRS (attrs); +unsigned long attrs =0 ;struct scatterlist *sg, *sg_list_start;int need_release =0 ;if (dmasync) -dma_set_attr (DMA_ATTR_WRITE_BARRIER , &attrs); + attrs |=DMA_ATTR_WRITE_BARRIER ;if (!size)return ERR_PTR (-EINVAL );
@@ -215,7 +214,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, umem->sg_head.sgl, umem->npages,DMA_BIDIRECTIONAL , - &attrs); + attrs);if (umem->nmap <=0 ) { ret = -ENOMEM ;
include/rdma/ib_verbs.h +4 -4
@@ -2893,7 +2893,7 @@ static inline void ib_dma_unmap_single(struct ib_device *dev,static inline u64 ib_dma_map_single_attrs (struct ib_device *dev,void *cpu_addr,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {return dma_map_single_attrs (dev->dma_device, cpu_addr, size, direction, attrs);
@@ -2902,7 +2902,7 @@ static inline u64 ib_dma_map_single_attrs(struct ib_device *dev,static inline void ib_dma_unmap_single_attrs (struct ib_device *dev,u64 addr,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {return dma_unmap_single_attrs (dev->dma_device, addr, size, direction, attrs);
@@ -2980,7 +2980,7 @@ static inline void ib_dma_unmap_sg(struct ib_device *dev,static inline int ib_dma_map_sg_attrs (struct ib_device *dev,struct scatterlist *sg,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {return dma_map_sg_attrs (dev->dma_device, sg, nents, direction, attrs); }
@@ -2988,7 +2988,7 @@ static inline int ib_dma_map_sg_attrs(struct ib_device *dev,static inline void ib_dma_unmap_sg_attrs (struct ib_device *dev,struct scatterlist *sg,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {dma_unmap_sg_attrs (dev->dma_device, sg, nents, direction, attrs); }
Signature · 1 line
1.9.1
Re: [PATCH v4 16/44] infiniband: dma-mapping: Use unsigned long for dma_attrs
Quoted 2 lines · Krzysztof Kozlowski
Split out subsystem specific changes for easier reviews. This will be squashed with main commit.
Please rename 'attrs' into 'dma_attrs' in this patch such that it remains clear that that variable refers to DMA attributes.
Thanks,
Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 16/44] infiniband: dma-mapping: Use unsigned long for dma_attrs
Quoted 6 lines · Bart Van Assche
Quoted 2 lines · Krzysztof Kozlowski
Split out subsystem specific changes for easier reviews. This will be squashed with main commit.
Please rename 'attrs' into '
dma_attrs' in this patch such that it remains clear that that variable refers to DMA attributes.
Good point, thanks.
Best regards,
Krzysztof
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v4 17/44 iommu: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- drivers/iommu/amd_iommu.c | 12 ++++++------ drivers/iommu/dma-iommu.c | 6 +++--- include/linux/dma-iommu.h | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-)
drivers/iommu/amd_iommu.c +6 -6
@@ -2716,7 +2716,7 @@ static void __unmap_single(struct dma_ops_domain *dma_dom,static dma_addr_t map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {phys_addr_t paddr =page_to_phys (page) + offset;struct protection_domain *domain;
@@ -2738,7 +2738,7 @@ static dma_addr_t map_page(struct device *dev, struct page *page,* The exported unmap_single function for dma_ops. */ static void unmap_page (struct device *dev,dma_addr_t dma_addr,size_t size, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {struct protection_domain *domain;
@@ -2755,7 +2755,7 @@ static void unmap_page(struct device *dev, dma_addr_t dma_addr, size_t size,*/ static int map_sg (struct device *dev,struct scatterlist *sglist,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct protection_domain *domain;int i;
@@ -2803,7 +2803,7 @@ unmap:*/ static void unmap_sg (struct device *dev,struct scatterlist *sglist,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct protection_domain *domain;struct scatterlist *s;
@@ -2825,7 +2825,7 @@ static void unmap_sg(struct device *dev, struct scatterlist *sglist,*/ static void *alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_addr,gfp_t flag, -struct dma_attrs *attrs) +unsigned long attrs) {u64 dma_mask = dev->coherent_dma_mask;struct protection_domain *domain;
@@ -2879,7 +2879,7 @@ out_free:*/ static void free_coherent (struct device *dev,size_t size,void *virt_addr,dma_addr_t dma_addr, -struct dma_attrs *attrs) +unsigned long attrs) {struct protection_domain *domain;struct page *page;
drivers/iommu/dma-iommu.c +3 -3
@@ -286,7 +286,7 @@ void iommu_dma_free(struct device *dev, struct page **pages, size_t size,* or NULL on failure. */ struct page **iommu_dma_alloc (struct device *dev,size_t size,gfp_t gfp, -struct dma_attrs *attrs,int prot,dma_addr_t *handle, +unsigned long attrs,int prot,dma_addr_t *handle,void (*flush_page)(struct device *,const void *,phys_addr_t )) {struct iommu_domain *domain =iommu_get_domain_for_dev (dev);
@@ -400,7 +400,7 @@ dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page, }void iommu_dma_unmap_page (struct device *dev,dma_addr_t handle,size_t size, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {__iommu_dma_unmap (iommu_get_domain_for_dev (dev), handle); }
@@ -560,7 +560,7 @@ out_restore_sg: }void iommu_dma_unmap_sg (struct device *dev,struct scatterlist *sg,int nents, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {/* * The scatterlist segments are mapped into a single
include/linux/dma-iommu.h +3 -3
@@ -39,7 +39,7 @@ int dma_direction_to_prot(enum dma_data_direction dir, bool coherent);* the arch code to take care of attributes and cache maintenance */ struct page **iommu_dma_alloc (struct device *dev,size_t size,gfp_t gfp, -struct dma_attrs *attrs,int prot,dma_addr_t *handle, +unsigned long attrs,int prot,dma_addr_t *handle,void (*flush_page)(struct device *,const void *,phys_addr_t ));void iommu_dma_free (struct device *dev,struct page **pages,size_t size,dma_addr_t *handle);
@@ -56,9 +56,9 @@ int iommu_dma_map_sg(struct device *dev, struct scatterlist *sg,* directly as DMA mapping callbacks for simplicity */ void iommu_dma_unmap_page (struct device *dev,dma_addr_t handle,size_t size, -enum dma_data_direction dir,struct dma_attrs *attrs); +enum dma_data_direction dir,unsigned long attrs);void iommu_dma_unmap_sg (struct device *dev,struct scatterlist *sg,int nents, -enum dma_data_direction dir,struct dma_attrs *attrs); +enum dma_data_direction dir,unsigned long attrs);int iommu_dma_supported (struct device *dev,u64 mask);int iommu_dma_mapping_error (struct device *dev,dma_addr_t dma_addr);
Signature · 1 line
1.9.1
PATCH v4 18/44 dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- drivers/media/platform/sti/bdisp/bdisp-hw.c | 26 +++++++--------------- drivers/media/v4l2-core/videobuf2-dma-contig.c | 30 +++++++++++--------------- drivers/media/v4l2-core/videobuf2-dma-sg.c | 19 ++++------------ include/media/videobuf2-dma-contig.h | 7 ++---- 4 files changed, 26 insertions(+), 56 deletions(-)
drivers/media/platform/sti/bdisp/bdisp-hw.c +8 -18
@@ -125,14 +125,11 @@ int bdisp_hw_get_and_clear_irq(struct bdisp_dev *bdisp)*/ void bdisp_hw_free_nodes (struct bdisp_ctx *ctx) { -if (ctx && ctx->node[0 ]) { -DEFINE_DMA_ATTRS (attrs); - -dma_set_attr (DMA_ATTR_WRITE_COMBINE , &attrs); +if (ctx && ctx->node[0 ])dma_free_attrs (ctx->bdisp_dev->dev,sizeof (struct bdisp_node ) *MAX_NB_NODE , - ctx->node[0 ], ctx->node_paddr[0 ], &attrs); - } + ctx->node[0 ], ctx->node_paddr[0 ], +DMA_ATTR_WRITE_COMBINE ); }/**
@@ -150,12 +147,10 @@ int bdisp_hw_alloc_nodes(struct bdisp_ctx *ctx)unsigned int i, node_size =sizeof (struct bdisp_node );void *base;dma_addr_t paddr; -DEFINE_DMA_ATTRS (attrs);/* Allocate all the nodes within a single memory page */ -dma_set_attr (DMA_ATTR_WRITE_COMBINE , &attrs); base =dma_alloc_attrs (dev, node_size *MAX_NB_NODE , &paddr, -GFP_KERNEL |GFP_DMA , &attrs); +GFP_KERNEL |GFP_DMA ,DMA_ATTR_WRITE_COMBINE );if (!base) {dev_err (dev,"%s no mem\n" , __func__);return -ENOMEM ;
@@ -188,13 +183,9 @@ void bdisp_hw_free_filters(struct device *dev) {int size = (BDISP_HF_NB *NB_H_FILTER ) + (BDISP_VF_NB *NB_V_FILTER ); -if (bdisp_h_filter[0 ].virt) { -DEFINE_DMA_ATTRS (attrs); - -dma_set_attr (DMA_ATTR_WRITE_COMBINE , &attrs); +if (bdisp_h_filter[0 ].virt)dma_free_attrs (dev, size, bdisp_h_filter[0 ].virt, - bdisp_h_filter[0 ].paddr, &attrs); - } + bdisp_h_filter[0 ].paddr,DMA_ATTR_WRITE_COMBINE ); }/**
@@ -211,12 +202,11 @@ int bdisp_hw_alloc_filters(struct device *dev)unsigned int i, size;void *base;dma_addr_t paddr; -DEFINE_DMA_ATTRS (attrs);/* Allocate all the filters within a single memory page */ size = (BDISP_HF_NB *NB_H_FILTER ) + (BDISP_VF_NB *NB_V_FILTER ); -dma_set_attr (DMA_ATTR_WRITE_COMBINE , &attrs); - base =dma_alloc_attrs (dev, size, &paddr,GFP_KERNEL |GFP_DMA , &attrs); + base =dma_alloc_attrs (dev, size, &paddr,GFP_KERNEL |GFP_DMA , +DMA_ATTR_WRITE_COMBINE );if (!base)return -ENOMEM ;
drivers/media/v4l2-core/videobuf2-dma-contig.c +12 -18
@@ -23,7 +23,7 @@struct vb2_dc_conf {struct device *dev; -struct dma_attrs attrs; +unsigned long attrs; };struct vb2_dc_buf {
@@ -32,7 +32,7 @@ struct vb2_dc_buf {unsigned long size;void *cookie;dma_addr_t dma_addr; -struct dma_attrs attrs; +unsigned long attrs;enum dma_data_direction dma_dir;struct sg_table *dma_sgt;struct frame_vector *vec;
@@ -135,7 +135,7 @@ static void vb2_dc_put(void *buf_priv)kfree (buf->sgt_base); }dma_free_attrs (buf->dev, buf->size, buf->cookie, buf->dma_addr, - &buf->attrs); + buf->attrs);put_device (buf->dev);kfree (buf); }
@@ -153,14 +153,14 @@ static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size, buf->attrs = conf->attrs; buf->cookie =dma_alloc_attrs (dev, size, &buf->dma_addr, -GFP_KERNEL | gfp_flags, &buf->attrs); +GFP_KERNEL | gfp_flags, buf->attrs);if (!buf->cookie) {dev_err (dev,"dma_alloc_coherent of size %ld failed\n" , size);kfree (buf);return ERR_PTR (-ENOMEM ); } -if (!dma_get_attr (DMA_ATTR_NO_KERNEL_MAPPING , &buf->attrs)) +if (!dma_get_attr (DMA_ATTR_NO_KERNEL_MAPPING , buf->attrs)) buf->vaddr = buf->cookie;/* Prevent the device from being released while the buffer is used */
@@ -194,7 +194,7 @@ static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma) vma->vm_pgoff =0 ; ret =dma_mmap_attrs (buf->dev, vma, buf->cookie, - buf->dma_addr, buf->size, &buf->attrs); + buf->dma_addr, buf->size, buf->attrs);if (ret) {pr_err ("Remapping memory failed, error: %d\n" , ret);
@@ -377,7 +377,7 @@ static struct sg_table *vb2_dc_get_base_sgt(struct vb2_dc_buf *buf) } ret =dma_get_sgtable_attrs (buf->dev, sgt, buf->cookie, buf->dma_addr, - buf->size, &buf->attrs); + buf->size, buf->attrs);if (ret <0 ) {dev_err (buf->dev,"failed to get scatterlist from DMA API\n" );kfree (sgt);
@@ -426,15 +426,12 @@ static void vb2_dc_put_userptr(void *buf_priv)struct page **pages;if (sgt) { -DEFINE_DMA_ATTRS (attrs); - -dma_set_attr (DMA_ATTR_SKIP_CPU_SYNC , &attrs);/* * No need to sync to CPU, it's already synced to the CPU * since the finish() memop will have been called before this. */ dma_unmap_sg_attrs (buf->dev, sgt->sgl, sgt->orig_nents, - buf->dma_dir, &attrs); + buf->dma_dir,DMA_ATTR_SKIP_CPU_SYNC ); pages =frame_vector_pages (buf->vec);/* sgt should exist only if vector contains pages... */ BUG_ON (IS_ERR (pages));
@@ -490,9 +487,6 @@ static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned long vaddr,struct sg_table *sgt;unsigned long contig_size;unsigned long dma_align =dma_get_cache_alignment (); -DEFINE_DMA_ATTRS (attrs); - -dma_set_attr (DMA_ATTR_SKIP_CPU_SYNC , &attrs);/* Only cache aligned DMA transfers are reliable */ if (!IS_ALIGNED (vaddr | size, dma_align)) {
@@ -554,7 +548,7 @@ static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned long vaddr,* prepare() memop is called. */ sgt->nents =dma_map_sg_attrs (buf->dev, sgt->sgl, sgt->orig_nents, - buf->dma_dir, &attrs); + buf->dma_dir,DMA_ATTR_SKIP_CPU_SYNC );if (sgt->nents <=0 ) {pr_err ("failed to map scatterlist\n" ); ret = -EIO ;
@@ -578,7 +572,7 @@ out: fail_map_sg:dma_unmap_sg_attrs (buf->dev, sgt->sgl, sgt->orig_nents, - buf->dma_dir, &attrs); + buf->dma_dir,DMA_ATTR_SKIP_CPU_SYNC ); fail_sgt_init:sg_free_table (sgt);
@@ -730,7 +724,7 @@ const struct vb2_mem_ops vb2_dma_contig_memops = {EXPORT_SYMBOL_GPL (vb2_dma_contig_memops);void *vb2_dma_contig_init_ctx_attrs (struct device *dev, -struct dma_attrs *attrs) +unsigned long attrs) {struct vb2_dc_conf *conf;
@@ -740,7 +734,7 @@ void *vb2_dma_contig_init_ctx_attrs(struct device *dev, conf->dev = dev;if (attrs) - conf->attrs = *attrs; + conf->attrs = attrs;return conf; }
drivers/media/v4l2-core/videobuf2-dma-sg.c +4 -15
@@ -107,9 +107,6 @@ static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size,struct sg_table *sgt;int ret;int num_pages; -DEFINE_DMA_ATTRS (attrs); - -dma_set_attr (DMA_ATTR_SKIP_CPU_SYNC , &attrs);if (WARN_ON (alloc_ctx ==NULL ))return NULL ;
@@ -148,7 +145,7 @@ static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size,* prepare() memop is called. */ sgt->nents =dma_map_sg_attrs (buf->dev, sgt->sgl, sgt->orig_nents, - buf->dma_dir, &attrs); + buf->dma_dir,DMA_ATTR_SKIP_CPU_SYNC );if (!sgt->nents) goto fail_map;
@@ -183,13 +180,10 @@ static void vb2_dma_sg_put(void *buf_priv)int i = buf->num_pages;if (atomic_dec_and_test (&buf->refcount)) { -DEFINE_DMA_ATTRS (attrs); - -dma_set_attr (DMA_ATTR_SKIP_CPU_SYNC , &attrs);dprintk (1 ,"%s: Freeing buffer of %d pages\n" , __func__, buf->num_pages);dma_unmap_sg_attrs (buf->dev, sgt->sgl, sgt->orig_nents, - buf->dma_dir, &attrs); + buf->dma_dir,DMA_ATTR_SKIP_CPU_SYNC );if (buf->vaddr)vm_unmap_ram (buf->vaddr, buf->num_pages);sg_free_table (buf->dma_sgt);
@@ -233,10 +227,8 @@ static void *vb2_dma_sg_get_userptr(void *alloc_ctx, unsigned long vaddr,struct vb2_dma_sg_conf *conf = alloc_ctx;struct vb2_dma_sg_buf *buf;struct sg_table *sgt; -DEFINE_DMA_ATTRS (attrs);struct frame_vector *vec; -dma_set_attr (DMA_ATTR_SKIP_CPU_SYNC , &attrs); buf =kzalloc (sizeof *buf,GFP_KERNEL );if (!buf)return NULL ;
@@ -267,7 +259,7 @@ static void *vb2_dma_sg_get_userptr(void *alloc_ctx, unsigned long vaddr,* prepare() memop is called. */ sgt->nents =dma_map_sg_attrs (buf->dev, sgt->sgl, sgt->orig_nents, - buf->dma_dir, &attrs); + buf->dma_dir,DMA_ATTR_SKIP_CPU_SYNC );if (!sgt->nents) goto userptr_fail_map;
@@ -291,14 +283,11 @@ static void vb2_dma_sg_put_userptr(void *buf_priv)struct vb2_dma_sg_buf *buf = buf_priv;struct sg_table *sgt = &buf->sg_table;int i = buf->num_pages; -DEFINE_DMA_ATTRS (attrs); - -dma_set_attr (DMA_ATTR_SKIP_CPU_SYNC , &attrs);dprintk (1 ,"%s: Releasing userspace buffer of %d pages\n" , __func__, buf->num_pages);dma_unmap_sg_attrs (buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir, - &attrs); +DMA_ATTR_SKIP_CPU_SYNC );if (buf->vaddr)vm_unmap_ram (buf->vaddr, buf->num_pages);sg_free_table (buf->dma_sgt);
include/media/videobuf2-dma-contig.h +2 -5
@@ -16,8 +16,6 @@#include <media/videobuf2-v4l2.h> #include <linux/dma-mapping.h> -struct dma_attrs ; -static inline dma_addr_t vb2_dma_contig_plane_dma_addr (struct vb2_buffer *vb,unsigned int plane_no) {
@@ -26,12 +24,11 @@ vb2_dma_contig_plane_dma_addr(struct vb2_buffer *vb, unsigned int plane_no)return *addr; } -void *vb2_dma_contig_init_ctx_attrs (struct device *dev, -struct dma_attrs *attrs); +void *vb2_dma_contig_init_ctx_attrs (struct device *dev,unsigned long attrs);static inline void *vb2_dma_contig_init_ctx (struct device *dev) { -return vb2_dma_contig_init_ctx_attrs (dev,NULL ); +return vb2_dma_contig_init_ctx_attrs (dev,0 ); }void vb2_dma_contig_cleanup_ctx (void *alloc_ctx);
Signature · 1 line
1.9.1
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Fabien DESSENNE
Hi
Quoted 6 lines · Krzysztof Kozlowski
Split out subsystem specific changes for easier reviews. This will be squashed with main commit.
Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/media/platform/sti/bdisp/bdisp-hw.c | 26 +++++++---------------
Quoted 5 lines
For bdisp: Acked-by: Fabien Dessenne <[email protected]>
The other part deals with v4l2-core, I let Mauro (ot other) review/ack it. I also think it would be better to split this patch in two patches
In case Mauro misses this patch, I will split it on next iteration.
Thanks,
Krzysztof
Quoted 5 lines
(bdisp / v4l2-core)
Quoted 4 lines
drivers/media/v4l2-core/videobuf2-dma-contig.c | 30 +++++++++++--------------- drivers/media/v4l2-core/videobuf2-dma-sg.c | 19 ++++------------ include/media/videobuf2-dma-contig.h | 7 ++---- 4 files changed, 26 insertions(+), 56 deletions(-)
PATCH v4 19/44 xen: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- drivers/xen/swiotlb-xen.c | 14 +++++++------- include/xen/swiotlb-xen.h | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-)
drivers/xen/swiotlb-xen.c +7 -7
@@ -294,7 +294,7 @@ error:void *xen_swiotlb_alloc_coherent (struct device *hwdev,size_t size,dma_addr_t *dma_handle,gfp_t flags, -struct dma_attrs *attrs) +unsigned long attrs) {void *ret;int order =get_order (size);
@@ -346,7 +346,7 @@ EXPORT_SYMBOL_GPL(xen_swiotlb_alloc_coherent);void xen_swiotlb_free_coherent (struct device *hwdev,size_t size,void *vaddr, -dma_addr_t dev_addr,struct dma_attrs *attrs) +dma_addr_t dev_addr,unsigned long attrs) {int order =get_order (size);phys_addr_t phys;
@@ -378,7 +378,7 @@ EXPORT_SYMBOL_GPL(xen_swiotlb_free_coherent);dma_addr_t xen_swiotlb_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {phys_addr_t map, phys =page_to_phys (page) + offset;dma_addr_t dev_addr =xen_phys_to_bus (phys);
@@ -434,7 +434,7 @@ EXPORT_SYMBOL_GPL(xen_swiotlb_map_page);*/ static void xen_unmap_single (struct device *hwdev,dma_addr_t dev_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {phys_addr_t paddr =xen_bus_to_phys (dev_addr);
@@ -462,7 +462,7 @@ static void xen_unmap_single(struct device *hwdev, dma_addr_t dev_addr,void xen_swiotlb_unmap_page (struct device *hwdev,dma_addr_t dev_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {xen_unmap_single (hwdev, dev_addr, size, dir, attrs); }
@@ -538,7 +538,7 @@ EXPORT_SYMBOL_GPL(xen_swiotlb_sync_single_for_device);int xen_swiotlb_map_sg_attrs (struct device *hwdev,struct scatterlist *sgl,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int i;
@@ -599,7 +599,7 @@ EXPORT_SYMBOL_GPL(xen_swiotlb_map_sg_attrs);void xen_swiotlb_unmap_sg_attrs (struct device *hwdev,struct scatterlist *sgl,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int i;
include/xen/swiotlb-xen.h +6 -6
@@ -9,30 +9,30 @@ extern int xen_swiotlb_init(int verbose, bool early);extern void *xen_swiotlb_alloc_coherent (struct device *hwdev,size_t size,dma_addr_t *dma_handle,gfp_t flags, -struct dma_attrs *attrs); +unsigned long attrs);extern void xen_swiotlb_free_coherent (struct device *hwdev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs); +unsigned long attrs);extern dma_addr_t xen_swiotlb_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs); +unsigned long attrs);extern void xen_swiotlb_unmap_page (struct device *hwdev,dma_addr_t dev_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs); +unsigned long attrs);extern int xen_swiotlb_map_sg_attrs (struct device *hwdev,struct scatterlist *sgl,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs); +unsigned long attrs);extern void xen_swiotlb_unmap_sg_attrs (struct device *hwdev,struct scatterlist *sgl,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs); +unsigned long attrs); extern void xen_swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH v4 20/44 swiotlb: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- include/linux/swiotlb.h | 10 +++++----- lib/swiotlb.c | 13 +++++++------ 2 files changed, 12 insertions(+), 11 deletions(-)
include/linux/swiotlb.h +5 -5
@@ -6,7 +6,6 @@#include <linux/types.h> struct device ; -struct dma_attrs ;struct page ;struct scatterlist ;
@@ -68,10 +67,10 @@ swiotlb_free_coherent(struct device *hwdev, size_t size,extern dma_addr_t swiotlb_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs); +unsigned long attrs);extern void swiotlb_unmap_page (struct device *hwdev,dma_addr_t dev_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs); +unsigned long attrs); extern int swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
@@ -83,12 +82,13 @@ swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,extern int swiotlb_map_sg_attrs (struct device *hwdev,struct scatterlist *sgl,int nelems, -enum dma_data_direction dir,struct dma_attrs *attrs); +enum dma_data_direction dir, +unsigned long attrs);extern void swiotlb_unmap_sg_attrs (struct device *hwdev,struct scatterlist *sgl,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs); +unsigned long attrs); extern void swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
lib/swiotlb.c +7 -6
@@ -738,7 +738,7 @@ swiotlb_full(struct device *dev, size_t size, enum dma_data_direction dir,dma_addr_t swiotlb_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {phys_addr_t map, phys =page_to_phys (page) + offset;dma_addr_t dev_addr =phys_to_dma (dev, phys);
@@ -807,7 +807,7 @@ static void unmap_single(struct device *hwdev, dma_addr_t dev_addr,void swiotlb_unmap_page (struct device *hwdev,dma_addr_t dev_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {unmap_single (hwdev, dev_addr, size, dir); }
@@ -877,7 +877,7 @@ EXPORT_SYMBOL(swiotlb_sync_single_for_device);*/ int swiotlb_map_sg_attrs (struct device *hwdev,struct scatterlist *sgl,int nelems, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {struct scatterlist *sg;int i;
@@ -914,7 +914,7 @@ int swiotlb_map_sg(struct device *hwdev, struct scatterlist *sgl, int nelems, enum dma_data_direction dir) { - return swiotlb_map_sg_attrs(hwdev, sgl, nelems, dir, NULL); + return swiotlb_map_sg_attrs(hwdev, sgl, nelems, dir, 0); }EXPORT_SYMBOL (swiotlb_map_sg);
@@ -924,7 +924,8 @@ EXPORT_SYMBOL(swiotlb_map_sg);*/ void swiotlb_unmap_sg_attrs (struct device *hwdev,struct scatterlist *sgl, -int nelems,enum dma_data_direction dir,struct dma_attrs *attrs) +int nelems,enum dma_data_direction dir, +unsigned long attrs) {struct scatterlist *sg;int i;
@@ -941,7 +942,7 @@ void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sgl, int nelems, enum dma_data_direction dir) { - return swiotlb_unmap_sg_attrs(hwdev, sgl, nelems, dir, NULL); + return swiotlb_unmap_sg_attrs(hwdev, sgl, nelems, dir, 0); }EXPORT_SYMBOL (swiotlb_unmap_sg);
Signature · 1 line
1.9.1
A message that is not in the archive (sent off-list or not yet received): 1465553521-27303-1-git-send-email-k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org
PATCH v4 43/44 dma-mapping: Remove dma_get_attr
After switching DMA attributes to unsigned long it is easier to just compare the bits.
--- Documentation/DMA-API.txt | 4 +-- arch/arc/mm/dma.c | 4 +-- arch/arm/mm/dma-mapping.c | 36 ++++++++++++-------------- arch/arm/xen/mm.c | 4 +-- arch/arm64/mm/dma-mapping.c | 10 +++---- arch/avr32/mm/dma-coherent.c | 4 +-- arch/ia64/sn/pci/pci_dma.c | 10 ++----- arch/metag/kernel/dma.c | 2 +- arch/mips/mm/dma-default.c | 6 ++--- arch/openrisc/kernel/dma.c | 4 +-- arch/parisc/kernel/pci-dma.c | 2 +- arch/powerpc/platforms/cell/iommu.c | 12 ++++----- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 2 +- drivers/iommu/dma-iommu.c | 2 +- drivers/media/v4l2-core/videobuf2-dma-contig.c | 2 +- include/linux/dma-mapping.h | 10 ------- 16 files changed, 47 insertions(+), 67 deletions(-)
Documentation/DMA-API.txt +1 -3
@@ -422,9 +422,7 @@ void whizco_dma_map_sg_attrs(struct device *dev, dma_addr_t dma_addr, unsigned long attrs) { .... - int foo = dma_get_attr(DMA_ATTR_FOO, attrs); - .... - if (foo) + if (attrs & DMA_ATTR_FOO) /* twizzle the frobnozzle */ ....
arch/arc/mm/dma.c +2 -2
@@ -46,7 +46,7 @@ static void *arc_dma_alloc(struct device *dev, size_t size,* (vs. always going to memory - thus are faster) */ if ((is_isa_arcv2 () && ioc_exists) || -dma_get_attr (DMA_ATTR_NON_CONSISTENT , attrs)) + (attrs &DMA_ATTR_NON_CONSISTENT )) need_coh =0 ;/*
@@ -95,7 +95,7 @@ static void arc_dma_free(struct device *dev, size_t size, void *vaddr,struct page *page =virt_to_page (dma_handle);int is_non_coh =1 ; - is_non_coh =dma_get_attr (DMA_ATTR_NON_CONSISTENT , attrs) || + is_non_coh = (attrs &DMA_ATTR_NON_CONSISTENT ) || (is_isa_arcv2 () && ioc_exists);if (PageHighMem (page) || !is_non_coh)
arch/arm/mm/dma-mapping.c +17 -19
@@ -126,7 +126,7 @@ static dma_addr_t arm_dma_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction dir, unsigned long attrs) { - if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) + if ((attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0) __dma_page_cpu_to_dev(page, offset, size, dir);return pfn_to_dma (dev,page_to_pfn (page)) + offset; }
@@ -155,7 +155,7 @@ static dma_addr_t arm_coherent_dma_map_page(struct device *dev, struct page *pagstatic void arm_dma_unmap_page (struct device *dev,dma_addr_t handle,size_t size,enum dma_data_direction dir,unsigned long attrs) { -if (!dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) +if ((attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 )__dma_page_dev_to_cpu (pfn_to_page (dma_to_pfn (dev, handle)), handle & ~PAGE_MASK , size, dir); }
@@ -622,9 +622,9 @@ static void __free_from_contiguous(struct device *dev, struct page *page,static inline pgprot_t __get_dma_pgprot (unsigned long attrs,pgprot_t prot) { - prot =dma_get_attr (DMA_ATTR_WRITE_COMBINE , attrs) ? -pgprot_writecombine (prot) : -pgprot_dmacoherent (prot); + prot = (attrs &DMA_ATTR_WRITE_COMBINE ) ? +pgprot_writecombine (prot) : +pgprot_dmacoherent (prot);return prot; }
@@ -744,7 +744,7 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, .gfp = gfp, .prot = prot, .caller = caller, - .want_vaddr = !dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, attrs), + .want_vaddr = ((attrs & DMA_ATTR_NO_KERNEL_MAPPING) == 0), };#ifdef CONFIG_DMA_API_DEBUG
@@ -887,7 +887,7 @@ static void __arm_dma_free(struct device *dev, size_t size, void *cpu_addr, .size = PAGE_ALIGN(size), .cpu_addr = cpu_addr, .page = page, - .want_vaddr = !dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, attrs), + .want_vaddr = ((attrs & DMA_ATTR_NO_KERNEL_MAPPING) == 0), }; buf =arm_dma_buffer_find (cpu_addr);
@@ -1267,7 +1267,7 @@ static struct page **__iommu_alloc_buffer(struct device *dev, size_t size,if (!pages)return NULL ; -if (dma_get_attr (DMA_ATTR_FORCE_CONTIGUOUS , attrs)) +if (attrs &DMA_ATTR_FORCE_CONTIGUOUS ) {unsigned long order =get_order (size);struct page *page;
@@ -1285,7 +1285,7 @@ static struct page **__iommu_alloc_buffer(struct device *dev, size_t size, }/* Go straight to 4K chunks if caller says it's OK. */ -if (dma_get_attr (DMA_ATTR_ALLOC_SINGLE_PAGES , attrs)) +if (attrs &DMA_ATTR_ALLOC_SINGLE_PAGES ) order_idx =ARRAY_SIZE (iommu_order_array) -1 ;/*
@@ -1346,7 +1346,7 @@ static int __iommu_free_buffer(struct device *dev, struct page **pages,int count = size >>PAGE_SHIFT ;int i; -if (dma_get_attr (DMA_ATTR_FORCE_CONTIGUOUS , attrs)) { +if (attrs &DMA_ATTR_FORCE_CONTIGUOUS ) {dma_release_from_contiguous (dev, pages[0 ], count); }else {for (i =0 ; i < count; i++)
@@ -1445,7 +1445,7 @@ static struct page **__iommu_get_pages(void *cpu_addr, unsigned long attrs)if (__in_atomic_pool (cpu_addr,PAGE_SIZE ))return __atomic_get_pages (cpu_addr); -if (dma_get_attr (DMA_ATTR_NO_KERNEL_MAPPING , attrs)) +if (attrs &DMA_ATTR_NO_KERNEL_MAPPING )return cpu_addr; area =find_vm_area (cpu_addr);
@@ -1512,7 +1512,7 @@ static void *arm_iommu_alloc_attrs(struct device *dev, size_t size,if (*handle ==DMA_ERROR_CODE ) goto err_buffer; -if (dma_get_attr (DMA_ATTR_NO_KERNEL_MAPPING , attrs)) +if (attrs &DMA_ATTR_NO_KERNEL_MAPPING )return pages; addr = __iommu_alloc_remap(pages, size, gfp, prot,
@@ -1583,7 +1583,7 @@ void arm_iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr,return ; } -if (!dma_get_attr (DMA_ATTR_NO_KERNEL_MAPPING , attrs)) { +if ((attrs &DMA_ATTR_NO_KERNEL_MAPPING ) ==0 ) {dma_common_free_remap (cpu_addr, size,VM_ARM_DMA_CONSISTENT |VM_USERMAP ); }
@@ -1653,8 +1653,7 @@ static int __map_sg_chunk(struct device *dev, struct scatterlist *sg,phys_addr_t phys =page_to_phys (sg_page (s));unsigned int len =PAGE_ALIGN (s->offset + s->length); -if (!is_coherent && - !dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) +if (!is_coherent && (attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 )__dma_page_cpu_to_dev (sg_page (s), s->offset, s->length, dir); prot =__dma_direction_to_prot (dir);
@@ -1767,8 +1766,7 @@ static void __iommu_unmap_sg(struct device *dev, struct scatterlist *sg,if (sg_dma_len (s))__iommu_remove_mapping (dev,sg_dma_address (s),sg_dma_len (s)); -if (!is_coherent && - !dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) +if (!is_coherent && (attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 )__dma_page_dev_to_cpu (sg_page (s), s->offset, s->length, dir); }
@@ -1892,7 +1890,7 @@ static dma_addr_t arm_iommu_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction dir, unsigned long attrs) { - if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) + if ((attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0) __dma_page_cpu_to_dev(page, offset, size, dir);return arm_coherent_iommu_map_page (dev, page, offset, size, dir, attrs);
@@ -1943,7 +1941,7 @@ static void arm_iommu_unmap_page(struct device *dev, dma_addr_t handle,if (!iova)return ; -if (!dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) +if ((attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 )__dma_page_dev_to_cpu (page, offset, size, dir);iommu_unmap (mapping->domain, iova, len);
arch/arm/xen/mm.c +2 -2
@@ -102,7 +102,7 @@ void __xen_dma_map_page(struct device *hwdev, struct page *page, {if (is_device_dma_coherent (hwdev))return ; -if (dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) +if (attrs &DMA_ATTR_SKIP_CPU_SYNC )return ;__xen_dma_page_cpu_to_dev (hwdev, dev_addr, size, dir);
@@ -115,7 +115,7 @@ void __xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, {if (is_device_dma_coherent (hwdev))return ; -if (dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) +if (attrs &DMA_ATTR_SKIP_CPU_SYNC )return ;__xen_dma_page_dev_to_cpu (hwdev, handle, size, dir);
arch/arm64/mm/dma-mapping.c +5 -5
@@ -32,7 +32,7 @@static pgprot_t __get_dma_pgprot (unsigned long attrs,pgprot_t prot,bool coherent) { -if (!coherent ||dma_get_attr (DMA_ATTR_WRITE_COMBINE , attrs)) +if (!coherent || (attrs &DMA_ATTR_WRITE_COMBINE ))return pgprot_writecombine (prot);return prot; }
@@ -702,7 +702,7 @@ static dma_addr_t __iommu_map_page(struct device *dev, struct page *page,dma_addr_t dev_addr =iommu_dma_map_page (dev, page, offset, size, prot);if (!iommu_dma_mapping_error (dev, dev_addr) && - !dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) + (attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 )__iommu_sync_single_for_device (dev, dev_addr, size, dir);return dev_addr;
@@ -712,7 +712,7 @@ static void __iommu_unmap_page(struct device *dev, dma_addr_t dev_addr, size_t size, enum dma_data_direction dir, unsigned long attrs) { - if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) + if ((attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0) __iommu_sync_single_for_cpu(dev, dev_addr, size, dir);iommu_dma_unmap_page (dev, dev_addr, size, dir, attrs);
@@ -752,7 +752,7 @@ static int __iommu_map_sg_attrs(struct device *dev, struct scatterlist *sgl, {bool coherent =is_device_dma_coherent (dev); -if (!dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) +if ((attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 )__iommu_sync_sg_for_device (dev, sgl, nelems, dir); return iommu_dma_map_sg(dev, sgl, nelems,
@@ -764,7 +764,7 @@ static void __iommu_unmap_sg_attrs(struct device *dev, enum dma_data_direction dir, unsigned long attrs) { -if (!dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) +if ((attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 )__iommu_sync_sg_for_cpu (dev, sgl, nelems, dir);iommu_dma_unmap_sg (dev, sgl, nelems, dir, attrs);
arch/avr32/mm/dma-coherent.c +2 -2
@@ -109,7 +109,7 @@ static void *avr32_dma_alloc(struct device *dev, size_t size,return NULL ; phys =page_to_phys (page); -if (dma_get_attr (DMA_ATTR_WRITE_COMBINE , attrs)) { +if (attrs &DMA_ATTR_WRITE_COMBINE ) {/* Now, map the page into P3 with write-combining turned on */ *handle = phys;return __ioremap (phys, size, _PAGE_BUFFER);
@@ -123,7 +123,7 @@ static void avr32_dma_free(struct device *dev, size_t size, {struct page *page; -if (dma_get_attr (DMA_ATTR_WRITE_COMBINE , attrs)) { +if (attrs &DMA_ATTR_WRITE_COMBINE ) {iounmap (cpu_addr); page =phys_to_page (handle);
arch/ia64/sn/pci/pci_dma.c +2 -8
@@ -183,14 +183,11 @@ static dma_addr_t sn_dma_map_page(struct device *dev, struct page *page,unsigned long phys_addr;struct pci_dev *pdev =to_pci_dev (dev);struct sn_pcibus_provider *provider =SN_PCIDEV_BUSPROVIDER (pdev); -int dmabarr; - - dmabarr =dma_get_attr (DMA_ATTR_WRITE_BARRIER , attrs);BUG_ON (!dev_is_pci (dev)); phys_addr =__pa (cpu_addr); -if (dmabarr) +if (attrs &DMA_ATTR_WRITE_BARRIER ) dma_addr = provider->dma_map_consistent (pdev, phys_addr, size,SN_DMA_ADDR_PHYS );else
@@ -280,9 +277,6 @@ static int sn_dma_map_sg(struct device *dev, struct scatterlist *sgl,struct pci_dev *pdev =to_pci_dev (dev);struct sn_pcibus_provider *provider =SN_PCIDEV_BUSPROVIDER (pdev);int i; -int dmabarr; - - dmabarr =dma_get_attr (DMA_ATTR_WRITE_BARRIER , attrs);BUG_ON (!dev_is_pci (dev));
@@ -292,7 +286,7 @@ static int sn_dma_map_sg(struct device *dev, struct scatterlist *sgl,for_each_sg (sgl, sg, nhwentries, i) {dma_addr_t dma_addr; phys_addr =SG_ENT_PHYS_ADDRESS (sg); -if (dmabarr) +if (attrs &DMA_ATTR_WRITE_BARRIER ) dma_addr = provider->dma_map_consistent(pdev, phys_addr, sg->length,
arch/metag/kernel/dma.c +1 -1
@@ -337,7 +337,7 @@ static int metag_dma_mmap(struct device *dev, struct vm_area_struct *vma,struct metag_vm_region *c;int ret = -ENXIO ; -if (dma_get_attr (DMA_ATTR_WRITE_COMBINE , attrs)) +if (attrs &DMA_ATTR_WRITE_COMBINE ) vma->vm_page_prot =pgprot_writecombine (vma->vm_page_prot);else vma->vm_page_prot =pgprot_noncached (vma->vm_page_prot);
arch/mips/mm/dma-default.c +3 -3
@@ -141,7 +141,7 @@ static void *mips_dma_alloc_coherent(struct device *dev, size_t size,* XXX: seems like the coherent and non-coherent implementations could * be consolidated. */ -if (dma_get_attr (DMA_ATTR_NON_CONSISTENT , attrs)) +if (attrs &DMA_ATTR_NON_CONSISTENT )return mips_dma_alloc_noncoherent (dev, size, dma_handle, gfp); gfp =massage_gfp_flags (dev, gfp);
@@ -182,7 +182,7 @@ static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr,unsigned int count =PAGE_ALIGN (size) >>PAGE_SHIFT ;struct page *page =NULL ; -if (dma_get_attr (DMA_ATTR_NON_CONSISTENT , attrs)) { +if (attrs &DMA_ATTR_NON_CONSISTENT ) {mips_dma_free_noncoherent (dev, size, vaddr, dma_handle);return ; }
@@ -214,7 +214,7 @@ static int mips_dma_mmap(struct device *dev, struct vm_area_struct *vma, pfn =page_to_pfn (virt_to_page ((void *)addr)); -if (dma_get_attr (DMA_ATTR_WRITE_COMBINE , attrs)) +if (attrs &DMA_ATTR_WRITE_COMBINE ) vma->vm_page_prot =pgprot_writecombine (vma->vm_page_prot);else vma->vm_page_prot =pgprot_noncached (vma->vm_page_prot);
arch/openrisc/kernel/dma.c +2 -2
@@ -100,7 +100,7 @@ or1k_dma_alloc(struct device *dev, size_t size, va = (unsigned long )page; -if (!dma_get_attr (DMA_ATTR_NON_CONSISTENT , attrs)) { +if ((attrs &DMA_ATTR_NON_CONSISTENT ) ==0 ) {/* * We need to iterate through the pages, clearing the dcache for * them and setting the cache-inhibit bit.
@@ -124,7 +124,7 @@ or1k_dma_free(struct device *dev, size_t size, void *vaddr, .mm = &init_mm }; -if (!dma_get_attr (DMA_ATTR_NON_CONSISTENT , attrs)) { +if ((attrs &DMA_ATTR_NON_CONSISTENT ) ==0 ) {/* walk_page_range shouldn't be able to fail here */ WARN_ON (walk_page_range (va, va + size, &walk)); }
arch/parisc/kernel/pci-dma.c +1 -1
@@ -581,7 +581,7 @@ static void *pcx_dma_alloc(struct device *dev, size_t size, {void *addr; -if (!dma_get_attr (DMA_ATTR_NON_CONSISTENT , attrs)) +if ((attrs &DMA_ATTR_NON_CONSISTENT ) ==0 )return NULL ; addr = (void *)__get_free_pages (flag,get_order (size));
arch/powerpc/platforms/cell/iommu.c +6 -6
@@ -193,7 +193,7 @@ static int tce_build_cell(struct iommu_table *tbl, long index, long npages, base_pte =CBE_IOPTE_PP_W |CBE_IOPTE_PP_R |CBE_IOPTE_M |CBE_IOPTE_SO_RW | (window->ioid & CBE_IOPTE_IOID_Mask);#endif -if (unlikely (dma_get_attr (DMA_ATTR_WEAK_ORDERING , attrs))) +if (unlikely (attrs &DMA_ATTR_WEAK_ORDERING )) base_pte &= ~CBE_IOPTE_SO_RW ; io_pte = (unsigned long *)tbl->it_base + (index - tbl->it_offset);
@@ -600,7 +600,7 @@ static dma_addr_t dma_fixed_map_page(struct device *dev, struct page *page, enum dma_data_direction direction, unsigned long attrs) { - if (iommu_fixed_is_weak == dma_get_attr(DMA_ATTR_WEAK_ORDERING, attrs)) + if (iommu_fixed_is_weak == (attrs & DMA_ATTR_WEAK_ORDERING)) return dma_direct_ops.map_page(dev, page, offset, size, direction, attrs); else
@@ -613,7 +613,7 @@ static void dma_fixed_unmap_page(struct device *dev, dma_addr_t dma_addr, size_t size, enum dma_data_direction direction, unsigned long attrs) { - if (iommu_fixed_is_weak == dma_get_attr(DMA_ATTR_WEAK_ORDERING, attrs)) + if (iommu_fixed_is_weak == (attrs & DMA_ATTR_WEAK_ORDERING)) dma_direct_ops.unmap_page(dev, dma_addr, size, direction, attrs); else
@@ -625,7 +625,7 @@ static int dma_fixed_map_sg(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction direction, unsigned long attrs) { - if (iommu_fixed_is_weak == dma_get_attr(DMA_ATTR_WEAK_ORDERING, attrs)) + if (iommu_fixed_is_weak == (attrs & DMA_ATTR_WEAK_ORDERING)) return dma_direct_ops.map_sg(dev, sg, nents, direction, attrs); else return ppc_iommu_map_sg(dev, cell_get_iommu_table(dev), sg,
@@ -637,7 +637,7 @@ static void dma_fixed_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction direction, unsigned long attrs) { - if (iommu_fixed_is_weak == dma_get_attr(DMA_ATTR_WEAK_ORDERING, attrs)) + if (iommu_fixed_is_weak == (attrs & DMA_ATTR_WEAK_ORDERING)) dma_direct_ops.unmap_sg(dev, sg, nents, direction, attrs); else ppc_iommu_unmap_sg(cell_get_iommu_table(dev), sg, nents,
@@ -1162,7 +1162,7 @@ static int __init setup_iommu_fixed(char *str) pciep =of_find_node_by_type (NULL ,"pcie-endpoint" );if (strcmp (str,"weak" ) ==0 || (pciep &&strcmp (str,"strong" ) !=0 )) - iommu_fixed_is_weak =1 ; + iommu_fixed_is_weak =DMA_ATTR_WEAK_ORDERING ;of_node_put (pciep);
drivers/gpu/drm/rockchip/rockchip_drm_gem.c +1 -1
@@ -273,7 +273,7 @@ void *rockchip_gem_prime_vmap(struct drm_gem_object *obj) {struct rockchip_gem_object *rk_obj =to_rockchip_obj (obj); -if (dma_get_attr (DMA_ATTR_NO_KERNEL_MAPPING , rk_obj->dma_attrs)) +if (rk_obj->dma_attrs &DMA_ATTR_NO_KERNEL_MAPPING )return NULL ;return rk_obj->kvaddr;
drivers/iommu/dma-iommu.c +1 -1
@@ -306,7 +306,7 @@ struct page **iommu_dma_alloc(struct device *dev, size_t size, gfp_t gfp, }else { size =ALIGN (size, min_size); } -if (dma_get_attr (DMA_ATTR_ALLOC_SINGLE_PAGES , attrs)) +if (attrs &DMA_ATTR_ALLOC_SINGLE_PAGES ) alloc_sizes = min_size; count =PAGE_ALIGN (size) >>PAGE_SHIFT ;
drivers/media/v4l2-core/videobuf2-dma-contig.c +1 -1
@@ -160,7 +160,7 @@ static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size,return ERR_PTR (-ENOMEM ); } -if (!dma_get_attr (DMA_ATTR_NO_KERNEL_MAPPING , buf->attrs)) +if ((buf->attrs &DMA_ATTR_NO_KERNEL_MAPPING ) ==0 ) buf->vaddr = buf->cookie;/* Prevent the device from being released while the buffer is used */
include/linux/dma-mapping.h +0 -10
@@ -101,16 +101,6 @@ static inline int is_device_dma_capable(struct device *dev)return dev->dma_mask !=NULL && *dev->dma_mask !=DMA_MASK_NONE ; } -/** -* dma_get_attr - check for a specific attribute -* @attr: attribute to look for -* @attrs: attributes to check within -*/ -static inline bool dma_get_attr (unsigned long attr,unsigned long attrs) -{ -return !!(attr & attrs); -} -#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT /* * These three functions are only for dma allocator.
Signature · 1 line
1.9.1
Re: [PATCH v4 43/44] dma-mapping: Remove dma_get_attr
Quoted 6 lines · Krzysztof Kozlowski
After switching DMA attributes to unsigned long it is easier to just compare the bits.
Signed-off-by Krzysztof Kozlowski <[email protected]>[for avr32]
Re: [PATCH v4 43/44] dma-mapping: Remove dma_get_attr
In reply to Krzysztof KozlowskiQuoted 6 lines · Krzysztof Kozlowski
After switching DMA attributes to unsigned long it is easier to just compare the bits.
Signed-off-by Krzysztof Kozlowski <[email protected]>[for avr32]
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
A message that is not in the archive (sent off-list or not yet received): 1465553521-27303-44-git-send-email-k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org
Robin Murphy
Acked-byRe: [PATCH v4 43/44] dma-mapping: Remove dma_get_attr
Quoted 7 lines · Krzysztof Kozlowski
After switching DMA attributes to unsigned long it is easier to just compare the bits.
Signed-off-by Krzysztof Kozlowski <[email protected]>[for avr32]---
[...]
Quoted 1 line
arch/arm64/mm/dma-mapping.c | 10 +++----
[...]
Quoted 1 line
drivers/iommu/dma-iommu.c | 2 +-
[...]
Quoted 49 lines
arch/arm64/mm/dma-mapping.c +5
-5@@ -32,7 +32,7 @@static pgprot_t __get_dma_pgprot (unsigned long attrs,pgprot_t prot,bool coherent) { -if (!coherent ||dma_get_attr (DMA_ATTR_WRITE_COMBINE , attrs)) +if (!coherent || (attrs &DMA_ATTR_WRITE_COMBINE ))return pgprot_writecombine (prot);return prot; }@@ -702,7 +702,7 @@ static dma_addr_t __iommu_map_page(struct device *dev, struct page *page,dma_addr_t dev_addr =iommu_dma_map_page (dev, page, offset, size, prot);if (!iommu_dma_mapping_error (dev, dev_addr) && - !dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) + (attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 )__iommu_sync_single_for_device (dev, dev_addr, size, dir);return dev_addr;@@ -712,7 +712,7 @@ static void __iommu_unmap_page(struct device *dev, dma_addr_t dev_addr, size_t size, enum dma_data_direction dir, unsigned long attrs) { - if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) + if ((attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0) __iommu_sync_single_for_cpu(dev, dev_addr, size, dir);iommu_dma_unmap_page (dev, dev_addr, size, dir, attrs);@@ -752,7 +752,7 @@ static int __iommu_map_sg_attrs(struct device *dev, struct scatterlist *sgl, {bool coherent =is_device_dma_coherent (dev); -if (!dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) +if ((attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 )__iommu_sync_sg_for_device (dev, sgl, nelems, dir); return iommu_dma_map_sg(dev, sgl, nelems,@@ -764,7 +764,7 @@ static void __iommu_unmap_sg_attrs(struct device *dev, enum dma_data_direction dir, unsigned long attrs) { -if (!dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) +if ((attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 )__iommu_sync_sg_for_cpu (dev, sgl, nelems, dir);iommu_dma_unmap_sg (dev, sgl, nelems, dir, attrs);
[...]
drivers/iommu/dma-iommu.c struct page **iommu_dma_alloc(struct device *dev, size_t size, gfp_t gfp, · line 312
Quoted 13 lines
drivers/iommu/dma-iommu.c +1
-1@@ -306,7 +306,7 @@ struct page **iommu_dma_alloc(struct device *dev, size_t size, gfp_t gfp, }else { size =ALIGN (size, min_size); } -if (dma_get_attr (DMA_ATTR_ALLOC_SINGLE_PAGES , attrs)) +if (attrs &DMA_ATTR_ALLOC_SINGLE_PAGES ) alloc_sizes = min_size; count =PAGE_ALIGN (size) >>PAGE_SHIFT ;
[...]
These all look appropriate to me; thanks!
For arm64 and dma-iommu:
Re: [PATCH v4 43/44] dma-mapping: Remove dma_get_attr
In reply to Krzysztof KozlowskiQuoted 7 lines · Krzysztof Kozlowski
After switching DMA attributes to unsigned long it is easier to just compare the bits.
Signed-off-by Krzysztof Kozlowski <[email protected]>[for avr32]---
[...]
Quoted 1 line
arch/arm64/mm/dma-mapping.c | 10 +++----
[...]
Quoted 1 line
drivers/iommu/dma-iommu.c | 2 +-
[...]
Quoted 49 lines
arch/arm64/mm/dma-mapping.c +5
-5@@ -32,7 +32,7 @@static pgprot_t __get_dma_pgprot (unsigned long attrs,pgprot_t prot,bool coherent) { -if (!coherent ||dma_get_attr (DMA_ATTR_WRITE_COMBINE , attrs)) +if (!coherent || (attrs &DMA_ATTR_WRITE_COMBINE ))return pgprot_writecombine (prot);return prot; }@@ -702,7 +702,7 @@ static dma_addr_t __iommu_map_page(struct device *dev, struct page *page,dma_addr_t dev_addr =iommu_dma_map_page (dev, page, offset, size, prot);if (!iommu_dma_mapping_error (dev, dev_addr) && - !dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) + (attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 )__iommu_sync_single_for_device (dev, dev_addr, size, dir);return dev_addr;@@ -712,7 +712,7 @@ static void __iommu_unmap_page(struct device *dev, dma_addr_t dev_addr, size_t size, enum dma_data_direction dir, unsigned long attrs) { - if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) + if ((attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0) __iommu_sync_single_for_cpu(dev, dev_addr, size, dir);iommu_dma_unmap_page (dev, dev_addr, size, dir, attrs);@@ -752,7 +752,7 @@ static int __iommu_map_sg_attrs(struct device *dev, struct scatterlist *sgl, {bool coherent =is_device_dma_coherent (dev); -if (!dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) +if ((attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 )__iommu_sync_sg_for_device (dev, sgl, nelems, dir); return iommu_dma_map_sg(dev, sgl, nelems,@@ -764,7 +764,7 @@ static void __iommu_unmap_sg_attrs(struct device *dev, enum dma_data_direction dir, unsigned long attrs) { -if (!dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) +if ((attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 )__iommu_sync_sg_for_cpu (dev, sgl, nelems, dir);iommu_dma_unmap_sg (dev, sgl, nelems, dir, attrs);
[...]
drivers/iommu/dma-iommu.c struct page **iommu_dma_alloc(struct device *dev, size_t size, gfp_t gfp, · line 312
Quoted 13 lines
drivers/iommu/dma-iommu.c +1
-1@@ -306,7 +306,7 @@ struct page **iommu_dma_alloc(struct device *dev, size_t size, gfp_t gfp, }else { size =ALIGN (size, min_size); } -if (dma_get_attr (DMA_ATTR_ALLOC_SINGLE_PAGES , attrs)) +if (attrs &DMA_ATTR_ALLOC_SINGLE_PAGES ) alloc_sizes = min_size; count =PAGE_ALIGN (size) >>PAGE_SHIFT ;
[...]
These all look appropriate to me; thanks!
For arm64 and dma-iommu:
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH v4 21/44 powerpc: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/powerpc/include/asm/dma-mapping.h | 7 +++---- arch/powerpc/include/asm/iommu.h | 10 +++++----- arch/powerpc/kernel/dma-iommu.c | 12 ++++++------ arch/powerpc/kernel/dma.c | 18 +++++++++--------- arch/powerpc/kernel/ibmebus.c | 12 ++++++------ arch/powerpc/kernel/iommu.c | 12 ++++++------ arch/powerpc/kernel/vio.c | 12 ++++++------ arch/powerpc/platforms/cell/iommu.c | 16 ++++++++-------- arch/powerpc/platforms/pasemi/iommu.c | 2 +- arch/powerpc/platforms/powernv/npu-dma.c | 8 ++++---- arch/powerpc/platforms/powernv/pci-ioda.c | 4 ++-- arch/powerpc/platforms/powernv/pci.c | 2 +- arch/powerpc/platforms/powernv/pci.h | 2 +- arch/powerpc/platforms/ps3/system-bus.c | 18 +++++++++--------- arch/powerpc/platforms/pseries/iommu.c | 6 +++--- arch/powerpc/sysdev/dart_iommu.c | 2 +- 16 files changed, 71 insertions(+), 72 deletions(-)
arch/powerpc/include/asm/dma-mapping.h +3 -4
@@ -13,7 +13,6 @@/* need struct page definitions */ #include <linux/mm.h> #include <linux/scatterlist.h> -#include <linux/dma-attrs.h> #include <linux/dma-debug.h> #include <asm/io.h> #include <asm/swiotlb.h>
@@ -25,14 +24,14 @@/* Some dma direct funcs must be visible for use in other dma_ops */ extern void *__dma_direct_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flag, -struct dma_attrs *attrs); +unsigned long attrs);extern void __dma_direct_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs); +unsigned long attrs);extern int dma_direct_mmap_coherent (struct device *dev,struct vm_area_struct *vma,void *cpu_addr,dma_addr_t handle, -size_t size,struct dma_attrs *attrs); +size_t size,unsigned long attrs);#ifdef CONFIG_NOT_COHERENT_CACHE /*
arch/powerpc/include/asm/iommu.h +5 -5
@@ -53,7 +53,7 @@ struct iommu_table_ops { long index, long npages, unsigned long uaddr, enum dma_data_direction direction, - struct dma_attrs *attrs); + unsigned long attrs);#ifdef CONFIG_IOMMU_API /* * Exchanges existing TCE with new TCE plus direction bits;
@@ -248,12 +248,12 @@ extern int ppc_iommu_map_sg(struct device *dev, struct iommu_table *tbl, struct scatterlist *sglist, int nelems, unsigned long mask, enum dma_data_direction direction, - struct dma_attrs *attrs); + unsigned long attrs);extern void ppc_iommu_unmap_sg (struct iommu_table *tbl,struct scatterlist *sglist,int nelems,enum dma_data_direction direction, -struct dma_attrs *attrs); +unsigned long attrs); extern void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl, size_t size, dma_addr_t *dma_handle,
@@ -264,10 +264,10 @@ extern dma_addr_t iommu_map_page(struct device *dev, struct iommu_table *tbl, struct page *page, unsigned long offset, size_t size, unsigned long mask, enum dma_data_direction direction, - struct dma_attrs *attrs); + unsigned long attrs);extern void iommu_unmap_page (struct iommu_table *tbl,dma_addr_t dma_handle,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs); +unsigned long attrs);extern void iommu_init_early_pSeries (void );extern void iommu_init_early_dart (struct pci_controller_ops *controller_ops);
arch/powerpc/kernel/dma-iommu.c +6 -6
@@ -18,7 +18,7 @@*/ static void *dma_iommu_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flag, -struct dma_attrs *attrs) +unsigned long attrs) { return iommu_alloc_coherent(dev, get_iommu_table_base(dev), size, dma_handle, dev->coherent_dma_mask, flag,
@@ -27,7 +27,7 @@ static void *dma_iommu_alloc_coherent(struct device *dev, size_t size,static void dma_iommu_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) {iommu_free_coherent (get_iommu_table_base (dev), size, vaddr, dma_handle); }
@@ -40,7 +40,7 @@ static void dma_iommu_free_coherent(struct device *dev, size_t size,static dma_addr_t dma_iommu_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {return iommu_map_page (dev,get_iommu_table_base (dev), page, offset, size,device_to_mask (dev), direction, attrs);
@@ -49,7 +49,7 @@ static dma_addr_t dma_iommu_map_page(struct device *dev, struct page *page,static void dma_iommu_unmap_page (struct device *dev,dma_addr_t dma_handle,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {iommu_unmap_page (get_iommu_table_base (dev), dma_handle, size, direction, attrs);
@@ -58,7 +58,7 @@ static void dma_iommu_unmap_page(struct device *dev, dma_addr_t dma_handle,static int dma_iommu_map_sg (struct device *dev,struct scatterlist *sglist,int nelems,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {return ppc_iommu_map_sg (dev,get_iommu_table_base (dev), sglist, nelems,device_to_mask (dev), direction, attrs);
@@ -66,7 +66,7 @@ static int dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,static void dma_iommu_unmap_sg (struct device *dev,struct scatterlist *sglist,int nelems,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {ppc_iommu_unmap_sg (get_iommu_table_base (dev), sglist, nelems, direction, attrs);
arch/powerpc/kernel/dma.c +9 -9
@@ -64,7 +64,7 @@ static int dma_direct_dma_supported(struct device *dev, u64 mask)void *__dma_direct_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flag, -struct dma_attrs *attrs) +unsigned long attrs) {void *ret;#ifdef CONFIG_NOT_COHERENT_CACHE
@@ -121,7 +121,7 @@ void *__dma_direct_alloc_coherent(struct device *dev, size_t size,void __dma_direct_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) {#ifdef CONFIG_NOT_COHERENT_CACHE __dma_free_coherent (size, vaddr);
@@ -132,7 +132,7 @@ void __dma_direct_free_coherent(struct device *dev, size_t size,static void *dma_direct_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flag, -struct dma_attrs *attrs) +unsigned long attrs) {struct iommu_table *iommu;
@@ -156,7 +156,7 @@ static void *dma_direct_alloc_coherent(struct device *dev, size_t size,static void dma_direct_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) {struct iommu_table *iommu;
@@ -177,7 +177,7 @@ static void dma_direct_free_coherent(struct device *dev, size_t size,int dma_direct_mmap_coherent (struct device *dev,struct vm_area_struct *vma,void *cpu_addr,dma_addr_t handle,size_t size, -struct dma_attrs *attrs) +unsigned long attrs) {unsigned long pfn;
@@ -195,7 +195,7 @@ int dma_direct_mmap_coherent(struct device *dev, struct vm_area_struct *vma,static int dma_direct_map_sg (struct device *dev,struct scatterlist *sgl,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int i;
@@ -211,7 +211,7 @@ static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,static void dma_direct_unmap_sg (struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) { }
@@ -232,7 +232,7 @@ static inline dma_addr_t dma_direct_map_page(struct device *dev,unsigned long offset, size_t size, enum dma_data_direction dir, - struct dma_attrs *attrs) + unsigned long attrs) { BUG_ON(dir == DMA_NONE);__dma_sync_page (page, offset, size, dir);
@@ -243,7 +243,7 @@ static inline void dma_direct_unmap_page(struct device *dev,dma_addr_t dma_address, size_t size, enum dma_data_direction direction, - struct dma_attrs *attrs) + unsigned long attrs) { }
arch/powerpc/kernel/ibmebus.c +6 -6
@@ -65,7 +65,7 @@ static void *ibmebus_alloc_coherent(struct device *dev,size_t size, dma_addr_t *dma_handle, gfp_t flag, - struct dma_attrs *attrs) + unsigned long attrs) { void *mem;
@@ -78,7 +78,7 @@ static void *ibmebus_alloc_coherent(struct device *dev,static void ibmebus_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) {kfree (vaddr); }
@@ -88,7 +88,7 @@ static dma_addr_t ibmebus_map_page(struct device *dev,unsigned long offset, size_t size, enum dma_data_direction direction, - struct dma_attrs *attrs) + unsigned long attrs) { return (dma_addr_t)(page_address(page) + offset); }
@@ -97,7 +97,7 @@ static void ibmebus_unmap_page(struct device *dev,dma_addr_t dma_addr, size_t size, enum dma_data_direction direction, - struct dma_attrs *attrs) + unsigned long attrs) { return; }
@@ -105,7 +105,7 @@ static void ibmebus_unmap_page(struct device *dev,static int ibmebus_map_sg (struct device *dev,struct scatterlist *sgl,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int i;
@@ -121,7 +121,7 @@ static int ibmebus_map_sg(struct device *dev,static void ibmebus_unmap_sg (struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {return ; }
arch/powerpc/kernel/iommu.c +6 -6
@@ -307,7 +307,7 @@ static dma_addr_t iommu_alloc(struct device *dev, struct iommu_table *tbl, void *page, unsigned int npages, enum dma_data_direction direction, unsigned long mask, unsigned int align_order, - struct dma_attrs *attrs) + unsigned long attrs) { unsigned long entry;dma_addr_t ret =DMA_ERROR_CODE ;
@@ -431,7 +431,7 @@ static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,int ppc_iommu_map_sg (struct device *dev,struct iommu_table *tbl,struct scatterlist *sglist,int nelems,unsigned long mask,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {dma_addr_t dma_next =0 , dma_addr;struct scatterlist *s, *outs, *segstart;
@@ -574,7 +574,7 @@ int ppc_iommu_map_sg(struct device *dev, struct iommu_table *tbl,void ppc_iommu_unmap_sg (struct iommu_table *tbl,struct scatterlist *sglist,int nelems,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;
@@ -753,7 +753,7 @@ void iommu_free_table(struct iommu_table *tbl, const char *node_name)dma_addr_t iommu_map_page (struct device *dev,struct iommu_table *tbl,struct page *page,unsigned long offset,size_t size,unsigned long mask,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {dma_addr_t dma_handle =DMA_ERROR_CODE ;void *vaddr;
@@ -790,7 +790,7 @@ dma_addr_t iommu_map_page(struct device *dev, struct iommu_table *tbl,void iommu_unmap_page (struct iommu_table *tbl,dma_addr_t dma_handle,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {unsigned int npages;
@@ -845,7 +845,7 @@ void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl, nio_pages = size >> tbl->it_page_shift; io_order =get_iommu_order (size, tbl); mapping =iommu_alloc (dev, tbl, ret, nio_pages,DMA_BIDIRECTIONAL , - mask >> tbl->it_page_shift, io_order,NULL ); + mask >> tbl->it_page_shift, io_order,0 );if (mapping ==DMA_ERROR_CODE ) {free_pages ((unsigned long )ret, order);return NULL ;
arch/powerpc/kernel/vio.c +6 -6
@@ -482,7 +482,7 @@ static void vio_cmo_balance(struct work_struct *work)static void *vio_dma_iommu_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flag, -struct dma_attrs *attrs) +unsigned long attrs) {struct vio_dev *viodev =to_vio_dev (dev);void *ret;
@@ -503,7 +503,7 @@ static void *vio_dma_iommu_alloc_coherent(struct device *dev, size_t size,static void vio_dma_iommu_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) {struct vio_dev *viodev =to_vio_dev (dev);
@@ -515,7 +515,7 @@ static void vio_dma_iommu_free_coherent(struct device *dev, size_t size,static dma_addr_t vio_dma_iommu_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct vio_dev *viodev =to_vio_dev (dev);struct iommu_table *tbl;
@@ -539,7 +539,7 @@ static dma_addr_t vio_dma_iommu_map_page(struct device *dev, struct page *page,static void vio_dma_iommu_unmap_page (struct device *dev,dma_addr_t dma_handle,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct vio_dev *viodev =to_vio_dev (dev);struct iommu_table *tbl;
@@ -552,7 +552,7 @@ static void vio_dma_iommu_unmap_page(struct device *dev, dma_addr_t dma_handle,static int vio_dma_iommu_map_sg (struct device *dev,struct scatterlist *sglist,int nelems,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct vio_dev *viodev =to_vio_dev (dev);struct iommu_table *tbl;
@@ -588,7 +588,7 @@ static int vio_dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,static void vio_dma_iommu_unmap_sg (struct device *dev,struct scatterlist *sglist,int nelems,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct vio_dev *viodev =to_vio_dev (dev);struct iommu_table *tbl;
arch/powerpc/platforms/cell/iommu.c +8 -8
@@ -166,7 +166,7 @@ static void invalidate_tce_cache(struct cbe_iommu *iommu, unsigned long *pte,static int tce_build_cell (struct iommu_table *tbl,long index,long npages,unsigned long uaddr,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {int i;unsigned long *io_pte, base_pte;
@@ -526,7 +526,7 @@ cell_iommu_setup_window(struct cbe_iommu *iommu, struct device_node *np,__set_bit (0 , window->table.it_map);tce_build_cell (&window->table, window->table.it_offset,1 , - (unsigned long )iommu->pad_page,DMA_TO_DEVICE ,NULL ); + (unsigned long )iommu->pad_page,DMA_TO_DEVICE ,0 );return window; }
@@ -572,7 +572,7 @@ static struct iommu_table *cell_get_iommu_table(struct device *dev)static void *dma_fixed_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flag, -struct dma_attrs *attrs) +unsigned long attrs) {if (iommu_fixed_is_weak) return iommu_alloc_coherent(dev, cell_get_iommu_table(dev),
@@ -586,7 +586,7 @@ static void *dma_fixed_alloc_coherent(struct device *dev, size_t size,static void dma_fixed_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) {if (iommu_fixed_is_weak) iommu_free_coherent(cell_get_iommu_table(dev), size, vaddr,
@@ -598,7 +598,7 @@ static void dma_fixed_free_coherent(struct device *dev, size_t size,static dma_addr_t dma_fixed_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {if (iommu_fixed_is_weak ==dma_get_attr (DMA_ATTR_WEAK_ORDERING , attrs)) return dma_direct_ops.map_page(dev, page, offset, size,
@@ -611,7 +611,7 @@ static dma_addr_t dma_fixed_map_page(struct device *dev, struct page *page,static void dma_fixed_unmap_page (struct device *dev,dma_addr_t dma_addr,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {if (iommu_fixed_is_weak ==dma_get_attr (DMA_ATTR_WEAK_ORDERING , attrs)) dma_direct_ops.unmap_page(dev, dma_addr, size, direction,
@@ -623,7 +623,7 @@ static void dma_fixed_unmap_page(struct device *dev, dma_addr_t dma_addr,static int dma_fixed_map_sg (struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {if (iommu_fixed_is_weak ==dma_get_attr (DMA_ATTR_WEAK_ORDERING , attrs))return dma_direct_ops.map_sg (dev, sg, nents, direction, attrs);
@@ -635,7 +635,7 @@ static int dma_fixed_map_sg(struct device *dev, struct scatterlist *sg,static void dma_fixed_unmap_sg (struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {if (iommu_fixed_is_weak ==dma_get_attr (DMA_ATTR_WEAK_ORDERING , attrs)) dma_direct_ops.unmap_sg (dev, sg, nents, direction, attrs);
arch/powerpc/platforms/pasemi/iommu.c +1 -1
@@ -88,7 +88,7 @@ static int iommu_table_iobmap_inited;static int iobmap_build (struct iommu_table *tbl,long index,long npages,unsigned long uaddr,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {u32 *ip;u32 rpn;
arch/powerpc/platforms/powernv/npu-dma.c +4 -4
@@ -73,7 +73,7 @@ EXPORT_SYMBOL(pnv_pci_get_npu_dev);static void *dma_npu_alloc (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flag, -struct dma_attrs *attrs) +unsigned long attrs) {NPU_DMA_OP_UNSUPPORTED ();return NULL ;
@@ -81,7 +81,7 @@ static void *dma_npu_alloc(struct device *dev, size_t size,static void dma_npu_free (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) {NPU_DMA_OP_UNSUPPORTED (); }
@@ -89,7 +89,7 @@ static void dma_npu_free(struct device *dev, size_t size,static dma_addr_t dma_npu_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {NPU_DMA_OP_UNSUPPORTED ();return 0 ;
@@ -97,7 +97,7 @@ static dma_addr_t dma_npu_map_page(struct device *dev, struct page *page,static int dma_npu_map_sg (struct device *dev,struct scatterlist *sglist,int nelems,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {NPU_DMA_OP_UNSUPPORTED ();return 0 ;
arch/powerpc/platforms/powernv/pci-ioda.c +2 -2
@@ -1783,7 +1783,7 @@ static void pnv_pci_ioda1_tce_invalidate(struct iommu_table *tbl,static int pnv_ioda1_tce_build (struct iommu_table *tbl,long index,long npages,unsigned long uaddr,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {int ret =pnv_tce_build (tbl, index, npages, uaddr, direction, attrs);
@@ -1912,7 +1912,7 @@ static void pnv_pci_ioda2_tce_invalidate(struct iommu_table *tbl,static int pnv_ioda2_tce_build (struct iommu_table *tbl,long index,long npages,unsigned long uaddr,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {int ret =pnv_tce_build (tbl, index, npages, uaddr, direction, attrs);
arch/powerpc/platforms/powernv/pci.c +1 -1
@@ -587,7 +587,7 @@ static __be64 *pnv_tce(struct iommu_table *tbl, long idx)int pnv_tce_build (struct iommu_table *tbl,long index,long npages,unsigned long uaddr,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {u64 proto_tce =iommu_direction_to_tce_perm (direction);u64 rpn =__pa (uaddr) >> tbl->it_page_shift;
arch/powerpc/platforms/powernv/pci.h +1 -1
@@ -178,7 +178,7 @@ struct pnv_phb {extern struct pci_ops pnv_pci_ops;extern int pnv_tce_build (struct iommu_table *tbl,long index,long npages,unsigned long uaddr,enum dma_data_direction direction, -struct dma_attrs *attrs); +unsigned long attrs);extern void pnv_tce_free (struct iommu_table *tbl,long index,long npages);extern int pnv_tce_xchg (struct iommu_table *tbl,long index,unsigned long *hpa,enum dma_data_direction *direction);
arch/powerpc/platforms/ps3/system-bus.c +9 -9
@@ -516,7 +516,7 @@ core_initcall(ps3_system_bus_init);*/ static void *ps3_alloc_coherent (struct device *_dev,size_t size,dma_addr_t *dma_handle,gfp_t flag, -struct dma_attrs *attrs) +unsigned long attrs) {int result;struct ps3_system_bus_device *dev =ps3_dev_to_system_bus_dev (_dev);
@@ -553,7 +553,7 @@ clean_none: }static void ps3_free_coherent (struct device *_dev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) {struct ps3_system_bus_device *dev =ps3_dev_to_system_bus_dev (_dev);
@@ -569,7 +569,7 @@ static void ps3_free_coherent(struct device *_dev, size_t size, void *vaddr,static dma_addr_t ps3_sb_map_page (struct device *_dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct ps3_system_bus_device *dev =ps3_dev_to_system_bus_dev (_dev);int result;
@@ -592,7 +592,7 @@ static dma_addr_t ps3_sb_map_page(struct device *_dev, struct page *page,static dma_addr_t ps3_ioc0_map_page (struct device *_dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct ps3_system_bus_device *dev =ps3_dev_to_system_bus_dev (_dev);int result;
@@ -626,7 +626,7 @@ static dma_addr_t ps3_ioc0_map_page(struct device *_dev, struct page *page, }static void ps3_unmap_page (struct device *_dev,dma_addr_t dma_addr, -size_t size,enum dma_data_direction direction,struct dma_attrs *attrs) +size_t size,enum dma_data_direction direction,unsigned long attrs) {struct ps3_system_bus_device *dev =ps3_dev_to_system_bus_dev (_dev);int result;
@@ -640,7 +640,7 @@ static void ps3_unmap_page(struct device *_dev, dma_addr_t dma_addr, }static int ps3_sb_map_sg (struct device *_dev,struct scatterlist *sgl, -int nents,enum dma_data_direction direction,struct dma_attrs *attrs) +int nents,enum dma_data_direction direction,unsigned long attrs) {#if defined(CONFIG_PS3_DYNAMIC_DMA )BUG_ON ("do" );
@@ -670,14 +670,14 @@ static int ps3_sb_map_sg(struct device *_dev, struct scatterlist *sgl,static int ps3_ioc0_map_sg (struct device *_dev,struct scatterlist *sg,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {BUG ();return 0 ; }static void ps3_sb_unmap_sg (struct device *_dev,struct scatterlist *sg, -int nents,enum dma_data_direction direction,struct dma_attrs *attrs) +int nents,enum dma_data_direction direction,unsigned long attrs) {#if defined(CONFIG_PS3_DYNAMIC_DMA )BUG_ON ("do" );
@@ -686,7 +686,7 @@ static void ps3_sb_unmap_sg(struct device *_dev, struct scatterlist *sg,static void ps3_ioc0_unmap_sg (struct device *_dev,struct scatterlist *sg,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {BUG (); }
arch/powerpc/platforms/pseries/iommu.c +3 -3
@@ -152,7 +152,7 @@ static void tce_invalidate_pSeries_sw(struct iommu_table *tbl,static int tce_build_pSeries (struct iommu_table *tbl,long index,long npages,unsigned long uaddr,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {u64 proto_tce;__be64 *tcep, *tces;
@@ -208,7 +208,7 @@ static void tce_freemulti_pSeriesLP(struct iommu_table*, long, long);static int tce_build_pSeriesLP (struct iommu_table *tbl,long tcenum,long npages,unsigned long uaddr,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {u64 rc =0 ;u64 proto_tce, tce;
@@ -251,7 +251,7 @@ static DEFINE_PER_CPU(__be64 *, tce_page);static int tce_buildmulti_pSeriesLP (struct iommu_table *tbl,long tcenum,long npages,unsigned long uaddr,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {u64 rc =0 ;u64 proto_tce;
arch/powerpc/sysdev/dart_iommu.c +1 -1
@@ -163,7 +163,7 @@ static void dart_flush(struct iommu_table *tbl)static int dart_build (struct iommu_table *tbl,long index,long npages,unsigned long uaddr,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {unsigned int *dp;unsigned int rpn;
Signature · 1 line
1.9.1
PATCH v4 22/44 video: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- drivers/video/fbdev/omap2/omapfb/omapfb-main.c | 12 ++++++------ drivers/video/fbdev/omap2/omapfb/omapfb.h | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-)
drivers/video/fbdev/omap2/omapfb/omapfb-main.c +6 -6
@@ -1332,7 +1332,7 @@ static void omapfb_free_fbmem(struct fb_info *fbi) }dma_free_attrs (fbdev->dev, rg->size, rg->token, rg->dma_handle, - &rg->attrs); + rg->attrs); rg->token =NULL ; rg->vaddr =NULL ;
@@ -1370,7 +1370,7 @@ static int omapfb_alloc_fbmem(struct fb_info *fbi, unsigned long size,struct omapfb2_device *fbdev = ofbi->fbdev;struct omapfb2_mem_region *rg;void *token; -DEFINE_DMA_ATTRS (attrs); +unsigned long attrs;dma_addr_t dma_handle;int r;
@@ -1386,15 +1386,15 @@ static int omapfb_alloc_fbmem(struct fb_info *fbi, unsigned long size, size =PAGE_ALIGN (size); -dma_set_attr (DMA_ATTR_WRITE_COMBINE , &attrs); + attrs =DMA_ATTR_WRITE_COMBINE ;if (ofbi->rotation_type =OMAP_DSS_ROT_VRFB ) -dma_set_attr (DMA_ATTR_NO_KERNEL_MAPPING , &attrs); + attrs |=DMA_ATTR_NO_KERNEL_MAPPING ;DBG ("allocating %lu bytes for fb %d\n" , size, ofbi->id); token =dma_alloc_attrs (fbdev->dev, size, &dma_handle, -GFP_KERNEL , &attrs); +GFP_KERNEL , attrs);if (token =NULL ) {dev_err (fbdev->dev,"failed to allocate framebuffer\n" );
@@ -1408,7 +1408,7 @@ static int omapfb_alloc_fbmem(struct fb_info *fbi, unsigned long size, r =omap_vrfb_request_ctx (&rg->vrfb);if (r) {dma_free_attrs (fbdev->dev, size, token, dma_handle, - &attrs); + attrs);dev_err (fbdev->dev,"vrfb create ctx failed\n" );return r; }
drivers/video/fbdev/omap2/omapfb/omapfb.h +1 -2
@@ -28,7 +28,6 @@#endif #include <linux/rwsem.h> -#include <linux/dma-attrs.h> #include <linux/dma-mapping.h> #include <video/omapdss.h>
@@ -51,7 +50,7 @@ extern bool omapfb_debug;struct omapfb2_mem_region {int id; -struct dma_attrs attrs; +unsigned long attrs;void *token;dma_addr_t dma_handle;u32 paddr;
Signature · 1 line
1.9.1
PATCH v4 23/44 x86: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/x86/include/asm/dma-mapping.h | 5 ++--- arch/x86/include/asm/swiotlb.h | 4 ++-- arch/x86/include/asm/xen/page-coherent.h | 9 ++++----- arch/x86/kernel/amd_gart_64.c | 20 ++++++++++---------- arch/x86/kernel/pci-calgary_64.c | 14 +++++++------- arch/x86/kernel/pci-dma.c | 4 ++-- arch/x86/kernel/pci-nommu.c | 4 ++-- arch/x86/kernel/pci-swiotlb.c | 4 ++-- arch/x86/pci/sta2x11-fixup.c | 2 +- arch/x86/pci/vmd.c | 16 ++++++++-------- 10 files changed, 40 insertions(+), 42 deletions(-)
arch/x86/include/asm/dma-mapping.h +2 -3
@@ -9,7 +9,6 @@#include <linux/kmemcheck.h> #include <linux/scatterlist.h> #include <linux/dma-debug.h> -#include <linux/dma-attrs.h> #include <asm/io.h> #include <asm/swiotlb.h> #include <linux/dma-contiguous.h>
@@ -48,11 +47,11 @@ extern int dma_supported(struct device *hwdev, u64 mask);extern void *dma_generic_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_addr,gfp_t flag, -struct dma_attrs *attrs); +unsigned long attrs);extern void dma_generic_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_addr, -struct dma_attrs *attrs); +unsigned long attrs);#ifdef CONFIG_X86_DMA_REMAP /* Platform code defines bridge-specific code */ extern bool dma_capable (struct device *dev,dma_addr_t addr,size_t size);
arch/x86/include/asm/swiotlb.h +2 -2
@@ -31,9 +31,9 @@ static inline void dma_mark_clean(void *addr, size_t size) {}extern void *x86_swiotlb_alloc_coherent (struct device *hwdev,size_t size,dma_addr_t *dma_handle,gfp_t flags, -struct dma_attrs *attrs); +unsigned long attrs);extern void x86_swiotlb_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_addr, -struct dma_attrs *attrs); +unsigned long attrs);#endif /* _ASM_X86_SWIOTLB_H */
arch/x86/include/asm/xen/page-coherent.h +4 -5
@@ -2,12 +2,11 @@#define _ASM_X86_XEN_PAGE_COHERENT_H#include <asm/page.h> -#include <linux/dma-attrs.h> #include <linux/dma-mapping.h> static inline void *xen_alloc_coherent_pages (struct device *hwdev,size_t size,dma_addr_t *dma_handle,gfp_t flags, -struct dma_attrs *attrs) +unsigned long attrs) {void *vstart = (void *)__get_free_pages (flags,get_order (size)); *dma_handle =virt_to_phys (vstart);
@@ -16,18 +15,18 @@ static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size,static inline void xen_free_coherent_pages (struct device *hwdev,size_t size,void *cpu_addr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) {free_pages ((unsigned long ) cpu_addr,get_order (size)); }static inline void xen_dma_map_page (struct device *hwdev,struct page *page,dma_addr_t dev_addr,unsigned long offset,size_t size, -enum dma_data_direction dir,struct dma_attrs *attrs) { } +enum dma_data_direction dir,unsigned long attrs) { }static inline void xen_dma_unmap_page (struct device *hwdev,dma_addr_t handle,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) { } +unsigned long attrs) { }static inline void xen_dma_sync_single_for_cpu (struct device *hwdev,dma_addr_t handle,size_t size,enum dma_data_direction dir) { }
arch/x86/kernel/amd_gart_64.c +10 -10
@@ -242,7 +242,7 @@ static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem,static dma_addr_t gart_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {unsigned long bus;phys_addr_t paddr =page_to_phys (page) + offset;
@@ -264,7 +264,7 @@ static dma_addr_t gart_map_page(struct device *dev, struct page *page,*/ static void gart_unmap_page (struct device *dev,dma_addr_t dma_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {unsigned long iommu_page;int npages;
@@ -286,7 +286,7 @@ static void gart_unmap_page(struct device *dev, dma_addr_t dma_addr,* Wrapper for pci_unmap_single working with scatterlists. */ static void gart_unmap_sg (struct device *dev,struct scatterlist *sg,int nents, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {struct scatterlist *s;int i;
@@ -294,7 +294,7 @@ static void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,for_each_sg (sg, s, nents, i) {if (!s->dma_length || !s->length)break ; -gart_unmap_page (dev, s->dma_address, s->dma_length, dir,NULL ); +gart_unmap_page (dev, s->dma_address, s->dma_length, dir,0 ); } }
@@ -316,7 +316,7 @@ static int dma_map_sg_nonforce(struct device *dev, struct scatterlist *sg, addr =dma_map_area (dev, addr, s->length, dir,0 );if (addr == bad_dma_addr) {if (i >0 ) -gart_unmap_sg (dev, sg, i, dir,NULL ); +gart_unmap_sg (dev, sg, i, dir,0 ); nents =0 ; sg[0 ].dma_length =0 ;break ;
@@ -387,7 +387,7 @@ dma_map_cont(struct device *dev, struct scatterlist *start, int nelems,* Merge chunks that have page aligned sizes into a continuous mapping. */ static int gart_map_sg (struct device *dev,struct scatterlist *sg,int nents, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {struct scatterlist *s, *ps, *start_sg, *sgmap;int need =0 , nextneed, i, out, start;
@@ -457,7 +457,7 @@ static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, error:flush_gart (); -gart_unmap_sg (dev, sg, out, dir,NULL ); +gart_unmap_sg (dev, sg, out, dir,0 );/* When it was forced or merged try again in a dumb way */ if (force_iommu || iommu_merge) {
@@ -477,7 +477,7 @@ error:/* allocate and map a coherent mapping */ static void *gart_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_addr, -gfp_t flag,struct dma_attrs *attrs) +gfp_t flag,unsigned long attrs) {dma_addr_t paddr;unsigned long align_mask;
@@ -509,9 +509,9 @@ gart_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_addr,/* free a coherent mapping */ static void gart_free_coherent (struct device *dev,size_t size,void *vaddr, -dma_addr_t dma_addr,struct dma_attrs *attrs) +dma_addr_t dma_addr,unsigned long attrs) { -gart_unmap_page (dev, dma_addr, size,DMA_BIDIRECTIONAL ,NULL ); +gart_unmap_page (dev, dma_addr, size,DMA_BIDIRECTIONAL ,0 );dma_generic_free_coherent (dev, size, vaddr, dma_addr, attrs); }
arch/x86/kernel/pci-calgary_64.c +7 -7
@@ -340,7 +340,7 @@ static inline struct iommu_table *find_iommu_table(struct device *dev)static void calgary_unmap_sg (struct device *dev,struct scatterlist *sglist,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct iommu_table *tbl =find_iommu_table (dev);struct scatterlist *s;
@@ -364,7 +364,7 @@ static void calgary_unmap_sg(struct device *dev, struct scatterlist *sglist,static int calgary_map_sg (struct device *dev,struct scatterlist *sg,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct iommu_table *tbl =find_iommu_table (dev);struct scatterlist *s;
@@ -396,7 +396,7 @@ static int calgary_map_sg(struct device *dev, struct scatterlist *sg,return nelems; error: -calgary_unmap_sg (dev, sg, nelems, dir,NULL ); +calgary_unmap_sg (dev, sg, nelems, dir,0 );for_each_sg (sg, s, nelems, i) { sg->dma_address =DMA_ERROR_CODE ; sg->dma_length =0 ;
@@ -407,7 +407,7 @@ error:static dma_addr_t calgary_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {void *vaddr =page_address (page) + offset;unsigned long uaddr;
@@ -422,7 +422,7 @@ static dma_addr_t calgary_map_page(struct device *dev, struct page *page,static void calgary_unmap_page (struct device *dev,dma_addr_t dma_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct iommu_table *tbl =find_iommu_table (dev);unsigned int npages;
@@ -432,7 +432,7 @@ static void calgary_unmap_page(struct device *dev, dma_addr_t dma_addr, }static void *calgary_alloc_coherent (struct device *dev,size_t size, -dma_addr_t *dma_handle,gfp_t flag,struct dma_attrs *attrs) +dma_addr_t *dma_handle,gfp_t flag,unsigned long attrs) {void *ret =NULL ;dma_addr_t mapping;
@@ -466,7 +466,7 @@ error:static void calgary_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) {unsigned int npages;struct iommu_table *tbl =find_iommu_table (dev);
arch/x86/kernel/pci-dma.c +2 -2
@@ -77,7 +77,7 @@ void __init pci_iommu_alloc(void) }void *dma_generic_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_addr,gfp_t flag, -struct dma_attrs *attrs) +unsigned long attrs) {unsigned long dma_mask;struct page *page;
@@ -120,7 +120,7 @@ again: }void dma_generic_free_coherent (struct device *dev,size_t size,void *vaddr, -dma_addr_t dma_addr,struct dma_attrs *attrs) +dma_addr_t dma_addr,unsigned long attrs) {unsigned int count =PAGE_ALIGN (size) >>PAGE_SHIFT ;struct page *page =virt_to_page (vaddr);
arch/x86/kernel/pci-nommu.c +2 -2
@@ -28,7 +28,7 @@ check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size)static dma_addr_t nommu_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {dma_addr_t bus =page_to_phys (page) + offset;WARN_ON (size ==0 );
@@ -55,7 +55,7 @@ static dma_addr_t nommu_map_page(struct device *dev, struct page *page,*/ static int nommu_map_sg (struct device *hwdev,struct scatterlist *sg,int nents,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *s;int i;
arch/x86/kernel/pci-swiotlb.c +2 -2
@@ -16,7 +16,7 @@ int swiotlb __read_mostly;void *x86_swiotlb_alloc_coherent (struct device *hwdev,size_t size,dma_addr_t *dma_handle,gfp_t flags, -struct dma_attrs *attrs) +unsigned long attrs) {void *vaddr;
@@ -37,7 +37,7 @@ void *x86_swiotlb_alloc_coherent(struct device *hwdev, size_t size,void x86_swiotlb_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_addr, -struct dma_attrs *attrs) +unsigned long attrs) {if (is_swiotlb_buffer (dma_to_phys (dev, dma_addr)))swiotlb_free_coherent (dev, size, vaddr, dma_addr);
arch/x86/pci/sta2x11-fixup.c +1 -1
@@ -169,7 +169,7 @@ static void *sta2x11_swiotlb_alloc_coherent(struct device *dev,size_t size, dma_addr_t *dma_handle, gfp_t flags, - struct dma_attrs *attrs) + unsigned long attrs) { void *vaddr;
arch/x86/pci/vmd.c +8 -8
@@ -265,14 +265,14 @@ static struct dma_map_ops *vmd_dma_ops(struct device *dev) }static void *vmd_alloc (struct device *dev,size_t size,dma_addr_t *addr, -gfp_t flag,struct dma_attrs *attrs) +gfp_t flag,unsigned long attrs) {return vmd_dma_ops (dev)->alloc (to_vmd_dev (dev), size, addr, flag, attrs); }static void vmd_free (struct device *dev,size_t size,void *vaddr, -dma_addr_t addr,struct dma_attrs *attrs) +dma_addr_t addr,unsigned long attrs) {return vmd_dma_ops (dev)->free (to_vmd_dev (dev), size, vaddr, addr, attrs);
@@ -280,7 +280,7 @@ static void vmd_free(struct device *dev, size_t size, void *vaddr,static int vmd_mmap (struct device *dev,struct vm_area_struct *vma,void *cpu_addr,dma_addr_t addr,size_t size, -struct dma_attrs *attrs) +unsigned long attrs) {return vmd_dma_ops (dev)->mmap (to_vmd_dev (dev), vma, cpu_addr, addr, size, attrs);
@@ -288,7 +288,7 @@ static int vmd_mmap(struct device *dev, struct vm_area_struct *vma,static int vmd_get_sgtable (struct device *dev,struct sg_table *sgt,void *cpu_addr,dma_addr_t addr,size_t size, -struct dma_attrs *attrs) +unsigned long attrs) {return vmd_dma_ops (dev)->get_sgtable (to_vmd_dev (dev), sgt, cpu_addr, addr, size, attrs);
@@ -297,26 +297,26 @@ static int vmd_get_sgtable(struct device *dev, struct sg_table *sgt,static dma_addr_t vmd_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {return vmd_dma_ops (dev)->map_page (to_vmd_dev (dev), page, offset, size, dir, attrs); }static void vmd_unmap_page (struct device *dev,dma_addr_t addr,size_t size, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {vmd_dma_ops (dev)->unmap_page (to_vmd_dev (dev), addr, size, dir, attrs); }static int vmd_map_sg (struct device *dev,struct scatterlist *sg,int nents, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {return vmd_dma_ops (dev)->map_sg (to_vmd_dev (dev), sg, nents, dir, attrs); }static void vmd_unmap_sg (struct device *dev,struct scatterlist *sg,int nents, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {vmd_dma_ops (dev)->unmap_sg (to_vmd_dev (dev), sg, nents, dir, attrs); }
Signature · 1 line
1.9.1
PATCH v4 24/44 iommu: intel: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- drivers/iommu/intel-iommu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/iommu/intel-iommu.c +6 -6
@@ -3545,7 +3545,7 @@ error:static dma_addr_t intel_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {return __intel_map_single (dev,page_to_phys (page) + offset, size, dir, *dev->dma_mask);
@@ -3704,14 +3704,14 @@ static void intel_unmap(struct device *dev, dma_addr_t dev_addr, size_t size)static void intel_unmap_page (struct device *dev,dma_addr_t dev_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {intel_unmap (dev, dev_addr, size); }static void *intel_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flags, -struct dma_attrs *attrs) +unsigned long attrs) {struct page *page =NULL ;int order;
@@ -3757,7 +3757,7 @@ static void *intel_alloc_coherent(struct device *dev, size_t size, }static void intel_free_coherent (struct device *dev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) {int order;struct page *page =virt_to_page (vaddr);
@@ -3772,7 +3772,7 @@ static void intel_free_coherent(struct device *dev, size_t size, void *vaddr,static void intel_unmap_sg (struct device *dev,struct scatterlist *sglist,int nelems,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {dma_addr_t startaddr =sg_dma_address (sglist) &PAGE_MASK ;unsigned long nrpages =0 ;
@@ -3801,7 +3801,7 @@ static int intel_nontranslate_map_sg(struct device *hddev, }static int intel_map_sg (struct device *dev,struct scatterlist *sglist,int nelems, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {int i;struct dmar_domain *domain;
Signature · 1 line
1.9.1
PATCH v4 25/44 h8300: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/h8300/kernel/dma.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/h8300/kernel/dma.c +4 -4
@@ -12,7 +12,7 @@static void *dma_alloc (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t gfp, -struct dma_attrs *attrs) +unsigned long attrs) {void *ret;
@@ -32,7 +32,7 @@ static void *dma_alloc(struct device *dev, size_t size,static void dma_free (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) {free_pages ((unsigned long )vaddr,get_order (size));
@@ -41,14 +41,14 @@ static void dma_free(struct device *dev, size_t size,static dma_addr_t map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {return page_to_phys (page) + offset; }static int map_sg (struct device *dev,struct scatterlist *sgl,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int i;
Signature · 1 line
1.9.1
PATCH v4 26/44 hexagon: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/hexagon/include/asm/dma-mapping.h | 1 - arch/hexagon/kernel/dma.c | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-)
arch/hexagon/include/asm/dma-mapping.h +0 -1
@@ -26,7 +26,6 @@#include <linux/mm.h> #include <linux/scatterlist.h> #include <linux/dma-debug.h> -#include <linux/dma-attrs.h> #include <asm/io.h> struct device ;
arch/hexagon/kernel/dma.c +4 -4
@@ -51,7 +51,7 @@ static struct gen_pool *coherent_pool;static void *hexagon_dma_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_addr,gfp_t flag, -struct dma_attrs *attrs) +unsigned long attrs) {void *ret;
@@ -84,7 +84,7 @@ static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size, }static void hexagon_free_coherent (struct device *dev,size_t size,void *vaddr, -dma_addr_t dma_addr,struct dma_attrs *attrs) +dma_addr_t dma_addr,unsigned long attrs) {gen_pool_free (coherent_pool, (unsigned long ) vaddr, size); }
@@ -105,7 +105,7 @@ static int check_addr(const char *name, struct device *hwdev,static int hexagon_map_sg (struct device *hwdev,struct scatterlist *sg,int nents,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *s;int i;
@@ -172,7 +172,7 @@ static inline void dma_sync(void *addr, size_t size,static dma_addr_t hexagon_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {dma_addr_t bus =page_to_phys (page) + offset;WARN_ON (size ==0 );
Signature · 1 line
1.9.1
PATCH v4 27/44 ia64: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/ia64/hp/common/sba_iommu.c | 22 +++++++++++----------- arch/ia64/include/asm/machvec.h | 1 - arch/ia64/kernel/pci-swiotlb.c | 4 ++-- arch/ia64/sn/pci/pci_dma.c | 12 ++++++------ 4 files changed, 19 insertions(+), 20 deletions(-)
arch/ia64/hp/common/sba_iommu.c +11 -11
@@ -919,7 +919,7 @@ sba_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt)static dma_addr_t sba_map_page (struct device *dev,struct page *page,unsigned long poff,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct ioc *ioc;void *addr =page_address (page) + poff;
@@ -1005,7 +1005,7 @@ static dma_addr_t sba_map_page(struct device *dev, struct page *page,static dma_addr_t sba_map_single_attrs (struct device *dev,void *addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {return sba_map_page (dev,virt_to_page (addr), (unsigned long )addr & ~PAGE_MASK , size, dir, attrs);
@@ -1046,7 +1046,7 @@ sba_mark_clean(struct ioc *ioc, dma_addr_t iova, size_t size)* See Documentation/DMA-API-HOWTO.txt */ static void sba_unmap_page (struct device *dev,dma_addr_t iova,size_t size, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {struct ioc *ioc;#if DELAYED_RESOURCE_CNT >0
@@ -1115,7 +1115,7 @@ static void sba_unmap_page(struct device *dev, dma_addr_t iova, size_t size, }void sba_unmap_single_attrs (struct device *dev,dma_addr_t iova,size_t size, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {sba_unmap_page (dev, iova, size, dir, attrs); }
@@ -1130,7 +1130,7 @@ void sba_unmap_single_attrs(struct device *dev, dma_addr_t iova, size_t size,*/ static void *sba_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle, -gfp_t flags,struct dma_attrs *attrs) +gfp_t flags,unsigned long attrs) {struct ioc *ioc;void *addr;
@@ -1175,7 +1175,7 @@ sba_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,* device to map single to get an iova mapping. */ *dma_handle =sba_map_single_attrs (&ioc->sac_only_dev->dev, addr, - size,0 ,NULL ); + size,0 ,0 );return addr; }
@@ -1191,9 +1191,9 @@ sba_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,* See Documentation/DMA-API-HOWTO.txt */ static void sba_free_coherent (struct device *dev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) { -sba_unmap_single_attrs (dev, dma_handle, size,0 ,NULL ); +sba_unmap_single_attrs (dev, dma_handle, size,0 ,0 );free_pages ((unsigned long ) vaddr,get_order (size)); }
@@ -1442,7 +1442,7 @@ sba_coalesce_chunks(struct ioc *ioc, struct device *dev,static void sba_unmap_sg_attrs (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction dir, -struct dma_attrs *attrs); +unsigned long attrs);/** * sba_map_sg - map Scatter/Gather list * @dev: instance of PCI owned by the driver that's asking.
@@ -1455,7 +1455,7 @@ static void sba_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist,*/ static int sba_map_sg_attrs (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct ioc *ioc;int coalesced, filled =0 ;
@@ -1551,7 +1551,7 @@ static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist,*/ static void sba_unmap_sg_attrs (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {#ifdef ASSERT_PDIR_SANITY struct ioc *ioc;
arch/ia64/include/asm/machvec.h +0 -1
@@ -22,7 +22,6 @@ struct pci_bus;struct task_struct ;struct pci_dev ;struct msi_desc ; -struct dma_attrs ;typedef void ia64_mv_setup_t (char **);typedef void ia64_mv_cpu_init_t (void );
arch/ia64/kernel/pci-swiotlb.c +2 -2
@@ -16,7 +16,7 @@ EXPORT_SYMBOL(swiotlb);static void *ia64_swiotlb_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t gfp, -struct dma_attrs *attrs) +unsigned long attrs) {if (dev->coherent_dma_mask !=DMA_BIT_MASK (64 )) gfp |=GFP_DMA ;
@@ -25,7 +25,7 @@ static void *ia64_swiotlb_alloc_coherent(struct device *dev, size_t size,static void ia64_swiotlb_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_addr, -struct dma_attrs *attrs) +unsigned long attrs) {swiotlb_free_coherent (dev, size, vaddr, dma_addr); }
arch/ia64/sn/pci/pci_dma.c +6 -6
@@ -77,7 +77,7 @@ EXPORT_SYMBOL(sn_dma_set_mask);*/ static void *sn_dma_alloc_coherent (struct device *dev,size_t size,dma_addr_t * dma_handle,gfp_t flags, -struct dma_attrs *attrs) +unsigned long attrs) {void *cpuaddr;unsigned long phys_addr;
@@ -138,7 +138,7 @@ static void *sn_dma_alloc_coherent(struct device *dev, size_t size,* any associated IOMMU mappings. */ static void sn_dma_free_coherent (struct device *dev,size_t size,void *cpu_addr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) {struct pci_dev *pdev =to_pci_dev (dev);struct sn_pcibus_provider *provider =SN_PCIDEV_BUSPROVIDER (pdev);
@@ -176,7 +176,7 @@ static void sn_dma_free_coherent(struct device *dev, size_t size, void *cpu_addrstatic dma_addr_t sn_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {void *cpu_addr =page_address (page) + offset;dma_addr_t dma_addr;
@@ -218,7 +218,7 @@ static dma_addr_t sn_dma_map_page(struct device *dev, struct page *page,*/ static void sn_dma_unmap_page (struct device *dev,dma_addr_t dma_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct pci_dev *pdev =to_pci_dev (dev);struct sn_pcibus_provider *provider =SN_PCIDEV_BUSPROVIDER (pdev);
@@ -240,7 +240,7 @@ static void sn_dma_unmap_page(struct device *dev, dma_addr_t dma_addr,*/ static void sn_dma_unmap_sg (struct device *dev,struct scatterlist *sgl,int nhwentries,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {int i;struct pci_dev *pdev =to_pci_dev (dev);
@@ -273,7 +273,7 @@ static void sn_dma_unmap_sg(struct device *dev, struct scatterlist *sgl,*/ static int sn_dma_map_sg (struct device *dev,struct scatterlist *sgl,int nhwentries,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {unsigned long phys_addr;struct scatterlist *saved_sg = sgl, *sg;
Signature · 1 line
1.9.1
PATCH v4 28/44 m68k: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/m68k/kernel/dma.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/m68k/kernel/dma.c +6 -6
@@ -19,7 +19,7 @@#if defined(CONFIG_MMU ) && !defined(CONFIG_COLDFIRE )static void *m68k_dma_alloc (struct device *dev,size_t size,dma_addr_t *handle, -gfp_t flag,struct dma_attrs *attrs) +gfp_t flag,unsigned long attrs) {struct page *page, **map;pgprot_t pgprot;
@@ -62,7 +62,7 @@ static void *m68k_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, }static void m68k_dma_free (struct device *dev,size_t size,void *addr, -dma_addr_t handle,struct dma_attrs *attrs) +dma_addr_t handle,unsigned long attrs) {pr_debug ("dma_free_coherent: %p, %x\n" , addr, handle);vfree (addr);
@@ -73,7 +73,7 @@ static void m68k_dma_free(struct device *dev, size_t size, void *addr,#include <asm/cacheflush.h> static void *m68k_dma_alloc (struct device *dev,size_t size, -dma_addr_t *dma_handle,gfp_t gfp,struct dma_attrs *attrs) +dma_addr_t *dma_handle,gfp_t gfp,unsigned long attrs) {void *ret;/* ignore region specifiers */
@@ -91,7 +91,7 @@ static void *m68k_dma_alloc(struct device *dev, size_t size, }static void m68k_dma_free (struct device *dev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) {free_pages ((unsigned long )vaddr,get_order (size)); }
@@ -130,7 +130,7 @@ static void m68k_dma_sync_sg_for_device(struct device *dev,static dma_addr_t m68k_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {dma_addr_t handle =page_to_phys (page) + offset;
@@ -139,7 +139,7 @@ static dma_addr_t m68k_dma_map_page(struct device *dev, struct page *page, }static int m68k_dma_map_sg (struct device *dev,struct scatterlist *sglist, -int nents,enum dma_data_direction dir,struct dma_attrs *attrs) +int nents,enum dma_data_direction dir,unsigned long attrs) {int i;struct scatterlist *sg;
Signature · 1 line
1.9.1
PATCH v4 28/44 m68k: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/m68k/kernel/dma.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/m68k/kernel/dma.c +6 -6
@@ -19,7 +19,7 @@#if defined(CONFIG_MMU ) && !defined(CONFIG_COLDFIRE )static void *m68k_dma_alloc (struct device *dev,size_t size,dma_addr_t *handle, -gfp_t flag,struct dma_attrs *attrs) +gfp_t flag,unsigned long attrs) {struct page *page, **map;pgprot_t pgprot;
@@ -62,7 +62,7 @@ static void *m68k_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, }static void m68k_dma_free (struct device *dev,size_t size,void *addr, -dma_addr_t handle,struct dma_attrs *attrs) +dma_addr_t handle,unsigned long attrs) {pr_debug ("dma_free_coherent: %p, %x\n" , addr, handle);vfree (addr);
@@ -73,7 +73,7 @@ static void m68k_dma_free(struct device *dev, size_t size, void *addr,#include <asm/cacheflush.h> static void *m68k_dma_alloc (struct device *dev,size_t size, -dma_addr_t *dma_handle,gfp_t gfp,struct dma_attrs *attrs) +dma_addr_t *dma_handle,gfp_t gfp,unsigned long attrs) {void *ret;/* ignore region specifiers */
@@ -91,7 +91,7 @@ static void *m68k_dma_alloc(struct device *dev, size_t size, }static void m68k_dma_free (struct device *dev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) {free_pages ((unsigned long )vaddr,get_order (size)); }
@@ -130,7 +130,7 @@ static void m68k_dma_sync_sg_for_device(struct device *dev,static dma_addr_t m68k_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {dma_addr_t handle =page_to_phys (page) + offset;
@@ -139,7 +139,7 @@ static dma_addr_t m68k_dma_map_page(struct device *dev, struct page *page, }static int m68k_dma_map_sg (struct device *dev,struct scatterlist *sglist, -int nents,enum dma_data_direction dir,struct dma_attrs *attrs) +int nents,enum dma_data_direction dir,unsigned long attrs) {int i;struct scatterlist *sg;
Signature · 1 line
1.9.1
PATCH v4 29/44 metag: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/metag/kernel/dma.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
arch/metag/kernel/dma.c +7 -7
@@ -172,7 +172,7 @@ out:* virtual and bus address for that space. */ static void *metag_dma_alloc (struct device *dev,size_t size, -dma_addr_t *handle,gfp_t gfp,struct dma_attrs *attrs) +dma_addr_t *handle,gfp_t gfp,unsigned long attrs) {struct page *page;struct metag_vm_region *c;
@@ -268,7 +268,7 @@ no_page:* free a page as defined by the above mapping. */ static void metag_dma_free (struct device *dev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) {struct metag_vm_region *c;unsigned long flags, addr;
@@ -331,7 +331,7 @@ no_area:static int metag_dma_mmap (struct device *dev,struct vm_area_struct *vma,void *cpu_addr,dma_addr_t dma_addr,size_t size, -struct dma_attrs *attrs) +unsigned long attrs) {unsigned long flags, user_size, kern_size;struct metag_vm_region *c;
@@ -482,7 +482,7 @@ static void dma_sync_for_cpu(void *vaddr, size_t size, int dma_direction)static dma_addr_t metag_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size, -enum dma_data_direction direction,struct dma_attrs *attrs) +enum dma_data_direction direction,unsigned long attrs) {dma_sync_for_device ((void *)(page_to_phys (page) + offset), size, direction);
@@ -491,14 +491,14 @@ static dma_addr_t metag_dma_map_page(struct device *dev, struct page *page,static void metag_dma_unmap_page (struct device *dev,dma_addr_t dma_address,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {dma_sync_for_cpu (phys_to_virt (dma_address), size, direction); }static int metag_dma_map_sg (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int i;
@@ -516,7 +516,7 @@ static int metag_dma_map_sg(struct device *dev, struct scatterlist *sglist,static void metag_dma_unmap_sg (struct device *dev,struct scatterlist *sglist,int nhwentries,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int i;
Signature · 1 line
1.9.1
PATCH v4 30/44 microblaze: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/microblaze/include/asm/dma-mapping.h | 1 - arch/microblaze/kernel/dma.c | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-)
arch/microblaze/include/asm/dma-mapping.h +0 -1
@@ -25,7 +25,6 @@#include <linux/mm.h> #include <linux/scatterlist.h> #include <linux/dma-debug.h> -#include <linux/dma-attrs.h> #include <asm/io.h> #include <asm/cacheflush.h>
arch/microblaze/kernel/dma.c +6 -6
@@ -17,7 +17,7 @@static void *dma_direct_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flag, -struct dma_attrs *attrs) +unsigned long attrs) {#ifdef NOT_COHERENT_CACHE return consistent_alloc (flag, size, dma_handle);
@@ -42,7 +42,7 @@ static void *dma_direct_alloc_coherent(struct device *dev, size_t size,static void dma_direct_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) {#ifdef NOT_COHERENT_CACHE consistent_free (size, vaddr);
@@ -53,7 +53,7 @@ static void dma_direct_free_coherent(struct device *dev, size_t size,static int dma_direct_map_sg (struct device *dev,struct scatterlist *sgl,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int i;
@@ -78,7 +78,7 @@ static inline dma_addr_t dma_direct_map_page(struct device *dev,unsigned long offset, size_t size, enum dma_data_direction direction, - struct dma_attrs *attrs) + unsigned long attrs) { __dma_sync(page_to_phys(page) + offset, size, direction);return page_to_phys (page) + offset;
@@ -88,7 +88,7 @@ static inline void dma_direct_unmap_page(struct device *dev,dma_addr_t dma_address, size_t size, enum dma_data_direction direction, - struct dma_attrs *attrs) + unsigned long attrs) {/* There is not necessary to do cache cleanup *
@@ -157,7 +157,7 @@ dma_direct_sync_sg_for_device(struct device *dev,static int dma_direct_mmap_coherent (struct device *dev,struct vm_area_struct *vma,void *cpu_addr,dma_addr_t handle,size_t size, -struct dma_attrs *attrs) +unsigned long attrs) {#ifdef CONFIG_MMU unsigned long user_count = (vma->vm_end - vma->vm_start) >>PAGE_SHIFT ;
Signature · 1 line
1.9.1
PATCH v4 31/44 mips: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/mips/cavium-octeon/dma-octeon.c | 8 ++++---- arch/mips/loongson64/common/dma-swiotlb.c | 10 +++++----- arch/mips/mm/dma-default.c | 14 +++++++------- arch/mips/netlogic/common/nlm-dma.c | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-)
arch/mips/cavium-octeon/dma-octeon.c +4 -4
@@ -125,7 +125,7 @@ static phys_addr_t octeon_small_dma_to_phys(struct device *dev,static dma_addr_t octeon_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {dma_addr_t daddr =swiotlb_map_page (dev, page, offset, size, direction, attrs);
@@ -135,7 +135,7 @@ static dma_addr_t octeon_dma_map_page(struct device *dev, struct page *page, }static int octeon_dma_map_sg (struct device *dev,struct scatterlist *sg, -int nents,enum dma_data_direction direction,struct dma_attrs *attrs) +int nents,enum dma_data_direction direction,unsigned long attrs) {int r =swiotlb_map_sg_attrs (dev, sg, nents, direction, attrs);mb ();
@@ -157,7 +157,7 @@ static void octeon_dma_sync_sg_for_device(struct device *dev, }static void *octeon_dma_alloc_coherent (struct device *dev,size_t size, -dma_addr_t *dma_handle,gfp_t gfp,struct dma_attrs *attrs) +dma_addr_t *dma_handle,gfp_t gfp,unsigned long attrs) {void *ret;
@@ -189,7 +189,7 @@ static void *octeon_dma_alloc_coherent(struct device *dev, size_t size, }static void octeon_dma_free_coherent (struct device *dev,size_t size, -void *vaddr,dma_addr_t dma_handle,struct dma_attrs *attrs) +void *vaddr,dma_addr_t dma_handle,unsigned long attrs) {swiotlb_free_coherent (dev, size, vaddr, dma_handle); }
arch/mips/loongson64/common/dma-swiotlb.c +5 -5
@@ -10,7 +10,7 @@#include <dma-coherence.h> static void *loongson_dma_alloc_coherent (struct device *dev,size_t size, -dma_addr_t *dma_handle,gfp_t gfp,struct dma_attrs *attrs) +dma_addr_t *dma_handle,gfp_t gfp,unsigned long attrs) {void *ret;
@@ -41,7 +41,7 @@ static void *loongson_dma_alloc_coherent(struct device *dev, size_t size, }static void loongson_dma_free_coherent (struct device *dev,size_t size, -void *vaddr,dma_addr_t dma_handle,struct dma_attrs *attrs) +void *vaddr,dma_addr_t dma_handle,unsigned long attrs) {swiotlb_free_coherent (dev, size, vaddr, dma_handle); }
@@ -49,7 +49,7 @@ static void loongson_dma_free_coherent(struct device *dev, size_t size,static dma_addr_t loongson_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {dma_addr_t daddr =swiotlb_map_page (dev, page, offset, size, dir, attrs);
@@ -59,9 +59,9 @@ static dma_addr_t loongson_dma_map_page(struct device *dev, struct page *page,static int loongson_dma_map_sg (struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) { -int r =swiotlb_map_sg_attrs (dev, sg, nents, dir,NULL ); +int r =swiotlb_map_sg_attrs (dev, sg, nents, dir,0 );mb ();return r;
arch/mips/mm/dma-default.c +7 -7
@@ -131,7 +131,7 @@ static void *mips_dma_alloc_noncoherent(struct device *dev, size_t size, }static void *mips_dma_alloc_coherent (struct device *dev,size_t size, -dma_addr_t * dma_handle,gfp_t gfp,struct dma_attrs *attrs) +dma_addr_t *dma_handle,gfp_t gfp,unsigned long attrs) {void *ret;struct page *page =NULL ;
@@ -176,7 +176,7 @@ static void mips_dma_free_noncoherent(struct device *dev, size_t size, }static void mips_dma_free_coherent (struct device *dev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) {unsigned long addr = (unsigned long ) vaddr;unsigned int count =PAGE_ALIGN (size) >>PAGE_SHIFT ;
@@ -200,7 +200,7 @@ static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr,static int mips_dma_mmap (struct device *dev,struct vm_area_struct *vma,void *cpu_addr,dma_addr_t dma_addr,size_t size, -struct dma_attrs *attrs) +unsigned long attrs) {unsigned long user_count = (vma->vm_end - vma->vm_start) >>PAGE_SHIFT ;unsigned long count =PAGE_ALIGN (size) >>PAGE_SHIFT ;
@@ -291,7 +291,7 @@ static inline void __dma_sync(struct page *page, }static void mips_dma_unmap_page (struct device *dev,dma_addr_t dma_addr, -size_t size,enum dma_data_direction direction,struct dma_attrs *attrs) +size_t size,enum dma_data_direction direction,unsigned long attrs) {if (cpu_needs_post_dma_flush (dev)) __dma_sync(dma_addr_to_page(dev, dma_addr),
@@ -301,7 +301,7 @@ static void mips_dma_unmap_page(struct device *dev, dma_addr_t dma_addr, }static int mips_dma_map_sg (struct device *dev,struct scatterlist *sglist, -int nents,enum dma_data_direction direction,struct dma_attrs *attrs) +int nents,enum dma_data_direction direction,unsigned long attrs) {int i;struct scatterlist *sg;
@@ -322,7 +322,7 @@ static int mips_dma_map_sg(struct device *dev, struct scatterlist *sglist,static dma_addr_t mips_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {if (!plat_device_is_coherent (dev))__dma_sync (page, offset, size, direction);
@@ -332,7 +332,7 @@ static dma_addr_t mips_dma_map_page(struct device *dev, struct page *page,static void mips_dma_unmap_sg (struct device *dev,struct scatterlist *sglist,int nhwentries,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {int i;struct scatterlist *sg;
arch/mips/netlogic/common/nlm-dma.c +2 -2
@@ -45,7 +45,7 @@static char *nlm_swiotlb;static void *nlm_dma_alloc_coherent (struct device *dev,size_t size, -dma_addr_t *dma_handle,gfp_t gfp,struct dma_attrs *attrs) +dma_addr_t *dma_handle,gfp_t gfp,unsigned long attrs) {/* ignore region specifiers */ gfp &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM);
@@ -62,7 +62,7 @@ static void *nlm_dma_alloc_coherent(struct device *dev, size_t size, }static void nlm_dma_free_coherent (struct device *dev,size_t size, -void *vaddr,dma_addr_t dma_handle,struct dma_attrs *attrs) +void *vaddr,dma_addr_t dma_handle,unsigned long attrs) {swiotlb_free_coherent (dev, size, vaddr, dma_handle); }
Signature · 1 line
1.9.1
PATCH v4 32/44 mn10300: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/mn10300/mm/dma-alloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/mn10300/mm/dma-alloc.c +4 -4
@@ -21,7 +21,7 @@static unsigned long pci_sram_allocated =0xbc000000 ;static void *mn10300_dma_alloc (struct device *dev,size_t size, -dma_addr_t *dma_handle,gfp_t gfp,struct dma_attrs *attrs) +dma_addr_t *dma_handle,gfp_t gfp,unsigned long attrs) {unsigned long addr;void *ret;
@@ -63,7 +63,7 @@ done: }static void mn10300_dma_free (struct device *dev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) {unsigned long addr = (unsigned long ) vaddr & ~0x20000000 ;
@@ -75,7 +75,7 @@ static void mn10300_dma_free(struct device *dev, size_t size, void *vaddr,static int mn10300_dma_map_sg (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int i;
@@ -92,7 +92,7 @@ static int mn10300_dma_map_sg(struct device *dev, struct scatterlist *sglist,static dma_addr_t mn10300_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size, -enum dma_data_direction direction,struct dma_attrs *attrs) +enum dma_data_direction direction,unsigned long attrs) {return page_to_bus (page) + offset; }
Signature · 1 line
1.9.1
PATCH v4 33/44 nios2: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/nios2/mm/dma-mapping.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/nios2/mm/dma-mapping.c +6 -6
@@ -59,7 +59,7 @@ static inline void __dma_sync_for_cpu(void *vaddr, size_t size, }static void *nios2_dma_alloc (struct device *dev,size_t size, -dma_addr_t *dma_handle,gfp_t gfp,struct dma_attrs *attrs) +dma_addr_t *dma_handle,gfp_t gfp,unsigned long attrs) {void *ret;
@@ -84,7 +84,7 @@ static void *nios2_dma_alloc(struct device *dev, size_t size, }static void nios2_dma_free (struct device *dev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) {unsigned long addr = (unsigned long )CAC_ADDR ((unsigned long ) vaddr);
@@ -93,7 +93,7 @@ static void nios2_dma_free(struct device *dev, size_t size, void *vaddr,static int nios2_dma_map_sg (struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {int i;
@@ -113,7 +113,7 @@ static int nios2_dma_map_sg(struct device *dev, struct scatterlist *sg,static dma_addr_t nios2_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {void *addr =page_address (page) + offset;
@@ -123,14 +123,14 @@ static dma_addr_t nios2_dma_map_page(struct device *dev, struct page *page,static void nios2_dma_unmap_page (struct device *dev,dma_addr_t dma_address,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {__dma_sync_for_cpu (phys_to_virt (dma_address), size, direction); }static void nios2_dma_unmap_sg (struct device *dev,struct scatterlist *sg,int nhwentries,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {void *addr;int i;
Signature · 1 line
1.9.1
PATCH v4 34/44 openrisc: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/openrisc/kernel/dma.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
arch/openrisc/kernel/dma.c +8 -9
@@ -22,7 +22,6 @@#include <linux/dma-mapping.h> #include <linux/dma-debug.h> #include <linux/export.h> -#include <linux/dma-attrs.h> #include <asm/cpuinfo.h> #include <asm/spr_defs.h>
@@ -83,7 +82,7 @@ page_clear_nocache(pte_t *pte, unsigned long addr,static void *or1k_dma_alloc (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t gfp, -struct dma_attrs *attrs) +unsigned long attrs) {unsigned long va;void *page;
@@ -117,7 +116,7 @@ or1k_dma_alloc(struct device *dev, size_t size,static void or1k_dma_free (struct device *dev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) {unsigned long va = (unsigned long )vaddr;struct mm_walk walk = {
@@ -137,7 +136,7 @@ static dma_addr_t or1k_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction dir, - struct dma_attrs *attrs) + unsigned long attrs) { unsigned long cl;dma_addr_t addr =page_to_phys (page) + offset;
@@ -170,7 +169,7 @@ or1k_map_page(struct device *dev, struct page *page,static void or1k_unmap_page (struct device *dev,dma_addr_t dma_handle,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {/* Nothing special to do here... */ }
@@ -178,14 +177,14 @@ or1k_unmap_page(struct device *dev, dma_addr_t dma_handle,static int or1k_map_sg (struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *s;int i;for_each_sg (sg, s, nents, i) { s->dma_address =or1k_map_page (dev,sg_page (s), s->offset, - s->length, dir,NULL ); + s->length, dir,0 ); }return nents;
@@ -194,13 +193,13 @@ or1k_map_sg(struct device *dev, struct scatterlist *sg,static void or1k_unmap_sg (struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *s;int i;for_each_sg (sg, s, nents, i) { -or1k_unmap_page (dev,sg_dma_address (s),sg_dma_len (s), dir,NULL ); +or1k_unmap_page (dev,sg_dma_address (s),sg_dma_len (s), dir,0 ); } }
Signature · 1 line
1.9.1
PATCH v4 35/44 parisc: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/parisc/kernel/pci-dma.c | 16 ++++++++-------- drivers/parisc/ccio-dma.c | 16 ++++++++-------- drivers/parisc/sba_iommu.c | 16 ++++++++-------- 3 files changed, 24 insertions(+), 24 deletions(-)
arch/parisc/kernel/pci-dma.c +8 -8
@@ -414,7 +414,7 @@ pcxl_dma_init(void)__initcall (pcxl_dma_init);static void *pa11_dma_alloc (struct device *dev,size_t size, -dma_addr_t *dma_handle,gfp_t flag,struct dma_attrs *attrs) +dma_addr_t *dma_handle,gfp_t flag,unsigned long attrs) {unsigned long vaddr;unsigned long paddr;
@@ -441,7 +441,7 @@ static void *pa11_dma_alloc(struct device *dev, size_t size, }static void pa11_dma_free (struct device *dev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) {int order;
@@ -454,7 +454,7 @@ static void pa11_dma_free(struct device *dev, size_t size, void *vaddr,static dma_addr_t pa11_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size, -enum dma_data_direction direction,struct dma_attrs *attrs) +enum dma_data_direction direction,unsigned long attrs) {void *addr =page_address (page) + offset;BUG_ON (direction ==DMA_NONE );
@@ -465,7 +465,7 @@ static dma_addr_t pa11_dma_map_page(struct device *dev, struct page *page,static void pa11_dma_unmap_page (struct device *dev,dma_addr_t dma_handle,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {BUG_ON (direction ==DMA_NONE );
@@ -484,7 +484,7 @@ static void pa11_dma_unmap_page(struct device *dev, dma_addr_t dma_handle,static int pa11_dma_map_sg (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {int i;struct scatterlist *sg;
@@ -503,7 +503,7 @@ static int pa11_dma_map_sg(struct device *dev, struct scatterlist *sglist,static void pa11_dma_unmap_sg (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {int i;struct scatterlist *sg;
@@ -577,7 +577,7 @@ struct dma_map_ops pcxl_dma_ops = { };static void *pcx_dma_alloc (struct device *dev,size_t size, -dma_addr_t *dma_handle,gfp_t flag,struct dma_attrs *attrs) +dma_addr_t *dma_handle,gfp_t flag,unsigned long attrs) {void *addr;
@@ -592,7 +592,7 @@ static void *pcx_dma_alloc(struct device *dev, size_t size, }static void pcx_dma_free (struct device *dev,size_t size,void *vaddr, -dma_addr_t iova,struct dma_attrs *attrs) +dma_addr_t iova,unsigned long attrs) {free_pages ((unsigned long )vaddr,get_order (size));return ;
drivers/parisc/ccio-dma.c +8 -8
@@ -790,7 +790,7 @@ ccio_map_single(struct device *dev, void *addr, size_t size,static dma_addr_t ccio_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {return ccio_map_single (dev,page_address (page) + offset, size, direction);
@@ -806,7 +806,7 @@ ccio_map_page(struct device *dev, struct page *page, unsigned long offset,*/ static void ccio_unmap_page (struct device *dev,dma_addr_t iova,size_t size, -enum dma_data_direction direction,struct dma_attrs *attrs) +enum dma_data_direction direction,unsigned long attrs) {struct ioc *ioc;unsigned long flags;
@@ -844,7 +844,7 @@ ccio_unmap_page(struct device *dev, dma_addr_t iova, size_t size,*/ static void *ccio_alloc (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flag, -struct dma_attrs *attrs) +unsigned long attrs) {void *ret;#if 0
@@ -878,9 +878,9 @@ ccio_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag,*/ static void ccio_free (struct device *dev,size_t size,void *cpu_addr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) { -ccio_unmap_page (dev, dma_handle, size,0 ,NULL ); +ccio_unmap_page (dev, dma_handle, size,0 ,0 );free_pages ((unsigned long )cpu_addr,get_order (size)); }
@@ -907,7 +907,7 @@ ccio_free(struct device *dev, size_t size, void *cpu_addr,*/ static int ccio_map_sg (struct device *dev,struct scatterlist *sglist,int nents, -enum dma_data_direction direction,struct dma_attrs *attrs) +enum dma_data_direction direction,unsigned long attrs) {struct ioc *ioc;int coalesced, filled =0 ;
@@ -984,7 +984,7 @@ ccio_map_sg(struct device *dev, struct scatterlist *sglist, int nents,*/ static void ccio_unmap_sg (struct device *dev,struct scatterlist *sglist,int nents, -enum dma_data_direction direction,struct dma_attrs *attrs) +enum dma_data_direction direction,unsigned long attrs) {struct ioc *ioc;
@@ -1004,7 +1004,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, ioc->usg_pages +=sg_dma_len (sglist) >>PAGE_SHIFT ;#endif ccio_unmap_page (dev,sg_dma_address (sglist), -sg_dma_len (sglist), direction,NULL ); +sg_dma_len (sglist), direction,0 ); ++sglist; }
drivers/parisc/sba_iommu.c +8 -8
@@ -783,7 +783,7 @@ sba_map_single(struct device *dev, void *addr, size_t size,static dma_addr_t sba_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {return sba_map_single (dev,page_address (page) + offset, size, direction);
@@ -801,7 +801,7 @@ sba_map_page(struct device *dev, struct page *page, unsigned long offset,*/ static void sba_unmap_page (struct device *dev,dma_addr_t iova,size_t size, -enum dma_data_direction direction,struct dma_attrs *attrs) +enum dma_data_direction direction,unsigned long attrs) {struct ioc *ioc;#if DELAYED_RESOURCE_CNT >0
@@ -876,7 +876,7 @@ sba_unmap_page(struct device *dev, dma_addr_t iova, size_t size,* See Documentation/DMA-API-HOWTO.txt */ static void *sba_alloc (struct device *hwdev,size_t size,dma_addr_t *dma_handle, -gfp_t gfp,struct dma_attrs *attrs) +gfp_t gfp,unsigned long attrs) {void *ret;
@@ -908,9 +908,9 @@ static void *sba_alloc(struct device *hwdev, size_t size, dma_addr_t *dma_handle*/ static void sba_free (struct device *hwdev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) { -sba_unmap_page (hwdev, dma_handle, size,0 ,NULL ); +sba_unmap_page (hwdev, dma_handle, size,0 ,0 );free_pages ((unsigned long ) vaddr,get_order (size)); }
@@ -943,7 +943,7 @@ int dump_run_sg = 0;*/ static int sba_map_sg (struct device *dev,struct scatterlist *sglist,int nents, -enum dma_data_direction direction,struct dma_attrs *attrs) +enum dma_data_direction direction,unsigned long attrs) {struct ioc *ioc;int coalesced, filled =0 ;
@@ -1026,7 +1026,7 @@ sba_map_sg(struct device *dev, struct scatterlist *sglist, int nents,*/ static void sba_unmap_sg (struct device *dev,struct scatterlist *sglist,int nents, -enum dma_data_direction direction,struct dma_attrs *attrs) +enum dma_data_direction direction,unsigned long attrs) {struct ioc *ioc;#ifdef ASSERT_PDIR_SANITY
@@ -1051,7 +1051,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,while (sg_dma_len (sglist) && nents--) {sba_unmap_page (dev,sg_dma_address (sglist),sg_dma_len (sglist), - direction,NULL ); + direction,0 );#ifdef SBA_COLLECT_STATS ioc->usg_pages += ((sg_dma_address (sglist) & ~IOVP_MASK ) +sg_dma_len (sglist) +IOVP_SIZE -1 ) >>PAGE_SHIFT ; ioc->usingle_calls--;/* kluge since call is unmap_sg() */
Signature · 1 line
1.9.1
PATCH v4 36/44 misc: mic: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- drivers/misc/mic/host/mic_boot.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/misc/mic/host/mic_boot.c +10 -10
@@ -38,7 +38,7 @@ static inline struct mic_device *vpdev_to_mdev(struct device *dev)static dma_addr_t _mic_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {void *va =phys_to_virt (page_to_phys (page)) + offset;struct mic_device *mdev =vpdev_to_mdev (dev);
@@ -48,7 +48,7 @@ _mic_dma_map_page(struct device *dev, struct page *page,static void _mic_dma_unmap_page (struct device *dev,dma_addr_t dma_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct mic_device *mdev =vpdev_to_mdev (dev);
@@ -144,7 +144,7 @@ static inline struct mic_device *scdev_to_mdev(struct scif_hw_dev *scdev)static void *__mic_dma_alloc (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t gfp, -struct dma_attrs *attrs) +unsigned long attrs) {struct scif_hw_dev *scdev =dev_get_drvdata (dev);struct mic_device *mdev =scdev_to_mdev (scdev);
@@ -164,7 +164,7 @@ static void *__mic_dma_alloc(struct device *dev, size_t size, }static void __mic_dma_free (struct device *dev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) {struct scif_hw_dev *scdev =dev_get_drvdata (dev);struct mic_device *mdev =scdev_to_mdev (scdev);
@@ -176,7 +176,7 @@ static void __mic_dma_free(struct device *dev, size_t size, void *vaddr,static dma_addr_t __mic_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {void *va =phys_to_virt (page_to_phys (page)) + offset;struct scif_hw_dev *scdev =dev_get_drvdata (dev);
@@ -188,7 +188,7 @@ __mic_dma_map_page(struct device *dev, struct page *page, unsigned long offset,static void __mic_dma_unmap_page (struct device *dev,dma_addr_t dma_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scif_hw_dev *scdev =dev_get_drvdata (dev);struct mic_device *mdev =scdev_to_mdev (scdev);
@@ -198,7 +198,7 @@ __mic_dma_unmap_page(struct device *dev, dma_addr_t dma_addr,static int __mic_dma_map_sg (struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scif_hw_dev *scdev =dev_get_drvdata (dev);struct mic_device *mdev =scdev_to_mdev (scdev);
@@ -229,7 +229,7 @@ err:static void __mic_dma_unmap_sg (struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scif_hw_dev *scdev =dev_get_drvdata (dev);struct mic_device *mdev =scdev_to_mdev (scdev);
@@ -327,7 +327,7 @@ static inline struct mic_device *mbdev_to_mdev(struct mbus_device *mbdev)static dma_addr_t mic_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {void *va =phys_to_virt (page_to_phys (page)) + offset;struct mic_device *mdev =dev_get_drvdata (dev->parent);
@@ -338,7 +338,7 @@ mic_dma_map_page(struct device *dev, struct page *page,static void mic_dma_unmap_page (struct device *dev,dma_addr_t dma_addr,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct mic_device *mdev =dev_get_drvdata (dev->parent);mic_unmap_single (mdev, dma_addr, size);
Signature · 1 line
1.9.1
PATCH v4 37/44 s390: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/s390/include/asm/dma-mapping.h | 1 - arch/s390/pci/pci_dma.c | 23 ++++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-)
arch/s390/include/asm/dma-mapping.h +0 -1
@@ -5,7 +5,6 @@#include <linux/types.h> #include <linux/mm.h> #include <linux/scatterlist.h> -#include <linux/dma-attrs.h> #include <linux/dma-debug.h> #include <linux/io.h>
arch/s390/pci/pci_dma.c +12 -11
@@ -285,7 +285,7 @@ static inline void zpci_err_dma(unsigned long rc, unsigned long addr)static dma_addr_t s390_dma_map_pages (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct zpci_dev *zdev =to_zpci (to_pci_dev (dev));unsigned long nr_pages, iommu_page_index;
@@ -331,7 +331,7 @@ out_err:static void s390_dma_unmap_pages (struct device *dev,dma_addr_t dma_addr,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct zpci_dev *zdev =to_zpci (to_pci_dev (dev));unsigned long iommu_page_index;
@@ -354,7 +354,7 @@ static void s390_dma_unmap_pages(struct device *dev, dma_addr_t dma_addr,static void *s390_dma_alloc (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flag, -struct dma_attrs *attrs) +unsigned long attrs) {struct zpci_dev *zdev =to_zpci (to_pci_dev (dev));struct page *page;
@@ -369,7 +369,7 @@ static void *s390_dma_alloc(struct device *dev, size_t size, pa =page_to_phys (page);memset ((void *) pa,0 , size); - map =s390_dma_map_pages (dev, page,0 , size,DMA_BIDIRECTIONAL ,NULL ); + map =s390_dma_map_pages (dev, page,0 , size,DMA_BIDIRECTIONAL ,0 );if (dma_mapping_error (dev, map)) {free_pages (pa,get_order (size));return NULL ;
@@ -383,19 +383,19 @@ static void *s390_dma_alloc(struct device *dev, size_t size,static void s390_dma_free (struct device *dev,size_t size,void *pa,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) {struct zpci_dev *zdev =to_zpci (to_pci_dev (dev)); size =PAGE_ALIGN (size);atomic64_sub (size /PAGE_SIZE , &zdev->allocated_pages); -s390_dma_unmap_pages (dev, dma_handle, size,DMA_BIDIRECTIONAL ,NULL ); +s390_dma_unmap_pages (dev, dma_handle, size,DMA_BIDIRECTIONAL ,0 );free_pages ((unsigned long ) pa,get_order (size)); }static int s390_dma_map_sg (struct device *dev,struct scatterlist *sg,int nr_elements,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {int mapped_elements =0 ;struct scatterlist *s;
@@ -404,7 +404,7 @@ static int s390_dma_map_sg(struct device *dev, struct scatterlist *sg,for_each_sg (sg, s, nr_elements, i) {struct page *page =sg_page (s); s->dma_address =s390_dma_map_pages (dev, page, s->offset, - s->length, dir,NULL ); + s->length, dir,0 );if (!dma_mapping_error (dev, s->dma_address)) { s->dma_length = s->length; mapped_elements++;
@@ -418,7 +418,7 @@ unmap:for_each_sg (sg, s, mapped_elements, i) {if (s->dma_address)s390_dma_unmap_pages (dev, s->dma_address, s->dma_length, - dir,NULL ); + dir,0 ); s->dma_address =0 ; s->dma_length =0 ; }
@@ -428,13 +428,14 @@ unmap:static void s390_dma_unmap_sg (struct device *dev,struct scatterlist *sg,int nr_elements,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *s;int i;for_each_sg (sg, s, nr_elements, i) { -s390_dma_unmap_pages (dev, s->dma_address, s->dma_length, dir,NULL ); +s390_dma_unmap_pages (dev, s->dma_address, s->dma_length, dir, +0 ); s->dma_address =0 ; s->dma_length =0 ; }
Signature · 1 line
1.9.1
Re: [PATCH v4 37/44] s390: dma-mapping: Use unsigned long for dma_attrs
Quoted 9 lines · On Fri, 10 Jun 2016 12:11:54 +0200 Krzysztof Kozlowski…
Split out subsystem specific changes for easier reviews. This will be squashed with main commit.
Signed-off-by Krzysztof Kozlowski <[email protected]>--- arch/s390/include/asm/dma-mapping.h | 1 - arch/s390/pci/pci_dma.c | 23 ++++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-)
Quoted 110 lines
arch/s390/include/asm/dma-mapping.h +0
-1@@ -5,7 +5,6 @@#include <linux/types.h> #include <linux/mm.h> #include <linux/scatterlist.h> -#include <linux/dma-attrs.h> #include <linux/dma-debug.h> #include <linux/io.h> arch/s390/pci/pci_dma.c +12
-11@@ -285,7 +285,7 @@ static inline void zpci_err_dma(unsigned long rc, unsigned long addr)static dma_addr_t s390_dma_map_pages (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct zpci_dev *zdev =to_zpci (to_pci_dev (dev));unsigned long nr_pages, iommu_page_index;@@ -331,7 +331,7 @@ out_err:static void s390_dma_unmap_pages (struct device *dev,dma_addr_t dma_addr,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct zpci_dev *zdev =to_zpci (to_pci_dev (dev));unsigned long iommu_page_index;@@ -354,7 +354,7 @@ static void s390_dma_unmap_pages(struct device *dev, dma_addr_t dma_addr,static void *s390_dma_alloc (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flag, -struct dma_attrs *attrs) +unsigned long attrs) {struct zpci_dev *zdev =to_zpci (to_pci_dev (dev));struct page *page;@@ -369,7 +369,7 @@ static void *s390_dma_alloc(struct device *dev, size_t size, pa =page_to_phys (page);memset ((void *) pa,0 , size); - map =s390_dma_map_pages (dev, page,0 , size,DMA_BIDIRECTIONAL ,NULL ); + map =s390_dma_map_pages (dev, page,0 , size,DMA_BIDIRECTIONAL ,0 );if (dma_mapping_error (dev, map)) {free_pages (pa,get_order (size));return NULL ;@@ -383,19 +383,19 @@ static void *s390_dma_alloc(struct device *dev, size_t size,static void s390_dma_free (struct device *dev,size_t size,void *pa,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) {struct zpci_dev *zdev =to_zpci (to_pci_dev (dev)); size =PAGE_ALIGN (size);atomic64_sub (size /PAGE_SIZE , &zdev->allocated_pages); -s390_dma_unmap_pages (dev, dma_handle, size,DMA_BIDIRECTIONAL ,NULL ); +s390_dma_unmap_pages (dev, dma_handle, size,DMA_BIDIRECTIONAL ,0 );free_pages ((unsigned long ) pa,get_order (size)); }static int s390_dma_map_sg (struct device *dev,struct scatterlist *sg,int nr_elements,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {int mapped_elements =0 ;struct scatterlist *s;@@ -404,7 +404,7 @@ static int s390_dma_map_sg(struct device *dev, struct scatterlist *sg,for_each_sg (sg, s, nr_elements, i) {struct page *page =sg_page (s); s->dma_address =s390_dma_map_pages (dev, page, s->offset, - s->length, dir,NULL ); + s->length, dir,0 );if (!dma_mapping_error (dev, s->dma_address)) { s->dma_length = s->length; mapped_elements++;@@ -418,7 +418,7 @@ unmap:for_each_sg (sg, s, mapped_elements, i) {if (s->dma_address)s390_dma_unmap_pages (dev, s->dma_address, s->dma_length, - dir,NULL ); + dir,0 ); s->dma_address =0 ; s->dma_length =0 ; }@@ -428,13 +428,14 @@ unmap:static void s390_dma_unmap_sg (struct device *dev,struct scatterlist *sg,int nr_elements,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *s;int i;for_each_sg (sg, s, nr_elements, i) { -s390_dma_unmap_pages (dev, s->dma_address, s->dma_length, dir,NULL ); +s390_dma_unmap_pages (dev, s->dma_address, s->dma_length, dir, +0 ); s->dma_address =0 ; s->dma_length =0 ; }
PATCH v4 38/44 sh: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/sh/include/asm/dma-mapping.h | 4 ++-- arch/sh/kernel/dma-nommu.c | 4 ++-- arch/sh/mm/consistent.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
arch/sh/include/asm/dma-mapping.h +2 -2
@@ -17,9 +17,9 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size,/* arch/sh/mm/consistent.c */ extern void *dma_generic_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_addr,gfp_t flag, -struct dma_attrs *attrs); +unsigned long attrs);extern void dma_generic_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs); +unsigned long attrs);#endif /* __ASM_SH_DMA_MAPPING_H */
arch/sh/kernel/dma-nommu.c +2 -2
@@ -13,7 +13,7 @@static dma_addr_t nommu_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {dma_addr_t addr =page_to_phys (page) + offset;
@@ -25,7 +25,7 @@ static dma_addr_t nommu_map_page(struct device *dev, struct page *page,static int nommu_map_sg (struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *s;int i;
arch/sh/mm/consistent.c +2 -2
@@ -34,7 +34,7 @@ fs_initcall(dma_init);void *dma_generic_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t gfp, -struct dma_attrs *attrs) +unsigned long attrs) {void *ret, *ret_nocache;int order =get_order (size);
@@ -66,7 +66,7 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,void dma_generic_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) {int order =get_order (size);unsigned long pfn = dma_handle >>PAGE_SHIFT ;
Signature · 1 line
1.9.1
PATCH v4 39/44 sparc: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/sparc/kernel/iommu.c | 12 ++++++------ arch/sparc/kernel/ioport.c | 24 ++++++++++++------------ arch/sparc/kernel/pci_sun4v.c | 12 ++++++------ 3 files changed, 24 insertions(+), 24 deletions(-)
arch/sparc/kernel/iommu.c +6 -6
@@ -196,7 +196,7 @@ static inline void iommu_free_ctx(struct iommu *iommu, int ctx)static void *dma_4u_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_addrp,gfp_t gfp, -struct dma_attrs *attrs) +unsigned long attrs) {unsigned long order, first_page;struct iommu *iommu;
@@ -245,7 +245,7 @@ static void *dma_4u_alloc_coherent(struct device *dev, size_t size,static void dma_4u_free_coherent (struct device *dev,size_t size,void *cpu,dma_addr_t dvma, -struct dma_attrs *attrs) +unsigned long attrs) {struct iommu *iommu;unsigned long order, npages;
@@ -263,7 +263,7 @@ static void dma_4u_free_coherent(struct device *dev, size_t size,static dma_addr_t dma_4u_map_page (struct device *dev,struct page *page,unsigned long offset,size_t sz,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct iommu *iommu;struct strbuf *strbuf;
@@ -385,7 +385,7 @@ do_flush_sync:static void dma_4u_unmap_page (struct device *dev,dma_addr_t bus_addr,size_t sz,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct iommu *iommu;struct strbuf *strbuf;
@@ -431,7 +431,7 @@ static void dma_4u_unmap_page(struct device *dev, dma_addr_t bus_addr,static int dma_4u_map_sg (struct device *dev,struct scatterlist *sglist,int nelems,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *s, *outs, *segstart;unsigned long flags, handle, prot, ctx;
@@ -607,7 +607,7 @@ static unsigned long fetch_sg_ctx(struct iommu *iommu, struct scatterlist *sg)static void dma_4u_unmap_sg (struct device *dev,struct scatterlist *sglist,int nelems,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {unsigned long flags, ctx;struct scatterlist *sg;
arch/sparc/kernel/ioport.c +12 -12
@@ -260,7 +260,7 @@ EXPORT_SYMBOL(sbus_set_sbus64);*/ static void *sbus_alloc_coherent (struct device *dev,size_t len,dma_addr_t *dma_addrp,gfp_t gfp, -struct dma_attrs *attrs) +unsigned long attrs) {struct platform_device *op =to_platform_device (dev);unsigned long len_total =PAGE_ALIGN (len);
@@ -315,7 +315,7 @@ err_nopages: }static void sbus_free_coherent (struct device *dev,size_t n,void *p, -dma_addr_t ba,struct dma_attrs *attrs) +dma_addr_t ba,unsigned long attrs) {struct resource *res;struct page *pgv;
@@ -355,7 +355,7 @@ static void sbus_free_coherent(struct device *dev, size_t n, void *p,static dma_addr_t sbus_map_page (struct device *dev,struct page *page,unsigned long offset,size_t len,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {void *va =page_address (page) + offset;
@@ -371,20 +371,20 @@ static dma_addr_t sbus_map_page(struct device *dev, struct page *page, }static void sbus_unmap_page (struct device *dev,dma_addr_t ba,size_t n, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {mmu_release_scsi_one (dev, ba, n); }static int sbus_map_sg (struct device *dev,struct scatterlist *sg,int n, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {mmu_get_scsi_sgl (dev, sg, n);return n; }static void sbus_unmap_sg (struct device *dev,struct scatterlist *sg,int n, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {mmu_release_scsi_sgl (dev, sg, n); }
@@ -429,7 +429,7 @@ arch_initcall(sparc_register_ioport);*/ static void *pci32_alloc_coherent (struct device *dev,size_t len,dma_addr_t *pba,gfp_t gfp, -struct dma_attrs *attrs) +unsigned long attrs) {unsigned long len_total =PAGE_ALIGN (len);void *va;
@@ -482,7 +482,7 @@ err_nopages:* past this call are illegal. */ static void pci32_free_coherent (struct device *dev,size_t n,void *p, -dma_addr_t ba,struct dma_attrs *attrs) +dma_addr_t ba,unsigned long attrs) {struct resource *res;
@@ -518,14 +518,14 @@ static void pci32_free_coherent(struct device *dev, size_t n, void *p,static dma_addr_t pci32_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {/* IIep is write-through, not flushing. */ return page_to_phys (page) + offset; }static void pci32_unmap_page (struct device *dev,dma_addr_t ba,size_t size, -enum dma_data_direction dir,struct dma_attrs *attrs) +enum dma_data_direction dir,unsigned long attrs) {if (dir !=PCI_DMA_TODEVICE )dma_make_coherent (ba,PAGE_ALIGN (size));
@@ -548,7 +548,7 @@ static void pci32_unmap_page(struct device *dev, dma_addr_t ba, size_t size,*/ static int pci32_map_sg (struct device *device,struct scatterlist *sgl,int nents,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int n;
@@ -567,7 +567,7 @@ static int pci32_map_sg(struct device *device, struct scatterlist *sgl,*/ static void pci32_unmap_sg (struct device *dev,struct scatterlist *sgl,int nents,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int n;
arch/sparc/kernel/pci_sun4v.c +6 -6
@@ -130,7 +130,7 @@ static inline long iommu_batch_end(void)static void *dma_4v_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_addrp,gfp_t gfp, -struct dma_attrs *attrs) +unsigned long attrs) {unsigned long flags, order, first_page, npages, n;struct iommu *iommu;
@@ -213,7 +213,7 @@ static void dma_4v_iommu_demap(void *demap_arg, unsigned long entry, }static void dma_4v_free_coherent (struct device *dev,size_t size,void *cpu, -dma_addr_t dvma,struct dma_attrs *attrs) +dma_addr_t dvma,unsigned long attrs) {struct pci_pbm_info *pbm;struct iommu *iommu;
@@ -235,7 +235,7 @@ static void dma_4v_free_coherent(struct device *dev, size_t size, void *cpu,static dma_addr_t dma_4v_map_page (struct device *dev,struct page *page,unsigned long offset,size_t sz,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct iommu *iommu;unsigned long flags, npages, oaddr;
@@ -294,7 +294,7 @@ iommu_map_fail:static void dma_4v_unmap_page (struct device *dev,dma_addr_t bus_addr,size_t sz,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct pci_pbm_info *pbm;struct iommu *iommu;
@@ -322,7 +322,7 @@ static void dma_4v_unmap_page(struct device *dev, dma_addr_t bus_addr,static int dma_4v_map_sg (struct device *dev,struct scatterlist *sglist,int nelems,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *s, *outs, *segstart;unsigned long flags, handle, prot;
@@ -466,7 +466,7 @@ iommu_map_failed:static void dma_4v_unmap_sg (struct device *dev,struct scatterlist *sglist,int nelems,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct pci_pbm_info *pbm;struct scatterlist *sg;
Signature · 1 line
1.9.1
David Miller
maintainerRe: [PATCH v4 39/44] sparc: dma-mapping: Use unsigned long for dma_attrs
From: Krzysztof Kozlowski <[email protected]>
Date: Fri, 10 Jun 2016 12:11:56 +0200
Quoted 4 lines
Split out subsystem specific changes for easier reviews. This will be squashed with main commit.
Signed-off-by Krzysztof Kozlowski <[email protected]>
If you split the method signatures from the type changes to the pointers that they are assigned to, this breaks bisection.
You have to change them all at once, or use some other transitional mechanism for the intervening changes.
Re: [PATCH v4 39/44] sparc: dma-mapping: Use unsigned long for dma_attrs
Quoted 6 lines · David Miller
From: Krzysztof Kozlowski <[email protected]>
Date: Fri, 10 Jun 2016 12:11:56 +0200Quoted 3 lines
Split out subsystem specific changes for easier reviews. This will be squashed with main commit.
Quoted 7 lines
Quoted 1 line
Signed-off-by Krzysztof Kozlowski <[email protected]>If you split the method signatures from the type changes to the pointers that they are assigned to, this breaks bisection.
You have to change them all at once, or use some other transitional mechanism for the intervening changes.
Yes, this is why I wrote the commit message above. The split here is only for making code review easier for respective maintainers.
All these smaller patches will be squashed together with the main commit (patch 1/44 [1] [2]). Unfortunately the CC-list would be too huge to send it to all maintainers.
Best regards,
Krzysztof
[1] https://www.mail-archive.com/[email protected]/msg1164335.html
[2] https://github.com/krzk/linux/commit/72dee332b0bedb5cbfc51646d3c03ecbc4a5fe1e
PATCH v4 40/44 tile: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/tile/kernel/pci-dma.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
arch/tile/kernel/pci-dma.c +14 -14
@@ -34,7 +34,7 @@static void *tile_dma_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t gfp, -struct dma_attrs *attrs) +unsigned long attrs) {u64 dma_mask = (dev && dev->coherent_dma_mask) ? dev->coherent_dma_mask :DMA_BIT_MASK (32 );
@@ -78,7 +78,7 @@ static void *tile_dma_alloc_coherent(struct device *dev, size_t size,*/ static void tile_dma_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) {homecache_free_pages ((unsigned long )vaddr,get_order (size)); }
@@ -202,7 +202,7 @@ static void __dma_complete_pa_range(dma_addr_t dma_addr, size_t size,static int tile_dma_map_sg (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int i;
@@ -224,7 +224,7 @@ static int tile_dma_map_sg(struct device *dev, struct scatterlist *sglist,static void tile_dma_unmap_sg (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int i;
@@ -240,7 +240,7 @@ static void tile_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,static dma_addr_t tile_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {BUG_ON (!valid_dma_direction (direction));
@@ -252,7 +252,7 @@ static dma_addr_t tile_dma_map_page(struct device *dev, struct page *page,static void tile_dma_unmap_page (struct device *dev,dma_addr_t dma_address,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {BUG_ON (!valid_dma_direction (direction));
@@ -343,7 +343,7 @@ EXPORT_SYMBOL(tile_dma_map_ops);static void *tile_pci_dma_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t gfp, -struct dma_attrs *attrs) +unsigned long attrs) {int node =dev_to_node (dev);int order =get_order (size);
@@ -368,14 +368,14 @@ static void *tile_pci_dma_alloc_coherent(struct device *dev, size_t size,*/ static void tile_pci_dma_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle, -struct dma_attrs *attrs) +unsigned long attrs) {homecache_free_pages ((unsigned long )vaddr,get_order (size)); }static int tile_pci_dma_map_sg (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int i;
@@ -400,7 +400,7 @@ static int tile_pci_dma_map_sg(struct device *dev, struct scatterlist *sglist,static void tile_pci_dma_unmap_sg (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *sg;int i;
@@ -416,7 +416,7 @@ static void tile_pci_dma_unmap_sg(struct device *dev,static dma_addr_t tile_pci_dma_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {BUG_ON (!valid_dma_direction (direction));
@@ -429,7 +429,7 @@ static dma_addr_t tile_pci_dma_map_page(struct device *dev, struct page *page,static void tile_pci_dma_unmap_page (struct device *dev,dma_addr_t dma_address,size_t size,enum dma_data_direction direction, -struct dma_attrs *attrs) +unsigned long attrs) {BUG_ON (!valid_dma_direction (direction));
@@ -531,7 +531,7 @@ EXPORT_SYMBOL(gx_pci_dma_map_ops);#ifdef CONFIG_SWIOTLB static void *tile_swiotlb_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t gfp, -struct dma_attrs *attrs) +unsigned long attrs) { gfp |=GFP_DMA ;return swiotlb_alloc_coherent (dev, size, dma_handle, gfp);
@@ -539,7 +539,7 @@ static void *tile_swiotlb_alloc_coherent(struct device *dev, size_t size,static void tile_swiotlb_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_addr, -struct dma_attrs *attrs) +unsigned long attrs) {swiotlb_free_coherent (dev, size, vaddr, dma_addr); }
Signature · 1 line
1.9.1
PATCH v4 41/44 unicore32: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/unicore32/mm/dma-swiotlb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/unicore32/mm/dma-swiotlb.c +2 -2
@@ -19,14 +19,14 @@static void *unicore_swiotlb_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flags, -struct dma_attrs *attrs) +unsigned long attrs) {return swiotlb_alloc_coherent (dev, size, dma_handle, flags); }static void unicore_swiotlb_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t dma_addr, -struct dma_attrs *attrs) +unsigned long attrs) {swiotlb_free_coherent (dev, size, vaddr, dma_addr); }
Signature · 1 line
1.9.1
PATCH v4 42/44 xtensa: dma-mapping: Use unsigned long for dma_attrs
In reply to Krzysztof KozlowskiSplit out subsystem specific changes for easier reviews. This will be squashed with main commit.
--- arch/xtensa/kernel/pci-dma.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/xtensa/kernel/pci-dma.c +6 -6
@@ -142,7 +142,7 @@ static void xtensa_sync_sg_for_device(struct device *dev,static void *xtensa_dma_alloc (struct device *dev,size_t size,dma_addr_t *handle,gfp_t flag, -struct dma_attrs *attrs) +unsigned long attrs) {unsigned long ret;unsigned long uncached =0 ;
@@ -171,7 +171,7 @@ static void *xtensa_dma_alloc(struct device *dev, size_t size, }static void xtensa_dma_free (struct device *hwdev,size_t size,void *vaddr, -dma_addr_t dma_handle,struct dma_attrs *attrs) +dma_addr_t dma_handle,unsigned long attrs) {unsigned long addr = (unsigned long )vaddr +XCHAL_KSEG_CACHED_VADDR -XCHAL_KSEG_BYPASS_VADDR ;
@@ -185,7 +185,7 @@ static void xtensa_dma_free(struct device *hwdev, size_t size, void *vaddr,static dma_addr_t xtensa_map_page (struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {dma_addr_t dma_handle =page_to_phys (page) + offset;
@@ -195,14 +195,14 @@ static dma_addr_t xtensa_map_page(struct device *dev, struct page *page,static void xtensa_unmap_page (struct device *dev,dma_addr_t dma_handle,size_t size,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {xtensa_sync_single_for_cpu (dev, dma_handle, size, dir); }static int xtensa_map_sg (struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *s;int i;
@@ -217,7 +217,7 @@ static int xtensa_map_sg(struct device *dev, struct scatterlist *sg,static void xtensa_unmap_sg (struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction dir, -struct dma_attrs *attrs) +unsigned long attrs) {struct scatterlist *s;int i;
Signature · 1 line
1.9.1
PATCH v4 43/44 dma-mapping: Remove dma_get_attr
In reply to Krzysztof KozlowskiAfter switching DMA attributes to unsigned long it is easier to just compare the bits.
--- Documentation/DMA-API.txt | 4 +-- arch/arc/mm/dma.c | 4 +-- arch/arm/mm/dma-mapping.c | 36 ++++++++++++-------------- arch/arm/xen/mm.c | 4 +-- arch/arm64/mm/dma-mapping.c | 10 +++---- arch/avr32/mm/dma-coherent.c | 4 +-- arch/ia64/sn/pci/pci_dma.c | 10 ++----- arch/metag/kernel/dma.c | 2 +- arch/mips/mm/dma-default.c | 6 ++--- arch/openrisc/kernel/dma.c | 4 +-- arch/parisc/kernel/pci-dma.c | 2 +- arch/powerpc/platforms/cell/iommu.c | 12 ++++----- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 2 +- drivers/iommu/dma-iommu.c | 2 +- drivers/media/v4l2-core/videobuf2-dma-contig.c | 2 +- include/linux/dma-mapping.h | 10 ------- 16 files changed, 47 insertions(+), 67 deletions(-)
Documentation/DMA-API.txt +1 -3
@@ -422,9 +422,7 @@ void whizco_dma_map_sg_attrs(struct device *dev, dma_addr_t dma_addr, unsigned long attrs) { .... - int foo = dma_get_attr(DMA_ATTR_FOO, attrs); - .... - if (foo) + if (attrs & DMA_ATTR_FOO) /* twizzle the frobnozzle */ ....
arch/arc/mm/dma.c +2 -2
@@ -46,7 +46,7 @@ static void *arc_dma_alloc(struct device *dev, size_t size,* (vs. always going to memory - thus are faster) */ if ((is_isa_arcv2 () && ioc_exists) || -dma_get_attr (DMA_ATTR_NON_CONSISTENT , attrs)) + (attrs &DMA_ATTR_NON_CONSISTENT )) need_coh =0 ;/*
@@ -95,7 +95,7 @@ static void arc_dma_free(struct device *dev, size_t size, void *vaddr,struct page *page =virt_to_page (dma_handle);int is_non_coh =1 ; - is_non_coh =dma_get_attr (DMA_ATTR_NON_CONSISTENT , attrs) || + is_non_coh = (attrs &DMA_ATTR_NON_CONSISTENT ) || (is_isa_arcv2 () && ioc_exists);if (PageHighMem (page) || !is_non_coh)
arch/arm/mm/dma-mapping.c +17 -19
@@ -126,7 +126,7 @@ static dma_addr_t arm_dma_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction dir, unsigned long attrs) { - if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) + if ((attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0) __dma_page_cpu_to_dev(page, offset, size, dir);return pfn_to_dma (dev,page_to_pfn (page)) + offset; }
@@ -155,7 +155,7 @@ static dma_addr_t arm_coherent_dma_map_page(struct device *dev, struct page *pagstatic void arm_dma_unmap_page (struct device *dev,dma_addr_t handle,size_t size,enum dma_data_direction dir,unsigned long attrs) { -if (!dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) +if ((attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 )__dma_page_dev_to_cpu (pfn_to_page (dma_to_pfn (dev, handle)), handle & ~PAGE_MASK , size, dir); }
@@ -622,9 +622,9 @@ static void __free_from_contiguous(struct device *dev, struct page *page,static inline pgprot_t __get_dma_pgprot (unsigned long attrs,pgprot_t prot) { - prot =dma_get_attr (DMA_ATTR_WRITE_COMBINE , attrs) ? -pgprot_writecombine (prot) : -pgprot_dmacoherent (prot); + prot = (attrs &DMA_ATTR_WRITE_COMBINE ) ? +pgprot_writecombine (prot) : +pgprot_dmacoherent (prot);return prot; }
@@ -744,7 +744,7 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, .gfp = gfp, .prot = prot, .caller = caller, - .want_vaddr = !dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, attrs), + .want_vaddr = ((attrs & DMA_ATTR_NO_KERNEL_MAPPING) == 0), };#ifdef CONFIG_DMA_API_DEBUG
@@ -887,7 +887,7 @@ static void __arm_dma_free(struct device *dev, size_t size, void *cpu_addr, .size = PAGE_ALIGN(size), .cpu_addr = cpu_addr, .page = page, - .want_vaddr = !dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, attrs), + .want_vaddr = ((attrs & DMA_ATTR_NO_KERNEL_MAPPING) == 0), }; buf =arm_dma_buffer_find (cpu_addr);
@@ -1267,7 +1267,7 @@ static struct page **__iommu_alloc_buffer(struct device *dev, size_t size,if (!pages)return NULL ; -if (dma_get_attr (DMA_ATTR_FORCE_CONTIGUOUS , attrs)) +if (attrs &DMA_ATTR_FORCE_CONTIGUOUS ) {unsigned long order =get_order (size);struct page *page;
@@ -1285,7 +1285,7 @@ static struct page **__iommu_alloc_buffer(struct device *dev, size_t size, }/* Go straight to 4K chunks if caller says it's OK. */ -if (dma_get_attr (DMA_ATTR_ALLOC_SINGLE_PAGES , attrs)) +if (attrs &DMA_ATTR_ALLOC_SINGLE_PAGES ) order_idx =ARRAY_SIZE (iommu_order_array) -1 ;/*
@@ -1346,7 +1346,7 @@ static int __iommu_free_buffer(struct device *dev, struct page **pages,int count = size >>PAGE_SHIFT ;int i; -if (dma_get_attr (DMA_ATTR_FORCE_CONTIGUOUS , attrs)) { +if (attrs &DMA_ATTR_FORCE_CONTIGUOUS ) {dma_release_from_contiguous (dev, pages[0 ], count); }else {for (i =0 ; i < count; i++)
@@ -1445,7 +1445,7 @@ static struct page **__iommu_get_pages(void *cpu_addr, unsigned long attrs)if (__in_atomic_pool (cpu_addr,PAGE_SIZE ))return __atomic_get_pages (cpu_addr); -if (dma_get_attr (DMA_ATTR_NO_KERNEL_MAPPING , attrs)) +if (attrs &DMA_ATTR_NO_KERNEL_MAPPING )return cpu_addr; area =find_vm_area (cpu_addr);
@@ -1512,7 +1512,7 @@ static void *arm_iommu_alloc_attrs(struct device *dev, size_t size,if (*handle ==DMA_ERROR_CODE ) goto err_buffer; -if (dma_get_attr (DMA_ATTR_NO_KERNEL_MAPPING , attrs)) +if (attrs &DMA_ATTR_NO_KERNEL_MAPPING )return pages; addr = __iommu_alloc_remap(pages, size, gfp, prot,
@@ -1583,7 +1583,7 @@ void arm_iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr,return ; } -if (!dma_get_attr (DMA_ATTR_NO_KERNEL_MAPPING , attrs)) { +if ((attrs &DMA_ATTR_NO_KERNEL_MAPPING ) ==0 ) {dma_common_free_remap (cpu_addr, size,VM_ARM_DMA_CONSISTENT |VM_USERMAP ); }
@@ -1653,8 +1653,7 @@ static int __map_sg_chunk(struct device *dev, struct scatterlist *sg,phys_addr_t phys =page_to_phys (sg_page (s));unsigned int len =PAGE_ALIGN (s->offset + s->length); -if (!is_coherent && - !dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) +if (!is_coherent && (attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 )__dma_page_cpu_to_dev (sg_page (s), s->offset, s->length, dir); prot =__dma_direction_to_prot (dir);
@@ -1767,8 +1766,7 @@ static void __iommu_unmap_sg(struct device *dev, struct scatterlist *sg,if (sg_dma_len (s))__iommu_remove_mapping (dev,sg_dma_address (s),sg_dma_len (s)); -if (!is_coherent && - !dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) +if (!is_coherent && (attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 )__dma_page_dev_to_cpu (sg_page (s), s->offset, s->length, dir); }
@@ -1892,7 +1890,7 @@ static dma_addr_t arm_iommu_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction dir, unsigned long attrs) { - if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) + if ((attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0) __dma_page_cpu_to_dev(page, offset, size, dir);return arm_coherent_iommu_map_page (dev, page, offset, size, dir, attrs);
@@ -1943,7 +1941,7 @@ static void arm_iommu_unmap_page(struct device *dev, dma_addr_t handle,if (!iova)return ; -if (!dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) +if ((attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 )__dma_page_dev_to_cpu (page, offset, size, dir);iommu_unmap (mapping->domain, iova, len);
arch/arm/xen/mm.c +2 -2
@@ -102,7 +102,7 @@ void __xen_dma_map_page(struct device *hwdev, struct page *page, {if (is_device_dma_coherent (hwdev))return ; -if (dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) +if (attrs &DMA_ATTR_SKIP_CPU_SYNC )return ;__xen_dma_page_cpu_to_dev (hwdev, dev_addr, size, dir);
@@ -115,7 +115,7 @@ void __xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, {if (is_device_dma_coherent (hwdev))return ; -if (dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) +if (attrs &DMA_ATTR_SKIP_CPU_SYNC )return ;__xen_dma_page_dev_to_cpu (hwdev, handle, size, dir);
arch/arm64/mm/dma-mapping.c +5 -5
@@ -32,7 +32,7 @@static pgprot_t __get_dma_pgprot (unsigned long attrs,pgprot_t prot,bool coherent) { -if (!coherent ||dma_get_attr (DMA_ATTR_WRITE_COMBINE , attrs)) +if (!coherent || (attrs &DMA_ATTR_WRITE_COMBINE ))return pgprot_writecombine (prot);return prot; }
@@ -702,7 +702,7 @@ static dma_addr_t __iommu_map_page(struct device *dev, struct page *page,dma_addr_t dev_addr =iommu_dma_map_page (dev, page, offset, size, prot);if (!iommu_dma_mapping_error (dev, dev_addr) && - !dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) + (attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 )__iommu_sync_single_for_device (dev, dev_addr, size, dir);return dev_addr;
@@ -712,7 +712,7 @@ static void __iommu_unmap_page(struct device *dev, dma_addr_t dev_addr, size_t size, enum dma_data_direction dir, unsigned long attrs) { - if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) + if ((attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0) __iommu_sync_single_for_cpu(dev, dev_addr, size, dir);iommu_dma_unmap_page (dev, dev_addr, size, dir, attrs);
@@ -752,7 +752,7 @@ static int __iommu_map_sg_attrs(struct device *dev, struct scatterlist *sgl, {bool coherent =is_device_dma_coherent (dev); -if (!dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) +if ((attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 )__iommu_sync_sg_for_device (dev, sgl, nelems, dir); return iommu_dma_map_sg(dev, sgl, nelems,
@@ -764,7 +764,7 @@ static void __iommu_unmap_sg_attrs(struct device *dev, enum dma_data_direction dir, unsigned long attrs) { -if (!dma_get_attr (DMA_ATTR_SKIP_CPU_SYNC , attrs)) +if ((attrs &DMA_ATTR_SKIP_CPU_SYNC ) ==0 )__iommu_sync_sg_for_cpu (dev, sgl, nelems, dir);iommu_dma_unmap_sg (dev, sgl, nelems, dir, attrs);
arch/avr32/mm/dma-coherent.c +2 -2
@@ -109,7 +109,7 @@ static void *avr32_dma_alloc(struct device *dev, size_t size,return NULL ; phys =page_to_phys (page); -if (dma_get_attr (DMA_ATTR_WRITE_COMBINE , attrs)) { +if (attrs &DMA_ATTR_WRITE_COMBINE ) {/* Now, map the page into P3 with write-combining turned on */ *handle = phys;return __ioremap (phys, size, _PAGE_BUFFER);
@@ -123,7 +123,7 @@ static void avr32_dma_free(struct device *dev, size_t size, {struct page *page; -if (dma_get_attr (DMA_ATTR_WRITE_COMBINE , attrs)) { +if (attrs &DMA_ATTR_WRITE_COMBINE ) {iounmap (cpu_addr); page =phys_to_page (handle);
arch/ia64/sn/pci/pci_dma.c +2 -8
@@ -183,14 +183,11 @@ static dma_addr_t sn_dma_map_page(struct device *dev, struct page *page,unsigned long phys_addr;struct pci_dev *pdev =to_pci_dev (dev);struct sn_pcibus_provider *provider =SN_PCIDEV_BUSPROVIDER (pdev); -int dmabarr; - - dmabarr =dma_get_attr (DMA_ATTR_WRITE_BARRIER , attrs);BUG_ON (!dev_is_pci (dev)); phys_addr =__pa (cpu_addr); -if (dmabarr) +if (attrs &DMA_ATTR_WRITE_BARRIER ) dma_addr = provider->dma_map_consistent (pdev, phys_addr, size,SN_DMA_ADDR_PHYS );else
@@ -280,9 +277,6 @@ static int sn_dma_map_sg(struct device *dev, struct scatterlist *sgl,struct pci_dev *pdev =to_pci_dev (dev);struct sn_pcibus_provider *provider =SN_PCIDEV_BUSPROVIDER (pdev);int i; -int dmabarr; - - dmabarr =dma_get_attr (DMA_ATTR_WRITE_BARRIER , attrs);BUG_ON (!dev_is_pci (dev));
@@ -292,7 +286,7 @@ static int sn_dma_map_sg(struct device *dev, struct scatterlist *sgl,for_each_sg (sgl, sg, nhwentries, i) {dma_addr_t dma_addr; phys_addr =SG_ENT_PHYS_ADDRESS (sg); -if (dmabarr) +if (attrs &DMA_ATTR_WRITE_BARRIER ) dma_addr = provider->dma_map_consistent(pdev, phys_addr, sg->length,
arch/metag/kernel/dma.c +1 -1
@@ -337,7 +337,7 @@ static int metag_dma_mmap(struct device *dev, struct vm_area_struct *vma,struct metag_vm_region *c;int ret = -ENXIO ; -if (dma_get_attr (DMA_ATTR_WRITE_COMBINE , attrs)) +if (attrs &DMA_ATTR_WRITE_COMBINE ) vma->vm_page_prot =pgprot_writecombine (vma->vm_page_prot);else vma->vm_page_prot =pgprot_noncached (vma->vm_page_prot);
arch/mips/mm/dma-default.c +3 -3
@@ -141,7 +141,7 @@ static void *mips_dma_alloc_coherent(struct device *dev, size_t size,* XXX: seems like the coherent and non-coherent implementations could * be consolidated. */ -if (dma_get_attr (DMA_ATTR_NON_CONSISTENT , attrs)) +if (attrs &DMA_ATTR_NON_CONSISTENT )return mips_dma_alloc_noncoherent (dev, size, dma_handle, gfp); gfp =massage_gfp_flags (dev, gfp);
@@ -182,7 +182,7 @@ static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr,unsigned int count =PAGE_ALIGN (size) >>PAGE_SHIFT ;struct page *page =NULL ; -if (dma_get_attr (DMA_ATTR_NON_CONSISTENT , attrs)) { +if (attrs &DMA_ATTR_NON_CONSISTENT ) {mips_dma_free_noncoherent (dev, size, vaddr, dma_handle);return ; }
@@ -214,7 +214,7 @@ static int mips_dma_mmap(struct device *dev, struct vm_area_struct *vma, pfn =page_to_pfn (virt_to_page ((void *)addr)); -if (dma_get_attr (DMA_ATTR_WRITE_COMBINE , attrs)) +if (attrs &DMA_ATTR_WRITE_COMBINE ) vma->vm_page_prot =pgprot_writecombine (vma->vm_page_prot);else vma->vm_page_prot =pgprot_noncached (vma->vm_page_prot);
arch/openrisc/kernel/dma.c +2 -2
@@ -100,7 +100,7 @@ or1k_dma_alloc(struct device *dev, size_t size, va = (unsigned long )page; -if (!dma_get_attr (DMA_ATTR_NON_CONSISTENT , attrs)) { +if ((attrs &DMA_ATTR_NON_CONSISTENT ) ==0 ) {/* * We need to iterate through the pages, clearing the dcache for * them and setting the cache-inhibit bit.
@@ -124,7 +124,7 @@ or1k_dma_free(struct device *dev, size_t size, void *vaddr, .mm = &init_mm }; -if (!dma_get_attr (DMA_ATTR_NON_CONSISTENT , attrs)) { +if ((attrs &DMA_ATTR_NON_CONSISTENT ) ==0 ) {/* walk_page_range shouldn't be able to fail here */ WARN_ON (walk_page_range (va, va + size, &walk)); }
arch/parisc/kernel/pci-dma.c +1 -1
@@ -581,7 +581,7 @@ static void *pcx_dma_alloc(struct device *dev, size_t size, {void *addr; -if (!dma_get_attr (DMA_ATTR_NON_CONSISTENT , attrs)) +if ((attrs &DMA_ATTR_NON_CONSISTENT ) ==0 )return NULL ; addr = (void *)__get_free_pages (flag,get_order (size));
arch/powerpc/platforms/cell/iommu.c +6 -6
@@ -193,7 +193,7 @@ static int tce_build_cell(struct iommu_table *tbl, long index, long npages, base_pte =CBE_IOPTE_PP_W |CBE_IOPTE_PP_R |CBE_IOPTE_M |CBE_IOPTE_SO_RW | (window->ioid & CBE_IOPTE_IOID_Mask);#endif -if (unlikely (dma_get_attr (DMA_ATTR_WEAK_ORDERING , attrs))) +if (unlikely (attrs &DMA_ATTR_WEAK_ORDERING )) base_pte &= ~CBE_IOPTE_SO_RW ; io_pte = (unsigned long *)tbl->it_base + (index - tbl->it_offset);
@@ -600,7 +600,7 @@ static dma_addr_t dma_fixed_map_page(struct device *dev, struct page *page, enum dma_data_direction direction, unsigned long attrs) { - if (iommu_fixed_is_weak == dma_get_attr(DMA_ATTR_WEAK_ORDERING, attrs)) + if (iommu_fixed_is_weak == (attrs & DMA_ATTR_WEAK_ORDERING)) return dma_direct_ops.map_page(dev, page, offset, size, direction, attrs); else
@@ -613,7 +613,7 @@ static void dma_fixed_unmap_page(struct device *dev, dma_addr_t dma_addr, size_t size, enum dma_data_direction direction, unsigned long attrs) { - if (iommu_fixed_is_weak == dma_get_attr(DMA_ATTR_WEAK_ORDERING, attrs)) + if (iommu_fixed_is_weak == (attrs & DMA_ATTR_WEAK_ORDERING)) dma_direct_ops.unmap_page(dev, dma_addr, size, direction, attrs); else
@@ -625,7 +625,7 @@ static int dma_fixed_map_sg(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction direction, unsigned long attrs) { - if (iommu_fixed_is_weak == dma_get_attr(DMA_ATTR_WEAK_ORDERING, attrs)) + if (iommu_fixed_is_weak == (attrs & DMA_ATTR_WEAK_ORDERING)) return dma_direct_ops.map_sg(dev, sg, nents, direction, attrs); else return ppc_iommu_map_sg(dev, cell_get_iommu_table(dev), sg,
@@ -637,7 +637,7 @@ static void dma_fixed_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction direction, unsigned long attrs) { - if (iommu_fixed_is_weak == dma_get_attr(DMA_ATTR_WEAK_ORDERING, attrs)) + if (iommu_fixed_is_weak == (attrs & DMA_ATTR_WEAK_ORDERING)) dma_direct_ops.unmap_sg(dev, sg, nents, direction, attrs); else ppc_iommu_unmap_sg(cell_get_iommu_table(dev), sg, nents,
@@ -1162,7 +1162,7 @@ static int __init setup_iommu_fixed(char *str) pciep =of_find_node_by_type (NULL ,"pcie-endpoint" );if (strcmp (str,"weak" ) ==0 || (pciep &&strcmp (str,"strong" ) !=0 )) - iommu_fixed_is_weak =1 ; + iommu_fixed_is_weak =DMA_ATTR_WEAK_ORDERING ;of_node_put (pciep);
drivers/gpu/drm/rockchip/rockchip_drm_gem.c +1 -1
@@ -273,7 +273,7 @@ void *rockchip_gem_prime_vmap(struct drm_gem_object *obj) {struct rockchip_gem_object *rk_obj =to_rockchip_obj (obj); -if (dma_get_attr (DMA_ATTR_NO_KERNEL_MAPPING , rk_obj->dma_attrs)) +if (rk_obj->dma_attrs &DMA_ATTR_NO_KERNEL_MAPPING )return NULL ;return rk_obj->kvaddr;
drivers/iommu/dma-iommu.c +1 -1
@@ -306,7 +306,7 @@ struct page **iommu_dma_alloc(struct device *dev, size_t size, gfp_t gfp, }else { size =ALIGN (size, min_size); } -if (dma_get_attr (DMA_ATTR_ALLOC_SINGLE_PAGES , attrs)) +if (attrs &DMA_ATTR_ALLOC_SINGLE_PAGES ) alloc_sizes = min_size; count =PAGE_ALIGN (size) >>PAGE_SHIFT ;
drivers/media/v4l2-core/videobuf2-dma-contig.c +1 -1
@@ -160,7 +160,7 @@ static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size,return ERR_PTR (-ENOMEM ); } -if (!dma_get_attr (DMA_ATTR_NO_KERNEL_MAPPING , buf->attrs)) +if ((buf->attrs &DMA_ATTR_NO_KERNEL_MAPPING ) ==0 ) buf->vaddr = buf->cookie;/* Prevent the device from being released while the buffer is used */
include/linux/dma-mapping.h +0 -10
@@ -101,16 +101,6 @@ static inline int is_device_dma_capable(struct device *dev)return dev->dma_mask !=NULL && *dev->dma_mask !=DMA_MASK_NONE ; } -/** -* dma_get_attr - check for a specific attribute -* @attr: attribute to look for -* @attrs: attributes to check within -*/ -static inline bool dma_get_attr (unsigned long attr,unsigned long attrs) -{ -return !!(attr & attrs); -} -#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT /* * These three functions are only for dma allocator.
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH v4 44/44 dma-mapping: Document the DMA attributes next to the declaration
In reply to Krzysztof KozlowskiCopy documentation abstract about each DMA attribute from Documentation/DMA-attributes.txt to the place with declaration.
--- include/linux/dma-mapping.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
include/linux/dma-mapping.h +33 -0
@@ -14,14 +14,47 @@/** * List of possible attributes associated with a DMA mapping. The semantics * of each attribute should be defined in Documentation/DMA-attributes.txt. +* +* DMA_ATTR_WRITE_BARRIER: DMA to a memory region with this attribute +* forces all pending DMA writes to complete. */ #define DMA_ATTR_WRITE_BARRIER (1UL << 0) +/* +* DMA_ATTR_WEAK_ORDERING: Specifies that reads and writes to the mapping +* may be weakly ordered, that is that reads and writes may pass each other. +*/ #define DMA_ATTR_WEAK_ORDERING (1UL << 1) +/* +* DMA_ATTR_WRITE_COMBINE: Specifies that writes to the mapping may be +* buffered to improve performance. +*/ #define DMA_ATTR_WRITE_COMBINE (1UL << 2) +/* +* DMA_ATTR_NON_CONSISTENT: Lets the platform to choose to return either +* consistent or non-consistent memory as it sees fit. +*/ #define DMA_ATTR_NON_CONSISTENT (1UL << 3) +/* +* DMA_ATTR_NO_KERNEL_MAPPING: Lets the platform to avoid creating a kernel +* virtual mapping for the allocated buffer. +*/ #define DMA_ATTR_NO_KERNEL_MAPPING (1UL << 4) +/* +* DMA_ATTR_SKIP_CPU_SYNC: Allows platform code to skip synchronization of +* the CPU cache for the given buffer assuming that it has been already +* transferred to 'device' domain. +*/ #define DMA_ATTR_SKIP_CPU_SYNC (1UL << 5) +/* +* DMA_ATTR_FORCE_CONTIGUOUS: Forces contiguous allocation of the buffer +* in physical memory. +*/ #define DMA_ATTR_FORCE_CONTIGUOUS (1UL << 6) +/* +* DMA_ATTR_ALLOC_SINGLE_PAGES: This is a hint to the DMA-mapping subsystem +* that it's probably not worth the time to try to allocate memory to in a way +* that gives better TLB efficiency. +*/ #define DMA_ATTR_ALLOC_SINGLE_PAGES (1UL << 7)/*
Signature · 1 line
1.9.1