diff options
author | Christoph Hellwig <hch@lst.de> | 2018-09-08 11:22:43 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-09-20 09:01:15 +0200 |
commit | bc3ec75de5452db59b683487867ba562b950708a (patch) | |
tree | ad93be8bbaea3429f83fb0afd6b7597ec90a1e7b /arch/arc/mm | |
parent | dma-mapping: move the dma_coherent flag to struct device (diff) | |
download | linux-bc3ec75de5452db59b683487867ba562b950708a.tar.xz linux-bc3ec75de5452db59b683487867ba562b950708a.zip |
dma-mapping: merge direct and noncoherent ops
All the cache maintainance is already stubbed out when not enabled,
but merging the two allows us to nicely handle the case where
cache maintainance is required for some devices, but not others.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Paul Burton <paul.burton@mips.com> # MIPS parts
Diffstat (limited to 'arch/arc/mm')
-rw-r--r-- | arch/arc/mm/dma.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c index c75d5c3470e3..535ed4a068ef 100644 --- a/arch/arc/mm/dma.c +++ b/arch/arc/mm/dma.c @@ -167,7 +167,7 @@ void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr, } /* - * Plug in coherent or noncoherent dma ops + * Plug in direct dma map ops. */ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, const struct iommu_ops *iommu, bool coherent) @@ -175,13 +175,11 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, /* * IOC hardware snoops all DMA traffic keeping the caches consistent * with memory - eliding need for any explicit cache maintenance of - * DMA buffers - so we can use dma_direct cache ops. + * DMA buffers. */ - if (is_isa_arcv2() && ioc_enable && coherent) { - set_dma_ops(dev, &dma_direct_ops); - dev_info(dev, "use dma_direct_ops cache ops\n"); - } else { - set_dma_ops(dev, &dma_noncoherent_ops); - dev_info(dev, "use dma_noncoherent_ops cache ops\n"); - } + if (is_isa_arcv2() && ioc_enable && coherent) + dev->dma_coherent = true; + + dev_info(dev, "use %sncoherent DMA ops\n", + dev->dma_coherent ? "" : "non"); } |