From 4f869790bdc237f5fddf632f1bdf9f195caea8a5 Mon Sep 17 00:00:00 2001 From: "Isaac J. Manjarres" Date: Fri, 2 Aug 2019 16:53:49 -0700 Subject: [PATCH] iommu/dma-iommu: Allow dma_info_to_prot to be used globally The dma_info_to_prot() function is needed for drivers that implement their own DMA operation so that the DMA directions and attributes can be translated to IOMMU page flags, so make it a global function. Change-Id: I4d74f193f75801e2d481f3a2ec4044f2da2ae8aa Signed-off-by: Isaac J. Manjarres --- drivers/iommu/dma-iommu.c | 2 +- include/linux/dma-iommu.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 63060cc997e1..f5084a5209d5 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -362,7 +362,7 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base, * * Return: corresponding IOMMU API page protection flags */ -static int dma_info_to_prot(enum dma_data_direction dir, bool coherent, +int dma_info_to_prot(enum dma_data_direction dir, bool coherent, unsigned long attrs) { int prot = coherent ? IOMMU_CACHE : 0; diff --git a/include/linux/dma-iommu.h b/include/linux/dma-iommu.h index b2e790a9f05c..5cfc5af6233c 100644 --- a/include/linux/dma-iommu.h +++ b/include/linux/dma-iommu.h @@ -20,6 +20,8 @@ int iommu_get_dma_cookie(struct iommu_domain *domain); int iommu_get_msi_cookie(struct iommu_domain *domain, dma_addr_t base); void iommu_put_dma_cookie(struct iommu_domain *domain); +int dma_info_to_prot(enum dma_data_direction dir, bool coherent, + unsigned long attrs); size_t iommu_dma_prepare_map_sg(struct device *dev, struct iova_domain *iovad, struct scatterlist *sg, int nents); int iommu_dma_finalise_sg(struct device *dev, struct scatterlist *sg,