diff options
author | Robin Murphy <robin.murphy@arm.com> | 2015-10-01 15:14:00 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2015-10-15 10:41:47 -0400 |
commit | 876945dbf6497c7539ef958fee7ade970fbbe17a (patch) | |
tree | 249ed5cde4c8ed71361a50f75f28091e3c281adf /arch/arm64/mm | |
parent | 13b8629f651164d71f4d38b821925f93ba4236c8 (diff) |
arm64: Hook up IOMMU dma_ops
With iommu_dma_ops in place, hook them up to the configuration code, so
IOMMU-fronted devices will get them automatically.
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'arch/arm64/mm')
-rw-r--r-- | arch/arm64/mm/dma-mapping.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 322404193044..6320361d8d4c 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c | |||
@@ -960,6 +960,19 @@ static void __iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, | |||
960 | } | 960 | } |
961 | } | 961 | } |
962 | 962 | ||
963 | void arch_teardown_dma_ops(struct device *dev) | ||
964 | { | ||
965 | struct iommu_domain *domain = iommu_get_domain_for_dev(dev); | ||
966 | |||
967 | if (domain) { | ||
968 | iommu_detach_device(domain, dev); | ||
969 | if (domain->type & __IOMMU_DOMAIN_FAKE_DEFAULT) | ||
970 | iommu_domain_free(domain); | ||
971 | } | ||
972 | |||
973 | dev->archdata.dma_ops = NULL; | ||
974 | } | ||
975 | |||
963 | #else | 976 | #else |
964 | 977 | ||
965 | static void __iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, | 978 | static void __iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, |
@@ -968,3 +981,12 @@ static void __iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, | |||
968 | 981 | ||
969 | #endif /* CONFIG_IOMMU_DMA */ | 982 | #endif /* CONFIG_IOMMU_DMA */ |
970 | 983 | ||
984 | void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, | ||
985 | struct iommu_ops *iommu, bool coherent) | ||
986 | { | ||
987 | if (!acpi_disabled && !dev->archdata.dma_ops) | ||
988 | dev->archdata.dma_ops = dma_ops; | ||
989 | |||
990 | dev->archdata.dma_coherent = coherent; | ||
991 | __iommu_setup_dma_ops(dev, dma_base, size, iommu); | ||
992 | } | ||