aboutsummaryrefslogtreecommitdiff
path: root/arch/nios2/mm/dma-mapping.c
AgeCommit message (Collapse)AuthorFilesLines
2020-03-16dma-direct: make uncached_kernel_address more generalChristoph Hellwig1-1/+1
Rename the symbol to arch_dma_set_uncached, and pass a size to it as well as allow an error return. That will allow reusing this hook for in-place pagetable remapping. As the in-place remap doesn't always require an explicit cache flush, also detangle ARCH_HAS_DMA_PREP_COHERENT from ARCH_HAS_DMA_SET_UNCACHED. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Robin Murphy <[email protected]>
2020-03-16dma-direct: remove the cached_kernel_address hookChristoph Hellwig1-10/+0
dma-direct now finds the kernel address for coherent allocations based on the dma address, so the cached_kernel_address hooks is unused and can be removed entirely. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Robin Murphy <[email protected]>
2019-11-20dma-mapping: drop the dev argument to arch_sync_dma_for_*Christoph Hellwig1-4/+4
These are pure cache maintainance routines, so drop the unused struct device argument. Signed-off-by: Christoph Hellwig <[email protected]> Suggested-by: Daniel Vetter <[email protected]>
2019-06-25nios2: use the generic uncached segment support in dma-directChristoph Hellwig1-19/+15
Stop providing our own arch alloc/free hooks and just expose the segment offset and use the generic dma-direct allocator. Signed-off-by: Christoph Hellwig <[email protected]> Acked-by: Ley Foon Tan <[email protected]>
2018-07-25nios2: use generic dma_noncoherent_opsChristoph Hellwig1-126/+13
Switch to the generic noncoherent direct mapping implementation. Signed-off-by: Christoph Hellwig <[email protected]> Acked-by: Ley Foon Tan <[email protected]> Tested-by: Ley Foon Tan <[email protected]>
2018-01-15dma-mapping: clear harmful GFP_* flags in common codeChristoph Hellwig1-3/+0
Lift the code from x86 so that we behave consistently. In the future we should probably warn if any of these is set. Signed-off-by: Christoph Hellwig <[email protected]> Acked-by: Jesper Nilsson <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> [m68k]
2017-01-24treewide: Constify most dma_map_ops structuresBart Van Assche1-1/+1
Most dma_map_ops structures are never modified. Constify these structures such that these can be write-protected. This patch has been generated as follows: git grep -l 'struct dma_map_ops' | xargs -d\\n sed -i \ -e 's/struct dma_map_ops/const struct dma_map_ops/g' \ -e 's/const struct dma_map_ops {/struct dma_map_ops {/g' \ -e 's/^const struct dma_map_ops;$/struct dma_map_ops;/' \ -e 's/const const struct dma_map_ops /const struct dma_map_ops /g'; sed -i -e 's/const \(struct dma_map_ops intel_dma_ops\)/\1/' \ $(git grep -l 'struct dma_map_ops intel_dma_ops'); sed -i -e 's/const \(struct dma_map_ops dma_iommu_ops\)/\1/' \ $(git grep -l 'struct dma_map_ops' | grep ^arch/powerpc); sed -i -e '/^struct vmd_dev {$/,/^};$/ s/const \(struct dma_map_ops[[:blank:]]dma_ops;\)/\1/' \ -e '/^static void vmd_setup_dma_ops/,/^}$/ s/const \(struct dma_map_ops \*dest\)/\1/' \ -e 's/const \(struct dma_map_ops \*dest = \&vmd->dma_ops\)/\1/' \ drivers/pci/host/*.c sed -i -e '/^void __init pci_iommu_alloc(void)$/,/^}$/ s/dma_ops->/intel_dma_ops./' arch/ia64/kernel/pci-dma.c sed -i -e 's/static const struct dma_map_ops sn_dma_ops/static struct dma_map_ops sn_dma_ops/' arch/ia64/sn/pci/pci_dma.c sed -i -e 's/(const struct dma_map_ops \*)//' drivers/misc/mic/bus/vop_bus.c Signed-off-by: Bart Van Assche <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Boris Ostrovsky <[email protected]> Cc: David Woodhouse <[email protected]> Cc: Juergen Gross <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: [email protected] Cc: [email protected] Cc: Russell King <[email protected]> Cc: [email protected] Signed-off-by: Doug Ledford <[email protected]>
2016-12-14arch/nios2: add option to skip DMA sync as a part of map and unmapAlexander Duyck1-8/+18
This change allows us to pass DMA_ATTR_SKIP_CPU_SYNC which allows us to avoid invoking cache line invalidation if the driver will just handle it via a sync_for_cpu or sync_for_device call. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Alexander Duyck <[email protected]> Reviewed-by: Tobias Klauser <[email protected]> Cc: Ley Foon Tan <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2016-08-04dma-mapping: use unsigned long for dma_attrsKrzysztof Kozlowski1-6/+6
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 ) and // 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 ) Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Krzysztof Kozlowski <[email protected]> Acked-by: Vineet Gupta <[email protected]> Acked-by: Robin Murphy <[email protected]> Acked-by: Hans-Christian Noren Egtvedt <[email protected]> Acked-by: Mark Salter <[email protected]> [c6x] Acked-by: Jesper Nilsson <[email protected]> [cris] Acked-by: Daniel Vetter <[email protected]> [drm] Reviewed-by: Bart Van Assche <[email protected]> Acked-by: Joerg Roedel <[email protected]> [iommu] Acked-by: Fabien Dessenne <[email protected]> [bdisp] Reviewed-by: Marek Szyprowski <[email protected]> [vb2-core] Acked-by: David Vrabel <[email protected]> [xen] Acked-by: Konrad Rzeszutek Wilk <[email protected]> [xen swiotlb] Acked-by: Joerg Roedel <[email protected]> [iommu] Acked-by: Richard Kuo <[email protected]> [hexagon] Acked-by: Geert Uytterhoeven <[email protected]> [m68k] Acked-by: Gerald Schaefer <[email protected]> [s390] Acked-by: Bjorn Andersson <[email protected]> Acked-by: Hans-Christian Noren Egtvedt <[email protected]> [avr32] Acked-by: Vineet Gupta <[email protected]> [arc] Acked-by: Robin Murphy <[email protected]> [arm64 and dma-iommu] Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2016-01-20nios2: convert to dma_map_opsChristoph Hellwig1-69/+80
Signed-off-by: Christoph Hellwig <[email protected]> Cc: Ley Foon Tan <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Joerg Roedel <[email protected]> Cc: Sebastian Ott <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-08nios2: DMA mapping APILey Foon Tan1-0/+186
This patch adds support for the DMA mapping API. Signed-off-by: Ley Foon Tan <[email protected]>