From cc0f4edc4e6b62f91badaf288317f8a9be378d4d Mon Sep 17 00:00:00 2001 From: Neeti Desai Date: Wed, 13 May 2015 17:55:53 -0700 Subject: iommu: Add support for .dma_supported() ops The .dma_supported() checks to see if the device can support DMA to the memory described by the mask. Add support for this operation in the iommu layer Change-Id: Icf37b9540aa68c2be3fd603a48402d6fcccd8208 Signed-off-by: Neeti Desai Signed-off-by: Mitchel Humpherys --- include/linux/iommu.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 1890dd08b52e..2d835b7c226d 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -141,6 +141,8 @@ struct iommu_ops { int (*domain_set_windows)(struct iommu_domain *domain, u32 w_count); /* Get the numer of window per domain */ u32 (*domain_get_windows)(struct iommu_domain *domain); + int (*dma_supported)(struct iommu_domain *domain, struct device *dev, + u64 mask); unsigned long pgsize_bitmap; }; @@ -263,6 +265,9 @@ static inline size_t iommu_map_sg(struct iommu_domain *domain, return domain->ops->map_sg(domain, iova, sg, nents, prot); } +extern int iommu_dma_supported(struct iommu_domain *domain, struct device *dev, + u64 mask); + #else /* CONFIG_IOMMU_API */ struct iommu_ops {}; @@ -453,6 +458,12 @@ static inline void iommu_device_unlink(struct device *dev, struct device *link) { } +static int iommu_dma_supported(struct iommu_domain *domain, struct device *dev, + u64 mask) +{ + return -EINVAL; +} + #endif /* CONFIG_IOMMU_API */ #endif /* __LINUX_IOMMU_H */ -- cgit v1.2.3