diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2015-05-14 19:00:02 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2017-04-28 18:09:25 -0400 |
commit | 26b37b946a5c2658dbc37dd5d6df40aaa9685d70 (patch) | |
tree | 9c115292757373235ac0e7c8e8cfe1a1d0fc355a | |
parent | d49f2dedf33b8e7752ec66ac2b3b5bf4d7210943 (diff) |
arm: dma-mapping: Don't override dma_ops in arch_setup_dma_ops()
The arch_setup_dma_ops() function is in charge of setting dma_ops with a
call to set_dma_ops(). set_dma_ops() is also called from
- highbank and mvebu bus notifiers
- dmabounce (to be replaced with swiotlb)
- arm_iommu_attach_device
(arm_iommu_attach_device is itself called from IOMMU and bus master
device drivers)
To allow the arch_setup_dma_ops() call to be moved from device add time
to device probe time we must ensure that dma_ops already setup by any of
the above callers will not be overriden.
Aftering replacing dmabounce with swiotlb, converting IOMMU drivers to
of_xlate and taking care of highbank and mvebu, the workaround should be
removed.
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
-rw-r--r-- | arch/arm/mm/dma-mapping.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 63eabb06f9f1..ff131928be50 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -2390,6 +2390,15 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, | |||
2390 | const struct dma_map_ops *dma_ops; | 2390 | const struct dma_map_ops *dma_ops; |
2391 | 2391 | ||
2392 | dev->archdata.dma_coherent = coherent; | 2392 | dev->archdata.dma_coherent = coherent; |
2393 | |||
2394 | /* | ||
2395 | * Don't override the dma_ops if they have already been set. Ideally | ||
2396 | * this should be the only location where dma_ops are set, remove this | ||
2397 | * check when all other callers of set_dma_ops will have disappeared. | ||
2398 | */ | ||
2399 | if (dev->dma_ops) | ||
2400 | return; | ||
2401 | |||
2393 | if (arm_setup_iommu_dma_ops(dev, dma_base, size, iommu)) | 2402 | if (arm_setup_iommu_dma_ops(dev, dma_base, size, iommu)) |
2394 | dma_ops = arm_get_iommu_dma_map_ops(coherent); | 2403 | dma_ops = arm_get_iommu_dma_map_ops(coherent); |
2395 | else | 2404 | else |