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

Commit 931eb43a authored by Mitchel Humpherys's avatar Mitchel Humpherys
Browse files

iommu: Add iommu_iova_to_phys_hard



Some IOMMU hardware implementations provide hardware translation
operations that can be useful during debugging and development.  Add a
function for this purpose along with an associated op in the iommu_ops
structure so that drivers can implement it.

Change-Id: I54ad5df526cdce05f8e04206a4f01253b3976b48
Signed-off-by: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
parent be2513ff
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1027,6 +1027,15 @@ phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova)
}
EXPORT_SYMBOL_GPL(iommu_iova_to_phys);

phys_addr_t iommu_iova_to_phys_hard(struct iommu_domain *domain,
				    dma_addr_t iova)
{
	if (unlikely(domain->ops->iova_to_phys_hard == NULL))
		return 0;

	return domain->ops->iova_to_phys_hard(domain, iova);
}

size_t iommu_pgsize(unsigned long pgsize_bitmap,
		    unsigned long addr_merge, size_t size)
{
+11 −0
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@ enum iommu_attr {
 * @map_sg: map a scatter-gather list of physically contiguous memory chunks
 * to an iommu domain
 * @iova_to_phys: translate iova to physical address
 * @iova_to_phys_hard: translate iova to physical address using IOMMU hardware
 * @add_device: add device to iommu grouping
 * @remove_device: remove device from iommu grouping
 * @domain_get_attr: Query domain attributes
@@ -134,6 +135,8 @@ struct iommu_ops {
			size_t len);

	phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova);
	phys_addr_t (*iova_to_phys_hard)(struct iommu_domain *domain,
					 dma_addr_t iova);
	int (*add_device)(struct device *dev);
	void (*remove_device)(struct device *dev);
	int (*device_group)(struct device *dev, unsigned int *groupid);
@@ -187,6 +190,8 @@ extern size_t default_iommu_map_sg(struct iommu_domain *domain, unsigned long io
				struct scatterlist *sg, unsigned int nents,
				int prot);
extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova);
extern phys_addr_t iommu_iova_to_phys_hard(struct iommu_domain *domain,
					   dma_addr_t iova);
extern void iommu_set_fault_handler(struct iommu_domain *domain,
			iommu_fault_handler_t handler, void *token);

@@ -381,6 +386,12 @@ static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_ad
	return 0;
}

static inline phys_addr_t iommu_iova_to_phys_hard(struct iommu_domain *domain,
						  dma_addr_t iova)
{
	return 0;
}

static inline void iommu_set_fault_handler(struct iommu_domain *domain,
				iommu_fault_handler_t handler, void *token)
{