iommu: Do physical merging in iommu_map_sg()
authorRobin Murphy <robin.murphy@arm.com>
Thu, 11 Oct 2018 15:56:42 +0000 (16:56 +0100)
committerJoerg Roedel <jroedel@suse.de>
Tue, 6 Nov 2018 15:30:39 +0000 (16:30 +0100)
commit5d95f40e62e4f2ed3053e9b178471669736cf636
tree9e4e0c2dab5030cdd9394a75a9c4e8688bd88696
parent651022382c7f8da46cb4872a545ee1da6d097d2a
iommu: Do physical merging in iommu_map_sg()

The original motivation for iommu_map_sg() was to give IOMMU drivers the
chance to map an IOVA-contiguous scatterlist as efficiently as they
could. It turns out that there isn't really much driver-specific
business involved there, so now that the default implementation is
mandatory let's just improve that - the main thing we're after is to use
larger pages wherever possible, and as long as domain->pgsize_bitmap
reflects reality, iommu_map() can already do that in a generic way. All
we need to do is detect physically-contiguous segments and batch them
into a single map operation, since whatever we do here is transparent to
our caller and not bound by any segment-length restrictions on the list
itself.

Speaking of efficiency, there's really very little point in duplicating
the checks that iommu_map() is going to do anyway, so those get cleared
up in the process.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/iommu.c