iommu/core: stop converting bytes to page order back and forth
Express sizes in bytes rather than in page order, to eliminate the
size->order->size conversions we have whenever the IOMMU API is calling
the low level drivers' map/unmap methods.
Adopt all existing drivers.
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Cc: David Brown <davidb@codeaurora.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Joerg Roedel <Joerg.Roedel@amd.com>
Cc: Stepan Moskovchenko <stepanm@codeaurora.org>
Cc: KyongHo Cho <pullip.cho@samsung.com>
Cc: Hiroshi DOYU <hdoyu@nvidia.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 2fb2963..7a2953d 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -168,13 +168,13 @@
BUG_ON(!IS_ALIGNED(iova | paddr, size));
- return domain->ops->map(domain, iova, paddr, gfp_order, prot);
+ return domain->ops->map(domain, iova, paddr, size, prot);
}
EXPORT_SYMBOL_GPL(iommu_map);
int iommu_unmap(struct iommu_domain *domain, unsigned long iova, int gfp_order)
{
- size_t size;
+ size_t size, unmapped;
if (unlikely(domain->ops->unmap == NULL))
return -ENODEV;
@@ -183,6 +183,8 @@
BUG_ON(!IS_ALIGNED(iova, size));
- return domain->ops->unmap(domain, iova, gfp_order);
+ unmapped = domain->ops->unmap(domain, iova, size);
+
+ return get_order(unmapped);
}
EXPORT_SYMBOL_GPL(iommu_unmap);