Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f91f6136 authored by Neeti Desai's avatar Neeti Desai Committed by Matt Wagantall
Browse files

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: default avatarNeeti Desai <neetid@codeaurora.org>
Signed-off-by: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
parent d97d02de
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1266,3 +1266,11 @@ int iommu_domain_set_attr(struct iommu_domain *domain,
	return ret;
}
EXPORT_SYMBOL_GPL(iommu_domain_set_attr);

int iommu_dma_supported(struct iommu_domain *domain, struct device *dev,
								u64 mask)
{
	if (domain->ops->dma_supported)
		return domain->ops->dma_supported(domain, dev, mask);
	return 0;
}
+11 −0
Original line number Diff line number Diff line
@@ -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 */